Jump to content

Recommended Posts

Hello,

I've been using this quest for dragon soul system 

Citat

define gemstone 30270
define alchemist 20001
define reward_box 50255
define gemstone_need_count 10
define gemstone_trade_max_per_day 10
define dragon_soul_can_use_level 30
define drop_flag "ds_drop"

quest dragon_soul begin
   state start begin
      when levelup or letter with pc.level >= dragon_soul_can_use_level begin
         send_letter("x")
         local v = find_npc_by_vnum(alchemist)
         
         if 0 != v then
            target.vid("__TARGET__", v, mob_name(alchemist))
         end
      end
      when info or button begin
         say("")
      end

      when alchemist.chat."Cioburi Piatra Dragon?!" with pc.level >= dragon_soul_can_use_level begin
         target.delete("__TARGET__")

         say_title(mob_name(alchemist))
         say("")
         set_state(state_learning)
      end
   end
   state state_learning begin
      when letter begin
         send_letter("x")
      end
      when info or button begin
         say("")
      end
      when kill begin
         if npc.is_pc() then
            return
         end
         
         if pc.count_item(gemstone) < gemstone_need_count then
            if drop_gamble_with_flag(drop_flag) then
               game.drop_item_with_ownership(gemstone, 1, 300)
            end
         end
      end
      when alchemist.chat."Aduna Cioburi Piatra Dragon" begin
         say_title(mob_name(alchemist))
         if pc.count_item(gemstone) >= gemstone_need_count then
            say(gameforge.dragon_soul._1070_say)
            pc.remove_item(gemstone, gemstone_need_count)
            ds.give_qualification()
            char_log(pc.get_player_id(), 'DS_QUALIFICATION', 'SUCCESS')
            pc.give_item2(reward_box)
            local today = math.floor(get_global_time() / 86400)
            pc.setf("dragon_soul", "eye_timestamp", today)
            pc.setf("dragon_soul", "eye_left", 9)
            set_state(state_farming)
         else
            say("")
         end
      end
   end
   state state_farming begin
      when letter begin
         send_letter("x")
      end
      when info or button begin
         say(string.format(gameforge.dragon_soul._1100_say, pc.getf("dragon_soul", "eye_left")))
      end
      when kill begin
         if npc.is_pc() then
            return
         end
         
         if drop_gamble_with_flag(drop_flag) then
            local eye_left = pc.getf("dragon_soul", "eye_left")
            local haved_gemstone_number = pc.count_item(gemstone)
            
            if eye_left > haved_gemstone_number / gemstone_need_count then
               game.drop_item_with_ownership(gemstone, 1, 300)
            end
         end
      end
      when gemstone.pick begin
         local eye_left = pc.getf("dragon_soul", "eye_left")
         if eye_left <= 0 then
            return
         end

         if pc.count_item(gemstone) >= gemstone_need_count then
            pc.setf("dragon_soul", "eye_left", eye_left - 1)
            pc.remove_item(gemstone, gemstone_need_count)
            pc.give_item2(reward_box)
            if 1 == eye_left then
               say("")
               set_state(state_closed_season)
            end
         end
      end
      when alchemist.chat."xx" begin
         say_title(mob_name(alchemist))
         local today = math.floor(get_global_time() / 86400)
         if today == pc.getf("dragon_soul", "eye_timestamp") then
            say("")
         else
            say("")
            pc.setf("dragon_soul", "eye_timestamp", today)
            pc.setf("dragon_soul", "eye_left", 10)
         end   
      end
   end
   state state_closed_season begin
      when letter begin
         send_letter("xxx")
      end
      when info or button begin
         say("Putere ochiului de dragon te-a parasit.")
         local today = math.floor(get_global_time() / 86400)
         if today == pc.getf("dragon_soul", "eye_timestamp") then
            say("")
         else
            say("")
         end
      end
      
      when alchemist.chat."Putere ochiului de dragon" begin
         say_title(mob_name(alchemist))
         local today = math.floor(get_global_time() / 86400)
         if today == pc.getf("dragon_soul", "eye_timestamp") then
            say("")
         else
            say("")
            pc.setf("dragon_soul", "eye_timestamp", today)
            pc.setf("dragon_soul", "eye_left", 10)
            set_state(state_farming)
         end
      end
   end
   state state_1 begin
      when login begin
         set_state(state_learning)
      end
   end
   state state_2 begin
      when login begin
         set_state(state_learning)
      end
   end
   state state_3 begin
      when login begin
         set_state(state_closed_season)
      end
   end
end

 and I decided that the gemstone should spawn in the inventory, not on the ground. So I decided to replace game.drop_item_with_ownership(gemstone, 1, 300) with pc.give_item2 .

Everything works fine - the problem is that when there are 10 gemstones in the inventory, they don't transform anymore into a rewardbox.

Ideas?

Link to comment
https://metin2.dev/topic/17993-pccount_item/
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Because the transform is triggered with the gemstone pick event, so when you changed to give item, there is no pick anymore, whick mewns no check for number and transform, So you can add the check after the give item function for example, couldn’t think of another way to do it actually 

Link to comment
https://metin2.dev/topic/17993-pccount_item/#findComment-98250
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.