Honestly what the title says. I want to have a usable item that can only be used on one specific enemy. Like if it's used on anything but that enemy it either isn't able to be consumed, or a text box comes up and says something like "Not the right foe." and then that turn is used up but the item isn't. Though when it it used on the specific enemy it triggers some text, does a lot of damage, and then the item is consumed. Is this even possible without using any custom scripts? I want to avoid this if possible. Thanks!
Item that can only be used on a specific enemy once that triggers an event?
RPG Maker VXAce SupportBasically your Item should have,
- 'Damage Type' set to 'HP Damage'
- 'Damage Formula' set as "b.enemy_id == 1 ? 1000, $game_variables[n]=true : 0"
(Replace '1' with the specific enemy ID, 'n' with a switch of your choice, and 1000 with the 'lot of dmg')
- 'Effects' with a 'Common Event'
- 'Consume' set to 'No'
- 'Occasion' set to 'Only in Battle'
- 'Scope' set to 'One Enemy'
The common event should have a conditional branch of,
- if $game_variables[n] is true then 'Change Items' -1, 'ControlVariable' set $game_variables[n]=false
- if not then 'Show Text' "Not the right foe." (won't remove item and still passes turn)
Untested but should work...
- 'Damage Type' set to 'HP Damage'
- 'Damage Formula' set as "b.enemy_id == 1 ? 1000, $game_variables[n]=true : 0"
(Replace '1' with the specific enemy ID, 'n' with a switch of your choice, and 1000 with the 'lot of dmg')
- 'Effects' with a 'Common Event'
- 'Consume' set to 'No'
- 'Occasion' set to 'Only in Battle'
- 'Scope' set to 'One Enemy'
The common event should have a conditional branch of,
- if $game_variables[n] is true then 'Change Items' -1, 'ControlVariable' set $game_variables[n]=false
- if not then 'Show Text' "Not the right foe." (won't remove item and still passes turn)
Untested but should work...
I would recommend using
Edit: Also the formula would not return 1000 damage, use instead:
$game_switches instead of $game_variables in the formula to use a switch instead of a variable and avoid using script calls in the common event. 🙂Edit: Also the formula would not return 1000 damage, use instead:
b.enemy_id == 1 ? ($game_switches[1] = true; 1000) : 0Ah, yep that would be right. Originally I had it set the variable as the targets ID so that was left over from that change.
I think I've gotten it in a respectable state. I've certainly have had to do a few different things in order for the conditional branch to even activate. But honestly I'm glad that it works, is able to only be used on one specific enemy, and that after figuring out a problem with my typing I've gotten errors to stop popping up. Will add anything if some unforeseen nonsense happens!
Original thread: https://forums.rpgmakerweb.com/threads/item-that-can-only-be-used-on-a-specific-enemy-once-that-triggers-an-event.184014/