Goal
- The player attacks the enemy with a poisoned weapon, inflicting the enemy with the Poisoned status.
- Every 15 frames, the enemy takes damage.
- After 60 frames, the Poisoned status is removed
Poisoned Weapon
There are multiple ways to handle this. What I'm showing is just my way. Don't be afraid to be creative. Firstly, let's create a poisoned weapon.
In Note section, let's add <status: poison>. It doesn't do anything yet but we'll make it work later. Also, I'll adjust the attack power to 5 or it'd be way too OP.
Now let's head to the common event that runs on all enemies, Enemy Collision Check.
Please see previous tutorials about Collision Checking if you don't understand the picture above |
We'll add a conditional branch: equippedWeaponNotetag('status') == 'poison'. This evaluates to true if <status: ___> is set to "poison." If it is, we’ll then check for a 50% chance of returning another true. If that succeeds, we’ll call the command Assign New Passive: <Status: Poison>. This activates a common event named "Status: Poison."
Assign New Passive only call common event for events that use Passive from plugin parameter or <passive> as a comment in the current event |
So now we'll have: If this event (enemy) is being hit by a weapon that has status as poison, there'll be 50% chance we call common event named Status: Poison. Let's move on to the common event.
I'll add a conditional branch to check a local variable called 'poisonClock' and see if its value is 60 or higher. If it is, I'll reset 'poisonClock' to 0 and remove this passive common event from the current event. However, if it's less than 60, every 15 frames, I'll subtract 7 HP from the current event and add 15 to the 'poisonClock' variable. Basically, it's a loop and it'll automatically break the loop when variable is 60.
Too complicated? If so, you can simplify it by just copying and pasting the code multiple times. The final command stays the same either way—it removes the passive common event Status: Poison.
Deal damage every 15 frames seem too fast so in result video I adjusted it to every 60 frame :P