Hello! Disclaimer first - I am the worst human at scripting. I've thrown together a script from several different resources, and I'm assuming it's beyond broken and need some help.
Goal: I want an equipped armor (e.g. a shield) to "break" when the attacked party member's HP hits a certain percentage. By "break" I mean swapping the good version of the item to a broken version of the item. Example: Bob has the Iron Shield equipped. During combat, a monster hits Bob with a physical attack and his health drops to 25% or lower, causing the Iron Shield to be swapped out to the Broken Shield. The attack must be a physical attack - if a spell causes Bob to drop below 25%, the shield stays intact UNTIL Bob is struck with a physical attack, therefore breaking the shield.
What I've done:
I have given all enemies a "monster attack" skill. This skill replaces the default "Physical Attack." It's a clone of the default physical attack, except I've added a Common Event to the Effects.
This common event (script will be below) will check to see if the attacked players HP is below 25%.
If it is, it retrieves the ArmorID of the item in the Shield slot, unequips the attacked player's item in the Shield slot, removes the ArmorID of the shield they had equipped from the party, adds the Broken Shield to the party's inventory, then equips the newly added Broken Shield on the attacked player. At the end, it displays a message that your shield is an ex-shield.
Common Event Script:
PROBLEM: I get a syntax error that a "(" was not closed. They all look pretty closed to me?
I'm sure I'm going about this an odd way and there's a strong possibility I might even be totally using the scripting feature wrong.
Could someone point to my mistake in the script, or if I'm doing something that totally doesn't work? It seems a rather "simple" scripty job to run the check, and if it fails grab the item, unequip, delete, add, equip.
As to why this mechanic - even though the shield is broken, it's still partially a shield. The Broken Shield is an armor item that still has some protection, but not much. I want the player to have a more permanent penalty when nearly losing a battle. Instead of just drinking potions and casting healing spells to continue skipping around the dungeon merrily, they have to deal with the loss of some gear. This either prompts them to get out of dodge, or make the decision to press on with the penalty.
Thanks in advance!
Goal: I want an equipped armor (e.g. a shield) to "break" when the attacked party member's HP hits a certain percentage. By "break" I mean swapping the good version of the item to a broken version of the item. Example: Bob has the Iron Shield equipped. During combat, a monster hits Bob with a physical attack and his health drops to 25% or lower, causing the Iron Shield to be swapped out to the Broken Shield. The attack must be a physical attack - if a spell causes Bob to drop below 25%, the shield stays intact UNTIL Bob is struck with a physical attack, therefore breaking the shield.
What I've done:
I have given all enemies a "monster attack" skill. This skill replaces the default "Physical Attack." It's a clone of the default physical attack, except I've added a Common Event to the Effects.
This common event (script will be below) will check to see if the attacked players HP is below 25%.
If it is, it retrieves the ArmorID of the item in the Shield slot, unequips the attacked player's item in the Shield slot, removes the ArmorID of the shield they had equipped from the party, adds the Broken Shield to the party's inventory, then equips the newly added Broken Shield on the attacked player. At the end, it displays a message that your shield is an ex-shield.
Common Event Script:
PROBLEM: I get a syntax error that a "(" was not closed. They all look pretty closed to me?
I'm sure I'm going about this an odd way and there's a strong possibility I might even be totally using the scripting feature wrong.
Could someone point to my mistake in the script, or if I'm doing something that totally doesn't work? It seems a rather "simple" scripty job to run the check, and if it fails grab the item, unequip, delete, add, equip.
As to why this mechanic - even though the shield is broken, it's still partially a shield. The Broken Shield is an armor item that still has some protection, but not much. I want the player to have a more permanent penalty when nearly losing a battle. Instead of just drinking potions and casting healing spells to continue skipping around the dungeon merrily, they have to deal with the loss of some gear. This either prompts them to get out of dodge, or make the decision to press on with the penalty.
Thanks in advance!