Jump to content
  • 0

How break an equipped weapon?


Kavaline

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  18
  • Reputation:   1
  • Joined:  02/15/20
  • Last Seen:  

Hi, I need help for a script that break the players equipped weapon (not delete the player weapon, but breaks that return the weapon with broken status). I tried "delequip" with "getitem2", but how I get the slotted cards? And in case of BS/WS crafted weapons and signed weapons, have problem?

 

And, have any way to do it better than:

get weapon id;
get refine;
get card 1;
get card 2;
get card 3;
get card 4;
delequip;
getitem2(weapon id, 1, 1, refine, 1, 0, card 1~4);

Some item script, function, effect, etc, that I can use to do it better/easier?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

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

	if (getequipid(EQI_HAND_R) != -1)
		breakequip(EQI_HAND_R);
	end;

Shorter ? xD

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

This command will break and unequip 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 broken and 0 otherwise.

 

  • MVP 1
Link to comment
Share on other sites

  • 1

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

try this.

.@equip_loc = EQI_HAND_R;
getinventorylist();
for (.@i = 0; .@i < @inventorylist_count; .@i++)
	if (@inventorylist_id[.@i] > 0 && @inventorylist_id[.@i] == getequipid(.@equip_loc) && @inventorylist_equip[.@i] > 0) {
		delequip .@equip_loc;
		getitem2 @inventorylist_id[.@i],1,@inventorylist_identify[.@i],@inventorylist_refine[.@i],1,@inventorylist_card1[.@i],@inventorylist_card2[.@i],@inventorylist_card3[.@i],@inventorylist_card4[.@i];
		end;
	}

with random item option

.@equip_loc = EQI_HAND_R;
getinventorylist();
for (.@i = 0; .@i < @inventorylist_count; .@i++)
	if (@inventorylist_id[.@i] > 0 && @inventorylist_id[.@i] == getequipid(.@equip_loc) && @inventorylist_equip[.@i] > 0) {
		delequip .@equip_loc;
		for (.@r = 1; .@r <= 5; .@r++) {
			.@RandomIDArray[.@r-1] = getd("@inventorylist_option_id"+.@r+"["+.@i+"]");
			.@RandomValueArray[.@r-1] = getd("@inventorylist_option_value"+.@r+"["+.@i+"]");
			.@RandomParamArray[.@r-1] = getd("@inventorylist_option_parameter"+.@r+"["+.@i+"]");
		}
		getitem3 @inventorylist_id[.@i],1,@inventorylist_identify[.@i],@inventorylist_refine[.@i],1,@inventorylist_card1[.@i],@inventorylist_card2[.@i],@inventorylist_card3[.@i],@inventorylist_card4[.@i],.@RandomIDArray,.@RandomValueArray,.@RandomParamArray;
		end;
	}

 

Edited by Emistry
fix attribute value
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  18
  • Reputation:   1
  • Joined:  02/15/20
  • Last Seen:  

Works, I changed the attribute to aways get broken, and fit fine. "inventorylist" is very useful, you gave me some cool ideas. Thanks so much ?

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