Jump to content

Recommended Posts

  • Premium

'Sup

*"Straight outta end statements" intensifies*

I didn't read the quest that much because I should sleep, but what I can notice is the large amount of "end" statements. To be sure, you must put an "end" to close the statement each time you put something like "when, if, for or while", but not for something like "else".

I suggest you to use tabs (for your eyes, it's better looking, plus it's easiest to modify, otherwise, lua doesn't give a flying damn about tabs, contrary to python, so you should be fine) and close the statements once you open it.

You must also add a close statement for "quest x begin" "state x begin" "when x begin".

By the way - excuse me I'm tired it's 01:01 AM so it's maybe me, but I don't think so - your quest won't work because the if and elseif seem to be misused.

I think it'd be better to ask here or at least explain what you wanted to do, then someone will help you or even create the quest for you, then you'd be able to know where you failed in order not to reproduce the same error again !

Good night (because you're polish so it's night too) ! :D

Link to comment
https://metin2.dev/topic/15019-quest/#findComment-84518
Share on other sites

  • Honorable Member

I can write it from scratch if you tell me exactly what you want to accomplish with it.

Right now it's literally not readable in any way.

  • 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/15019-quest/#findComment-84523
Share on other sites

1 hour ago, Syreldar said:

I can write it from scratch if you tell me exactly what you want to accomplish with it.

Right now it's literally not readable in any way.

I wanted to write quest which give points for kill (person) depends on lvl enemy like if he's lower lvl + 5 (lower max 10 lvl ) higher +10 and  for each death - points like lower lvl - 10 points higher -5, and split into ranks. And btw can u tell me how can i learn making quests for mt2 i'm doing quite good with html css php, and basic in some other. Is there any tutortial for start and list of fuctions with descriptions?

Link to comment
https://metin2.dev/topic/15019-quest/#findComment-84524
Share on other sites

  • Honorable Member

Dude i don't understand, write in a clear way the points you want to give based on the levels.

 

Example: 

If the enemy's level is 10 levels higher than you then give x points,

else, if the enemy is higher level than you but less than 10 levels higher, give y points,

else if the enemy's level is lower than yours, give z points.

 

This is a clear way to say it.

  • 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/15019-quest/#findComment-84526
Share on other sites

  • Honorable Member

I've done 95% of the work, but you have to tell me how do you want to manage the points received per kill, that's what it's missing.

View down

  • 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/15019-quest/#findComment-84529
Share on other sites

  • Honorable Member

perfect, hold on.

not tested.

quest rank_system begin
	state start begin
		function update_rank(points)
			local ranks = {
				[1] = {["minimum_points"] = 100, ["rank_name"] = "Bronze"},
				[2] = {["minimum_points"] = 200, ["rank_name"] = "Silver"},
				[3] = {["minimum_points"] = 500, ["rank_name"] = "Gold"},
				[4] = {["minimum_points"] = 1000, ["rank_name"] = "Platinum"},
				[5] = {["minimum_points"] = 2000, ["rank_name"] = "Diamond"}
			};
			
			for i = 1, table.getn(ranks) do
				return syschat(string.format("Your actual rank: %s", ranks[points < ranks[i]["minimum_points"] and i-1 or i]["rank_name"]))
			end -- for
		end -- function
		
		function update_statistics(selected_player_name, inc_or_dec)
			local selected_player_points = mysql_query(string.format("SELECT punkty FROM player.player WHERE name = '%s';", selected_player_name));
			--local selected_player_kills = mysql_query(string.format("SELECT smierci FROM player.player WHERE name = '%s';", selected_player_name));
			--local selected_player_deaths = mysql_query(string.format("SELECT zabojstwa FROM player.player WHERE name = '%s';", selected_player_name));

			--** Increase Player's Kills and increase Player's points
			if (inc_or_dec == "increase") then
				mysql_query(string.format("UPDATE player.player SET smierci = smierci+1 WHERE name = '%s';", selected_player_name));
				mysql_query(string.format("UPDATE player.player SET punkty = punkty+%d WHERE name = '%s';", received_points, selected_player_name));
				syschat(string.format("You killed %s (Level. %d)", target_name, target_level))
				syschat(string.format("Points received: %d", received_points))
				rank_system.update_rank(selected_player_points);

			--** Increase Target's Deaths and decrease Target's points
			else
				mysql_query(string.format("UPDATE player.player SET zabojstwa = zabojstwa+1 WHERE name = '%s';", selected_player_name));
				mysql_query(string.format("UPDATE player.player SET punkty = punkty-%d WHERE name = '%s';", lost_points, selected_player_name));
				if (select_target_vid ~= 0) then
					syschat(string.format("You have been killed by %s (Level. %d)", player_name, player_level))
					syschat(string.format("Points lost: %d", lost_points))
					rank_system.update_rank(selected_player_points);
					pc.select(player_vid);
				end -- if
			end -- if/else
		end -- function

		when kill with npc.is_pc() and pc.get_level() >= 80 begin
			local player_name = pc.get_name();
			local player_level = pc.get_level();
			local player_vid = pc.get_vid();

			local target_vid = npc.get_vid();
			local select_target_vid = pc.select(target_vid);

			if (select_target_vid ~= 0) then
				local target_name = pc.get_name();
				local target_level = pc.get_level();
				pc.select(player_vid);
			end -- if
			
			local received_points = 0;
			local lost_points = 0;

			if (target_level > player_level) then
				received_points = 10;
				lost_points = 5;

			elseif (target_level == player_level) then
				received_points = 7;
				lost_points = 7;
				
			elseif (target_level < player_level) then
				if (player_level - target_level <= 20) then
					received_points = 5;
				end -- if

				lost_points = 10;
			end -- if/elseif

			rank_system.update_statistics(player_name, "increase");
			rank_system.update_statistics(target_name, "decrease");
		end -- when
	end -- state
end -- quest

 

  • 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/15019-quest/#findComment-84531
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.