• 0
Sign in to follow this  
Radian

Add check for bounded items

Question

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

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0
		setarray [email protected][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 [email protected],1; [email protected] <= 10; set [email protected],[email protected]+1 ) {
			if( getequipisequiped([email protected][[email protected]]) )
				set [email protected]$, [email protected]$ + F_getpositionname([email protected][[email protected]]) + " - [ " + getequipname([email protected][[email protected]]) + " ]";
				set [email protected]$, [email protected]$ + ":";
			}
			set [email protected], [email protected][ select([email protected]$) ];
			if(!getequipisequiped([email protected])) {
				mes "[ ^04B4AEIsaac^000000 ]";
				mes "Young one... Your not wearing anything there that I can remove cards from.";
				end;
			}
			set [email protected],getequipcardcnt([email protected]);
			if([email protected] == 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,([email protected]+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;
			[email protected] = getarraysize(@bound_items);
			[email protected] = getquipid([email protected]);
			for([email protected] = 0;[email protected]< [email protected];[email protected]++) {
				if(@bound_items[[email protected]] == [email protected]) {
					mes "This item is bounded.";
					close;
				}
			}

 

  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0
---------------------------------------

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

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

 

Share this post


Link to post
Share on other sites
  • 0
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.

Share this post


Link to post
Share on other sites
  • 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

Share this post


Link to post
Share on other sites
  • 0

you could try using the getinventorylist

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

 

  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0

Thanks guys for helping, this is solved already. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this