Moj mistrz
Monster Creator
Hi guys, I need help with this script which is based on script from this thread. I tried to remake it for monster spell(so monster can go through players and other monsters, but no blocking objects like walls, bushes etc.), but I failed. This is where I get so far. I wanted to make it for TFS 1.2.
Actually it works only for players + it checks if item is blockable only when you are already teleported on it :/, it wouldn't be so bad, but it still don't work for monsters, dunno why. It only works when I remove queryTileAddThing line, but it gives monster opportunity to walk on walls etc. Would be also good if it pushes creatures on its way(just like giant spider pushes minotaur for example).
Thanks for any help .
Code:
function onCastSpell(creature, var)
local direction = creature:getDirection()
local nextPosition = creature:getPosition()
if Tile(nextPosition):queryAdd(creature) == RETURNVALUE_NOERROR then
nextPosition:getNextPosition(direction)
creature:teleportTo(nextPosition, true)
end
return true
end
Thanks for any help .