Niskafase
New Member
- Joined
- Jan 8, 2010
- Messages
- 104
- Reaction score
- 1
I'm having a hard time with this script, no idea how I can solve this so if someone can make it work I'll be Mr. Happy.
Information:
When a monster is 3 sqm away or closer to this item, a magic effect should show on the monster over and over again
(ONLY ONE OF THE MONSTERS THAT ARE IN THAT RANGE)
^ That's the problem.
When I use this script it shows the effect on all monsters in the range.
So what I would like you to figure out now is to make it only send the effect on one of the monsters in that range.
Thanks
Information:
When a monster is 3 sqm away or closer to this item, a magic effect should show on the monster over and over again
(ONLY ONE OF THE MONSTERS THAT ARE IN THAT RANGE)
^ That's the problem.
When I use this script it shows the effect on all monsters in the range.
Lua:
function onThink(interval, lastExecution, thinkInterval)
if getThingFromPos({x=111, y=111, z=7, stackpos=1}).itemid == 9999 then
for x = item.x-3, item.x+3 do
for y = item.y-3, item.y+3 do
local monsterPos = {x=x, y=y, z=7, stackpos=253}
local monster = getThingFromPos(monsterPos)
if monster.itemid > 0 and isMonster(monster.uid) then
doSendMagicEffect(monsterPos, 39)
end
end
end
end
return true
end
So what I would like you to figure out now is to make it only send the effect on one of the monsters in that range.
Thanks