where to put this please bro@zbizu But you don't need to store player direction in a table in order to make it work like TFS 0.4
Code:function Player:onTurn(direction) if self:getDirection() == direction and self:getGroup():getAccess() then local nextPosition = self:getPosition() nextPosition:getNextPosition(direction) self:teleportTo(nextPosition, true) end return true end
function Player:onTurn(direction)
return true
end
function Player:onTurn(direction)
if self:getDirection() == direction then
local nextPosition = self:getPosition()
nextPosition:getNextPosition(direction)
self:teleportTo(nextPosition, true)
end
return true
end
<event class="Player" method="onTurn" enabled="0" />
thx dyablo for answer but the edit is for tfs 0.4 and u just rewrite the first postData -> Events -> Scripts -> Player.lua -> Change this ->
Code:function Player:onTurn(direction) return true end
to ->
Code:function Player:onTurn(direction) if self:getDirection() == direction then local nextPosition = self:getPosition() nextPosition:getNextPosition(direction) self:teleportTo(nextPosition, true) end return true end
After you have added, go to ...\data\events\events.xml and open the XML file, change bold code ->
to enabled="1" (if it already was marked 1, then leave it as it is).Code:<event class="Player" method="onTurn" enabled="0" />
function Player:onTurn(direction)
if self:getDirection() == direction and self:getGroup():getAccess() then
local nextPosition = self:getPosition()
nextPosition:getNextPosition(direction)
self:teleportTo(nextPosition, true)
end
return true
end
its possible this system but for levels 50-? (chars with protection pz) I need because have many players trap zones in my server, pleaseHello,
Well some people have requested this missing feature which could be found in 0.3 series. Well i have made one for TFS 1.x.
I will send a pull request to the forgottenserver project, but in case it may not be accepted. Due to, this is mby a personal future. This way is alot better than 0.3, since 0.3 was hardcoded while this is made by lua with few lines. Which make it even more easier to edit stuff.
Go to events/events.xml and onTurn make sure write from 0 to 1.
Now go to events/scripts and open player.lua and find PlayernTurn(direction) and replace with this:
Code:function Player:onTurn(direction) if self:getGroup():getAccess() and self:getDirection() == direction then local nextPosition = self:getPosition() nextPosition:getNextPosition(direction) self:teleportTo(nextPosition, true) end return true end
Cheers.
playerLastTurn = playerLastTurn or {}
function Player:onTurn(direction)
if not self:getGroup():getAccess() or self:getAccountType() < ACCOUNT_TYPE_GOD then
return true
end
local lastTurn = playerLastTurn[self:getId()]
if self:getDirection() ~= direction and (not lastTurn or os.time() - lastTurn > 1) then
return true
end
playerLastTurn[self:getId()] = os.time()
local pos = self:getPosition()
pos:getNextPosition(direction)
while not Tile(pos) and pos.z < 7 do
pos.z = pos.z + 1
end
self:teleportTo(pos, true)
return true
end
how does that make you go downstairs if you're adding +1 to z posFelt unnecessary to create a new thread for this, however here's my take on it:
Code:playerLastTurn = playerLastTurn or {} function Player:onTurn(direction) if not self:getGroup():getAccess() or self:getAccountType() < ACCOUNT_TYPE_GOD then return true end local lastTurn = playerLastTurn[self:getId()] if self:getDirection() ~= direction and (not lastTurn or os.time() - lastTurn > 1) then return true end playerLastTurn[self:getId()] = os.time() local pos = self:getPosition() pos:getNextPosition(direction) while not Tile(pos) and pos.z < 7 do pos.z = pos.z + 1 end self:teleportTo(pos, true) return true end
Will throw you down from roofs, mountains and similar (not below ground floor) if you reach the end. Also makes turning much smoother. You will have to stop running for one second if you want to turn normally (without it moving you).
how does that make you go downstairs if you're adding +1 to z pos
ah i forgotBecause upper floors decrease the z-position.
function Player:onTurn(direction)
if self:isInGhostMode() and self:getDirection() == direction then
local nextPosition = self:getPosition()
nextPosition:getNextPosition(direction)
self:teleportTo(nextPosition, true)
end
return true
end