[Event] Walkthrough everything Ctrl + Arrow keys [TFS 1.X]

Discussion in 'GlobalEvents, Spells & CreatureEvents' started by Printer, Jan 10, 2015.

  1. Hultin

    Hultin Member

    Joined:
    Dec 2, 2008
    Messages:
    257
    Likes Received:
    16
    Best Answers:
    0
    Can I dynamically edit the amount of packets allowed to be sent? This keeps booting me out of the server for exceeding packet limit on a 10.90 server (did that exist on latest official TFS?)
     
  2. Dyabl0

    Dyabl0 Yes!

    Joined:
    Sep 22, 2009
    Messages:
    1,852
    Likes Received:
    253
    Best Answers:
    7
    Change the following amount in your config.lua:

    maxPacketsPerSecond = 25
    maxPacketsPerSecond = 40 (try higher ones if you want)
     
  3. magista

    magista RL name " Amir reda "

    Joined:
    Jul 22, 2011
    Messages:
    136
    Likes Received:
    13
    Best Answers:
    0
    where to put this please bro
     
  4. Dyabl0

    Dyabl0 Yes!

    Joined:
    Sep 22, 2009
    Messages:
    1,852
    Likes Received:
    253
    Best Answers:
    7
    Data -> Events -> Scripts -> Player.lua -> Change this ->
    Code (Text):
    1. function Player:onTurn(direction)
    2.     return true
    3. end
    to ->

    Code (Text):
    1. function Player:onTurn(direction)
    2.     if self:getDirection() == direction then
    3.         local nextPosition = self:getPosition()
    4.         nextPosition:getNextPosition(direction)
    5.  
    6.         self:teleportTo(nextPosition, true)
    7.     end
    8.     return true
    9. end
    After you have added, go to ...\data\events\events.xml and open the XML file, change bold code ->
    Code (Text):
    1.     <event class="Player" method="onTurn" enabled="0" />
    to enabled="1" (if it already was marked 1, then leave it as it is).
     
    magista likes this.
  5. magista

    magista RL name " Amir reda "

    Joined:
    Jul 22, 2011
    Messages:
    136
    Likes Received:
    13
    Best Answers:
    0
    thx dyablo for answer but the edit is for tfs 0.4 and u just rewrite the first post
    i need to know where to add this in 0.4 not 1.x
     
  6. Dyabl0

    Dyabl0 Yes!

    Joined:
    Sep 22, 2009
    Messages:
    1,852
    Likes Received:
    253
    Best Answers:
    7
    magista likes this.
  7. magista

    magista RL name " Amir reda "

    Joined:
    Jul 22, 2011
    Messages:
    136
    Likes Received:
    13
    Best Answers:
    0
    i searched a lot where to edit to add this but i found nothing so my question is which file i edit to add this
    Code (Text):
    1.  
    2. function Player:onTurn(direction)
    3. if self:getDirection() == direction and self:getGroup():getAccess() then
    4. local nextPosition = self:getPosition()
    5. nextPosition:getNextPosition(direction)
    6.  
    7. self:teleportTo(nextPosition, true)
    8. end
    9. return true
    10. end
    i searched in player.cpp, creature.cpp and creatureevent.cpp but didn't know where to add
     
  8. Dyabl0

    Dyabl0 Yes!

    Joined:
    Sep 22, 2009
    Messages:
    1,852
    Likes Received:
    253
    Best Answers:
    7
    That is .LUA code and not C++ code. You are not supposed to write inside any C++ file. Check my post above before you comment anything. (I'm feeling stupid now that you are not listening to anyone)
    https://otland.net/threads/event-wa...arrow-keys-tfs-1-x.226973/page-2#post-2347758

    Of course, there are ways to do inside C++ codes, but that won't be easy. For that reason you have LUA script, you can modify anything very easily without touching the C++ files and compiling your engine over and over.
     
  9. magista

    magista RL name " Amir reda "

    Joined:
    Jul 22, 2011
    Messages:
    136
    Likes Received:
    13
    Best Answers:
    0
    thx alot for helping dyabl0 i just misunderstanding the code
     
  10. Pabox Cavieres

    Pabox Cavieres Dovux Online owner

    Joined:
    May 12, 2008
    Messages:
    574
    Likes Received:
    7
    Best Answers:
    0
    its possible this system but for levels 50-? (chars with protection pz) I need because have many players trap zones in my server, please :D
     
  11. Colandus

    Colandus Support Team Support Team

    Joined:
    Jun 6, 2007
    Messages:
    2,424
    Likes Received:
    157
    Best Answers:
    18
    Felt unnecessary to create a new thread for this, however here's my take on it:

    Code (Text):
    1.  
    2. playerLastTurn = playerLastTurn or {}
    3. function Player:onTurn(direction)
    4.     if not self:getGroup():getAccess() or self:getAccountType() < ACCOUNT_TYPE_GOD then
    5.         return true
    6.     end
    7.  
    8.     local lastTurn = playerLastTurn[self:getId()]
    9.     if self:getDirection() ~= direction and (not lastTurn or os.time() - lastTurn > 1) then
    10.         return true
    11.     end
    12.  
    13.     playerLastTurn[self:getId()] = os.time()
    14.  
    15.     local pos = self:getPosition()
    16.     pos:getNextPosition(direction)
    17.     while not Tile(pos) and pos.z < 7 do
    18.         pos.z = pos.z + 1
    19.     end
    20.     self:teleportTo(pos, true)
    21.  
    22.     return true
    23. end
    24.  
    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).
     
  12. Xeraphus

    Xeraphus Premium User Premium User

    Joined:
    Feb 14, 2015
    Messages:
    2,348
    Likes Received:
    924
    Best Answers:
    100
    how does that make you go downstairs if you're adding +1 to z pos
     
  13. Colandus

    Colandus Support Team Support Team

    Joined:
    Jun 6, 2007
    Messages:
    2,424
    Likes Received:
    157
    Best Answers:
    18
    Because upper floors decrease the z-position.
     
  14. Xeraphus

    Xeraphus Premium User Premium User

    Joined:
    Feb 14, 2015
    Messages:
    2,348
    Likes Received:
    924
    Best Answers:
    100
    ah i forgot
    :|
     

Share This Page

Loading...