Jump to content
  • 0

Delete only an equiped item.


Erebos

Question


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

I want to delete specifically an equiped item that is supposed to be refined to +7, but when i have 3 jackets and one is equiped, my script keeps deleting the ones in the inventory first even when they are +0, then at last deletes the one equiped. I have tried many ways but i keep getting inventory items deleted or errors. Here's what i tried:

 

getinventorylist;	
for(set .@ida,0; .@ida < @inventorylist_count; set .@ida,.@ida+1)
if (@inventorylist_refine[.@ida] == 7 && @inventorylist_id[.@ida] == 2304 && @inventorylist_equip[.@ida]) { delitem @inventorylist_id[.@ida],1; }

Thanks in advance ?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

Method 1 - just unequip the item

prontera,155,185,5	script	khfskjdfh	1_F_MARIA,{
	for ( .@i = 1; .@i <= 10; ++.@i )
		if ( getequiprefinerycnt(.@i) >= 7 )
			unequip .@i;
	end;
}

Method 2 - delete the item

prontera,158,185,5	script	khfskjdfh2	1_F_MARIA,{
	getinventorylist;
	for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) {
		if ( (@inventorylist_equip[.@i] & 1023) && @inventorylist_refine[.@i] >= 7 ) {
			if ( @inventorylist_option_id1[.@i] ) { // that's why rathena random option check so sux, still has to fall back to delitem2
				setarray .@option_id, @inventorylist_option_id1[.@i], @inventorylist_option_id2[.@i], @inventorylist_option_id3[.@i], @inventorylist_option_id4[.@i], @inventorylist_option_id5[.@i];
				setarray .@option_value, @inventorylist_option_value1[.@i], @inventorylist_option_value2[.@i], @inventorylist_option_value3[.@i], @inventorylist_option_value4[.@i], @inventorylist_option_value5[.@i];
				setarray .@option_parameter, @inventorylist_option_parameter1[.@i], @inventorylist_option_parameter2[.@i], @inventorylist_option_parameter3[.@i], @inventorylist_option_parameter4[.@i], @inventorylist_option_parameter5[.@i];
				delitem3 @inventorylist_id[.@i], @inventorylist_amount[.@i], @inventorylist_identify[.@i], @inventorylist_refine[.@i], @inventorylist_attribute[.@i], @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i], .@option_id, .@option_value, .@option_parameter;
			}
			else
				delitem2 @inventorylist_id[.@i], @inventorylist_amount[.@i], @inventorylist_identify[.@i], @inventorylist_refine[.@i], @inventorylist_attribute[.@i], @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i];
		}
	}
	end;
}

 


btw if you are thinking of denying players to use high refine in a pvp map or event map, after you delete the item player still can equip inside the map
you have to create your own mapflag in this case

Edited by AnnieRuru
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

delequip could do the work too

*delequip <equipment slot>{,<char_id>};

This command will destroy whatever is currently equipped in the invoking
character's specified equipment slot. For a full list of possible equipment
slots see 'getequipid'.

This command will return 1 if an item was deleted and 0 otherwise.
if (getequipid(EQI_ARMOR) == 2304 && getequiprefinerycnt(EQI_ARMOR) == 7)
	delequip EQI_ARMOR;

 

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