Jump to content

Quest random value from table


Recommended Posts

Hi. I found quest: 

quest daily_bonus begin
	state start begin
		when login begin
			if pc.getqf("time") == 0 or pc.getqf("time") <= get_time() then
				pc.setqf("time", get_time()+60*60*24)
				local bonusy = {
					{"Max. HP +1000", 1, 1000},
					{"Szansa na Omdlenie 5%", 13, 6},
					{"Szansa na Kryt. Uderzenie 8%", 15, 10},
					{"Szansa na Przeszyw. Uderzenie 8%", 16, 10},
					{"Silny Przeciwko Potworom 3%", 63, 5},
					{"Silny Przeciwko Ludziom 3%", 17, 5},
					{"Silny Przeciwko Nieumarłym 15%", 21, 10},
					{"Silny Przeciwko Diabłom 15%", 22, 10},
					{"Średnie Obrażenia +15%", 72, 10},
					{"Obrona +50", 54, 50},
					{"Wartość Ataku +50", 53, 50},
				}
				local n = number(1, table.getn(bonusy))
				affect.add_collect(bonusy[n][2], bonusy[n][3], 60*60*24)
				chat("Za dzisiejsze zalogowanie się otrzymujesz bonus: "..bonusy[n][1])
				chat("Czas Trwania Bonusu: 24h.")
				end
			end
		end
	end
	

How can i make that value of the bonus will be random from table. For example: {"Max. HP +1000", 1, random(1000 or 1500 or 2000)},

Thanks for help. 

Link to comment
Share on other sites

  • Premium
quest daily_bonus begin
	state start begin
		function GetData()
			local data = {
				[1] =  {["attrtype"] = 1,  ["attrvalue_list"] = {[1] = 1000, [2] = 1500, [3] = 2000}},
				[2] =  {["attrtype"] = 13, ["attrvalue_list"] = {[1] = 6,    [2] = 12,   [3] = 18}},
				[3] =  {["attrtype"] = 15, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[4] =  {["attrtype"] = 16, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[5] =  {["attrtype"] = 63, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[6] =  {["attrtype"] = 17, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[7] =  {["attrtype"] = 21, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[8] =  {["attrtype"] = 22, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[9] =  {["attrtype"] = 72, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[10] = {["attrtype"] = 54, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[11] = {["attrtype"] = 53, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}}
			};
			
			return data;
		end -- function
		
		function table_get_random_item(table_ex)
			return table_ex[math.random(table.getn(table_ex))];
		end -- function
	
		when login with pc.getqf("time") <= get_time() begin
			local data = daily_bonus.GetData();
			local random_num = daily_bonus.table_get_random_item(data);
			local chosen_bonus = data[random_num];
			local day_time = 60*60*24;

			pc.setqf("time", get_time()+day_time);
			affect.add_collect(chosen_bonus["attrtype"], table_get_random_item(chosen_bonus["attrvalue_list"]), day_time);
			syschat("You have received your bonus. Come back in 24 hours.")
		end -- when
	end -- state
end -- quest

 

  • Love 3

 

"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

Dnia 26.01.2018 o 13:31, Syreldar napisał:

quest daily_bonus begin
	state start begin
		function GetData()
			local data = {
				[1] =  {["attrtype"] = 1,  ["attrvalue_list"] = {[1] = 1000, [2] = 1500, [3] = 2000}},
				[2] =  {["attrtype"] = 13, ["attrvalue_list"] = {[1] = 6,    [2] = 12,   [3] = 18}},
				[3] =  {["attrtype"] = 15, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[4] =  {["attrtype"] = 16, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[5] =  {["attrtype"] = 63, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[6] =  {["attrtype"] = 17, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[7] =  {["attrtype"] = 21, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[8] =  {["attrtype"] = 22, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[9] =  {["attrtype"] = 72, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[10] = {["attrtype"] = 54, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[11] = {["attrtype"] = 53, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}}
			};
			
			return data;
		end -- function
		
		function table_get_random_item(table_ex)
			return table_ex[math.random(table.getn(table_ex))];
		end -- function
	
		when login with pc.getqf("time") <= get_time() begin
			local data = daily_bonus.GetData();
			local random_num = table_get_random_item(data);
			local chosen_bonus = data[random_num];
			local day_time = 60*60*24;

			pc.setqf("time", get_time()+day_time);
			affect.add_collect(chosen_bonus["attrtype"], table_get_random_item(chosen_bonus["attrvalue_list"]), day_time);
			syschat("You have received your bonus. Come back in 24 hours.")
		end -- when
	end -- state
end -- quest

 

I have problem. Your quest doesn't work. Error: 

SYSERR: Jan 28 17:36:56 :: RunState: LUA_ERROR: [string "daily_bonus"]:6: attempt to index local `chosen_bonus' (a nil value)
SYSERR: Jan 28 17:36:56 :: WriteRunningStateToSyserr: LUA_ERROR: quest daily_bonus.start click

I wanted add attr_name and value on chat

quest daily_bonus begin
	state start begin
		function GetData()
			local data = {
				[1] =  {["attr_name"] = "MAX HP", ["attrtype"] = 1,  ["attrvalue_list"] = {[1] = 1000, [2] = 1500, [3] = 2000}},
				[2] =  {["attr_name"] = "MAX HP", ["attrtype"] = 13, ["attrvalue_list"] = {[1] = 6,    [2] = 12,   [3] = 18}},
				[3] =  {["attr_name"] = "MAX HP", ["attrtype"] = 15, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[4] =  {["attr_name"] = "MAX HP", ["attrtype"] = 16, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[5] =  {["attr_name"] = "MAX HP", ["attrtype"] = 63, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[6] =  {["attr_name"] = "MAX HP", ["attrtype"] = 17, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[7] =  {["attr_name"] = "MAX HP", ["attrtype"] = 21, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[8] =  {["attr_name"] = "MAX HP", ["attrtype"] = 22, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[9] =  {["attr_name"] = "MAX HP", ["attrtype"] = 72, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[10] = {["attr_name"] = "MAX HP", ["attrtype"] = 54, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[11] = {["attr_name"] = "MAX HP", ["attrtype"] = 53, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}}
			};
			
			return data;
		end -- function
		
		function table_get_random_item(table_ex)
			return table_ex[math.random(table.getn(table_ex))];
		end -- function
	
		when 80009.use with pc.getqf("time") <= get_time() begin
			local data = daily_bonus.GetData();
			local random_num = table_get_random_item(data);
			local chosen_bonus = data[random_num];
			local day_time = 60*60*24;

			pc.setqf("time", get_time()+day_time);
			affect.add_collect(chosen_bonus["attrtype"], table_get_random_item(chosen_bonus["attrvalue_list"]), day_time);
			syschat("You got bonus" "..chosen_bonus["attr_name"]..""..value table_get_random_item(chosen_bonus["attrvalue_list"])).."")
		end -- when
	end -- state
end -- quest

and it doesn't work. Can you help me? 

Link to comment
Share on other sites

  • Premium
8 minutes ago, avertuss said:

I have problem. Your quest doesn't work. Error: 


SYSERR: Jan 28 17:36:56 :: RunState: LUA_ERROR: [string "daily_bonus"]:6: attempt to index local `chosen_bonus' (a nil value)
SYSERR: Jan 28 17:36:56 :: WriteRunningStateToSyserr: LUA_ERROR: quest daily_bonus.start click

I wanted add attr_name and value on chat


quest daily_bonus begin
	state start begin
		function GetData()
			local data = {
				[1] =  {["attr_name"] = "MAX HP", ["attrtype"] = 1,  ["attrvalue_list"] = {[1] = 1000, [2] = 1500, [3] = 2000}},
				[2] =  {["attr_name"] = "MAX HP", ["attrtype"] = 13, ["attrvalue_list"] = {[1] = 6,    [2] = 12,   [3] = 18}},
				[3] =  {["attr_name"] = "MAX HP", ["attrtype"] = 15, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[4] =  {["attr_name"] = "MAX HP", ["attrtype"] = 16, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[5] =  {["attr_name"] = "MAX HP", ["attrtype"] = 63, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[6] =  {["attr_name"] = "MAX HP", ["attrtype"] = 17, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[7] =  {["attr_name"] = "MAX HP", ["attrtype"] = 21, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[8] =  {["attr_name"] = "MAX HP", ["attrtype"] = 22, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[9] =  {["attr_name"] = "MAX HP", ["attrtype"] = 72, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[10] = {["attr_name"] = "MAX HP", ["attrtype"] = 54, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[11] = {["attr_name"] = "MAX HP", ["attrtype"] = 53, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}}
			};
			
			return data;
		end -- function
		
		function table_get_random_item(table_ex)
			return table_ex[math.random(table.getn(table_ex))];
		end -- function
	
		when 80009.use with pc.getqf("time") <= get_time() begin
			local data = daily_bonus.GetData();
			local random_num = table_get_random_item(data);
			local chosen_bonus = data[random_num];
			local day_time = 60*60*24;

			pc.setqf("time", get_time()+day_time);
			affect.add_collect(chosen_bonus["attrtype"], table_get_random_item(chosen_bonus["attrvalue_list"]), day_time);
			syschat("You got bonus" "..chosen_bonus["attr_name"]..""..value table_get_random_item(chosen_bonus["attrvalue_list"])).."")
		end -- when
	end -- state
end -- quest

and it doesn't work. Can you help me? 

You are using the wrong version, i modified that once for a quick fix, c/p it again.

as for the attrs on chat, why don't you try to figure it yourself man? Try to learn.

 

"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

Dnia 28.01.2018 o 17:49, Syreldar napisał:

You are using the wrong version, i modified that once for a quick fix, c/p it again.

as for the attrs on chat, why don't you try to figure it yourself man? Try to learn.

But your quest doesn't work 

quest daily_bonus begin
	state start begin
		function GetData()
			local data = {
				[1] =  {["attrtype"] = 1,  ["attrvalue_list"] = {[1] = 1000, [2] = 1500, [3] = 2000}},
				[2] =  {["attrtype"] = 13, ["attrvalue_list"] = {[1] = 6,    [2] = 12,   [3] = 18}},
				[3] =  {["attrtype"] = 15, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[4] =  {["attrtype"] = 16, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[5] =  {["attrtype"] = 63, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[6] =  {["attrtype"] = 17, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[7] =  {["attrtype"] = 21, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[8] =  {["attrtype"] = 22, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[9] =  {["attrtype"] = 72, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[10] = {["attrtype"] = 54, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[11] = {["attrtype"] = 53, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}}
			};
			
			return data;
		end -- function
		
		function table_get_random_item(table_ex)
			return table_ex[math.random(table.getn(table_ex))];
		end -- function
	
		when 80009.use begin
			local data = daily_bonus.GetData();
			local random_num = daily_bonus.table_get_random_item(data);
			local chosen_bonus = data[random_num];
			local day_time = 60*60*24;
			affect.add_collect(chosen_bonus["attrtype"], table_get_random_item(chosen_bonus["attrvalue_list"]), day_time);
			chat(chat_color("["..item_name(item.vnum).."]", "green").." You got bonus.")
		end -- when
	end -- state
end -- quest

SYSERR: Jan 29 19:10:44 :: RunState: LUA_ERROR: [string "teleport"]:5: attempt to index local `chosen_bonus' (a nil value)
SYSERR: Jan 29 19:10:44 :: WriteRunningStateToSyserr: LUA_ERROR: quest teleport.start click

Link to comment
Share on other sites

  • Premium
5 minutes ago, avertuss said:

But your quest doesn't work 

SYSERR: Jan 29 19:10:44 :: RunState: LUA_ERROR: [string "teleport"]:5: attempt to index local `chosen_bonus' (a nil value)
SYSERR: Jan 29 19:10:44 :: WriteRunningStateToSyserr: LUA_ERROR: quest teleport.start click

 
quest daily_bonus begin
	state start begin
		function GetData()
			local data = {
				[1] =  {["attrtype"] = 1,  ["attrvalue_list"] = {[1] = 1000, [2] = 1500, [3] = 2000}},
				[2] =  {["attrtype"] = 13, ["attrvalue_list"] = {[1] = 6,    [2] = 12,   [3] = 18}},
				[3] =  {["attrtype"] = 15, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[4] =  {["attrtype"] = 16, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[5] =  {["attrtype"] = 63, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[6] =  {["attrtype"] = 17, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[7] =  {["attrtype"] = 21, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[8] =  {["attrtype"] = 22, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[9] =  {["attrtype"] = 72, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[10] = {["attrtype"] = 54, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[11] = {["attrtype"] = 53, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}}
			};
			
			return data;
		end -- function
		
		function table_get_random_item(table_ex)
			return table_ex[math.random(table.getn(table_ex))];
		end -- function
	
		when 80009.use begin
			local data = daily_bonus.GetData();
			local chosen_bonus = daily_bonus.table_get_random_item(data);
			local day_time = 60*60*24;

			affect.add_collect(chosen_bonus["attrtype"], daily_bonus.table_get_random_item(chosen_bonus["attrvalue_list"]), day_time);
			chat(chat_color("["..item_name(item.vnum).."]", "green").." You got bonus.")
		end -- when
	end -- state
end -- quest

because you keep modifying things without testing them first. Use this now.

 

"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

17 godzin temu, Syreldar napisał:

quest daily_bonus begin
	state start begin
		function GetData()
			local data = {
				[1] =  {["attrtype"] = 1,  ["attrvalue_list"] = {[1] = 1000, [2] = 1500, [3] = 2000}},
				[2] =  {["attrtype"] = 13, ["attrvalue_list"] = {[1] = 6,    [2] = 12,   [3] = 18}},
				[3] =  {["attrtype"] = 15, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[4] =  {["attrtype"] = 16, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[5] =  {["attrtype"] = 63, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[6] =  {["attrtype"] = 17, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[7] =  {["attrtype"] = 21, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[8] =  {["attrtype"] = 22, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[9] =  {["attrtype"] = 72, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[10] = {["attrtype"] = 54, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[11] = {["attrtype"] = 53, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}}
			};
			
			return data;
		end -- function
		
		function table_get_random_item(table_ex)
			return table_ex[math.random(table.getn(table_ex))];
		end -- function
	
		when 80009.use begin
			local data = daily_bonus.GetData();
			local chosen_bonus = daily_bonus.table_get_random_item(data);
			local day_time = 60*60*24;

			affect.add_collect(chosen_bonus["attrtype"], daily_bonus.table_get_random_item(chosen_bonus["attrvalue_list"]), day_time);
			chat(chat_color("["..item_name(item.vnum).."]", "green").." You got bonus.")
		end -- when
	end -- state
end -- quest

because you keep modifying things without testing them first. Use this now.

Now it works but when i wanted to show which bonus player got i saw error

SYSERR: Jan 30 13:05:49 :: RunState: LUA_ERROR: [string "daily_bonus"]:5: attempt to call field `attrname' (a string value)
SYSERR: Jan 30 13:05:49 :: WriteRunningStateToSyserr: LUA_ERROR: quest daily_bonus.start click

Quest:

quest daily_bonus begin
	state start begin
		function GetData()
			local data = {
				[1] =  {["attrname"] = "Max. HP", ["attrtype"] = 1,  ["attrvalue_list"] = {[1] = 1000, [2] = 1500, [3] = 2000}},
				[2] =  {["attrname"] = "Max. HP2", ["attrtype"] = 13, ["attrvalue_list"] = {[1] = 6,    [2] = 12,   [3] = 18}},
				[3] =  {["attrname"] = "Max. HP3", ["attrtype"] = 15, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[4] =  {["attrname"] = "Max. HP4", ["attrtype"] = 16, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[5] =  {["attrname"] = "Max. HP5", ["attrtype"] = 63, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[6] =  {["attrname"] = "Max. HP6", ["attrtype"] = 17, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[7] =  {["attrname"] = "Max. HP7", ["attrtype"] = 21, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[8] =  {["attrname"] = "Max. HP8", ["attrtype"] = 22, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[9] =  {["attrname"] = "Max. HP9", ["attrtype"] = 72, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[10] = {["attrname"] = "Max. HP10", ["attrtype"] = 54, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[11] = {["attrname"] = "Max. HP11", ["attrtype"] = 53, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}}
			};
			
			return data;
		end -- function
		
		function table_get_random_item(table_ex)
			return table_ex[math.random(table.getn(table_ex))];
		end -- function
	
		when 80009.use begin
			local data = daily_bonus.GetData();
			local chosen_bonus = daily_bonus.table_get_random_item(data);
			local day_time = 1*1*30;

			affect.add_collect(chosen_bonus["attrtype"], daily_bonus.table_get_random_item(chosen_bonus["attrvalue_list"]), day_time);
			chat(chat_color("["..item_name(item.vnum).."]", "green").." You got "..chosen_bonus["attrname"]"")
		end -- when
	end -- state
end -- quest

Can you help me? 

Link to comment
Share on other sites

  • Premium
9 hours ago, avertuss said:

Now it works but when i wanted to show which bonus player got i saw error

SYSERR: Jan 30 13:05:49 :: RunState: LUA_ERROR: [string "daily_bonus"]:5: attempt to call field `attrname' (a string value)
SYSERR: Jan 30 13:05:49 :: WriteRunningStateToSyserr: LUA_ERROR: quest daily_bonus.start click

Quest:


quest daily_bonus begin
	state start begin
		function GetData()
			local data = {
				[1] =  {["attrname"] = "Max. HP", ["attrtype"] = 1,  ["attrvalue_list"] = {[1] = 1000, [2] = 1500, [3] = 2000}},
				[2] =  {["attrname"] = "Max. HP2", ["attrtype"] = 13, ["attrvalue_list"] = {[1] = 6,    [2] = 12,   [3] = 18}},
				[3] =  {["attrname"] = "Max. HP3", ["attrtype"] = 15, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[4] =  {["attrname"] = "Max. HP4", ["attrtype"] = 16, ["attrvalue_list"] = {[1] = 10,   [2] = 15,   [3] = 20}},
				[5] =  {["attrname"] = "Max. HP5", ["attrtype"] = 63, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[6] =  {["attrname"] = "Max. HP6", ["attrtype"] = 17, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[7] =  {["attrname"] = "Max. HP7", ["attrtype"] = 21, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[8] =  {["attrname"] = "Max. HP8", ["attrtype"] = 22, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[9] =  {["attrname"] = "Max. HP9", ["attrtype"] = 72, ["attrvalue_list"] = {[1] = 5,    [2] = 10,   [3] = 15}},
				[10] = {["attrname"] = "Max. HP10", ["attrtype"] = 54, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}},
				[11] = {["attrname"] = "Max. HP11", ["attrtype"] = 53, ["attrvalue_list"] = {[1] = 50,   [2] = 75,   [3] = 100}}
			};
			
			return data;
		end -- function
		
		function table_get_random_item(table_ex)
			return table_ex[math.random(table.getn(table_ex))];
		end -- function
	
		when 80009.use begin
			local data = daily_bonus.GetData();
			local chosen_bonus = daily_bonus.table_get_random_item(data);
			local day_time = 1*1*30;

			affect.add_collect(chosen_bonus["attrtype"], daily_bonus.table_get_random_item(chosen_bonus["attrvalue_list"]), day_time);
			chat(chat_color("["..item_name(item.vnum).."]", "green").." You got "..chosen_bonus["attrname"]"")
		end -- when
	end -- state
end -- quest

Can you help me? 

That's the line you inserted, try to learn and solve 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
Share on other sites

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.