I used the following code to add connectors to the weapons in my level:
Code: Select all
-- Wire up the MeleeAttackComponents on this level.
for e in second_timer.map:allEntities() do
if e.meleeattack then
e.meleeattack:addConnector("onHitMonster", "myscript", "onHitMonster")
end
end
Code: Select all
function onHitMonster(meleeAttackComponent, monster, tside, damage, champion)
print("Here")
end
[string "Component.lua"]:0: attempt to index field 'map' (a nil value)
stack traceback:
[string "Component.lua"]: in function 'triggerConnectors'
[string "Component.lua"]: in function 'callHook'
[string "Component.lua"]: in function 'attack'
...
Anyone got any idea what's going on here?
Thanks