Jump to content
  • 0

Random item from my 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 had crafted this script, but somehow after a couple day of testing, i had not even 1 single time got the random chance item, even after i had increase the chance to 99%

can someone check them for error and help me fix it?

Spoiler
new_1-3,87,138,6	script	Public Butcher Table	665,{
			
			setarray .@MakeShiftBoneDagger[0], 40101,40102,40103,40104,40105;
			.@Chance = 99;
			
			
			
			mes "Select :-"; 
			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 "Require :-";
									mes "- [1] Monster Loot.";
									mes "- [1] Stone Blade.";
									close;
										}
										delitem 40026, 1;
										getitem 40036, 1;
										getitem 40011, 2;
									}
							
							if(countitem(40106) == 1){ //T2 Butchering
								if(countitem(40026) < 1 || rentalcountitem(40024) < 1){
									mes "Require :-";
									mes "- [1] Monster Loot.";
									mes "- [1] Stone Blade.";
									close;
										}
										delitem 40026, 1;
										getitem 40036, 1;
										getitem 40011, 2;
									}
							else
							mes "Require :-";
							mes "- [1] Monster Loot.";
							mes "- [1] Stone Blade.";
							close;
							
						case 2:
							if(countitem(40043) == 1){ //T1 Butchering
								if(countitem(40026) < 1 || rentalcountitem(40058) < 1){
									mes "Require :-";
									mes "- [1] Monster Loot.";
									mes "- [1] Stone Blade.";
									close;
										}
										delitem 40026, 1;
										getitem 40036, 1;
										getitem 40011, 2;
										close;
									}
							
							if(countitem(40106) == 1){ //T2 Butchering
								if(countitem(40026) > 1 || rentalcountitem(40058) > 1){
									if(rand(100) <= .@Chance){
                                    //random chance start here
									getitem .@MakeShiftBoneDagger[rand(getarraysize(.@MakeShiftBoneDagger))], 1;
									getitem 40036, 1;
												}
                                  		//if no luck gets normal item
										delitem 40026, 1;
										getitem 40036, 1;
										getitem 40011, 2;
										close;
											}
										}
									else
										mes "Require :-";
										mes "- [1] Monster Loot.";
										mes "- [1] Make Shift .";
										close;
							
						case 3:
							mes "Cancel";
							close3;
						
					}
					
					
					
						
				case 2:
						mes "WIP";
						close3;
				
				case 3:
						mes "WIP";
						close3;
				case 4:
						mes "Process Cancel";
						close3;
						}
}
//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

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1537
  • Reputation:   237
  • Joined:  08/03/12
  • Last Seen:  

Can you explain on u didnt get the random chance item ?

From what I saw in the script;

 

			if(countitem(40106) == 1){ //T2 Butchering
								if(countitem(40026) > 1 || rentalcountitem(40058) > 1){
									if(rand(100) <= .@Chance){
									getitem .@MakeShiftBoneDagger[rand(getarraysize(.@MakeShiftBoneDagger))], 1;
									getitem 40036, 1;
												}
										delitem 40026, 1;
										getitem 40036, 1;
										getitem 40011, 2;
										close;
											}
										}

So, make sure your item 40106 = 1, not more than that. item 40026 and 40058 rent item is exist.

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:  

40 minutes ago, Chaos92 said:

Can you explain on u didnt get the random chance item ?

From what I saw in the script;

 

			if(countitem(40106) == 1){ //T2 Butchering
								if(countitem(40026) > 1 || rentalcountitem(40058) > 1){
									if(rand(100) <= .@Chance){
									getitem .@MakeShiftBoneDagger[rand(getarraysize(.@MakeShiftBoneDagger))], 1;
									getitem 40036, 1;
												}
										delitem 40026, 1;
										getitem 40036, 1;
										getitem 40011, 2;
										close;
											}
										}

So, make sure your item 40106 = 1, not more than that. item 40026 and 40058 rent item is exist.

it start on this part here:

case 2:
							if(countitem(40043) == 1){ //T1 Butchering
								if(countitem(40026) < 1 || rentalcountitem(40058) < 1){
									mes "Require :-";
									mes "- [1] Monster Loot.";
									mes "- [1] Stone Blade.";
									close;
										}
										delitem 40026, 1;
										getitem 40036, 1;
										getitem 40011, 2;
										close;
									}
							
							if(countitem(40106) == 1){ //T2 Butchering
								if(countitem(40026) > 1 || rentalcountitem(40058) > 1){
									if(rand(100) <= .@Chance){
                                    //random chance start here
									getitem .@MakeShiftBoneDagger[rand(getarraysize(.@MakeShiftBoneDagger))], 1;
									getitem 40036, 1;
												}
                                  		//if no luck gets normal item
										delitem 40026, 1;
										getitem 40036, 1;
										getitem 40011, 2;
										close;
											}
										}
									else
										mes "Require :-";
										mes "- [1] Monster Loot.";
										mes "- [1] Make Shift .";
										close;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1537
  • Reputation:   237
  • Joined:  08/03/12
  • Last Seen:  

yes, told ya about what item should have only 1, and can more than 1

So, make sure your item 40106 = 1, not more than that. item 40026 and 40058 rent item is exist.

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:  

On 11/12/2023 at 6:34 AM, Chaos92 said:

yes, told ya about what item should have only 1, and can more than 1

So, make sure your item 40106 = 1, not more than that. item 40026 and 40058 rent item is exist.

yes the item 40106 is a indicator item ( Tier 2 Butchering ) and it was meant only to have 1, 40026 is an item drop form monster, and 40058 is a rental weapons. and yes all the item needed is existing within my inventory 

 

closing this post, since im no longer using this script.

 

hye i got question, with my current script if you look down there is a section which i tag it, the problem is it works with giving reward, but it give all the listed rewards, what i need is only 1 item from the list and 1 bonus item, you may refer to the script or just ask me here, 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 butchering 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 "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;
								}
							

								
								
						
						case 2:
							if(countitem(40106) == 1){
								if(countitem(40026) < 1 || rentalcountitem(40058) < 1) {
									mes "Require:-"; 
									mes "[1] Monster Loot";
									mes "[1] Stone Blade";
									close3;
									}
								delitem(40026, 1);
								getitem(40036, 1); // Prove Of Butchering
								if (rand(100) < 10) {
//============================ if have Butchering T2 has 10% chance to get the following items, how to make it 1 item only and bonus 1 item, bonus item (40036)
								setarray(getd("$wrkb_" + .@wrkb_id + "_products"),40101,1, 40102,1, 40103,1, 40104,1, 40105,1);
								}

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

								goto OnCraftingStart;
								}
							
						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

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1537
  • Reputation:   237
  • Joined:  08/03/12
  • Last Seen:  

1 hour ago, Dolphin86 said:

yes the item 40106 is a indicator item ( Tier 2 Butchering ) and it was meant only to have 1, 40026 is an item drop form monster, and 40058 is a rental weapons. and yes all the item needed is existing within my inventory 

I dont think i have any issue getting the chance item, i change all the itemid to 501~ 515~ and no problem at all. just make sure all are in inventory. choose first case, then 2nd case.

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...