Jump to content
  • 0

Quest Time - 1 Hour Daily


iRETEMAG

Question

  • Premium

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.  :blush:  :excl:

 

  • Metin2 Dev 1
Link to comment
Share on other sites

Recommended Posts

  • 0
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 :)

  • Metin2 Dev 1
  • Love 1
Link to comment
Share on other sites

  • 0
  • Premium

At game (npc 20090):

 

"You can't teleport now please wait."


Why can't teleport first time? :(
  :(  :angry: 

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

  • 0
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
  • Love 1
Link to comment
Share on other sites

  • 0
  • Premium
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.  :unsure:  :excl:

Link to comment
Share on other sites

  • 0
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

  • 0
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 :D sorry as i told you i don't have a running server atm

  • Love 1
Link to comment
Share on other sites

  • 0
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

  • 0

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


  • Love 1
Link to comment
Share on other sites

  • 0
  • Premium

 

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.

 

:D  :D  They rock!

Link to comment
Share on other sites

  • 0
  • Premium

 

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())

 

JiIPf.png

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

:blush:  :blush:  :excl:  :excl:  :excl:  :excl:

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 0

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

  • 0

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

  • 0
  • Premium

Try

quest event1 begin
    state start begin
    when 20090.chat."Akapo Map (LVL.95)" begin
        if pc.getqf("24h") == 0 then
            pc.setqf("access222",get_time()+3600)
            pc.warp(45600,45600)
        else
        say_title(" test ")
        say(" can't in this time ")
    end
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(" stil have "..akapotime.." seconds. ")
            timer("exit",pc.getqf("access222")-get_time())
            pc.setqf("24h", 1)
    end
end
 
    when exit.timer begin
        warp_to_village()
        pc.setqf("24h", 0)
        end
    end
end

If you're going to do something, then do it right.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Activity

    1. 7

      Metin2 2003 Beta Client!!!!!

    2. 32

      Boss Effect Over Head

    3. 0

      Open Source API for Metin2 Server Management - Early Development

    4. 0

      Official Item Combination [18.4]

    5. 2

      Proper SIGNAL management for Windows

    6. 2

      Proper SIGNAL management for Windows

    7. 4

      syserr erorr ( not working OK button on client )

    8. 2

      Proper SIGNAL management for Windows

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.