• 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!

Lua Learning about movements [TFS 1.2]

Aeronx

Intermediate OT User
Joined
Dec 17, 2015
Messages
746
Solutions
9
Reaction score
125
Hello otlanders!

Today is testing day!
I've being doing some testing with creature:allowMovement(), creature:setDirection() and doMoveCreature().

After doing some tests, i've seen that allowMovement prevents ANY type of movement, even if its forced by teleportTo or doMoveCreature.. it tries to move but it gets back to position.

Also, i've seen something like creature:getPath(), is there a way to make a monster or player walk that path automatically?

Is there a way to immobilize a creature/player and force use doMoveCreature and teleportTo?

I appreciate any kind of explanations!

Thank you in advance!
 
Oh! I didnt know! i thought it was from source.. but you are right.
I've been using it for so long that i thought it was there since forever haha
I thought it was the same as DoSetNoMove() from older distros.

Looking to this function i see it wont be possible "to stop" movement and force move by code unless i modify this function.

What about my other questions? Thank you!

Code:
--Function Stop Movement by Printer
local function allowMovementEvent(cid, allow, oldPosition)
  local creature = Creature(cid)
  if not creature then
  return false
  end

  if allow then
  return stopEvent(event)
  else
  stopEvent(event)
  end

  creature:teleportTo(oldPosition, true)
 
  event = addEvent(allowMovementEvent, 100, cid, allow, oldPosition)
end

function Creature.allowMovement(self, allow)
  allowMovementEvent(self:getId(), allow, self:getPosition())
end
--End
 
Last edited:
Back
Top