Jump to content
  • 0

Add check for bounded items


Question

Posted (edited)

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

6 answers to this question

Recommended Posts

  • 0
Posted
		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
  • 0
Posted
---------------------------------------

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

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

 

  • 0
Posted
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.

  • 0
Posted (edited)

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
  • 0
Posted

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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...