Jump to content
  • 0

Npc that consume custom coins to generate items to players.


Kenex

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  10
  • Reputation:   0
  • Joined:  04/01/22
  • Last Seen:  

Hi can anybody help me to Implement an custom npc?

this is how this npc Works : it checks if the player has 3 or more custom coins in its invetory  ID 675451 , if the player has 3 or more coins it should open the text box for the player type the Item Id he wants and it generate the item.
if the player has less than 3 coins it should close the dialogue.

If possible i would also ask for the npc not consume the coins if the ID is invalid/ not found. But only if this is easy to implement , if it requires a lot of extra work its not necessary.


Thanks for the help.

 

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

yuno,160,80,3	script	3D Printer	4_MACHINE_DEVICE,{

	.@custom_coin_ID = 675451;
	.@custom_coin_qty = 3;

	if (countitem(.@custom_coin_ID) < .@custom_coin_qty) {
		npctalk "You need " + .@custom_coin_qty + " " + getitemname(.@custom_coin_ID) + " to generate a item.", strnpcinfo(0), bc_self;
		end;
	}
	npctalk "Type the ID of the item to generate.", strnpcinfo(0), bc_self;
	input .@item_id;
	if (getitemname(.@item_id) == "null") {
		npctalk "ID is invalid / item not found.", strnpcinfo(0), bc_self;
		end;
	}
	mes "[" + strnpcinfo(1) + "]";
	mes "Confirm generation of";
	mes "<ITEM>" + getitemname(.@item_id) + "<INFO>" + .@item_id + "</INFO></ITEM>?";
	next;
	if (select("Cancel", "Confirm") == 1)
		close;
	mes "[" + strnpcinfo(1) + "]";
	mes "Starting...";
	close2;
	if (countitem(.@custom_coin_ID) < .@custom_coin_qty) {
		npctalk "You need " + .@custom_coin_qty + " " + getitemname(.@custom_coin_ID) + " to generate a item.", strnpcinfo(0), bc_self;
		end;
	}
	if (checkweight(.@item_id,1) == 0) {
		npctalk "Overweight detected. You cannot proceed.", strnpcinfo(0), bc_self;
		end;
	}
	delitem .@custom_coin_ID, .@custom_coin_qty;
	getitem .@item_id, 1;
	npctalk "Generated.", strnpcinfo(0), bc_self;
	specialeffect EF_OVERTHRUST;
	end;
}

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  10
  • Reputation:   0
  • Joined:  04/01/22
  • Last Seen:  

7 hours ago, Racaae said:

Hi

yuno,160,80,3	script	3D Printer	4_MACHINE_DEVICE,{

	.@custom_coin_ID = 675451;
	.@custom_coin_qty = 3;

	if (countitem(.@custom_coin_ID) < .@custom_coin_qty) {
		npctalk "You need " + .@custom_coin_qty + " " + getitemname(.@custom_coin_ID) + " to generate a item.", strnpcinfo(0), bc_self;
		end;
	}
	npctalk "Type the ID of the item to generate.", strnpcinfo(0), bc_self;
	input .@item_id;
	if (getitemname(.@item_id) == "null") {
		npctalk "ID is invalid / item not found.", strnpcinfo(0), bc_self;
		end;
	}
	mes "[" + strnpcinfo(1) + "]";
	mes "Confirm generation of";
	mes "<ITEM>" + getitemname(.@item_id) + "<INFO>" + .@item_id + "</INFO></ITEM>?";
	next;
	if (select("Cancel", "Confirm") == 1)
		close;
	mes "[" + strnpcinfo(1) + "]";
	mes "Starting...";
	close2;
	if (countitem(.@custom_coin_ID) < .@custom_coin_qty) {
		npctalk "You need " + .@custom_coin_qty + " " + getitemname(.@custom_coin_ID) + " to generate a item.", strnpcinfo(0), bc_self;
		end;
	}
	if (checkweight(.@item_id,1) == 0) {
		npctalk "Overweight detected. You cannot proceed.", strnpcinfo(0), bc_self;
		end;
	}
	delitem .@custom_coin_ID, .@custom_coin_qty;
	getitem .@item_id, 1;
	npctalk "Generated.", strnpcinfo(0), bc_self;
	specialeffect EF_OVERTHRUST;
	end;
}

 

Thank you very much !!! you helped me a lot sir , i'm not familiar with coding so my code was pretty bad.

This one worked very well for me thanks 😃

Just to share with you my project, i'm doing a Lan server for me and like 4 friends , so ive set custom coins to drop from every mob with a low chance (0,5%)

This way my friends can create their own items using this custom coin.

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