AddProc(Spawn: Entity, Int8: Type, Float: Chance, Item: FromItem, Int8: UseAllSpellTargets)
Pre-Requisite(s)
- Must be called inside a Spell Script (Spell Proc), or the Item field must be populated for Item Proc.
Parameter(s)
Spawn: Entity - Spawn LUA Pointer of Player, NPC or Bot type only.
Int8: Type - ProcType
Float: Chance - 1-100 (%) chance of proc triggering.
Item: Item (OPTIONAL) - If not a Spell Script, Item must be supplied as the Item Proc.
Int8: UseAllSpellTargets - If set to 1 in a Spell Script, will apply to all Spawn Targets in the Spell. Otherwise, default is only adding the proc to a single Spawn: Entity.
Return(s)
- None
Example(s)
– Example taken from Spells/Commoner/BlightoftheMorning.lua
function cast(Caster, Target, DmgType, MinVal, MaxVal)
SetSpellTriggerCount(100, 1)
AddProc(Caster, 3, 8) – Adds a procf to Caster of Type 3(PROC_TYPE_PHYSICAL_OFFENSIVE) with 8% chance to call function proc
end
function proc(Caster, Target, Type, DmgType, MinVal, MaxVal)
Spell = GetSpell(2550441)
DmgBonus = math.floor(GetInt(Caster)/10)
MinDmg = MinVal + DmgBonus
MaxDmg = MaxVal + DmgBonus
if Type == 3 then
SetSpellDataIndex(Spell, 0, DmgType)
SetSpellDataIndex(Spell, 1, MinDmg)
SetSpellDataIndex(Spell, 2, MaxDmg)
CastCustomSpell(Spell, Caster, Target)
RemoveTriggerFromSpell(1)
end
end
function remove(Caster, Target)
RemoveProc(Caster)
end
Result
function proc(Caster, Target, Type, ..Additional Arguments..)
– do proc work here
end
function proc(Item, Caster, Target, Type)
– do proc work here
end
Additional Notes