No categories assigned

LUA:Spells

Revision as of 15:54, 12 February 2012 by John adams (talk | contribs)

The LUA Scripting System: Spells

Describe purpose, examples, our chosen folder structure for script storage.


Spells are controlled by (mainly) 3 tables: spell_tiers, spells and spell_classes and can be used to create all manner of spells.


It would be wise to have a read over Spells


There are 3 main functions in a spell: cast, remove and tick. You should get familiar with these and how they are used.

function cast(Caster, Target, DamageType, Damage)

end

function remove(Caster, Target)

end

function tick(Caster, Target, DDType, MinDDVal, MaxDDVal, EffectType, MinEffectVal, MaxEffectVal)
    SpellDamage(Target, 6, 30)
end

Examples

HP Buff

--main process function
function cast(Caster, Target, DamageType, Damage)
	SetMaxHP(Target, (GetMaxHP(Target) + 50))
end

function tick(Caster, Target, DDType, MinDDVal, MaxDDVal, EffectType, MinEffectVal, MaxEffectVal)

end

function remove(Caster, Target)
	SetMaxHP(Target, (GetMaxHP(Target) - 50))
end

Heal

--main process function
function cast(Caster, Target, DamageType, Damage)
	-- syntax for SpellDamage is Target, DamageType, and Damage
	--SpellDamage(Target, DamageType, Damage)
	ModifyHP(Caster, 20) 
end

function remove(Caster, Target)
end

Runspeed

function cast(Caster, Target, DamageType, Damage)
	SetSpeed(Player, 100)
end

function remove(Caster, Target)
        SetSpeed(Player, 1)
end


Back to LUA