Page 2 of 4
Re: Help with constructing spells?
Posted: Fri Oct 05, 2012 11:02 pm
by LordGarth
Hello,
I made a new spell but there is no visual of the spell traveling and no hit effect either.
Can I see a typical normal script for the onCast command.
Here is my script so far.
defineSpell{
name = "chain_lightning",
class = "ProjectileSpell",
uiName = "Chain Lightning",
particleSystem = "lightning_bolt",
hitParticleEffect = "lightning_bolt_hit",
lightColor = vec(0.25, 0.5, 1),
lightBrightness = 15,
lightRange = 7,
lightHitBrightness = 40,
lightHitRange = 10,
castShadow = true,
launchSound = "lightning_bolt_launch",
projectileSound = "lightning_bolt",
hitSound = "lightning_bolt_hit_small",
projectileSpeed = 15,
attackPower = 60,
runes = "CDH",
skill = "air_magic",
level = 1,
manaCost = 10,
damageType = "shock",
--cameraShake = true,
tags = { "spell" },
onCast = function(champ, x, y, direction, skill)
end
}
Thx,
LG
Re: Help with constructing spells?
Posted: Fri Oct 05, 2012 11:39 pm
by LordGarth
Can spells be given muliple damage types?
Thx,
LordGarth
Re: Help with constructing spells?
Posted: Sat Oct 06, 2012 1:10 pm
by flatline
You are trying to define a spell but using defineobject-commands, which won't work. A spell is made of two parts:
The defineSpell-part which rules manacost, type of spell and so on, and the defineObject part which you spawn from the onCast-command in the defineSpell:
So you need both of these:
Code: Select all
defineSpell{
name = "chain_lightning_spell",
uiName = "Chain Lightning",
runes = "CDH",
skill = "air_magic",
level = 0,
manaCost = 10,
onCast = function(champ, x, y, direction, skill)
if party.facing == 0 then
spawn("chain_lightning", party.level, party.x, party.y-1, party.facing)
end
if party.facing == 1 then
spawn("chain_lightning", party.level, party.x+1, party.y, party.facing)
end
if party.facing == 2 then
spawn("chain_lightning", party.level, party.x, party.y+1, party.facing)
end
if party.facing == 3 then
spawn("chain_lightning", party.level, party.x-1, party.y, party.facing)
end
end
}
defineObject{
name = "chain_lightning",
class = "ProjectileSpell",
uiName = "Chain Lightning",
particleSystem = "lightning_bolt",
hitParticleEffect = "lightning_bolt_hit",
lightColor = vec(0.25, 0.5, 1),
lightBrightness = 15,
lightRange = 7,
lightHitBrightness = 40,
lightHitRange = 10,
castShadow = true,
launchSound = "lightning_bolt_launch",
projectileSound = "lightning_bolt",
hitSound = "lightning_bolt_hit_small",
projectileSpeed = 15,
attackPower = 60,
damageType = "shock",
--cameraShake = true,
tags = { "spell" }
}
Re: Help with constructing spells?
Posted: Sat Oct 06, 2012 5:04 pm
by LordGarth
Hello,
Great and thx for the script example. I never would have guess all of that.
Also I would like to give some spells more than one damage type. Is that possible.
The Meteor spell would be earth and fire. So I guess poison and fire damage.
Thx,
LG
Re: Help with constructing spells?
Posted: Sat Oct 06, 2012 5:08 pm
by flatline
LordGarth wrote:Hello,
Great and thx for the script example. I never would have guess all of that.
Also I would like to give some spells more than one damage type. Is that possible.
The Meteor spell would be earth and fire. So I guess poison and fire damage.
Thx,
LG
I think you'd have to make one spell that releases two separate objects.
So, onCast will need to launch two identical objects with separate damage types.
Re: Help with constructing spells?
Posted: Sat Oct 06, 2012 7:58 pm
by LordGarth
I cant seem to apply new textures for the new spells.
Not sure what format to save the textures for spells when the blend mode is additive. I change blend mode to opaque and that fixes that but then I get
bad argument #2 to '__newindex' (invalid enum)
Do I have to assign new indexes for the new texture for spell hit and so on.
I made my own particle system and just changed the path of one of the textures
defineParticleSystem{
name = "chainlightning_bolt_hit",
emitters = {
-- sparks
{
emissionRate = 80,
emissionTime = 1,
maxParticles = 50,
boxMin = {-0.5, -0.5, -0.5},
boxMax = { 0.5, 0.5, 0.5},
sprayAngle = {0,360},
velocity = {0,0},
objectSpace = false,
texture = "mod_assets/textures/chainlightning01.tga",
frameRate = 4,
frameSize = 256,
frameCount = 4,
lifetime = {0.2,0.4},
color0 = {2.5,2.5,2.5},
opacity = 1,
fadeIn = 0.1,
fadeOut = 0.3,
size = {0.1, 1.5},
gravity = {0,0,0},
airResistance = 1,
rotationSpeed = 0,
blendMode = "Opaque",
},
-- fog
{
spawnBurst = true,
maxParticles = 30,
sprayAngle = {0,360},
velocity = {0,3},
objectSpace = true,
texture = "assets/textures/particles/fog.tga",
lifetime = {0.4,0.6},
color0 = {0.25, 0.5, 1},
opacity = 0.7,
fadeIn = 0.1,
fadeOut = 0.3,
size = {1, 2},
gravity = {0,0,0},
airResistance = 0.5,
rotationSpeed = 1,
blendMode = "Additive",
},
-- glow
{
spawnBurst = true,
emissionRate = 1,
emissionTime = 0,
maxParticles = 1,
boxMin = {0,0,-0.1},
boxMax = {0,0,-0.1},
sprayAngle = {0,30},
velocity = {0,0},
texture = "assets/textures/particles/glow.tga",
lifetime = {0.5, 0.5},
colorAnimation = false,
color0 = {1, 1, 1},
opacity = 1,
fadeIn = 0.01,
fadeOut = 0.5,
size = {1, 1},
gravity = {0,0,0},
airResistance = 1,
rotationSpeed = 2,
blendMode = "Additive",
}
}
}
Re: Help with constructing spells?
Posted: Sat Oct 06, 2012 11:24 pm
by LordGarth
I can assign new sounds to new spells but new textures dont work.
LG
Re: Help with constructing spells?
Posted: Sun Oct 07, 2012 7:22 pm
by LordGarth
Still cant get new textures to work inside new particle systems for new spells.
LG
Re: Help with constructing spells?
Posted: Sun Oct 07, 2012 8:05 pm
by flatline
post deleted
Re: Help with constructing spells?
Posted: Sun Oct 07, 2012 8:23 pm
by petri
That's strange, particle system textures should work like other textures.