Gw Temp

Menu

Tutorial - 'Advanced variable tracking' by dragonheartman

An item about RPGMaker 2000 posted on

Blurb

Not too advanced, but it teaches you how to have a gun in your ABS, nonetheless.

Body


ADVANCED VARIABLE TRACKING PART ONE

Don't be confused by the title, This tutorial is advanced for those who know about tracking variables but don't know their full potential. If you don't know to track an event via variables, I suggest you read another tutorial on how to do so.



I will discuss and share how to have some sort of projectile (gun, bow & arrows) in your ABS, and how to make your own "Move (Hero or event) towards/away any Event". why would you want a move towards event? Well it helps out a lot for AI in a tactical battle system. This is split into two parts, so I'll talk about shooting in this part.



SHOOTING

Start out by making a parallel process on the map you want to implement the system. It will be needed on every map, however a common event will not work due to the fact that you are going to be dealiing with different event numbers to track on different maps. Confused? Don't worry. Now this parallel process event will need to track your playable character and any events you want to be able to shoot. I recommend naming those events you will be tracking.



Next create another parallel process event on the same map. This one controlls the gun. Start by having an enter password for button 5 (enter, wait 'till key pressed) followed by a fork to see if that variable is equal to 5. If it is, you (might) want it to check if you have enough ammo after. The next few lines of code should just basically show a battle animation of the bullet being shot, the sound, and the variable "ammo" decreasing by one. We are now going to have a fork condition checking if the hero is up. If he is, then we need to check if hero's Y posion is greater than target one's Y position (meaning he is above him, remember, to the right adds X value, down adds Y value). The final fork should Check if the hero and the target have the same X position. If all those conditions are true, you should put a "Flash Event" red here and decrease it's HP by whatever value you choose. After all three of the previous forks are done with, add another fork checking if the hero is facing right. In that fork have another fork check if the target's X position is greater than the hero's (to the right of the hero). Inside that fork, check if the Y positions of the target and hero are equal. Then do your flash red, Damage target and stuff. I think you get the idea. Do that for the other two directions and the code should look something like this:





<>enter password 5, wait till key hit
<>fork, if var(enterpassword) is equal to 5
<>Fork, if variable (gun ammo) is above 0
<>play SE gun hit
<>Fork, if hero is facing up
<>Fork, if var(HeroYpos) greater than (target 1 Y pos)
<>Fork, if var(hero X pos) equal to var(Target X pos)
<>Change variable (gun ammo) -1
<>Flash event, target1
<>Change variable, (target 1 HP)-*Whatever value you wish*
<>Fork, if hero is facing right
<>Fork, if var(HeroXpos) less than (target 1 X pos)
<>Fork, if var(hero Y pos) equal to var(Target Y pos)
<>Change variable (gun ammo) -1
<>Flash event, target1
<>Change variable, (target 1 HP)-*Whatever value you wish*
<>Fork, if hero is facing down
<>Fork, if var(HeroYpos) less than (target 1 Y pos)
<>Fork, if var(hero X pos) equal to var(Target X pos)
<>Change variable (gun ammo) -1
<>Flash event, target1
<>Change variable, (target 1 HP)-*Whatever value you wish*
<>Fork, if hero is facing left
<>Fork, if var(HeroXpos) greater than (target 1 X pos)
<>Fork, if var(hero Y pos) equal to var(Target Y pos)
<>Change variable (gun ammo) -1
<>Flash event, target1
<>Change variable, (target 1 HP)-*Whatever value you wish*





That pretty much covers the basics. PM me if you need any questions/ have comments.



-dragonheartman