Home > Tutorials > RPG Maker 2003 > Special Enemy Attacks and Targetting
Special Enemy Attacks and Targetting
This is for stuff like alternate physical skills, which can't be redirected by Reflect. Common examples would be something like a bite or slash attack, or dragon's breath.
Okay, first off, make sure your enemy party doesn't have more than one enemy with the same attack type. You will probably want about three or four different types (let's call them Slash for sword attacks, Claws for beast attacks, Bash for punches, and MultiAtk for ones that hit the whole party). Now each of these should be a switch that turns on when that attack type is used. Make a conditional if that switch is ON in your monster events page. Let's start with the most simple, a multiple attack. Simply show battle animation (no wait here, as this sort of event pausing can sometimes lag or repeat it). Now Change Entire Party HP. Make a new page (which technically should be the first page, since it contains all stuff at the start of battle, including music changes) called Turns Elapsed [0]. In this should be two things, the Variables for damage (unless you want to put them at the at the switch ON, you'll see why) and the Call Event: Battle Targets. You'll need the following later. Now why did I say you could either have the damage variables here or in the switch section? It depends on whether you want the code to be fixed (in which case just give it a specific number and leave it at the start) or random (in which case place it directly before the battle animation in the Switch ON, and give a random number). So the multiatk should look like this:
(Variable Set Random Number 1-32 or something here if you chose random)
Battle Animation: All Alies (no wait)
Change Entire Party HP (Variable)
Call Event: EndAttack
EndAttack is simple, just fill it with all the switches turned off and then End Event Processing.
So, there this is the simple no-targetting attack that just knocks your party around, such as a dragon's breath. But the next part is more complicated. Remember that Battle Targets call event? Well, this is what is used for determining enemies to attack. First, we have if the main character is in the party, then a variable operation sets 1 (if not, have the next character lead, in a case like Crono's death). Each character is represented by a number so they can be targetted, and there are four Char_ID variables (party of four). So after the first conditional, make three more.
The second one should be:
If Char2 is in party
Variable Char_ID2 Set, 2
Else
If Char3 is in party
Variable Char_ID2 Set, 3
Else
If Char4 is in party
Variable Char_ID2 Set, 4
Else
If Char5 is in party
Variable Char_ID2 Set, 5
Else
If Char6 is in party
Variable Char_ID2 Set, 6
Else
Etc...
End
The next one should advance in the sequence, starting with character 3, so the third one should be:
If Char3 is in party
Variable Char_ID2 Set, 3
Else
If Char4 is in party
Variable Char_ID2 Set, 4
Else
If Char5 is in party
Variable Char_ID2 Set, 5
Else
If Char6 is in party
Variable Char_ID2 Set, 6
Else
Etc...
End
Because it's next in the sequence, the code will sort 1st, 2nd, 3rd, and 4th in party formation, identifying each character in the party. But this will not be enough to target alone.
Start the targetted attack with the CallEvent: TargetAtk
Make four branches (you don't need to nest them with else statements) called If PartyMemberAtk is 1, If PartyMemberAtk is 2, If PartyMemberAtk is 3, and If PartyMemberAtk is 4. Now instead of having all the party attacked, you changed the target to variable Char_ID1 for condition PartyMemberAtk is 1, variable Char_ID2 for condition PartyMemberAtk is 2, variable Char_ID3 for condition PartyMemberAtk is 3, and variable Char_ID4 for condition PartyMemberAtk is 4. The only thing left to do now is make the TargetAtk call event. Alright, compared with the other, this is pretty simple.
Variable PartySize, Set Party Size
If PartySize is 4
Variable PartyMemberAtk random 1-4
Else
If PartySize is 3
Variable PartyMemberAtk random 1-3
Else
If PartySize is 2
Variable PartyMemberAtk random 1-2
Else
If PartySize is 1
Variable PartyMemberAtk random 1-1
End
End Event Processing.
This will keep the code from wasting attacks on unnecessary targets, but it still targets the dead, since they are in your party. If you followed all of this, congrats! You now have a series of special attacks that can damage the party despite things like defense and magic, and which are non-reflectable.
|
|
Details
|
|
Tutorial:
|
Special Enemy Attacks and Targetting |
|
Date Listed:
|
Tue, 05 Oct 2010 11:00:26 -0400 |
|
Author:
|
bulmabriefs144
|
|
Total Hits:
|
1157 |
|
|