Jump to content
  • 0

How to add random 10% chance on my current script?


Dolphin86

Question


  • Group:  Members
  • Topic Count:  255
  • Topics Per Day:  0.06
  • Content Count:  706
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

hye i need help on getting random chance if player had (40101) Butchering's Tier 2, from the script below, if player had (40043) Butchering's Tier 1, it will proceed to craft the item with current script which all thanks to @Winterfox who created it, but I'm kind of confused how to add on the second option which is random chance to gain some different item result by 10%, if else player will just get a normal item (40011) Low Quality Bone, 

 

also the script need a little improvement, when the time is up the chat box disappear, while the item are still have not taken out, i would like the chat box disappear only when the item had been taken out only, thanks  

Spoiler
new_1-3,87,138,6	script	Public Butcher Table	665,{

			.@wrkb_id = atoi(strnpcinfo(2));

			if($wrkb_crafting_state[.@wrkb_id] == 1) {
			mes "Please wait until the cooking process is finished. ";
			close;
			}

			if($wrkb_crafting_state[.@wrkb_id] == 2) {
			mes "Here are your crafted items.";
			for(.@i = 0; .@i < getarraysize(getd("$wrkb_" + .@wrkb_id + "_products")); .@i += 2)
			getitem(getd("$wrkb_" + .@wrkb_id + "_products[" + .@i + "]"), getd("$wrkb_" + .@wrkb_id + "_products[" + (.@i + 1) + "]"));

			delwaitingroom;
			$wrkb_crafting_state[.@wrkb_id] = 0;
			close;
			}
			
			
			mes "Select :-"; 
			next;
			switch(select("- Take Bone only:- Take Meat Only:- Take Monster Skin Only:- Cancel")) {
			
				case 1:
					switch(select("- Use Stone Blade:- Use Make Shift Bone Blade:- Cancel")) {
					
						case 1:
							if(countitem(40043) == 1){ // T1 Butchering
								if(countitem(40026) < 1 || rentalcountitem(40024) < 1) {
									mes "Take Out Bone";
									mes "Require:-"; 
									mes "[1] Monster Loot";
									mes "[1] Stone Blade";
									close3;
									}
								delitem(40026, 1);
								getitem(40036, 1); // Prove Of Butchering
								setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40036,1, 40011, 1);

								goto OnCraftingStart;
								}
							
							if(countitem(40106) == 1){
								
								mes "How to add random chance?";
								close3;
								
								}
						
						case 2:
							mes "WIP";
							close3;
						case 3:
							mes "Cancel";
							close3;
						
					}
					
					
					
						
				case 2:
						mes "WIP";
						close3;
				
				case 3:
						mes "WIP";
						close3;
				case 4:
						mes "Process Cancel";
						close3;
						}

		OnCraftingStart:
		$wrkb_crafting_state[.@wrkb_id] = 1;
		waitingroom("Butchering...", 0);
		initnpctimer;
		end;

	OnTimer10000:
		$wrkb_crafting_state[atoi(strnpcinfo(2))] = 2;
		delwaitingroom;
		waitingroom("COMPLETED!", 0);
		end;

	OnInit:
		.@wrkb_id = atoi(strnpcinfo(2));
		if(.@wrkb_id < 1) end;

		if($wrkb_crafting_state[.@wrkb_id] == 1) goto OnCraftingStart;
}
//Duplicate
//=====================================================
chry_fld,81,74,6	duplicate(Public Butcher Table)	Public Butcher Table#1	665
ma_fild01,317,289,6	duplicate(Public Butcher Table)	Public Butcher Table#2	665
ma_fild01,264,358,6	duplicate(Public Butcher Table)	Public Butcher Table#3	665

ma_fild01,231,316,6	duplicate(Public Butcher Table)	Public Butcher Table#4	665
ma_fild01,144,285,6	duplicate(Public Butcher Table)	Public Butcher Table#5	665
ma_fild01,54,193,6	duplicate(Public Butcher Table)	Public Butcher Table#6	665
ma_fild01,91,91,6	duplicate(Public Butcher Table)	Public Butcher Table#7	665

ma_fild01,196,185,6	duplicate(Public Butcher Table)	Public Butcher Table#8	665
ma_fild01,234,240,6	duplicate(Public Butcher Table)	Public Butcher Table#9	665
ma_fild01,182,107,6	duplicate(Public Butcher Table)	Public Butcher Table#10	665
ma_fild01,281,120,6	duplicate(Public Butcher Table)	Public Butcher Table#11	665

 

 

Edited by Dolphin86
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  132
  • Reputation:   53
  • Joined:  06/02/12
  • Last Seen:  

Hi, find this line:

setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40036,1, 40011, 1);

and replace to:

if (countitem(40101) && rand(100) < 10) {
	// if have Butchering T2 has 10% chance to get the following items
	setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40036,1, 948,1, 929,1);
}

else {
	// Butchering 1 list / commom items
	setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40036,1, 40011, 1);
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  255
  • Topics Per Day:  0.06
  • Content Count:  706
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

Spoiler

 

14 hours ago, Racaae said:

Hi, find this line:

setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40036,1, 40011, 1);

and replace to:

if (countitem(40101) && rand(100) < 10) {
	// if have Butchering T2 has 10% chance to get the following items
	setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40036,1, 948,1, 929,1);
}

else {
	// Butchering 1 list / commom items
	setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40036,1, 40011, 1);
}

 

this great but i think this part:

setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40101,2, 40102,2, 40103,2 ,40104,2 ,40105,2);

i need either one of the item, not all of it?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...