Jump to content
  • 0

Script Not detecting item


Dolphin86

Question


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

as title i did manage to make the item using the requirement before, but some how now its not working as it should?

script :

Spoiler
case 4:
			next;
			switch(select("- Animal Skin Armor:- Cancel")) {	
				
				case 1:
				if(countitem(40028) < 2 || countitem(40029) < 2 || countitem(40030) < 1 ) {	
				mes "^ff0000 Animal Skin Armor ^000000";
				mes "Requires:-";
				mes "- [2] Padded Leaf";
				mes "- [2] Tanned Skin";
				mes "- [1] Needle";
				close;
				}

				delitem(40028, 2);
				delitem(40029, 2);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40032, 1);

				goto OnCraftingStart;
				
				case 2:
					mes "Crafting Cancel.";
					close;
				}

 

 item db :

Spoiler
  - Id: 40030
    AegisName: Wood Needle
    Name: Wood Needle
    Type: Etc
    Weight: 10
    Trade:
      NoDrop: true
      NoTrade: true
      NoSell: true
      NoCart: true
      NoStorage: true
      NoGuildStorage: true
      NoMail: true
      NoAuction: true

  - Id: 40028
    AegisName: Padded Leaf
    Name: Padded Leaf
    Type: Etc
    Weight: 10

  - Id: 40029
    AegisName: Tanned Skin
    Name: Tanned Skin
    Type: Etc
    Weight: 10

 

Full Script:

Spoiler
-	script	Workbench	FAKE_NPC,{
	.@wrkb_id = atoi(strnpcinfo(2));

	if($wrkb_crafting_state[.@wrkb_id] == 1) {
		mes "Please wait until the crafting 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 "==============================";
	mes "^ff0000 Any item crafted by using the public Workbench can be stolen by other players !! ^000000";
	mes "==============================";
	next;
	mes "What do you want to craft?";
	next;
	switch(select("- Material Crafting:- Tool Crafting:- Weapon Crafting:- Armor Crafting:- Cancel")) {
	
		case 1:
			next;
			switch(select("- Rock Chunk:- Rope:- Blade:- Handle:- Padded Leaf:- Tanned Skin:- Cancel")) {	
			
			case 1:
				if(countitem(40005) < 4) {
				mes "^ff0000 Rock Chunk ^000000";
				mes "Requires:-";
				mes "- [4] Rock";
				close;
			}

				delitem(40005, 4);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40018, 1);

			goto OnCraftingStart;
		
			case 2:
				if(countitem(40008) < 4) {
				mes "^ff0000 Ropes ^000000";
				mes "Require:-";
				mes "- [4] Stalk";
				close;
			}

				delitem(40008, 4);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40014, 1);
			
				goto OnCraftingStart;
		
			case 3:
				if(countitem(40021) < 4) {
				mes "^ff0000 Blade ^000000";
				mes "Require:-";
				mes "- [4] Boulder";
				close;
			}

			delitem(40021, 4);
			setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40022, 1);
			
			goto OnCraftingStart;
			
			case 4:
				if(countitem(40002) < 2) {
				mes "^ff0000 Handle ^000000";
				mes "Require:-";
				mes "- [2] Log";
				close;
			}

				delitem(40002, 2);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40023, 1);
			
				goto OnCraftingStart;
			
			case 5:
				if(countitem(40004) < 4) {
				mes "^ff0000 Padded Leaf ^000000";
				mes "Require:-";
				mes "- [4] Leaf";
				close;
			}

				delitem(40004, 4);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40028, 1);
			
				goto OnCraftingStart;	
			
			case 6:
				if(countitem(40027) < 4) {
				mes "^ff0000 Tanned Skin ^000000";
				mes "Require:-";
				mes "- [4] Skin";
				close;
			}

				delitem(40027, 4);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40029, 1);
			
				goto OnCraftingStart;	
		}	
		
		case 2:
			next;
			next;
			switch(select("- Stone Dagger:- Stone Axe:- Stone Hammer:- Wood Needle :- Cancel")) {
			
			case 1:
				if(countitem(40005) < 4) {
				mes "^ff0000 Stone Dagger ^000000";
				mes "Requires:-";
				mes "- [4] Rocks";
				close;
				}

				delitem(40005, 4);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40009, 1);

				goto OnCraftingStart;
			
			case 2:
				if(countitem(40018) < 1 || countitem(40014) < 2 || countitem(40003) < 1 ) {	
				mes "^ff0000 Stone Axe ^000000";
				mes "Requires:-";
				mes "- [1] Rock Chunk";
				mes "- [2] Ropes";
				mes "- [1] Branch";
				close;
				}

				delitem(40018, 1);
				delitem(40014, 2);
				delitem(40003, 1);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40017, 1);

				goto OnCraftingStart;
				
			case 3:
				if(countitem(40018) < 1 || countitem(40014) < 2 || countitem(40003) < 1 ) {	
				mes "^ff0000 Stone Hammer ^000000";
				mes "Requires:-";
				mes "- [1] Rock Chunk";
				mes "- [2] Ropes";
				mes "- [1] Branch";
				close;
				}

				delitem(40018, 1);
				delitem(40014, 2);
				delitem(40003, 1);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40020, 1);

				goto OnCraftingStart;
				
			case 4:
				if(countitem(40003) < 2 || countitem(40018) < 1 || !isequipped(40016) ) {	
				mes "^ff0000 Wood Needle ^000000";
				mes "Requires:-";
				mes "- [2] Branch";
				mes "- [1] Stone Chunk";
				mes "- [1] Stone Axe";
				close;
				}

				delitem(40003, 2);
				delitem(40018, 1);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40033, 1);

				goto OnCraftingStart;
			
			}
		case 3:
			next;
			switch(select("- Stone Blade:- Cancel")) {	
				
				case 1:
				if(countitem(40023) < 2 || countitem(40022) < 1 || countitem(40014) < 2 || !isequipped(40019) ) {	
				mes "^ff0000 Stone Blade ^000000";
				mes "Requires:-";
				mes "- [2] Handle";
				mes "- [1] Blade";
				mes "- [2] Rope";
				mes "- [1] Stone Hammer";
				close;
				}

				delitem(40023, 2);
				delitem(40022, 1);
				delitem(40014, 2);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40025, 1);

				goto OnCraftingStart;
				
				case 2:
					mes "Cancel Crafting.";
					close;
				}
			
		
		case 4:
			next;
			switch(select("- Animal Skin Armor:- Cancel")) {	
				
				case 1:
				if(countitem(40028) < 2 || countitem(40029) < 2 || countitem(40030) < 1 ) {	
				mes "^ff0000 Animal Skin Armor ^000000";
				mes "Requires:-";
				mes "- [2] Padded Leaf";
				mes "- [2] Tanned Skin";
				mes "- [1] Needle";
				close;
				}

				delitem(40028, 2);
				delitem(40029, 2);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40032, 1);

				goto OnCraftingStart;
				
				case 2:
					mes "Crafting Cancel.";
					close;
				}
		case 5:
			mes "Crafting Cancel.";
			close;
			
		}

	end;

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

	OnTimer60000:
		$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
//=====================================================
new_1-3,98,58,6	duplicate(Workbench)	Workbench#1	665
new_1-3,98,50,6	duplicate(Workbench)	Workbench#2	665
new_1-3,98,43,6	duplicate(Workbench)	Workbench#3	665
chry_fld,58,89,6	duplicate(Workbench)	Workbench#4	665
chry_fld,55,85,6	duplicate(Workbench)	Workbench#5	665
chry_fld,52,81,6	duplicate(Workbench)	Workbench#6	665
chry_fld,63,86,6	duplicate(Workbench)	Workbench#7	665
chry_fld,60,81,6	duplicate(Workbench)	Workbench#8	665
chry_fld,57,77,6	duplicate(Workbench)	Workbench#9	665
chry_fld,68,83,6	duplicate(Workbench)	Workbench#10	665
chry_fld,65,78,6	duplicate(Workbench)	Workbench#11	665
chry_fld,61,74,6	duplicate(Workbench)	Workbench#12	665

 

 

Edited by Dolphin86
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

3 hours ago, Dolphin86 said:

as title i did manage to make the item using the requirement before, but some how now its not working as it should?

 

It would be helpful if you would explain exactly what is not working and how you expect it to.

Edited by Winterfox
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:  

11 hours ago, Winterfox said:

It would be helpful if you would explain exactly what is not working and how you expect it to.

well as u can see on the script below, all i need is to bring 2 items only the 3rd item is kinda like tool item, before i was able to craft the final item result, but im not sure what happen since i did not edit any part of the npc as it was consider done, but when i re-test the scipt i was not able to carft even when i have all the materials in my inventory

Spoiler
case 4:
			next;
			switch(select("- Animal Skin Armor:- Cancel")) {	
				
				case 1:
				if(countitem(40028) < 2 || countitem(40029) < 2 || countitem(40030) < 1 ) {	
				mes "^ff0000 Animal Skin Armor ^000000";
				mes "Requires:-";
				mes "- [2] Padded Leaf";
				mes "- [2] Tanned Skin";
				mes "- [1] Needle";
				close;
				}

				delitem(40028, 2);
				delitem(40029, 2);
				setarray(getd("$wrkb_" + .@wrkb_id + "_products"), 40007, 1, 40032, 1);

				goto OnCraftingStart;
				
				case 2:
					mes "Crafting Cancel.";
					close;
				}

 

 

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