Jump to content
Sign in to follow this  
Ultrasoth

Delay System

Recommended Posts

as I can add delay system for all maps? I have only argent, shaitan and icicle.

if someone could tell me, I appreciate it :)

Spoiler

print("Loading Delay.lua")
original_MoveCity = MoveCity
MoveCity = function ( ...)
    if(arg[3] ~= nil)then
        _G[GetChaDefaultName(arg[1]).."_move"] = { city = arg[2],copy = arg[3]}
    else
        _G[GetChaDefaultName(arg[1]).."_move"] = { city = arg[2]}
    end
end

function cha_timer_hook(ignore,role,freq,time)
        local cha_name = GetChaDefaultName (role)
        local now_tick = GetChaParam(role, 1)
        local cha_name = GetChaDefaultName (role)
        local cha_map = GetChaMapName ( role )
        local k = ChaIsBoat ( role )         
        if k == 0 then
            local guildticket = CheckBagItem(role,7524)
            local guild_id = GetChaGuildID(role)
            
            if guildticket == 0 and guild_id > 0 then
                -- GiveItem ( role , 0 , 7524 , 1 , 4)    
                DelBagItem(role,7524,1)
            end            
            if guildticket ~= 0 and guild_id == 0 then
                local gtdel = DelBagItem(role,7524,1)
            end            
            if guild_id == 0 and cha_map == "guildhouse" then
                MoveCity(role,"")
            end
        end
        -- MoveCity Delay
        
--    local cha_name = GetChaDefaultName(role)
 --               if _G[cha_name.."_move"] ~= nil then
 --                       if(_G[cha_name.."_move"].city ~= nil) then
 --                               BickerNotice(role,"Please wait, teleporting... ")
 --                               if(os.time() == _G[cha_name.."_move"].time and now_tick > 0)then  
 --                                       if(_G[cha_name.."_move"].copy ~= nil)then
  --                                              original_MoveCity(role,_G[cha_name.."_move"].city,_G[cha_name.."_move"].copy)
  --                                      else
  --                                              original_MoveCity(role,_G[cha_name.."_move"].city)
  --                                      end
  --                                      _G[cha_name.."_move"] = nil
  --                              end
--                            if(os.time() > _G[cha_name.."_move"].time) then
  --                                      _G[cha_name.."_move"] = nil
  --                              end
  ----                      end
  --              end
--end

local cha_name = GetChaDefaultName(role)
        if _G[cha_name.."_move"] ~= nil then
                if(_G[cha_name.."_move"].city ~= nil) then
                        BickerNotice(role,"Please wait, teleporting... ")
                        local delay2 = math.random(2, 7) -- Random Delay Secodns

                        if math.mod(now_tick, delay2) == 0 and now_tick > 0 then
                                if(_G[cha_name.."_move"].copy ~= nil)then
                                    original_MoveCity(role,_G[cha_name.."_move"].city,_G[cha_name.."_move"].copy)
                                else
                                    original_MoveCity(role,_G[cha_name.."_move"].city)
                                end
                                _G[cha_name.."_move"] = nil
                        end
                end
        end
--end

--delay tele

local cha_name = GetChaDefaultName (role)

               if _G[cha_name.."_goto"] ~= nil then
                        if(_G[cha_name.."_goto"].x ~= nil and _G[cha_name.."_goto"].y ~= nil) then
                                BickerNotice(role,"Please wait, teleporting...")
                                local delay = math.random(3,5)  -- Random Delay Seconds
 
                              if math.mod(now_tick, delay) == 0 and now_tick > 0 then
                                       GoTo(role,_G[cha_name.."_goto"].x,_G[cha_name.."_goto"].y,_G[cha_name.."_goto"].map)
   
                                     _G[cha_name.."_goto"] = nil
                                end
                        end
end
end

 

Share this post


Link to post
Share on other sites

Just took it from some server file in Lucky's Archive. There are portal delay and ticket delay works for all maps. Just need to look (might need download all files to find it or if someone is nice enough to let you knows which file contains it). I don't remember which one so, u might need to find it from a known file.

Share this post


Link to post
Share on other sites

I think these scripts are obsolete. Also, not too optimized because of the usage of the _G table.
if my character name is cha, and it concatenates "_move" or "_goto" as a variable and puts it into the _G table.
and I have custom functions such as: cha_move or cha_goto than that would easily collide and resulting in

function malfunction. 


kong.png

a2.png

Share this post


Link to post
Share on other sites

function cha_timer(role, freq, time)
--    Anti_Dupe(role,freq,time) 
    
    local resume_freq = 5 
    local now_tick = GetChaParam(role, 1) 
    local is_role_living = -1
    local cha_name = GetChaDefaultName(role) 
      -- MoveCity Delay 
        if _G[cha_name.."_move"] ~= nil then 
            if(_G[cha_name.."_move"].city ~= nil) then 
                BickerNotice(role,"Please wait, teleporting... ") 
                local delay = math.random(3,8) -- Random Delay Secodns 
                if math.mod(now_tick, delay) == 0 and now_tick > 0 then  
                    if(_G[cha_name.."_move"].copy ~= nil)then 
                        original_MoveCity(role,_G[cha_name.."_move"].city,_G[cha_name.."_move"].copy) 
                    else
                        original_MoveCity(role,_G[cha_name.."_move"].city) 
                    end
                    _G[cha_name.."_move"] = nil 
                end
            end
        end
    SetChaParam(role, 1, now_tick + freq * time) 
    local cha_name = GetChaDefaultName (role)
 
      if _G[cha_name.."_goto"] ~= nil then
                if(_G[cha_name.."_goto"].x ~= nil and _G[cha_name.."_goto"].y ~= nil) then
                        BickerNotice(role,"Please wait, teleporting ...")
                      local delay = math.random(3,8) -- Random Delay Seconds
                        if math.mod(now_tick, delay) == 0 and now_tick > 0 then
                        GoTo(role,_G[cha_name.."_goto"].x,_G[cha_name.."_goto"].y,_G[cha_name.."_goto"].map)
                          _G[cha_name.."_goto"] = nil
                      end
                end
        end
   

Edited by abdoelghoul

Share this post


Link to post
Share on other sites

And that uses cha name to identify which char to teleport, which is a terrible idea since you can get multiple people with the same cha name and use it to teleport other players.

Share this post


Link to post
Share on other sites

With this script just have delay in maps of gameserver, gameserver1 and gameserver2, for some reason it does not effect the gameserver 3 and 4, any have idea ? x.x

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...