Jump to content
  • 0

Add check for bounded items


Radian

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

Hey guys! How do you add check in this script if items are bounded? or if the player selected an item that is bounded.

		setarray .@indices[1], EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R, EQI_HEAD_MID, EQI_HEAD_LOW;
		for( set .@i,1; .@i <= 10; set .@i,.@i+1 ) {
			if( getequipisequiped(.@indices[.@i]) )
				set .@menu$, .@menu$ + F_getpositionname(.@indices[.@i]) + " - [ " + getequipname(.@indices[.@i]) + " ]";
				set .@menu$, .@menu$ + ":";
			}
			set .@part, .@indices[ select(.@menu$) ];
			if(!getequipisequiped(.@part)) {
				mes "[ ^04B4AEIsaac^000000 ]";
				mes "Young one... Your not wearing anything there that I can remove cards from.";
				end;
			}
			set .@cardcount,getequipcardcnt(.@part);
			if(.@cardcount == 0) {
				mes "[ ^04B4AEIsaac^000000 ]";
				mes "Young one... There are no cards compounded on this item. I can do nothing with it, I'm afraid.";
				end;
			}
			if (!checkweight(1202,(.@cardcount+1))) { 
				mes "^3355FFJust a minute!";
				mes "I can't offer any of my";
				mes "services to you because";
				mes "you're carrying too much";
				mes "stuff. Put your extra items in";
				mes "Kafra Storage and come again~";
				end;
			}

 

Edited by Radian
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  303
  • Reputation:   117
  • Joined:  12/10/16
  • Last Seen:  

		setarray .@indices[1], EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R, EQI_HEAD_MID, EQI_HEAD_LOW;
		for( set .@i,1; .@i <= 10; set .@i,.@i+1 ) {
			if( getequipisequiped(.@indices[.@i]) )
				set .@menu$, .@menu$ + F_getpositionname(.@indices[.@i]) + " - [ " + getequipname(.@indices[.@i]) + " ]";
				set .@menu$, .@menu$ + ":";
			}
			set .@part, .@indices[ select(.@menu$) ];
			if(!getequipisequiped(.@part)) {
				mes "[ ^04B4AEIsaac^000000 ]";
				mes "Young one... Your not wearing anything there that I can remove cards from.";
				end;
			}
			set .@cardcount,getequipcardcnt(.@part);
			if(.@cardcount == 0) {
				mes "[ ^04B4AEIsaac^000000 ]";
				mes "Young one... There are no cards compounded on this item. I can do nothing with it, I'm afraid.";
				end;
			}
			if (!checkweight(1202,(.@cardcount+1))) { 
				mes "^3355FFJust a minute!";
				mes "I can't offer any of my";
				mes "services to you because";
				mes "you're carrying too much";
				mes "stuff. Put your extra items in";
				mes "Kafra Storage and come again~";
				end;
			}
			countbound;
			.@size = getarraysize(@bound_items);
			.@item = getquipid(.@part);
			for(.@i = 0;.@i< .@size;.@i++) {
				if(@bound_items[.@i] == .@item) {
					mes "This item is bounded.";
					close;
				}
			}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  431
  • Reputation:   164
  • Joined:  12/12/17
  • Last Seen:  

---------------------------------------

*getinventorylist {<char_id>};

This command sets a bunch of arrays with a complete list of whatever the
invoking character has in their inventory, including all the data needed to
recreate these items perfectly if they are destroyed. Here's what you get:

@inventorylist_bound[]             - the bound type of the items (see BOUND_* constants)

This could be handy to save/restore a character's inventory, since no other
command returns such a complete set of data, and could also be the only way to
correctly handle an NPC trader for carded and named items who could resell them
- since NPC objects cannot own items, so they have to store item data in
variables and recreate the items.

Notice that the variables this command generates are all temporary, attached to
the character, and integer.

Be sure to use @inventorylist_count to go through these arrays, and not
'getarraysize', because the arrays are not automatically cleared between runs
of 'getinventorylist'.

---------------------------------------

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

3 hours ago, pajodex said:

---------------------------------------

*getinventorylist {<char_id>};

This command sets a bunch of arrays with a complete list of whatever the
invoking character has in their inventory, including all the data needed to
recreate these items perfectly if they are destroyed. Here's what you get:

@inventorylist_bound[]             - the bound type of the items (see BOUND_* constants)

This could be handy to save/restore a character's inventory, since no other
command returns such a complete set of data, and could also be the only way to
correctly handle an NPC trader for carded and named items who could resell them
- since NPC objects cannot own items, so they have to store item data in
variables and recreate the items.

Notice that the variables this command generates are all temporary, attached to
the character, and integer.

Be sure to use @inventorylist_count to go through these arrays, and not
'getarraysize', because the arrays are not automatically cleared between runs
of 'getinventorylist'.

---------------------------------------

 

Yeah i've seen this on script_commands just like this topic 

 which says it check if you have bounded items in your inventory not if you want to uncard the bounded item.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

What im trying to do here is to check if the player is attempting to uncard a bounded item and npc will reject the process.

Edited by Radian
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

you could try using the getinventorylist

prontera,155,181,5	script	Sample	4_F_KAFRA1,{
	getinventorylist();
	for (.@i = 0; .@i < @inventorylist_count; .@i++) {
		if (@inventorylist_equip[.@i] > 0)
			.@menu$ = .@menu$ + "[" + getitemname(@inventorylist_id[.@i])+"]";
		.@menu$ = .@menu$ + ":";
	}
	.@i = select(.@menu$) - 1;
	if (@inventorylist_bound[.@i]) {
		mes "this is bounded item.";
	}
	else if (!@inventorylist_card1[.@i]) {
		mes "It doesn't have card compounded in it.";
	}
	else {
		// uncard...
	}
	close;
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

Thanks guys for helping, this is solved already. 

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