Jump to content
  • 0

Quest with time


DragonBlack94

Question

Hi guys, I would need help.. I would like to create a quest in time. That is, since you've been on the mission, you've had enough time to finish it otherwise it expires, cancelling the mission.

I leave you two quests, modify one to your liking, thank you very much.
 

quest Guerriero_Mistico begin
	state start begin
		when login with pc.get_level() >= 90 begin
			set_state("information")
		end		
	end
	
	state information begin
		when letter begin
			send_letter_ex("Missione lv.90", "purple,blink,ex", "scroll_open_purple.tga")
		end
		
		when button or info begin
			addimage(-140, -350, "ground.tga")
			say_title("Missione Liv. 90")
			say("Giovane combattente,abbiamo bisogno del tuo aiuto.[ENTER]Stiamo subendo l'attacco dai guerrieri mistici,[ENTER]che vogliono attaccare il nostro villaggio.[ENTER]Aiutarci a difenderlo![ENTER]")
			set_state("run")
		end
	end
	
	state run begin
		when letter begin
			send_letter_ex("Missione lv.90", "purple,blink,ex", "scroll_open_purple.tga")
			q.set_counter("Guerriero_Mistico: ", 2500-pc.getqf("kill_cnt_covo3"))
		end
		
		when button or info begin
			addimage(-140, -350, "ground.tga")
			say_title("Missione Liv. 90")
			say("Hai ucciso "..pc.getqf("kill_cnt_covo3").." Guerrieri Mistici.[ENTER]")
			say_reward("Devi arrivare a 2500 uccisioni.")
		end
		
		when 60058.kill begin
			local cntNow = pc.getqf("kill_cnt_covo3") 
			if(cntNow < 2500) then
				pc.setqf("kill_cnt_covo3", cntNow+1)
				q.set_counter_value(2500-cntNow)
			else
				pc.setqf("kill_cnt_covo3", cntNow+1)
				q.set_counter_value(2500-cntNow)
				set_state("reward")
			end
		end
	end
	
	state reward begin
		when letter begin
			send_letter_ex("Missione lv.90 completata", "purple,blink,ex", "scroll_open_purple.tga")
		end
		
		when button or info begin
			addimage(-140, -350, "ground.tga")
			say_title("Missione liv. 90 completata")
			say("Grazie avventuriero, hai completato la missione.[ENTER]Come ringraziamento accetta questo piccolo omaggio:[ENTER]")
		 	say_reward("Ricevi: 20.000.000 Yang.")
			say_reward("Ricevi: Stola Maestro Nobile x1")
			say_reward("Ricevi: Baule Alchimia x 10")
			say_reward("Ricevi: Pozione Miglioramento Alta x2")
			say_reward("Ricevi: Moneta LastBreath x40.")
			pc.changegold ( 20000000 )
			pc.give_item2("85007", 1)
			pc.give_item2("33029", 10)
			pc.give_item2("56003", 2)
			pc.give_item2("25105", 40)
			
			set_quest_state("Guerriero_Mistico", "information")
			set_state(__COMPLETE__)
			q.done()
		end
	end
	
	state __COMPLETE__ begin
	end
end

OR:
 

quest Amicia4zampe begin

 state start begin

     when login or levelup with pc.level >= 16 begin
         set_state ( "startmissione" )
	end
end

 state startmissione begin

     when letter begin
         local v = find_npc_by_vnum ( 9003 )
         if v != 0 then
             target.vid ( "__TARGET__" , v, "amici" )
         end
         send_letter_ex("Amici a 4 zampe", "blue,blink,ex", "scroll_open_blue.tga")
     end

     when button or info begin
         addimage(-140, -350, "ground.tga")
         say ( "La bottegaia vuole parlarti." )
         say ( "Vai da lei." )
         say ( "La trovi nella Capitale" )
         say ( "" ) 
     end

    when 9003.chat."Eccoti" begin
	target.delete ( "__TARGET__" )
	addimage(-140, -350, "ground.tga")
	say_title ( "Bottegaia:")
	say ( "Ciao, mi devi fare un favore io non posso andarci" )
	say ( "perche' sto lavorando.." )
	say ( "Dovresti andare in Antiche Rovine Jinno " )
	say ( "dalla Musicista lei sa gia' tutto," )
	say ( "ti deve dare dei croccantini." )
	say ( "Dopo averli presi torna qui e' fa mangiare i nostri" )
	say ( "cani della capitale. Sono affamati." )
    say ( "" ) 
    say ( "" ) 
	local yesno = select ( "Va bene" , "Non mi interessa" )
	if yesno == 1 then
	set_state ( "parla1" )
	else
	set_state ( "completo" )
		end
	end
end
	state parla1 begin
	
	    when letter begin
		local v = find_npc_by_vnum ( 20060 )
         if v != 0 then
            target.vid ( "__TARGET__" , v, "amici" )
         end
        send_letter_ex("Amici a 4 zampe", "blue,blink,ex", "scroll_open_blue.tga")
     end

     when button or info begin
         addimage(-140, -350, "ground.tga")
         say ( "Devi recarti nelle Antiche Rovine - Jinno," )
         say ( "e trova la Musicista," )
         say ( "e fatti dare i croccantini." )
         say ( "" ) 
	end
        when 20060.chat."Salve" begin
         target.delete ( "__TARGET__" )
         addimage(-140, -350, "ground.tga")
         say_title ( "Musicista:")
         say ( "Salve piacere di conoscerti sono la Musicista della citta'" )
         say ( "Ecco a te i croccantini piu' buoni del regno." )
         say ( "Portali ai nostri amici a 4 zampe per nutrirli." )
         say ( "" )
         local yesno = select ( "Va bene" , "Non mi interessa" )
         if yesno == 1 then
         set_state ( "parla2" )
		 say_reward("Hai ricevuto Croccantini x3")
		 pc.give_item2("30200", 3)
         else
         set_state ( "completo" )
		end
	end
end
	state parla2 begin
	
		when letter begin
		local v = find_npc_by_vnum ( 60021 )
         if v != 0 then
            target.vid ( "__TARGET__" , v, "amici" )
         end
        send_letter_ex("Amici a 4 zampe", "blue,blink,ex", "scroll_open_blue.tga")
     end

     when button or info begin
         addimage(-140, -350, "ground.tga")
         say ( "Hai recuperato i croccantini" )
         say ( "torna in capitale per darla agli" )
         say ( "amici a 4 zampe." )
         say ( "" ) 
	end
        when 60021.chat."Bau" begin
         target.delete ( "__TARGET__" )
         addimage(-140, -350, "ground.tga")
         say_title ( "Cico:")
         say ( "Bau Bau." )
         say ( "" )
         local yesno = select ( "Fai mangiare" , "Non mi interessa" )
         if yesno == 1 then
         set_state ( "parla3" )
		 pc.remove_item(30200, 1)
         else
         set_state ( "completo" )
		end
	end
end

	state parla3 begin
	
		when letter begin
		local v = find_npc_by_vnum ( 60022 )
         if v != 0 then
            target.vid ( "__TARGET__" , v, "amici" )
         end
        send_letter_ex("Amici a 4 zampe", "blue,blink,ex", "scroll_open_blue.tga")
     end

     when button or info begin
         addimage(-140, -350, "ground.tga")
         say ( "Fai mangiare agli altri cani." )
         say ( "Li trovi nella Capitale" )
         say ( "" ) 
	end
        when 60022.chat."Bau" begin
         target.delete ( "__TARGET__" )
         addimage(-140, -350, "ground.tga")
         say_title ( "Lilly:")
         say ( "Bau Bau." )
         say ( "" )
         local yesno = select ( "Fai mangiare" , "Non mi interessa" )
         if yesno == 1 then
         set_state ( "parla4" )
		 pc.remove_item(30200, 1)
         else
         set_state ( "completo" )
		end
	end
end

	state parla4 begin
	
		when letter begin
		local v = find_npc_by_vnum ( 60023 )
         if v != 0 then
            target.vid ( "__TARGET__" , v, "amici" )
         end
        send_letter_ex("Amici a 4 zampe", "blue,blink,ex", "scroll_open_blue.tga")
     end

     when button or info begin
         addimage(-140, -350, "ground.tga")
         say ( "Fai mangiare agli altri cani." )
         say ( "Li trovi nella Capitale" )
         say ( "" ) 
	end
        when 60023.chat."Bau" begin
         target.delete ( "__TARGET__" )
         addimage(-140, -350, "ground.tga")
         say_title ( "Laky:")
         say ( "Bau Bau." )
         say ( "" )
         local yesno = select ( "Fai mangiare" , "Non mi interessa" )
         if yesno == 1 then
         set_state ( "parla5" )
		 pc.remove_item(30200, 1)
         else
         set_state ( "completo" )
		end
	end
end

	state parla5 begin
	
		when letter begin
		local v = find_npc_by_vnum ( 9003 )
         if v != 0 then
            target.vid ( "__TARGET__" , v, "amici" )
         end
        send_letter_ex("Amici a 4 zampe", "blue,blink,ex", "scroll_open_blue.tga")
     end

     when button or info begin
         addimage(-140, -350, "ground.tga")
         say ( "I cani hanno mangiato ora torna dalla" )
         say ( "bottegaia per riferirle il completamento" )
		 say ( "della tua missione" )
         say ( "Lo trovi nella Capitale" )
         say ( "" ) 
	end
        when 9003.chat."Grazie" begin
         target.delete ( "__TARGET__" )
         addimage(-140, -350, "ground.tga")
         say_title ( "Bottegaia:")
         say ( "Grazie per aver dato da mangiare ai cani della capitale" )
         say ( "sono le nostre mascotte." )
         say ( "Grazie ancora, buona giornata." )
         say ( "" )
		 say ( "Ecco la tua Ricompensa: " )
		 say ( "" )
		 say_reward("Hai Ricevuto: 2.020.000 yang")
		 pc.changegold ( 2020000 )
         set_state ( "completo" )
		end
	end
    state completo begin
	end
end

Thanks
 

Link to post

4 answers to this question

Recommended Posts

  • 0
  • VIP
Posted (edited)

Hey, its pretty easy to set a timer for quests, here is how:

when enter begin
	pc.setqf("time_limit", get_time() + 30 * 60) -- Set a time limit for this quest (30 Minutes)
end

when letter begin
	q.set_clock("Time left", pc.getqf("time_limit") - get_time()) -- Set remaining time text on client's Quest window
end

-- Check time limit under certain actions and update the quest's state (kill, login, enter, chat, button or info)
-- if the time has passed.
-- Example:

when kill begin
	if pc.getf("quest_name","limit_time") >= get_time()
		set_state(failure)
	end
end

 

Also, you only need to set the time limit once (at the start of the quest), but you should update remaining time on the client on every quest state.

Edited by Sonitex
Link to post
  • 0
On 4/11/2021 at 4:13 PM, Sonitex said:

Hey, its pretty easy to set a timer for quests, here is how:

when enter begin
	pc.setqf("time_limit", get_time() + 30 * 60) -- Set a time limit for this quest (30 Minutes)
end

when letter begin
	q.set_clock("Time left", pc.getqf("time_limit") - get_time()) -- Set remaining time text on client's Quest window
end

-- Check time limit under certain actions and update the quest's state (kill, login, enter, chat, button or info)
-- if the time has passed.
-- Example:

when kill begin
	if pc.getf("quest_name","limit_time") >= get_time()
		set_state(failure)
	end
end

 

Also, you only need to set the time limit once (at the start of the quest), but you should update remaining time on the client on every quest state.

Could you please put them in the right place? I can't get it to start

 

quest Missione_bambina begin

 state start begin

     when login or levelup with pc.level >= 16 begin
         set_state ( "startmissione" )
		end
	end

 state startmissione begin

     when letter begin
         local v = find_npc_by_vnum ( 20027 )
         if v != 0 then
             target.vid ( "__TARGET__" , v, "bambina" )
         end
         send_letter_ex("Chi cerca trova", "blue,blink,ex", "scroll_open_blue.tga")
     end

     when button or info begin
         addimage(-140, -350, "ground.tga")
         say_reward ( "Miriam:" )
         say ( "Miriam la bambina della capitale," )
         say ( "cerca aiuto, trovala." )
         say ( "Lo trovi nella Capitale" )
         say ( "" ) 
     end

    when 20027.chat."Ciaooo" begin
	target.delete ( "__TARGET__" )
	addimage(-140, -350, "ground.tga")
	say_title ( "Miriam:")
	say ( "Ciao, piacere Miriam mi serve aiuto.." )
	say ( "Quando sono andato con papa' nel villaggio ho perso" )
	say ( "la spilla di mia mamma che mi ha regalato al mio compleanno." )
	say ( "Mentre mio papa' parlava con mio zio io mi sono imbattuta" )
	say ( "in dei brutti ceffi che si fanno chiamare" )
	say ( "Maniaco del vento oscuro, ti prego riportami la spilla." )
	local yesno = select ( "Ok piccola" , "Non mi interessa" )
	if yesno == 1 then
	set_state ( "uccidimob" )
	else
	set_state ( "completo" )
		end
	end
end
	
	state uccidimob begin

        when letter begin
         send_letter_ex("Chi cerca trova", "blue,blink,ex", "scroll_open_blue.tga")
     end

     when button or info begin
         addimage(-140, -350, "ground.tga")
         say_reward ( "Uccidi Maniaci del vento oscuro fin quando" )
         say_reward ( "non trovi la spilla di Miriam." )
		 say("Hai ucciso "..pc.getqf("kill_cnt_metinf").." Maniaci del vento osc.[ENTER]")
         say ( "" )
     end

        when 402.kill begin
        local cntNow = pc.getqf("kill_cnt_metinf") 
			if(cntNow < 49) then
				pc.setqf("kill_cnt_metinf", cntNow+1)
				q.set_counter_value(49-cntNow)
			else
				pc.setqf("kill_cnt_metinf", cntNow+1)
				q.set_counter_value(49-cntNow)
         addimage(-140, -350, "ground.tga")
         say_reward ( "Hai trovato la spilla" )
         say ( "Torna da Miriam in Capitale." )
         set_state ( "ritorna" )
         local v = find_npc_by_vnum ( 20027 )
         if v != 0 then
             target.vid ( "__TARGET__" , v, "bambina" )
         	end
		end
	end
end

	state ritorna begin

	when 20027.chat."Trovato?" begin
	target.delete ( "__TARGET__" )
    addimage(-140, -350, "ground.tga")
	say_title ( "Miriam:")
	say ( "Hai trovato la mia spilla? Grazieeee" )
	say ( "Non so come ringraziarti, ci tengo molto a questa" )
	say ( "spilla.. Tieni questi possono servirti." )
	wait()
    addimage(-140, -350, "ground.tga")
	say_reward ( "Miriam ti ha dato una ricompensa per aver trovato la spilla" )
	say ( "" )
	say ( "Ecco la Ricompensa:" )
	say ( "" )
	say_reward("Hai ricevuto: 100.000 yang")
	pc.changegold ( 100000 )
	pc.delqf ( "caccia_1" )
	set_state ( "completo" )
	end
end

    state completo begin

	end
end

 

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   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.



  • Activity

    1. 4

      Check Server Vulnerability Messenger - SQL Injection

    2. 18

      GRAPHIC & ANIMATION & CODE | Pixarts - Game Development Studio

    3. 3

      Mob HP Bug

    4. 3

      Mob HP Bug

    5. 0

      【Winz2】 ★ 【55-120】 ★ 【21: 05.2021】 ★ ✅ TR SUNUCU! ✅ ★ 【Açıkbeta 19 Mayıs】 ★

    6. 4

      [Learn] Server side

    7. 4

      [Learn] Server side

    8. 3

      Mob HP Bug

    9. 3

      Drop problem - level limit

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