Post by NASH7777 on Nov 15, 2004 21:56:00 GMT -5
I'll post the basic consepts on how it all works. Not the actual scripts in most cases but more of a summary.
Here's an overview of how it plays out.
You are always in the battle system, you walk around and just attack whenever you want with whatever weapon you want. Your HP appears in the top left corner and your breath (when under water), etc...
Some Maps have enemies that move around and attack as they please. You may go to them and attack and get $ from them (well rupees).
+++
That's basically how it plays out.
Here is kinda how the enemy scripts play out.
There are enemy events 1-6 (e1,e2,e3...), there are also variables for each enemy as to which # they are which changes what enemy each enemy event is. Ex if e1=1 it's a slime, if e1=2 its a ghost etc...
The enemies are basically controlled by their motion script. Here's a mini example of an enemy script:
If e1=1
-Set e1's graphic to slime Make e1hp=2
-Loop
--Make random variable #, if this # move this way, if another # move another way or attack etc...
-End Loop
End If
If e1=2
Blah blah blah blah
End Loop
*****
Now for each enemies action there are different ways you can go. If you want to move and attack randomly, use AI to attack when your close etc, or like a boss have a special customized actions based on it's remaining hp. Here's how you can work each one.
For just your common stupid enemy have it move randomly based off a variable and one of the option (or more) will be to attack. There are some common flaws with this script, the enemy may run into an object and get stuck (unless it's a ghost who bypasses objects). This isn't a big problem for just some stupid enemies out in the middle of no-where. Just try to remember to put them in open areas.
For smarter enemies have it check the distance between you and the enemy and if your so close have it come closer until it's so close it can attack and have it do so. (i'll post the way to find the distance later)
For bosses you can have it do whatever you need, but one trick you may want is when the bosses hp gets so low it will act differently.
Finding the distance is a key element in my CBS. here's how:
Load your x and y. Then the enemies variables x y . Then have 3 variables open distanceX, Dy and Dxy.
Script works something like this:
x-(enemies)x= Dx
If Dx is less then 0
Dx * -1
End Cond
y-(enemies)y= Dy
If Dy is less then 0
Dy * -1
End Cond
If Dx is greater then Dy
Dx-Dy= Dxy
End Cond
If Dx is less than or equal to Dy
Dy-Dx=Dxy
End Cond
****
The variable Dxy then tells you the distance between you and the other object. Which u can then use for whatever purpose you need!
Weapons
Basically the weapons are called by square and then another button that determines which weapon. They all cycle some of the same pretty basic scripts. Here I go:
Variables: Target Area for all x,y,and z
Sword: have it get your x,y,z then store it in the target area, now I have a script that is called "Att. 1 forward" basically depending on your Direction it will change the variable to move up one spot. Ex: If dir=0 then make ty+1, or if dir=1 then make ty+1, tx+1. This will change the attack area to the spot forward where the sword is swinging (i just use a simple sword SFX). Then have it call a basic script you'll use a lot called "Check Damage" This script will loop and load enemy1's x,y and if they match have it will make e1hp - (swords Dmg). Also I have something called a z range which is set in the sword script that checks your z distance in relation to target's if it is too much the attack won't hit either. Then have it load e2's x,y,z and do the same thing as it loops, and so on through all your enemies.
Now that we've accomplished the sword we'll move on to something slightly more range-y. Bombs: for bombs have it basically the same as the sword except have it repeat the "att 1 forward" script like 3 times (or as many as you want your bomb thrown), and then have it check the damage area.
And since we have those two accomplished we'll go on to arrows. The same basic concept exept that you "att 1 forward" then "check Damage" then go back to "att 1 forward" for as far as the arrow is shot. Or like if you want it to stop going after it hits something you could have a flag flip if you want.
You can basically make any kind of weapons you want with that, you may also want something that shoots upwards with just simply editing the tz variable. I have special weapons too that burn plants or bombs that destroy floors, basically just have a script like the "check damage" except have it check for your plant or floor event then have it remove that event or whatever you want it to do. Even a wave to push a distant block!
Here's some basic simple scripts for enemy attacks, they work just like your character's attacks except grab the enemie's x,y,z and direction instead of the party's, and when checking damage see if leader is there and not party.
I have some enemies that shoot out things, some that attack with a sword or some, like the slime that jump up and down and they splash arround them, for that basically have it check the dist. and if it is w/i so many it does the damage.
Q's/comments just go ahead!
Here's an overview of how it plays out.
You are always in the battle system, you walk around and just attack whenever you want with whatever weapon you want. Your HP appears in the top left corner and your breath (when under water), etc...
Some Maps have enemies that move around and attack as they please. You may go to them and attack and get $ from them (well rupees).
+++
That's basically how it plays out.
Here is kinda how the enemy scripts play out.
There are enemy events 1-6 (e1,e2,e3...), there are also variables for each enemy as to which # they are which changes what enemy each enemy event is. Ex if e1=1 it's a slime, if e1=2 its a ghost etc...
The enemies are basically controlled by their motion script. Here's a mini example of an enemy script:
If e1=1
-Set e1's graphic to slime Make e1hp=2
-Loop
--Make random variable #, if this # move this way, if another # move another way or attack etc...
-End Loop
End If
If e1=2
Blah blah blah blah
End Loop
*****
Now for each enemies action there are different ways you can go. If you want to move and attack randomly, use AI to attack when your close etc, or like a boss have a special customized actions based on it's remaining hp. Here's how you can work each one.
For just your common stupid enemy have it move randomly based off a variable and one of the option (or more) will be to attack. There are some common flaws with this script, the enemy may run into an object and get stuck (unless it's a ghost who bypasses objects). This isn't a big problem for just some stupid enemies out in the middle of no-where. Just try to remember to put them in open areas.
For smarter enemies have it check the distance between you and the enemy and if your so close have it come closer until it's so close it can attack and have it do so. (i'll post the way to find the distance later)
For bosses you can have it do whatever you need, but one trick you may want is when the bosses hp gets so low it will act differently.
Finding the distance is a key element in my CBS. here's how:
Load your x and y. Then the enemies variables x y . Then have 3 variables open distanceX, Dy and Dxy.
Script works something like this:
x-(enemies)x= Dx
If Dx is less then 0
Dx * -1
End Cond
y-(enemies)y= Dy
If Dy is less then 0
Dy * -1
End Cond
If Dx is greater then Dy
Dx-Dy= Dxy
End Cond
If Dx is less than or equal to Dy
Dy-Dx=Dxy
End Cond
****
The variable Dxy then tells you the distance between you and the other object. Which u can then use for whatever purpose you need!
Weapons
Basically the weapons are called by square and then another button that determines which weapon. They all cycle some of the same pretty basic scripts. Here I go:
Variables: Target Area for all x,y,and z
Sword: have it get your x,y,z then store it in the target area, now I have a script that is called "Att. 1 forward" basically depending on your Direction it will change the variable to move up one spot. Ex: If dir=0 then make ty+1, or if dir=1 then make ty+1, tx+1. This will change the attack area to the spot forward where the sword is swinging (i just use a simple sword SFX). Then have it call a basic script you'll use a lot called "Check Damage" This script will loop and load enemy1's x,y and if they match have it will make e1hp - (swords Dmg). Also I have something called a z range which is set in the sword script that checks your z distance in relation to target's if it is too much the attack won't hit either. Then have it load e2's x,y,z and do the same thing as it loops, and so on through all your enemies.
Now that we've accomplished the sword we'll move on to something slightly more range-y. Bombs: for bombs have it basically the same as the sword except have it repeat the "att 1 forward" script like 3 times (or as many as you want your bomb thrown), and then have it check the damage area.
And since we have those two accomplished we'll go on to arrows. The same basic concept exept that you "att 1 forward" then "check Damage" then go back to "att 1 forward" for as far as the arrow is shot. Or like if you want it to stop going after it hits something you could have a flag flip if you want.
You can basically make any kind of weapons you want with that, you may also want something that shoots upwards with just simply editing the tz variable. I have special weapons too that burn plants or bombs that destroy floors, basically just have a script like the "check damage" except have it check for your plant or floor event then have it remove that event or whatever you want it to do. Even a wave to push a distant block!
Here's some basic simple scripts for enemy attacks, they work just like your character's attacks except grab the enemie's x,y,z and direction instead of the party's, and when checking damage see if leader is there and not party.
I have some enemies that shoot out things, some that attack with a sword or some, like the slime that jump up and down and they splash arround them, for that basically have it check the dist. and if it is w/i so many it does the damage.
Q's/comments just go ahead!