Jump to content

Reset biologist time


Recommended Posts

PS: I didn't tested, but should working.

  • 1. Command mysql (if you want to reset for all people):
UPDATE player.quest SET lValue = 0 WHERE szName LIKE ('%collect_quest_lv%') AND szState = 'duration';
  • 2. Quest (if you want for people can do that alone, you can put like via a special item etc):

quest biolog begin
	state start begin
		function remove_time()
			local biologistDict = {
				"collect_quest_lv30", "collect_quest_lv40",
				"collect_quest_lv50", "collect_quest_lv60",
				"collect_quest_lv70", "collect_quest_lv80",
				"collect_quest_lv85", "collect_quest_lv90",
				"collect_quest_lv92", "collect_quest_lv94"
			}

			for questName = 1, table.getn(biologistDict) do
				pc.setf(biologistDict[questName], "duration", 0) -- SetFlag(questName + "." + stateName, iValue);
				syschat(string.format("pc.setf(%s.duration, 0)", biologistDict[questName]))
			end
		end
		
		when 20084.chat."Reset biologist time" begin
			say_title("Biologist:")
			say("Are you sure you want to do that?")
			if (select("Yes", "Not now") == 1) then
				biolog.remove_time()
			end
		end
	end
end

 

  • Love 1
Link to comment
Share on other sites

  • Premium

@Tasho

 

Bad

local sel = select ("Yes", "Not now")
if (sel == 1) then
	biolog.remove_time()
else
	return
end

 

Good

if (select("Yes", "Not now") == 1) then
	biolog.remove_time();
end -- if

Saving the select function inside a variable is only useful when the select has 3+ arguments, else it is not.

while "else return end" is just useless coding-wise and can be substituted by a simple "end".

 

"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
Just now, Tasho said:

Yeah it's same but there we speak just about "good practices".
I was know already that, doesn't importantly the else return (in this case) it was just useless coding, but i did that that without to think.
Now should be ok, thanks.

Yes, sorry, bad coding just triggers me, even tho it does not matter.

 

"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

On 02.06.2017 at 4:30 AM, Tasho said:

PS: I didn't tested, but should working.

  • 1. Command mysql (if you want to reset for all people):

UPDATE player.quest SET lValue = 0 WHERE szName LIKE ('%collect_quest_lv%') AND szState = 'duration';
  • 2. Quest (if you want for people can do that alone, you can put like via a special item etc):


quest biolog begin
	state start begin
		function remove_time()
			local biologistDict = {
				"collect_quest_lv30", "collect_quest_lv40",
				"collect_quest_lv50", "collect_quest_lv60",
				"collect_quest_lv70", "collect_quest_lv80",
				"collect_quest_lv85", "collect_quest_lv90",
				"collect_quest_lv92", "collect_quest_lv94"
			}

			for questName = 1, table.getn(biologistDict) do
				pc.setf(biologistDict[questName], "duration", 0) -- SetFlag(questName + "." + stateName, iValue);
				syschat(string.format("pc.setf(%s.duration, 0)", biologistDict[questName]))
			end
		end
		
		when 20084.chat."Reset biologist time" begin
			say_title("Biologist:")
			say("Are you sure you want to do that?")
			if (select("Yes", "Not now") == 1) then
				biolog.remove_time()
			end
		end
	end
end

 

 

On 02.06.2017 at 5:24 AM, Syreldar said:

@Tasho

 

Bad


local sel = select ("Yes", "Not now")
if (sel == 1) then
	biolog.remove_time()
else
	return
end

 

Good


if (select("Yes", "Not now") == 1) then
	biolog.remove_time();
end -- if

Saving the select function inside a variable is only useful when the select has 3+ arguments, else it is not.

while "else return end" is just useless coding-wise and can be substituted by a simple "end".

Thanks guys, its work but i have some problems.
How can i prevent reuse of active.
I want to run through an item.

Link to comment
Share on other sites

  • Premium
On 3/6/2017 at 10:03 AM, jkhan said:

 

Thanks guys, its work but i have some problems.
How can i prevent reuse of active.
I want to run through an item.

What do you mean by reuse of active? You mean you only want to make it possible to use this only once per player, on an item?

 

if yes:

Substitute XXX with the item vnum, and keep in mind the item's type must be 18 in order for the quest to work.

 

quest biologist_reset begin
	state start begin
		function ResetBiologist()
			local quest_names = {
				[1] = "collect_quest_lv30",
				[2] = "collect_quest_lv40",
				[3] = "collect_quest_lv50",
				[4] = "collect_quest_lv60",
				[5] = "collect_quest_lv70",
				[6] = "collect_quest_lv80",
				[7] = "collect_quest_lv85",
				[8] = "collect_quest_lv90",
				[9] = "collect_quest_lv92",
				[10] = "collect_quest_lv94"
			};

			for i = 1, table.getn(quest_names) do
				pc.setf(quest_names[i], "duration", 0);
			end -- for
		end -- function

		when XXX.use begin
			say_title(string.format("%s:[ENTER]", item_name(item.get_vnum())))
			if (pc.getqf("biologist_reset") == 0) then
				say("Are you sure?")
				say("You can only do this once.[ENTER]")
				if (select("Yes", "Not now") == 1) then
					pc.setqf("biologist_reset", 1);
					biologist_reset.ResetBiologist();
				end -- if
			else
				say("You already used it.")
				say("You can't use it anymore.[ENTER]")
			end -- if/else
		end -- when
	end -- state
end -- quest

 

 

"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

1 hour ago, Syreldar said:

What do you mean by reuse of active? You mean you only want to make it possible to use this only once per player, on an item?

 

if yes:

Substitute XXX with the item vnum, and keep in mind the item's type must be 18 in order for the quest to work.

 


quest biologist_reset begin
	state start begin
		function ResetBiologist()
			local quest_names = {
				[1] = "collect_quest_lv30",
				[2] = "collect_quest_lv40",
				[3] = "collect_quest_lv50",
				[4] = "collect_quest_lv60",
				[5] = "collect_quest_lv70",
				[6] = "collect_quest_lv80",
				[7] = "collect_quest_lv85",
				[8] = "collect_quest_lv90",
				[9] = "collect_quest_lv92",
				[10] = "collect_quest_lv94"
			};

			for i = 1, table.getn(quest_names) do
				pc.setf(quest_names[i], "duration", 0);
			end -- for
		end -- function

		when XXX.use begin
			say_title(string.format("%s:[ENTER]", item_name(item.get_vnum())))
			if (pc.getqf("biologist_reset") == 0) then
				say("Are you sure?")
				say("You can only do this once.[ENTER]")
				if (select("Yes", "Not now") == 1) then
					pc.setqf("biologist_reset", 1);
					biologist_reset.ResetBiologist();
				end -- if
			else
				say("You already used it.")
				say("You can't use it anymore.[ENTER]")
			end -- if/else
		end -- when
	end -- state
end -- quest

 

Thank you bro,

soory for my bad english.
I could not explain exactly
I want if the time is reset, prevent it from being used again.
I appreciate your help.
Thank you!

Link to comment
Share on other sites

  • Premium
13 hours ago, jkhan said:

Thank you bro,

soory for my bad english.
I could not explain exactly
I want if the time is reset, prevent it from being used again.
I appreciate your help.
Thank you!

then that quest fits you, substitute the XXX with the vnum of the item you want to use and you are set.

 

"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

2 hours ago, Syreldar said:

then that quest fits you, substitute the XXX with the vnum of the item you want to use and you are set.

Thank you but,
This will not happen that. If the time is reset and no task is given the time will not be reset for the 2nd time. If the time is reset and the task is given, The System Will be reset.
Sorry for my bad English.
Link to comment
Share on other sites

  • Premium

Sorry, i do not understand.

 

"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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.