Advertisement
Guest User

Daily quest over 100

a guest
Apr 1st, 2014
2,079
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.42 KB | None
  1. quest daily_quest_over100 begin
  2.     state start begin
  3.         when login or levelup with pc.get_level() >=100 begin
  4.             if get_global_time()> pc.getqf(tempo)
  5.                 set_state(info)
  6.             end
  7.         end
  8.     end
  9.    
  10.     state info begin -- info about the mission
  11.         when letter begin
  12.             send_letter("Daily quest")
  13.         end -- letter sent
  14.  
  15.         when button or info begin
  16.             say_title("Daily quest")
  17.             say("Hi, " .. pc.get_name() .. ".")
  18.             say("You can choose the easy way,")
  19.             say("with a poor reward or")
  20.             say("the hard way, for a better reward")
  21.             say("")
  22.             local risp = select("Easy","Hard", "Cancel")
  23.             if risp==3 then -- Cancel
  24.                 return
  25.             elseif risp == 1 -- Easy
  26.                 pc.setqf("dif",0) -- difficulty FLAG (0=easy, 1=hard)
  27.                 set_state(running)
  28.             else -- Hard
  29.                 pc.setqf("dif",1)
  30.                 set_state(running)
  31.             end
  32.         end -- when closed
  33.     end -- INFO closed
  34.  
  35.     state running begin
  36.        
  37.         pc.setqf("done",0) -- quest completed FLAG (0=not completed, 1=completed)
  38.        
  39.         if pc.getqf(dif)==0 then
  40.             pc.setqf("mob_to_kill",math.random(2411, 2414))
  41.             -- how many kills
  42.             local qta = {
  43.                             100, 125, 150, 175, 200,
  44.                             225, 250, 275, 300
  45.                         }
  46.             pc.setqf("qta_to_kill",qta[math.random(1, 9)])
  47.             -- 50k yang for each kill, max=15M yang
  48.             pc.setqf("reward",50000 * (pc.getqf(qta_to_kill)))
  49.         else
  50.             local vmob = {
  51.                             1093, 1191, 1901, 2092, 2191, 2491, 2492, 2493
  52.                          }
  53.             pc.setqf("mob_to_kill",(vmob[math.random(1, 8)])
  54.             pc.setqf("qta_to_kill",(math.random(1, 10)))
  55.             -- 3M exp for each kill, max=30M exp
  56.             pc.setqf("reward",3000000 * (pc.getqf(qta_to_kill)))
  57.         end
  58.  
  59.         when letter begin
  60.             if pc.getqf(dif) == 0
  61.                 send_letter("Daily mission, Easy")
  62.             else
  63.                 send_letter("Daily mission, Hard")
  64.             end
  65.         end
  66.  
  67.         when button or info begin -- info about the quest
  68.             if pc.getqf(done) == 0 then -- if he didn't complete the quest
  69.                 if pc.getqf(dif) == 0 then
  70.                     say_title("Daily quest, Hasy")
  71.                 else
  72.                     say_title("Daily quest, Hard")
  73.                 end
  74.                 say("So, you have chosen the easy way..")
  75.                 say("Here is your objective.")
  76.                 say("")
  77.                 say_reward("You have to kill: " .. qta_to_kill .. mob_name(pc.getqf(mob_to_kill)))
  78.                 if pc.getqf(dif) == 0 then
  79.                     say_reward("That's what you'll got: " .. pc.getqf(reward) .. " yang.")
  80.                 else
  81.                     say_reward("That's what you'll got: " .. pc.getqf(reward) .. " experience.")
  82.                 end
  83.             else
  84.                 say_title("Daily mission reward")
  85.                 say("Congratulations " ..pc.get_name() .. " !!")
  86.                 say("You've earned a nice reward..")
  87.                 wait()
  88.                 if pc.getqf(dif)==0 then
  89.                     say_reward("You have earned: " .. pc.getqf(reward) .. " yang.")
  90.                     pc.changegold(pc.getqf(reward))
  91.                 else
  92.                     say_reward("You have earned: " .. pc.getqf(reward) .. " experience.")
  93.                     pc.give_exp2(pc.getqf(reward))
  94.                 end
  95.                 -- timer FLAG, this quest is repeatable once per day (24h)
  96.                 pc.setqf("tempo", get_global_time()+86400) -- 60*60*24
  97.                 -- deleting FLAGS
  98.                 pc.delqf(mob_to_kill)
  99.                 pc.delqf(reward)
  100.                 pc.delqf(qta_to_kill)
  101.                 pc.delqf(dif)
  102.                 pc.delqf(done)
  103.                 set_state(__COMPLETE__)
  104.             end
  105.         end
  106.  
  107.         when pc.getqf(mob_to_kill).kill begin
  108.             pc.setqf("qta_to_kill",(pc.getqf(qta_to_kill))-1)
  109.             if pc.getqf(qta_to_kill) == 0 then
  110.                 pc.setqf("done",1)
  111.                 send_letter("Daily mission, Reward")
  112.             end
  113.         end
  114.     end -- closed RUNNING
  115.  
  116.     state __COMPLETE__ begin
  117.         when enter begin
  118.             q.done()
  119.         end
  120.     end -- closed __COMPLETE__
  121. end -- closed QUEST
Advertisement
RAW Paste Data Copied
Advertisement