Home > Tutorials > RPG Maker 2003 > Enemy Attacks 3: Direct targetting
Enemy Attacks 3: Direct targetting
Okay, I came up with this after I found a glitch in the code (part one) because if the variable somehow was blank or zero, it would give the error "script refers to a character that does not exist." Well, anyway, I worked on a solution, and came up with this.
In the section, have the attack switch ON as the condition as before (Claw ON, etc)
Then, put the damage range variable. Then the Battle Animation, then a common event called Random target. Then finish as before with EndAttack comon event.
So it should look like this:
Claw ON
Variable ClawDamage set, [random 45-100]
BattleAnimation (some type of claw animation)
Common Event RandomTarget
Common Event EndAttack
Okay, now get rid of any of the old cruft from part one, except for those two common events mentioned before. End Attack is about the same, so just change the RandomTarget code.
Target [random 1-whatever the max party size is]
Label 1
If Target is 1
If Joe (Char1) is in party
:If Joe is dead
Target [random 1-whatever the max party size is]
Goto Label 1
(This is to avoid targetting dead party members)
:Else
If Claw is ON
Joe Change HP inflict variable (ClawDamage)
Else
If Bite is ON
Joe Change HP inflict variable (BiteDamage)
Else
If Etc is ON
Joe Change HP inflict variable (EtcDamage)
End
Else (to the if Joe is in Party)
Target [random 1-whatever the max party size is]
Goto Label 1
Else (to skip people not in party too)
If Target is 2 (Etc...)
.....
End Event Processing
|
|
Details
|
|
Tutorial:
|
Enemy Attacks 3: Direct targetting |
|
Date Listed:
|
Sat, 06 Nov 2010 03:31:14 -0400 |
|
Author:
|
bulmabriefs144
|
|
Total Hits:
|
970 |
|
|