Auto Handling (Un)Equip Claws/Robes

Greetings fellow gamers, scripters, and entrepreneurs! I have a request for something that sounds simple, but for the life of me I can not figure it out on my own (still new to programming).
I need the script to do a few things, but first I would like to point out the main character has the Dual Weapon skill slots ( no shields ):

  1. Script needs to detect if Weapon Slot 1 is Empty -> add and then equip a "Claw" weapon (id and image provided in attached files)
    <> same goes for Weapon Slot 2
    <> Also if possible check to see if the weapon slot 1 or 2 is equipped, that is NOT "Claw" weapon ID, but not specific to any weapon (as that can be done with events). I don't know maybe like "if.isEquipped > 0 && equipID != X (X being the claw ID) :: granted I don't know the actual code, so that pseudocode might be a little off 😛  Hence the request ^_^
     
  2. If another weapon is equipped into Slot 1 or Slot 2, then it needs to remove/destroy the "Claw" it places into inventory (or destroy it prior to equipping?)
    <> Essentially what I'm going for here is the "Claws" are your natural weapons. You wouldn't be able to just remove your hands in favor of a sword.... although that would be kind of cool, like an Evil Dead Ash's Chainsaw thing xD ... *coughs* I digress.
     
  3. Script needs to do all of the above, checking/(re)equipping of the 'Burial Robes' basic clothing ((also included in screenshots)) for the armor slot if no other armor is equipped; and if any armor IS equipped -> then to destroy the robes until once again no armor is equipped (like if they decided to remove the Leather Armor instead of changing to another armor set).
     
  4. And Finally having available some functions that do the above I can call ((of course these functions might already be implemented as part of the script)) for the use of Common Events.
    <> I am creating my own custom inventory-weight management system that handles weapons/armors and their weight.





--- (INVENTORY / WEIGHT) MANAGEMENT SYSTEM [IWMS] ---
This information isn't necessary (but would be nice to have) to the script or request; however, I felt giving additional information tied to the game and the mechanics the script requested could potentially help?


<> Player is only allowed to carry up to 2 weapons (left hand and right hand)
   -> When picking up new weapons, the IWMS checks for how many weapons they're currently holding/wielding or otherwise already have in their Travel Pack (if carrying one)
   -> I would like the functions (mentioned above) to be able to call when swapping out a weapon already equipped (checking if weaponID is valid but not the claw (see point 1. above))

<> Player can carry +1 addition weapon in their inventory if they have a Travel Pack(item)

<> Player can only carry 1 suit of armor (1x headgear, 1x torso, 1x boots, 1x gloves)
   -> This is already handled via Common Events and switches/variables
   -> Checks for both the Unfitted and regular versions of the armor

<> Players can carry small items (crafting materials, bandages, Rats (feeding options -- it's a vampire RPG afterall 😛 ), and other various items that weight 0.1  or 0.5 lbs) but they need the Small Pouch (item) to do so -- or the Travel Pack if they've upgraded carrying gear.

<> Everything has a weight to it (by variable) and is calculated everytime an item is picked up (so 10x 0.1 lbs items will be calculated into "InvWgt_Items" += 1, and so on 🙂 )


-> Then the final DS_IWMS Common Event is called -> This common event adds up ALL the weight of all items, armor, weapons, etc. and checks to see if you go over your Encumberance (4 variables setup at the beginning of the game.
Min = 200
Loaded = 250
Overburdened = 275
MaxLoad = 285

And with each variable passed, the movement Speed is decreased by 1 until they can't move no more xD -- *insert evil laugh here*

Ev1.png

Ev2.png
um isnt 5 lbs a little much for a robe? i could see 2 lbs tops
um isnt 5 lbs a little much for a robe? i could see 2 lbs tops



Was mostly going by D&D's estimates. Majority of their basic clothes are 4 to 8 lbs with some of the more "extravagant" ones going upwards to like 15 lbs. Although I think your 1st set of clothes isn't even counted though.... which I also though about doing, just not count the first set of clothes ((since you'll be piling up a lot of other stuff))


EDIT: Although I do see your point. They're just rich fabrics in just robes... they're not tackling on all that other adventuring stuff like belts, pouches, cloaks, boots/gloves and what not :\   Yeah I think I will tune that down to 2 lbs. Thanks ^_^
no problem, and yea D&D is taking into account belts, pouches, cloaks, and other adventuring gear that comes with the clothes you obtain
*Friendly 72 hour bump* 

I just thought of something that might make this script request a lot more friendly to other people who might be interested ((but not completely necessary and not officially part of the script request -- just more or less something to think about)). Is searching a weapon and/or armor ID by variable. 

So if other people would be interested in the script, they could have the same "no un-equipping / or remove when equipped by something else" restrictions, but instead set a weapon1 ID, weapon2 ID, armor ID, and so forth? Perhaps make it an Array? -> Parameters[ItemIDs: [0]weapon1, [1]weapon2, [2]shield, [3]armor] or something like that (naturally weapon2 would be defaulted to 0 (no variable). but [1]weapon2 > 0, then it overrides [2]shield, and so forth.

Anywho just another idea ^_^
* Le Bump-a-roony* 


Is there a Klingon Warrior (scripter) brave enough to take on this challenge!!! 


--Stand imposingly in the center of the room and pounds his chest--
I didn't take into account dual wield. I may add something for it depending on your feedback.


Script



How To Use:


 Notetags go into an actor's notes.


 Put <unequipWeapon:x> with x being the weapon id to equip when unequipping a
 weapon.
 Put <unequipArmor: x y> with x being the armor slot ID (see Equipment Types
 under Types in the database) and y being the id of the armor to equip when that
 armor slot ID is unequipped. You can put more than one of these in the notes for
 an actor, but be sure to do only one per line.
 
 The player cannot gain duplicates of the auto equipment by
 equipping/unequipping.
 
 You will still need to choose an actor's initial equipment, this plugin only
 affects when they manually unequip/equip something.


Terms Of Use:


Free to use and modify for commercial and noncommercial games, with credit.
Hello DreamX, first of all thank you for responding to the call! ^_^ but I seem to be having trouble getting it to work.

After setting up my weapons and armor in my testing project similar to my main project; I the followed your script's instructions and put the notetags on the Actor. Assigned the Claws in weapon slot 1, and weapon slot 2 (or 0 and 1?) and the burial robes in the main Body slot. Went in game, and unequipped one of the claws. Nothing happened. Exited the menu. Re-opened the menu - it's still unequipped.

Tested the armor. Same result. Put down chests with a new sword and armor. Equipped those, exited menu, went back in and unequipped those. Nothing happened. Not sure if I'm doing something wrong or what's going on 😳


-----Further Note-------
Not sure if I was being too lengthy in explanation or just suck as explaining things but just wanted to confirm all I'm looking for in this script is to check:

If weapon slot 1 is empty -> add Claw (id:5) + Equip claw.
If weapon slot 2 is empty -> add Claw (id:5) + Equip claw.
If body slot is empty -> add robes (id:1) + equip robes.

That's all ^_^ I have a Common Event to handle removing any claws or robes in the inventory that lingers for 30+ frames, so that should take care of that issue.
Events aren't required.


I corrected a typo in the script. It should work correctly now.


Here's an example of correct tags.


<unequipWeapon:3>


<unequipArmor: 4 5>


I've just tested this and confirmed it to work. Use the exact same format, including spaces, with each tag on a separate line. Make sure that the actor is set to be able to equip the weapon or armor type you are trying to auto-equip on empty.


Script
Events aren't required.


I corrected a typo in the script. It should work correctly now.


Here's an example of correct tags.


<unequipWeapon:3>


<unequipArmor: 4 5>


I've just tested this and confirmed it to work. Use the exact same format, including spaces, with each tag on a separate line. Make sure that the actor is set to be able to equip the weapon or armor type you are trying to auto-equip on empty.


Script



BOOM!!!!! [Flawless Victory!] <3 <3 <3 you sir are a saint and shall have top honors of being first in plugin credit list ^_^ Thank you so much for the time and effort put in for this request. 10/10 customer is satisfied ^_^
@DreamX 


Nevermind ^_^ Fixed it. I just had the common event called within your script upon equipping armor and it worked ^_^


I know you fulfilled my request already; but I was wondering if it's possible to add/edit the script for 1 more little thing? 🙂   -- mostly due to whatever system I had in place is now broken (not fault of your script. It seems broken without your script even in yet).

I have a common event to run on "changeEquip()". it takes the variable "player_ac" = 0, and it adds the values of the Defense of each armor, totals them all up, divides by 3, then adds THAT total by += 10. This result is the "Armor Rating" used in my custom combat system. For some reason the player_ac variable is still reading "0" even after I swapped armors from robes (0 Def) to Brigantine Armor (+10 Def) which alone should've been ((10 / 3) + 10) = [13] Armor Rating. But it didn't 🙁  

So I was hoping if it's possible to do these calculations upon armor swapping in this script? Or is that something I have to request differently?

Original thread: https://forums.rpgmakerweb.com/threads/auto-handling-un-equip-claws-robes.55838/