Premium iRETEMAG 137 Posted December 15, 2014 Premium Share Posted December 15, 2014 Hi people, I need a quest, player click at NPC (need level 95) and get teleported to the map for 1 hour. After 1 hour end, player have to wait 24 hours to enter again. I really need this. I hope devs can help me. 1 Link to comment Share on other sites More sharing options...
Sober 37 Posted December 15, 2014 Share Posted December 15, 2014 quest test begin state start begin when login with (pc.get_map_index()==INDEX and pc.getqf("time_pass")<=get_time()) or pc.get_level()<95 begin if pc.get_level()<95 then chat("You need to be at least level 95, you will be warped") else if pc.get_level()>=95 then chat("Your trial period has ended") end if pc.get_empire()==1 then pc.warp(cords,cords) elseif pc.get_empire()==2 then pc.warp(cords,cords) else pc.warp(cords,cords) end end when npcvnum.chat."I want to teleport for one hour" begin if pc.getqf("timepass") <= get_time() then say("You can't teleport now please wait.") elseif pc.get_level()<95 then say("You need to be at least level 95") else pc.setqf("timepass",24*60*60) say("You can go have fun") pc.warp(cords,cords) end end end end I haven't got a test server atm so i can't tell you if it will work, replace the cords and map index, and try it 1 1 Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 15, 2014 Author Premium Share Posted December 15, 2014 At game (npc 20090): "You can't teleport now please wait." Why can't teleport first time? quest event1 begin state start begin when login with (pc.get_map_index()==103 and pc.getqf("time_pass")<=get_time()) or pc.get_level()<95 begin if pc.get_level()<95 then chat("You need to be at least level 95, you will be warped") else if pc.get_level()>=95 then chat("Your time period has ended.") chat("Back later!") end if pc.get_empire()==1 then pc.warp(3812585, 3799162) elseif pc.get_empire()==2 then pc.warp(3812585, 3799162) else pc.warp(3812585, 3799162) end end end when 20090.chat."Akapo Map (LV.95)" begin if pc.getqf("timepass") <= get_time() then say("You can't teleport now please wait.") elseif pc.get_level()<95 then say("You need to be at least level 95") else pc.setqf("timepass",24*60*60) say("You can go have fun") pc.warp(456,456) end end end end Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 15, 2014 Author Premium Share Posted December 15, 2014 (edited) Quest show this at game for all people: Edited August 18, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Sober 37 Posted December 16, 2014 Share Posted December 16, 2014 when login with (pc.get_map_index()==103 and pc.getqf("time_pass")<=get_time()) or pc.get_level()<95 begin change to when login with (pc.get_map_index()==103 and pc.getqf("time_pass")<=get_time()) or (pc.get_level()<95 and pc.get_map_index()==103) begin 1 Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 16, 2014 Author Premium Share Posted December 16, 2014 Times don't work too. NPC too. (Just some say text's) Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted December 16, 2014 Share Posted December 16, 2014 change time <= to < 1 https://m2admin.net/ Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 16, 2014 Author Premium Share Posted December 16, 2014 quest event1 begin state start begin when login with (pc.get_map_index()==103 and pc.getqf("timepass2")<get_time()) or (pc.get_level()<95 and pc.get_map_index()==103) begin if pc.get_level()<95 then chat("You need to be at least level 95, you will be warped") else if pc.get_level()>=95 then chat("Your time period has ended.") chat("Back later!") end if pc.get_empire()==1 then pc.warp(3812585, 3799162) elseif pc.get_empire()==2 then pc.warp(3812585, 3799162) else pc.warp(3812585, 3799162) end end end when 20090.chat."Akapo Map (LV.95)" begin if pc.getqf("timepass2") < get_time() then say("You can't teleport now please wait.") elseif pc.get_level()<95 then say("You need to be at least level 95") else pc.setqf("timepass2",24) say("You can go now, have fun.") pc.warp(456,456) end end end end I just can see at game: say("You can't teleport now please wait.") I've put the timepass2 to 24 seconds (just to test) pc.setqf("timepass2",24) I can't enter to the map via the quest. I change the time's names to timepass2 (just to test). First try can't enter in the map too. Link to comment Share on other sites More sharing options...
Sober 37 Posted December 16, 2014 Share Posted December 16, 2014 quest event1 begin state start begin when login with (pc.get_map_index()==103 and pc.getqf("timepass2")>=get_time()) or (pc.get_level()<95 and pc.get_map_index()==103) begin if pc.get_level()<95 then chat("You need to be at least level 95, you will be warped") else if pc.get_level()>=95 then chat("Your time period has ended.") chat("Back later!") end if pc.get_empire()==1 then pc.warp(3812585, 3799162) elseif pc.get_empire()==2 then pc.warp(3812585, 3799162) else pc.warp(3812585, 3799162) end end end when 20090.chat."Akapo Map (LV.95)" begin if pc.getqf("timepass2") >= get_time() then say("You can't teleport now please wait.") elseif pc.get_level()<95 then say("You need to be at least level 95") else pc.setqf("timepass2",24*60*60) say("You can go now, have fun.") pc.warp(45600,45600) end end end end Okay try this out too, also i think that your cords should be (45600,45600) not (456,456) Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 16, 2014 Author Premium Share Posted December 16, 2014 Now I can teleport to the map. chat("Your time period has ended.") chat("Back later!") After teleport, I'm teleported instantly to 3812585, 3799162 Link to comment Share on other sites More sharing options...
Sober 37 Posted December 17, 2014 Share Posted December 17, 2014 quest event1 begin state start begin when login with (pc.get_map_index()==103 and pc.getqf("timepass2")<=get_time()) or (pc.get_level()<95 and pc.get_map_index()==103) begin if pc.get_level()<95 then chat("You need to be at least level 95, you will be warped") else if pc.get_level()>=95 then chat("Your time period has ended.") chat("Back later!") end if pc.get_empire()==1 then pc.warp(3812585, 3799162) elseif pc.get_empire()==2 then pc.warp(3812585, 3799162) else pc.warp(3812585, 3799162) end end end when 20090.chat."Akapo Map (LV.95)" begin if pc.getqf("timepass2") >= get_time() then say("You can't teleport now please wait.") elseif pc.get_level()<95 then say("You need to be at least level 95") else pc.setqf("timepass2",24*60*60) say("You can go now, have fun.") pc.warp(45600,45600) end end end end Okay this will work normaly i think sorry as i told you i don't have a running server atm 1 Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 17, 2014 Author Premium Share Posted December 17, 2014 Thank you very much for replying. But... Same... post #10 Link to comment Share on other sites More sharing options...
Sober 37 Posted December 17, 2014 Share Posted December 17, 2014 try that out i've made a small change Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 17, 2014 Author Premium Share Posted December 17, 2014 Now I can teleport to the map. chat("Your time period has ended.") chat("Back later!") After teleport, I'm teleported instantly to 3812585, 3799162 Link to comment Share on other sites More sharing options...
Sober 37 Posted December 17, 2014 Share Posted December 17, 2014 quest event1 begin state start begin when login with (pc.get_map_index()==103 and pc.getqf("timepass2")<=get_time()) or (pc.get_level()<95 and pc.get_map_index()==103) begin if pc.get_level()<95 then chat("You need to be at least level 95, you will be warped") end if pc.get_empire()==1 then pc.warp(3812585, 3799162) elseif pc.get_empire()==2 then pc.warp(3812585, 3799162) else pc.warp(3812585, 3799162) end end when 20090.chat."Akapo Map (LV.95)" begin if pc.getqf("timepass2") >= get_time() then say("You can't teleport now please wait.") elseif pc.get_level()<95 then say("You need to be at least level 95") else pc.setqf("timepass2",get_time()+24*60*60) say("You can go now, have fun.") pc.warp(45600,45600) end end end end Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 17, 2014 Author Premium Share Posted December 17, 2014 Hm... Now I get teleported to the map. I enter at the map but warped again to (3812585, 3799162) instantly. After click NPC again, I can't enter now. I have to wait. Link to comment Share on other sites More sharing options...
Pepineitor 69 Posted December 17, 2014 Share Posted December 17, 2014 Try it, I did in a few mins, you must modify the vars with #. quest blabla begin state start begin when #xx.chat."Map" with pc.getqf("access")+3600*23 < get_time() begin pc.setqf("access",get_time()+3600) pc.warp(#x,#y) end when login with pc.get_map_index() == #MAP_ID begin if pc.getqf("access") < get_time() then warp_to_village() else timer("exit",pc.getqf("access")-get_time()) end end when exit.timer begin warp_to_village() end when logout with pc.get_map_index() == #MAP_ID begin cleartimer("exit") end end end 1 Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 18, 2014 Author Premium Share Posted December 18, 2014 Try it, I did in a few mins, you must modify the vars with #. quest blabla begin state start begin when #xx.chat."Map" with pc.getqf("access")+3600*23 < get_time() begin pc.setqf("access",get_time()+3600) pc.warp(#x,#y) end when login with pc.get_map_index() == #MAP_ID begin if pc.getqf("access") < get_time() then warp_to_village() else timer("exit",pc.getqf("access")-get_time()) end end when exit.timer begin warp_to_village() end when logout with pc.get_map_index() == #MAP_ID begin cleartimer("exit") end end end I modified all vars with # made by Pepineitor. Now I have this: quest event1 begin state start begin when 20090.chat."Akapo Map (LVL.95)" with pc.getqf("access222")+3600*23 < get_time() begin pc.setqf("access222",get_time()+3600) pc.warp(45600,45600) end when login with pc.get_map_index() == 103 begin if pc.getqf("access222") < get_time() then warp_to_village() else timer("exit",pc.getqf("access222")-get_time()) end end when exit.timer begin warp_to_village() end when logout with pc.get_map_index() == 103 begin cleartimer("exit") end end end I think I have all working. Thank you. Can you help me with one more thing? How can I display this Seconds in Minutes? akapotime = pc.getqf("access222")-get_time() say("Time left: "..akapotime.." Seconds") timer("exit",pc.getqf("access222")-get_time()) Thank you @Pepineitor and @Sober for helping me. They rock! Link to comment Share on other sites More sharing options...
Denis 1474 Posted December 18, 2014 Share Posted December 18, 2014 Use time_to_str: akapotime = pc.getqf("access222")-get_time() say(string.format("%s", time_to_str(akapotime))) timer("exit",pc.getqf("access222")-get_time()) Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 18, 2014 Author Premium Share Posted December 18, 2014 (edited) Use time_to_str: akapotime = pc.getqf("access222")-get_time() say(string.format("%s", time_to_str(akapotime))) timer("exit",pc.getqf("access222")-get_time()) Quest still don't working. I get out the map after 1 hour. I can enter again without waiting 24 hours. Time not showing correctly. quest event1 begin state start begin when 20090.chat."Akapo Map (LVL.95)" with pc.getqf("access222")+3600*23 < get_time() begin pc.setqf("access222",get_time()+3600) pc.warp(45600,45600) end when login with pc.get_map_index() == 103 begin if pc.getqf("access222") < get_time() then warp_to_village() else akapotime = pc.getqf("access222")-get_time() say(string.format("%s", time_to_str(akapotime))) timer("exit",pc.getqf("access222")-get_time()) end end when exit.timer begin warp_to_village() end when logout with pc.get_map_index() == 103 begin cleartimer("exit") end end end Edited August 18, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Pepineitor 69 Posted December 18, 2014 Share Posted December 18, 2014 If you do this akapotime = pc.getqf("access222")-get_time() say(string.format("%s", time_to_str(akapotime))) You are sowing the date when the time becomes < 24h, 1st of Jan of 1970, when the time 'start' in the machines. You must do this say(string.format("%s", time_to_str(pc.getqf("access222")))) Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 18, 2014 Author Premium Share Posted December 18, 2014 Show me the date again Link to comment Share on other sites More sharing options...
Sober 37 Posted December 18, 2014 Share Posted December 18, 2014 i guess it shows you that date because the value of quest flag "access222" is probably zero Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted December 18, 2014 Author Premium Share Posted December 18, 2014 i guess it shows you that date because the value of quest flag "access222" is probably zero Where I can change/do this? (sorry) Link to comment Share on other sites More sharing options...
Pepineitor 69 Posted December 18, 2014 Share Posted December 18, 2014 I think you want this, try it quest event1 begin state start begin when 20090.chat."Akapo Map (LVL.95)" begin if pc.getqf("access222")+3600*23 < get_time() then pc.setqf("access222",get_time()+3600) pc.warp(45600,45600) else local tr = (pc.getqf("access222")+3600*23)-get_time() say("You can enter other time to the map in: "..tr.." min.") end end when login with pc.get_map_index() == 103 begin if pc.getqf("access222") < get_time() then warp_to_village() else local tr = (pc.getqf("access222")-get_time())/60 say("Time remaining in the map: "..tr.." min.") timer("exit",pc.getqf("access222")-get_time()) end end when exit.timer begin warp_to_village() end when logout with pc.get_map_index() == 103 begin cleartimer("exit") end end end Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now