I did this in init part:
Code: Select all
function gadget:Initialize()
for id,weaponDef in pairs(WeaponDefs) do
local wName = weaponDef.name
if (wName == "darkswarm") then
Script.SetWatchWeapon(weaponDef.id, true)
bugWeaponID = weaponDef.id
end
end
end
Code: Select all
function gadget:ProjectileCreated(projectileID, projectileOwnerID, projectileWeaponDefID)
if (bugWeaponID == projectileWeaponDefID) then
spSetUnitWeaponState(projectileOwnerID,2,"range",100)
end
end
Can you pls explain how this work and if this Script is the one i need for use of this call-in described on wiki like:[f=0000000] Error: error = 2, LuaRules/draw.lua, error = 2, LuaRules/gadgets.lua, [string "LuaRules/Gadgets/0fix_bug5.lua"]:56: attempt to call field 'SetWatchWeapon' (a nil value)
ProjectileCreated() --> "proID, proOwnerID, weaponDefID" Only called for weapons with SetWatchWeapon enabled