Adaugare drop chance in quest

Înainte de a posta o problemă, caută în acest forum și poate găsești rezolvare.
Închis
Avatar utilizator
se1bymatrix
Nivel 1

Nivel 1
Mesaje: 81
Membru din: 10 Sep 2014, 18:04
Server: www.epicalmetin2.ro
Regat: Chunjo
Aprecieri: 145  
Mulţumiri: 0
 Contact:
Medalii

*Problemă/Întrebare:Deci, am adaugat un quest, toate bune si frumoase, dar
local box_50134=number(1, 8)

if 1>=box_50134 then

pc.give_item2("45011", 1)

elseif 2>=box_50134 then

pc.give_item2("45013", 1)

elseif 3>=box_50134 then

pc.give_item2("45015", 1)

elseif 4>=box_50134 then

pc.give_item2("45017", 1)
aici e problema, am pus 1, 8 , ma rog is 8 de elseif dar am pus doar 4 aici, ideea e ca vreau ca de exemplu itemul 45011 sa aiba sansa de 90% sa cada fata de restul , nu vreau sa-l scriu pe ala de 90 de ori si pe celelalte sa le las de 10... si ma gandeam ca poate exista o solutie mai easy :P sper ca sa inteles ce voiam sa spun, multumesc anticipat.
Tipologie server:pvm
*Resursă folosită:-
*ServerFiles utilizat:-
*Syserr:-
Poză:-
*Detalii suplimentare:-
The grass is always green around the other side! (The Green-Side) :ymsick: %%- =:)
Afișează semnătura
Avatar utilizator
Vladii
Utilizator interzis !

Utilizator interzis !
Mesaje: 402
Membru din: 03 Iun 2018, 18:33
Server: Arena2
Regat: Chunjo
Aprecieri: 230  
Mulţumiri: 252  
Discord: Copiază ID
 Contact:
Medalii

Foloseste asta.
quest items_drop begin
	state start begin
		function mob_drop_with_chance(vnum, count, drop_chance, chance_for_drop)
			local random_drop = number(1, chance_for_drop)
			
			if random_drop <= drop_chance then
				game.drop_item_with_ownership(vnum, count)
			end
		end
		
		when kill begin
			local drop_stats = {
				{["lvl"] = {15, 105}, ["vnum"] = 71084, ["count"] = 1, ["drop_at"] = 1000, ["drop_chance"] = 10000},
				{["lvl"] = {15, 105}, ["vnum"] = 71085, ["count"] = 1, ["drop_at"] = 1000, ["drop_chance"] = 10000},
				{["lvl"] = {15, 105}, ["vnum"] = 25040, ["count"] = 1, ["drop_at"] = 500, ["drop_chance"] = 10000},
			};
			local random_take = number(1, table.getn(drop_stats))
			
			if (pc.get_level() >= drop_stats[random_take]["lvl"][1]) and (pc.get_level() <= drop_stats[random_take]["lvl"][2]) then
				if (npc.get_level0() - 15 <= pc.get_level()) and (pc.get_level() <= npc.get_level0() + 15) then
					items_drop.mob_drop_with_chance(drop_stats[random_take]["vnum"], drop_stats[random_take]["count"], drop_stats[random_take]["drop_at"], drop_stats[random_take]["drop_chance"])
				end
			end
		end
	end
end
Pentru acest mesaj, Vladii for the post:
se1bymatrix
Avatar utilizator
se1bymatrix
Nivel 1

Nivel 1
Mesaje: 81
Membru din: 10 Sep 2014, 18:04
Server: www.epicalmetin2.ro
Regat: Chunjo
Aprecieri: 145  
Mulţumiri: 0
 Contact:
Medalii

Vladii scrie: ↑28 Mar 2020, 12:16 Foloseste asta.
quest items_drop begin
	state start begin
		function mob_drop_with_chance(vnum, count, drop_chance, chance_for_drop)
			local random_drop = number(1, chance_for_drop)
			
			if random_drop <= drop_chance then
				game.drop_item_with_ownership(vnum, count)
			end
		end
		
		when kill begin
			local drop_stats = {
				{["lvl"] = {15, 105}, ["vnum"] = 71084, ["count"] = 1, ["drop_at"] = 1000, ["drop_chance"] = 10000},
				{["lvl"] = {15, 105}, ["vnum"] = 71085, ["count"] = 1, ["drop_at"] = 1000, ["drop_chance"] = 10000},
				{["lvl"] = {15, 105}, ["vnum"] = 25040, ["count"] = 1, ["drop_at"] = 500, ["drop_chance"] = 10000},
			};
			local random_take = number(1, table.getn(drop_stats))
			
			if (pc.get_level() >= drop_stats[random_take]["lvl"][1]) and (pc.get_level() <= drop_stats[random_take]["lvl"][2]) then
				if (npc.get_level0() - 15 <= pc.get_level()) and (pc.get_level() <= npc.get_level0() + 15) then
					items_drop.mob_drop_with_chance(drop_stats[random_take]["vnum"], drop_stats[random_take]["count"], drop_stats[random_take]["drop_at"], drop_stats[random_take]["drop_chance"])
				end
			end
		end
	end
end

man chiar am incercat sa schimb datele sa fac cand dau pe chest 50132 cu cheia 50156 si numa am bugat questul, pentru ca ala e sa fie drop la mob, si cred ca de asta se bugheaza asa....
The grass is always green around the other side! (The Green-Side) :ymsick: %%- =:)
Afișează semnătura
Avatar utilizator
se1bymatrix
Nivel 1

Nivel 1
Mesaje: 81
Membru din: 10 Sep 2014, 18:04
Server: www.epicalmetin2.ro
Regat: Chunjo
Aprecieri: 145  
Mulţumiri: 0
 Contact:
Medalii

are cineva o solutie pentru astfel de cufere?
The grass is always green around the other side! (The Green-Side) :ymsick: %%- =:)
Afișează semnătura
Avatar utilizator
[Reizo]
Ţepar / Untrusted User

Ţepar / Untrusted User
Mesaje: 1301
Membru din: 22 Oct 2019, 15:44
Server: SAPPHIRE2
Regat: Chunjo
Aprecieri: 409  
Mulţumiri: 4322  
Discord: Copiază ID
 Contact:
Medalii

Fa-le cu random.math si faci sansa cu ala =))
Pentru acest mesaj, [Reizo] for the post:
se1bymatrix
Imagine
Afișează semnătura
Avatar utilizator
se1bymatrix
Nivel 1

Nivel 1
Mesaje: 81
Membru din: 10 Sep 2014, 18:04
Server: www.epicalmetin2.ro
Regat: Chunjo
Aprecieri: 145  
Mulţumiri: 0
 Contact:
Medalii

[Reizo] scrie: ↑28 Mar 2020, 15:59 Fa-le cu random.math si faci sansa cu ala =))
pai sa zic ca pun
local box_50134=random.math(1, 8)
If 1>=box_50134 then
pc.give_item2("45011", 1)
elseif 2>bla bla
gen cum setez sa zic if valoare intre 1 si 5 sa-ti dea ceva
else if 1 6-8 altceva... asta nu inteleg
The grass is always green around the other side! (The Green-Side) :ymsick: %%- =:)
Afișează semnătura
Avatar utilizator
se1bymatrix
Nivel 1

Nivel 1
Mesaje: 81
Membru din: 10 Sep 2014, 18:04
Server: www.epicalmetin2.ro
Regat: Chunjo
Aprecieri: 145  
Mulţumiri: 0
 Contact:
Medalii

Solutie:
setezi
local habarnam = math.random()*100
if 50>habarnam then
pc.give_item2("vnum", 1)
elseif 70>habarnam then
pc.give_item2("vnum", 1)
elseif 100>habarnam then
pc.give.item2("vnum",1)
endif
sansa primului e de 50% cel de-al doilea are 20% si ultimult are 30%
Multumesc frumos celor 2 pentru ca m-au ajutat! ^_^
The grass is always green around the other side! (The Green-Side) :ymsick: %%- =:)
Afișează semnătura
Avatar utilizator
Ionuţ M.
Metin Master

Metin Master
Mesaje: 2680
Membru din: 28 Noi 2015, 22:02
Aprecieri: 170  
Mulţumiri: 12723  
  Rezolvări prob.: 2
Discord: Copiază ID
 Contact:
Medalii

Mutat in Probleme Rezolvate.
Imagine
Afișează semnătura
Închis
Răspunsuri
3
Vizualizări
124
Răspunsuri
5
Vizualizări
586
Răspunsuri
2
Vizualizări
426
Răspunsuri
7
Vizualizări
519

Înapoi la “Probleme rezolvate”

  • Informaţie
  • Cine este conectat

    Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 33 vizitatori