Hi guys, im having a hard time trying to solve this.
Basically, i want to make this work:
for i = 1,stickQuantity do function npc\_dmg(i) if npc[i].x == castle.x then castle.hp = castle.hp - npc[i].dmg end end Runtime:addEventListener("enterFrame",npc\_dmg(i))
Something like that, where you make a function per npc and then assign a runtime event.
First of all, its not working because it seems like i cant pass parameters to a function when I call it from a runtime event listener.
Second, I find it very un-optimized to add one function per mob, specially if i make 100 and that includes their event listeners too.
Is there any way to make this simplier(and that it works ofc haha) i’ve been hitting my head into a wall for the last day trying to figure this out.
Thanks in advance.