Jump to content
  • 0

Making each duplicate individual npc


Dolphin86

Question


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

I really had no idea on this part how can i make this npc individual, since currently all the npc react the same, like if i start crafting on npc A i can still claim it from NPC B or C,D,E and the list goes on, how can i make it individuals, if player craft on NPC A, the player can only claim in from the NPC A, also how can i change the timer...

and how can i make the another version of the same NPC will only react to only it's own owner ? (Onwer must have a certain item indicate only it owner can talk to the NPC..)

Spoiler

-	script	Workbench	-1,{
	if($wrkb_crafting_state == 1) {
		
		mes "Please wait until the crafting process is finished. ";
		close;
	}

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

		delwaitingroom;
		$wrkb_crafting_state = 0;
		close;
	}

	mes "==============================";
	mes "^ff0000 Any crafted item using public Workbech can be stolen by other player !! ^000000";
	mes "==============================";
	next;
	mes "What do you want to craft?";
	next;
	switch(select("Stone Dagger:Stone Axe:Ropes:Stone Chunk:Cancel")) {
		case 1:
			if(countitem(40005) < 4) {
				
				mes "^ff0000 To craft Stone Dagger ^000000";
				mes "Require:-";
				mes "- [4] Rocks";
				close;
			}

			delitem(40005, 4);
			setarray($product, 40007, 1, 40009, 1);

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

			delitem(40018, 1);
			delitem(40014, 2);
			delitem(40003, 1);
			setarray($product, 40007, 1, 40017, 1);

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

			delitem(40008, 4);
			setarray($product, 40007, 1, 40014, 1);

			goto OnCraftingStart;
		case 4:
			if(countitem(40005) < 4) {
				
				mes "^ff0000 To craft Rock Chunk ^000000";
				mes "Require:-";
				mes "- [4] Rock";
				close;
			}

			delitem(40005, 4);
			setarray($product, 40007, 1, 40018, 1);

			goto OnCraftingStart;
		case 5:
			
			mes "Crafting canceled.";
			close;
	}
	end;

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

	OnTimer60000:
		$wrkb_crafting_state = 2;
		delwaitingroom;
		waitingroom("COMPLETED!", 0);
		end;

	OnInit:
		.npc_name = strnpcinfo(1);
		if($wrkb_crafting_state == 1) goto OnCraftingStart;
}
//Duplicate
//=====================================================
new_1-3,98,58,6	duplicate(Workbench)	Workbench#neko	665
new_1-3,98,50,6	duplicate(Workbench)	Workbench#neko1	665
new_1-3,98,43,6	duplicate(Workbench)	Workbench#neko2	665
//new_1-3,113,45,6	duplicate(Workbench)	Workbench#neko3	665
//new_1-3,114,39,6	duplicate(Workbench)	Workbench#neko4	665
//new_1-3,110,36,6	duplicate(Workbench)	Workbench#neko5	665
//new_1-3,114,33,6	duplicate(Workbench)	Workbench#neko6	665

 

 

Link to comment
Share on other sites

5 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:  

-	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("Stone Dagger:Stone Axe:Ropes:Stone Chunk: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(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 4:
			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 5:
			mes "Crafting canceled.";
			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
//new_1-3,113,45,6	duplicate(Workbench)	Workbench#4	665
//new_1-3,114,39,6	duplicate(Workbench)	Workbench#5	665
//new_1-3,110,36,6	duplicate(Workbench)	Workbench#6	665
//new_1-3,114,33,6	duplicate(Workbench)	Workbench#7	665

 

Link to comment
Share on other sites

  • 0

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

-	script	Workbench	FAKE_NPC,{
	.@wrkb_id = 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($product); .@i += 2)
			getitem($product[.@i], $product[.@i + 1]);

		delwaitingroom;
		$wrkb_crafting_state[.@wrkb_id] = 0;
		close;
	}

	mes "==============================";
	mes "^ff0000 Any crafted item using public Workbech can be stolen by other player !! ^000000";
	mes "==============================";
	next;
	mes "What do you want to craft?";
	next;
	switch(select("Stone Dagger:Stone Axe:Ropes:Stone Chunk:Cancel")) {
		case 1:
			if(countitem(40005) < 4) {
				
				mes "^ff0000 To craft Stone Dagger ^000000";
				mes "Require:-";
				mes "- [4] Rocks";
				close;
			}

			delitem(40005, 4);
			setarray($product, 40007, 1, 40009, 1);

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

			delitem(40018, 1);
			delitem(40014, 2);
			delitem(40003, 1);
			setarray($product, 40007, 1, 40017, 1);

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

			delitem(40008, 4);
			setarray($product, 40007, 1, 40014, 1);

			goto OnCraftingStart;
		case 4:
			if(countitem(40005) < 4) {
				
				mes "^ff0000 To craft Rock Chunk ^000000";
				mes "Require:-";
				mes "- [4] Rock";
				close;
			}

			delitem(40005, 4);
			setarray($product, 40007, 1, 40018, 1);

			goto OnCraftingStart;
		case 5:
			mes "Crafting canceled.";
			close;
	}
	end;

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

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

	OnInit:
		if($wrkb_crafting_state[strnpcinfo(2)] == 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
//new_1-3,113,45,6	duplicate(Workbench)	Workbench#4	665
//new_1-3,114,39,6	duplicate(Workbench)	Workbench#5	665
//new_1-3,110,36,6	duplicate(Workbench)	Workbench#6	665
//new_1-3,114,33,6	duplicate(Workbench)	Workbench#7	665

 

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:  

@Winterfox  sorry but this is above my understanding... what are these debug warning..?

btw it works as individual npc now , but it confused on what npc should craft what item, i did all 3 npc to craft different item, some how the npc reward me with different item from what i plan to craft. 

1.PNG.c77d3ade462e5b08f58d0593cda3c427.PNG

 

Updated script :

Spoiler
-	script	Workbench	FAKE_NPC,{


	.@wrkb_id = 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($product); .@i += 2)
			getitem($product[.@i], $product[.@i + 1]);

		delwaitingroom;
		$wrkb_crafting_state[.@wrkb_id] = 0;
		close;
	}

	mes "==============================";
	mes "^ff0000 Any crafted item using public Workbech can be stolen by other player !! ^000000";
	mes "==============================";
	next;
	mes "What do you want to craft?";
	next;
	switch(select("- Equipment Crafting:- Gathering Tools:- Tier 1 Material Crafting:- Cancel")) {
		
		case 1:
			switch(select("- Boulder Blade:- Cancel")) { // Equipment
				
			case 1:
				if(countitem(40018) < 1 || countitem(40014) < 2 || countitem(40003) < 1 ) {	
				mes "^ff0000 To craft Boulder Blade ^000000";
				mes "Require:-";
				mes "- [1] Blade";
				mes "- [1] Handle";
				mes "- [2] Rope";
				close;
				}
				
			case 2:
				mes "Crafting canceled.";
				close;
			}
		
		case 2:
			switch(select("- Stone Dagger:- Stone Axe:- Stone Hammer:- Cancel")) { // tools
			
			case 1:
				if(countitem(40018) < 1) {
				mes "^ff0000 To craft Stone Dagger ^000000";
				mes "Require:-";
				mes "- [1] Rock Chunk";
				close;
				}
				delitem(40018, 1);
				setarray($product, 40007, 1, 40009, 1);

				goto OnCraftingStart;
				
			case 2:
				if(countitem(40018) < 1 || countitem(40014) < 2) {
				mes "^ff0000 To craft Stone Axe ^000000";
				mes "Require:-";
				mes "- [1] Rock Chunk";
				mes "- [2] Ropes";
				close;
				}
				delitem(40018, 1);
				delitem(40014, 2);
				setarray($product, 40007, 1, 40017, 1);

				goto OnCraftingStart;
				
			case 3:
				if(countitem(40018) < 1 || countitem(40014) < 2) {
				mes "^ff0000 To craft Stone Hammer ^000000";
				mes "Require:-";
				mes "- [1] Rock Chunk";
				mes "- [2] Ropes";
				close;
				}
				delitem(40018, 1);
				delitem(40014, 2);
				setarray($product, 40007, 1, 40020, 1);

				goto OnCraftingStart;
				
			case 4:
				mes "Crafting canceled.";
				close;
				
			}
		
		case 3:
			switch(select("- Rock Chunk:- Rope:- Blade:- Handle:- Cancel")) {//Tier 1 mat
			case 1:
				if(countitem(40005) < 4) {
				
				mes "^ff0000 To craft Rock Chunk ^000000";
				mes "Require:-";
				mes "- [4] Rock";
				close;
				}

				delitem(40005, 4);
				setarray($product, 40007, 1, 40018, 1);

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

				delitem(40008, 4);
				setarray($product, 40007, 1, 40014, 1);

				goto OnCraftingStart;
				
			case 3:
				if(countitem(40021) < 4) {
				
				mes "^ff0000 To craft Blade ^000000";
				mes "Require:-";
				mes "- [4] Boulder";
				close;
				}

				delitem(40021, 4);
				setarray($product, 40007, 1, 40022, 1);

				goto OnCraftingStart;
				
			case 4:
				if(countitem(40003) < 2) {
				
				mes "^ff0000 To craft Handle ^000000";
				mes "Require:-";
				mes "- [2] Log";
				close;
				}

				delitem(40002, 2);
				setarray($product, 40007, 1, 40025, 1);

				goto OnCraftingStart;
			
			case 5:
				mes "Crafting canceled.";
				close;
			
			}
		case 4:
			mes "Crafting canceled.";
			close;
	}
	end;

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

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

	OnInit:
		if($wrkb_crafting_state[strnpcinfo(2)] == 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
//new_1-3,113,45,6	duplicate(Workbench)	Workbench#4	665
//new_1-3,114,39,6	duplicate(Workbench)	Workbench#5	665
//new_1-3,110,36,6	duplicate(Workbench)	Workbench#6	665
//new_1-3,114,33,6	duplicate(Workbench)	Workbench#7	665

 

 

Edited by Dolphin86
Link to comment
Share on other sites

  • 0

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

-	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("Stone Dagger:Stone Axe:Ropes:Stone Chunk: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(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 4:
			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 5:
			mes "Crafting canceled.";
			close;
	}
	end;

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

	OnTimer60000:
		$wrkb_crafting_state[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
//new_1-3,113,45,6	duplicate(Workbench)	Workbench#4	665
//new_1-3,114,39,6	duplicate(Workbench)	Workbench#5	665
//new_1-3,110,36,6	duplicate(Workbench)	Workbench#6	665
//new_1-3,114,33,6	duplicate(Workbench)	Workbench#7	665

 

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:  

@Winterfox it works as it should now, no error or such all item crafted as planned, only debug came out when ever start crafting

1.PNG.9322bfa4e3f3847d466e472743e1bd2e.PNG

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