• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Monster direction

flaviiojr

Active Member
Joined
Jan 20, 2017
Messages
230
Solutions
13
Reaction score
39
How to check the targets that are in front of the monster?

Example: The monster casts a spell, and only casts the spells to the players who are in the direction of it ... So, whoever is behind it does not receive the damage ...

I'm not good at spells, could anyone give me an idea?
Thank you very much in advance!

[TFS 1.2]
 
Coded from the Phone ,so tabbing sucks. But here is how you can achive What you want

Code:
local position = creature:getPosition()
position:getNextPosition(creature:getDirection())

local tile = Tile(position)
if tile then
    local topCreature = tile:getTopCreature()
    if topCreature and topCreature:isPlayer() then
        print(topCreature:getName())
    end
end
 
Back
Top