Jump to content

Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Hi, my first publication in this forum. Quest with daily limit and level interval for drop cor draconis in alchemi. I think it will be useful to someone. I also write commissioned quests :)

https://github.com/Alerinos/M2-Quest-Alchemy

Quest is compatible with Marty files.

  • Metin2 Dev 29
  • Confused 1
  • Good 4
  • Love 2
  • Love 13
Link to comment
https://metin2.dev/topic/23881-alchemy-with-a-daily-limit/
Share on other sites

  • Honorable Member

Good job, glad to see someone post in this section every now and then.

 

Let me help you with something:

 

	-- Customizable
	function count(level)
		local ranges = {
			{["min"] = 110, ["count"] = 20},
			{["min"] = 100, ["count"] = 18},
			{["min"] = 90, ["count"] = 16},
			{["min"] = 80, ["count"] = 14},
			{["min"] = 70, ["count"] = 12},
			{["min"] = 60, ["count"] = 10},
			{["min"] = 50, ["count"] = 8},
			{["min"] = 40, ["count"] = 6},
			{["min"] = 30, ["count"] = 4},
		};
		
		for _, range in ipairs(ranges) do
			if (level >= range["min"]) then
				return range["count"];
			end -- if
		end -- for
		
		return 0;
	end -- function
	
	-- Dynamic
	function count(level)
		local ranges = {30, 40, 50, 60, 70, 80, 90, 100, 110, INSERT_MAX_LEVEL_HERE};
		local multiplier = pc.ispremium() and 1.5 or 1;
		
		for index = 1, table.getn(ranges) do
			if (level >= range[index] and level < range[index+1]) then
				return (2 + 2 * index) * multiplier;
			end -- if
		end -- for
		
		return 0;
	end -- function

One more thing I can tell you is that if the argument you're going to pass to the function is always the player's level, there is no point in making it an argument in the first place, you can just call pc.get_level() instead, save it in a var if you prefer.

Edited by Syreldar
  • Love 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
https://metin2.dev/topic/23881-alchemy-with-a-daily-limit/#findComment-128092
Share on other sites

Thank you for opinion. You can do it nicely in an array, but I made editing the version for the less experienced easier. I also try to avoid unnecessary loops. Lua is the fastest scripting language but implementation in metin is scary.

Edited by Alerin
Link to comment
https://metin2.dev/topic/23881-alchemy-with-a-daily-limit/#findComment-128096
Share on other sites

  • Honorable Member
21 minutes ago, Alerin said:

Thank you for opinion. You can do it nicely in an array, but I made editing the version for the less experienced easier. I also try to avoid unnecessary loops. Lua is the fastest scripting language but implementation in metin is scary.

Don't be scared using loops by any means, they work fine and fast.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
https://metin2.dev/topic/23881-alchemy-with-a-daily-limit/#findComment-128099
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.