lazarus321
Member
- Joined
- May 8, 2017
- Messages
- 222
- Reaction score
- 23
function Creature.IsInCornerToCreature(self, creature)
local spos = self:getPosition()
local cpos = creature:getPosition()
local relativepos = {
Position(-1, -1, 0)
Position(1, -1, 0)
Position(-1, 1, 0)
Position(1, 1, 0)
}
for _, rpos in pairs(relativepos) do
local pos = spos+rpos
if pos == cpos then
return true
end
end
return false
end
TFS 1.2.what is your tfs?
Thanks for help Sarah.
- function Creature.IsInCornerToCreature(self, creature)
- local spos = self:getPosition()
- local cpos = creature:getPosition()
- local relativepos = {
- Position(-1, -1, 0)
- Position(1, -1, 0)
- Position(-1, 1, 0)
- Position(1, 1, 0)
- }
- for _, rpos in pairs(relativepos) do
- local pos = spos+rpos
- if pos == cpos then
- return true
- end
- end
- return false
- end
Thanks Vulcan too.you could also use position:setDirectionOffset(dir) to get the destination pos
Vulcan, can you unify this code for me?you could also use position:setDirectionOffset(dir) to get the destination pos