Jump to content

Alchemy with a Daily Limit


Alerin

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 19
  • Confused 1
  • Good 4
  • Love 2
  • Love 8
Link to comment
Share on other sites

  • Premium

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
Share on other sites

  • Premium
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
Share on other sites

Announcements



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