Aeronx
Intermediate OT User
- Joined
- Dec 17, 2015
- Messages
- 746
- Solutions
- 9
- Reaction score
- 125
Hello everyone!
I've been doing testing with game.getSpectators and tried something like this:
I've tested with creatures[ i ], creatures[1], creatures[ i ]:getId(), etc etc etc.. but the player NEVER gets target even it doesnt come up with any error.
Its because of the code or because creature:setTarget(target) will not actually target a creature? (by target i mean like right click (attack) on monster and set red square).
Thank you for your time.
I've been doing testing with game.getSpectators and tried something like this:
Code:
local creatures = Game.getSpectators(creature:getPosition(), false, false, 7, 7, 7, 7)
if #creatures == 0 then
return true
end
for i = 1, #creatures do
if creatures[i]:isMonster() then
--print(creatures[1]:getName())
--print(creatures[1]:getId())
creature:setTarget(creatures[2]:getId())
end
end
I've tested with creatures[ i ], creatures[1], creatures[ i ]:getId(), etc etc etc.. but the player NEVER gets target even it doesnt come up with any error.
Its because of the code or because creature:setTarget(target) will not actually target a creature? (by target i mean like right click (attack) on monster and set red square).
Thank you for your time.