• 0
Kavaline

How break an equipped weapon?

Question

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?

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

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

 

Share this post


Link to post
Share on other sites
  • 1
Posted (edited)

try this.

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

with random item option

[email protected]_loc = EQI_HAND_R;
getinventorylist();
for ([email protected] = 0; [email protected] < @inventorylist_count; [email protected]++)
	if (@inventorylist_id[[email protected]] > 0 && @inventorylist_id[[email protected]] == getequipid([email protected]_loc) && @inventorylist_equip[[email protected]] > 0) {
		delequip [email protected]_loc;
		for ([email protected] = 1; [email protected] <= 5; [email protected]++) {
			[email protected][[email protected]] = getd("@inventorylist_option_id"[email protected]+"["[email protected]+"]");
			[email protected][[email protected]] = getd("@inventorylist_option_value"[email protected]+"["[email protected]+"]");
			[email protected][[email protected]] = getd("@inventorylist_option_parameter"[email protected]+"["[email protected]+"]");
		}
		getitem3 @inventorylist_id[[email protected]],1,@inventorylist_identify[[email protected]],@inventorylist_refine[[email protected]],1,@inventorylist_card1[[email protected]],@inventorylist_card2[[email protected]],@inventorylist_card3[[email protected]],@inventorylist_card4[[email protected]],[email protected],[email protected],[email protected];
		end;
	}

 

Edited by Emistry
fix attribute value
  • MVP 1

Share this post


Link to post
Share on other sites
  • 0

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 😄

Share this post


Link to post
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.