[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:
    256
    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 Just stop copying my outfit colours

    Joined:
    Sep 22, 2009
    Messages:
    1,791
    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
    where to put this please bro
     
  4. Dyabl0

    Dyabl0 Just stop copying my outfit colours

    Joined:
    Sep 22, 2009
    Messages:
    1,791
    Data -> 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 ->
    Code:
        <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
    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 Just stop copying my outfit colours

    Joined:
    Sep 22, 2009
    Messages:
    1,791
    magista likes this.
  7. magista

    magista RL name " Amir reda "

    Joined:
    Jul 22, 2011
    Messages:
    136
    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:
    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
    i searched in player.cpp, creature.cpp and creatureevent.cpp but didn't know where to add
     
  8. Dyabl0

    Dyabl0 Just stop copying my outfit colours

    Joined:
    Sep 22, 2009
    Messages:
    1,791
    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
    thx alot for helping dyabl0 i just misunderstanding the code
     
  10. Pabox Cavieres

    Pabox Cavieres Dovux Online owner

    Joined:
    May 12, 2008
    Messages:
    575
    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 Well-Known Member

    Joined:
    Jun 6, 2007
    Messages:
    2,291
    Felt 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).
     
  12. Xeraphus

    Xeraphus the best

    Joined:
    Feb 14, 2015
    Messages:
    1,726
    how does that make you go downstairs if you're adding +1 to z pos
     
  13. Colandus

    Colandus Well-Known Member

    Joined:
    Jun 6, 2007
    Messages:
    2,291
    Because upper floors decrease the z-position.
     
  14. Xeraphus

    Xeraphus the best

    Joined:
    Feb 14, 2015
    Messages:
    1,726
    ah i forgot
    :|
     

Share This Page