Jump to content

Recommended Posts

Hi guys, i have a specific question about "For" function

 

If i write:

for i = 1, 500 do

     pc.give_item(27001)

end

Everything its okay, but

 

for i = 1, 900 do

     pc.give_item(27001)

end

 

 

Playser gets creshed.

 

There is something in core what is limited this value? Thank you

Link to comment
https://metin2.dev/topic/7917-quest-function-for/
Share on other sites

function give_multiple_items(item, count)
   while(count > 200) do
      print("pc.give_item2(item, 200)")
      pc.give_item2(item, 200)
      count = count - 200
   end 
   if count > 0 then
      print("pc.give_item2(item, "..count..")")
   end
end

give_multiple_items(19, 1893)

// output
/*
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 93)
*/

comment unnecessary lines.

  • Love 3
Link to comment
https://metin2.dev/topic/7917-quest-function-for/#findComment-49543
Share on other sites

function give_multiple_items(item, count)
   while(count > 200) do
      print("pc.give_item2(item, 200)")
      pc.give_item2(item, 200)
      count = count - 200
   end 
   if count > 0 then
      print("pc.give_item2(item, "..count..")")
   end
end

give_multiple_items(19, 1893)

// output
/*
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 200)
pc.give_item2(item, 93)
*/

comment unnecessary lines.

thank you

 

Link to comment
https://metin2.dev/topic/7917-quest-function-for/#findComment-49544
Share on other sites

  • Premium

metin2team, you forgot something:

function give_multiple_items(item, count)
   while(count > 200) do
      print("pc.give_item2(item, 200)")
      pc.give_item2(item, 200)
      count = count - 200
   end 
   if count > 0 then
      print("pc.give_item2(item, "..count..")")
      pc.give_item2(item, count) --!!! THIS FUNCTION
   end
end

 

  • Love 2
Link to comment
https://metin2.dev/topic/7917-quest-function-for/#findComment-49572
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.