Battle Scripting

I need to take a break before I tackle this. And you should too, this will take awhile.

Ever played Final fantasy or any other console style RPG?

Anox is just like one of those games. But there are a couple of differences, Mostly that Console Rpgs sell bundles of copies where Anox did Not.

But in those ‘other’ console style games, when a battle takes place, the camera will cut away to an area where all the cameras are prescripted. But NOT with Anox, battles can take place anywhere. The reason Anox can do this is Planet has a ‘relative’ scripting system. Where ANY relative script can change dynamically based off the locations of the attacker & the Attackee. Awesome Stuff.

Lets load up map battlesize

Click on the ‘draw cyl’ checkbox on the left. Notice there are now 3 cylinders in the middle of map battlesizeas depicted in the picture to the right. The blue cylinder is the attacker cylinder, the red cylinder is the attackee cylinder, the big white cylinder is the area in between. The attacker is who you are currently building the script for. Attackers can have multiple attack scripts which are each initiated through the AI script you learned about in Monster_AI.


I put the attacker on path 1 with the -focus on path 2. THERE MUST be a focus node AND IT MUST BE OPEN FOCUS.

To do this:
Drop a 3D node in the middle of the blue cylinder. This will be PAL. Have cubic 1 -focus at path 2
Have the -cmd at 0.0

(ALL the main characters switch to a combat model, character_boots_com etc., except democratus. Combat Character models have a whole slew of combat animations)

For cubic 2 drop a 3d node in the red cylinder. This is Pal’s OPEN focus. Drag it out to 1.0.

For cubic 3 drop a 3d node in the red cylinder. This will be the enemy. Have it -focus on path 4.

For cubic 4 drop a 3d node in the blue cylinder. This is the enemy’s OPEN focus. Drag it out to 1.0.

Put a camera on cubic track 10 with -focus on path 11

All battle scripts begin with an OPEN NODE & OPEN FOCUS. You don’t necessarily have to do this, it was the style that we wanted. So the first camera would move smoothly to the action and THEN start cutting.

NOTE: In My Opinion, action is better expressed with a moving focus, not necessarily a moving camera. But hey…

You may want to examine all the battle animations Pal has to choose what type of attack you want to do. But lets do something simple, cuz my fingers are getting tired. We are going to make a simple attack animation instead.

On path 6 Place a 3dnode in front of pal with a -cmd node

At 4.0
(scale down the sphere if it is too large)
Place a 3d node at the location of the enemy so that the sphere makes contact with the enemy at 5.0 secs. MAKE SURE THERE IS A NODE AT the enemy at exactly 5.0 secs. For reasons which I’ll explain later. BE SURE TO GIVE THIS NODE SOME FORWARD VELOCITY of about 500. And then drop another 3d node Past the enemy.

Play the script. Our whitesphere isn't appearing in front of Pal, then moving toward the enemy. It appears midway and moves. This is because we are making it appear halfway between it's movement path. We want it to stay stationary, until we unhide it, then have it move toward the enemy.
On the Whitesphere's cubic path, left click on the node you dropped at 5.0 secs, then hit the insert key. This will insert a node halfway between the 5.0 sec node and the 0.0 sec node. Hit the '7' key to copy the values from the 0.0 sec node, this will keep the whitesphere stationary until time hits this node. Move this new node to 4.0 secs where we unhide the whitespehere.

Play the script. It's not the flashiest….But lets continue. When the whitesphere hits the target at 5.0 we need to have the monster respond.

So on cubic 3 drop a -cmd node at 5.0

This will do 2 things:
Play the monster’s hurt sound
Play the monster’s hurt animation
NOTE: You can play these multiple times if you wish
Drop a MASTER COMMAND node at 6.0

This will bring up the amount of damage inflicted. Since we are not in battle mode it will say damage:XXX for now. Only 1 is needed.

This is essentially what a finished battle script looks like.

Assigning relativity.
Now we need to make this normal script a relative script.
Click on the first check box on the left ‘relative mode
A bunch of question marks appear over your nodes. They need to be assigned to cylinders.

Select the only 3D node on cubic 1, Pal’s node. Hit ‘5’. now hit the up arrow key. Scroll through all the relative cylinders that you can choose from, using the up and down arrow keys. The short squat(fixed source)ones are preferred, they do not scale script nodes dependent on height. Choose the short squat cylinder(fixed source) that is in the blue cylinder.
Assign the node in cubic 4 to the same relative(fixed source) cylinder node.
Assign the nodes in cubic 2 & 3 to the short squat(fixed source) relative cylinder node in the red cylinder.
Assign the first node in cubic 6 to the same relative(fixed source) cylinder node in the blue cylinder, do the same for the node at 4.0 secs. When that path reaches the monster at exactly 5.0, assign that node to the short squat(fixed source) relative cylinder node in the red cylinder, do the same for the node at 6.0 secs.
The camera you will have to judge for yourself. My tests do not show any difference at this time.

Now hopefully you shouldn’t see ANY QUESTION MARKS. If you do, assign em relative cylinder nodes.

It’s VERY important that the first and last attacker & attackee nodes be CENTERED IN THEIR CYLINDERS. If not, the characters will skip around in battle mode. To fix this, select the first node in cubic 1 and hit ‘9’. This will Center the node for you. Do the same for cubic 3.

Play the script. It should look exactly the same.

Now lets cycle through some possible battle cylinder scenarios. Cycle through cylinder positions by hitting the [ & ] keys. See how the script changes! If you followed the directions correctly, then all of the nodes should move together.
If you are creating your own script and you notice how some nodes may not have gone where you wanted them, go back to your original cylinder configuration and reassign those nodes.

Configure the cylinders so that they are right next to each other, near the red cylinder. Play the script. Notice that the white sphere goes backward and hits PAL (THIS HAPPENS IF YOU GAVE THE NODE AT 5.0 SOME VELOCITY). This can be ok, depeding on the effect you are trying to achieve. But we don't want it to do this here, so try to adjust the velocity for the whitesphere so that it looks decent. Now change to the far spaced cylinder configuration. Play the script. This is why battle scripting can be difficult, YOU MUST MAKE SURE THAT YOUR SCRIPT WORKS AT ANY CONFIGURATION. Check all of the different configurations. If at some battle cylinder position configuration you don't see pal, or the monster, or anything then it means your camera is leaving world space. Try changing the location of your camera, os it stay within the battle cylinder for all configurations.
The reason why you dropped a node exactly at 5.0 ON the monster is so that it is in sync with the soundpains and Hit animations for the monster at 5.0.

Here are some RULES that MUST be Followed

ALWAYS return model to FLOOR=1
If you ever pick up an attacker OR attackee using floor=0, you must return it to floor=1

ALWAYS return models to the CENTER of the cylinder
If you ever MOVE an attacker or attackee, you MUST return them to the center of their appropriate cylinder

EVERY NODE MUST have a relativity

PLAY every script in all cylinder nodes

CAMERA should RARELY go out side the big cylinder.
If you don’t the camera can go out of world in some battles. Making the battle disappear!!


Any flash effects you try, just be sure to return them all to zero by the end of it.

You are almost done with your battle script

Replace the -cmdnewent=character_pal_com;’ on cubic 1 with:
The attacker. This turns the character appearing here into a relative. When the script is actually used in the game, you don't know what character will be in the party, or at this node.

Replace the -cmdnewent=monster_noxgad;’ on cubic 3 with:
Sets the attackee node to relative.

When you play this script in planet, you wont see the attacker or attackee models.

So use these commands
To assign temporary models, You can also see how the cylinders will change.
Cylinder sizes are determined by Bounding boxes.

A3_relsource character_pal_com
A3_reltarget monster_noxgad

Now play the script

You are done with simple battle scripting. Now try using the various effects and things you have learned from the Planet documentation. Change the whitespehere into something else, or maybe attach a particle system too it... Flash the screen when it hits the attackee, or maybe EntQuake it? Think of all of the effects you can do, and try some out.

Stay tuned for Advanced battle scripting, where you will learn to tie everything together to create some awesome monster attack scripts.