GOD Half
Member
- Joined
- May 9, 2010
- Messages
- 179
- Reaction score
- 15
Hi guys, how do I print the direction the target is looking?
The model below prints the direction the player is looking, but I need the direction that the target of the player is looking to be printed:
I'm trying but from error below:
The model below prints the direction the player is looking, but I need the direction that the target of the player is looking to be printed:
Lua:
function onThink(interval, lastExecution, thinkInterval)
for _, player in ipairs(Game.getPlayers()) do
local dirPlayer = player:getDirection() -- or getPlayerLookDir(player) -- 0: n | 1: e | 2: s | 3: w
print("Your direction: "..dirPlayer)
end
return true
end
Lua:
function onThink(interval, lastExecution, thinkInterval)
for _, player in ipairs(Game.getPlayers()) do
local target = getCreatureTarget(player)
if isPlayer(target) or isMonster(target) then
local dirTarget = target:getDirection() -- ERROR
print("Target direction: "..dirTarget)
end
end
return true
end