|
Post by vespuleth on Aug 10, 2006 21:02:10 GMT -5
Several years ago, Vic and I worked on a Tactical Battle System, which I hope to lay out here. This is not, however, a walkthrough; it is a how-to. What is the difference? That it is not specifically a set procedure yet. This is the product of some notes I have taken when developing the system. My goal is to post seven steps a week, that way everyone has a chance to implement the steps. I am not merely posting the scripts because all previous attempts to do this (even when it was specifically for vic to read) produced all sorts of nightmarish troubleshooting duties for vic and I that neither of us needed nor volunteered; at the time we both had little understanding of how it worked ourselves; answering questions became a chore. Doan probably has the best recollection of this event. So, if there are not seven steps released a week, the system will be released in chunks. That is how it will begin; this week (officially, Friday; this comes a day early) will be merely setup. I hope everyone will go through these steps. All of them will take a little over an hour if you are completely incompetent and should not be doing this. Everyone else will be no more than 30 minutes, I wager. If you implement parts of this system and feel I have not adequately explained how it works, or your implementation does not work, post here and I will do my best to answer any questions you may have. As you read this, please bear in mind that this is not the only way, or necessarily the best way to go about this. This is the way I have already done. If you have suggestions, make them in the linked thread. Finally, please continue to check this post (the one you are reading) for modifications. All updates and changes will be posted here. /**Reserved for Updates**/ Update 2: 18 Aug 06 @ 0331: A Note On Scripts I have updated with the newest set of steps. However, I have not yet updated the scripts. I will be getting to that, but as it takes a little more work, it will come a little later. Update 1: 10 Aug 06 @ 2154: Expectations: In writing this, I make a few assumptions of the reader. I assume you are competent, capable of reading, own and are comfortable with RPGM2, and capable of some fairly complex scripting. If you are still wondering what a variable is and how to use it, not to be rude, but this guide is not for you. I suggest you figure out some of the more rudimentary information inherent in the game before taking on a project like this. /**End Updates**/
|
|
|
Post by vespuleth on Aug 10, 2006 21:44:00 GMT -5
This post is reserved for a general list of events, scripts, variables, and other database parts that need to be reserved. The memory taken so far will also be posted. Scripts: 7 EnterTestBattle Controller Origin TileControl Move TileSpawn GridTurnSort Events: 3+ 2x^2+2x tiles where x = movement distance (for a 6 layer grid, there are 84) EnterTestBattle Controller Origin (0,1) (-1,0) (0,-1) (1,0) (1,1) (0,2) (-1,1) (-2,0) (-1,-1) (0,-2) (1,-1) (2,0) (2,1) (1,2) (0,3) (-1,2) (-2,1) (-3,0) (-2,-1) (-1,-2) (0,-3) (1,-2) (2,-1) (3,0) et al for desired tiles... //link to steps that discuss creation Variables: 5 /**In my original file, some of these were TempVariables. to keep things easy, I am avoiding all use of TempVariables, save the most rudimentary needs.**/ TileSort GridTurn GridTurnRepeat GTRT GridLayer //link to steps that discuss use Memory Remaining: 315680 (with a 6 layer grid)
|
|
|
Post by vespuleth on Aug 10, 2006 21:46:39 GMT -5
The Steps:
//link to posts
Step 1: Initialization and Preferences Step 2: Map Creation Step 3: Party Member Manipulation Step 4: Initial Script and Event Setup Step 5: Moving Origin to Party Step 6: Deploying the First Tile Step 7: Deploying the Second, Third and Fourth Tiles Step 8: Beginning Grid Arrangement Step 9: Complete Grid Arrangement
|
|
|
Post by vespuleth on Aug 10, 2006 21:56:15 GMT -5
Start a new 'beginner file' and immediately change to hard mode (Menu>File>Preferences. (This is not absolutely necessary. I only suggest it because most people enjoy the benefits of having the presets around when they begin to build their games.) Edit any preferences at this time as well. For instance, I change the music volume to 20 and rhythm to 50, all cursor sound effects to 20, and the help text to 15 seconds, etc etc. Go to Main>Game>Game Settings>Basic and change this info to be appropriately descriptive. I strongly advise naming the file 'VTCS CORE' so you can keep it and know what it is later, and so you are aware it is not specifically a game. While here, go to advanced and set the Square button script to 'none'. Got to Menu>File>Save and save your file. If you plan on ever emailing me this file for examination, do not saveit on spots 0-5. This is also good practice due to the fact that it is a library more than a game.
/**Note: I need not and therefore will not be so detailed in the future. As a product of notes, I am not sure yet what can and cannot be left out. As I become more sure, only appropriate details will be included. However, it is my hope that in addition to reproducing a VTCS, all who do gain an understanding of how it works and are capable of making additions and improvements.**/
|
|
|
Post by vespuleth on Aug 10, 2006 22:03:06 GMT -5
With the game saved, go to Menu>Graphics>Dungeon Editor (For the purposes of this How-To, the VTCS will be built in the dungeon editor. Other options may be discussed later). Create a new dungeon and name it 'TestBattle' or something to identify it. (Naming will often be done first; this a practice well implemented into all of the game creation process. Clear names will prevent confusion later) Under the 'custom' tab, change 'transparency' and 'distortion' to 0, then edit the dungeon and build a 15x15 with the default block starting at (0,0,0). This means it will end at (14,14,0). Save and quit the dungeon editor. So that our dungeon is accessible, it needs to be registered with 'World Organization'. Do that now, labeling 'World Organization' with the same label as the dungeon (TestBattle in my case). Do not forget to load it in the data slot. Save and quite the World Organization; we are done here for now.
|
|
|
Post by vespuleth on Aug 10, 2006 22:20:48 GMT -5
Next, go to the 'party members' (Game>Party Members) database and clear out member 0. Change his/her name to DONOTUSE or BLANK. Remove the model. I also remove all stats and equipment, so that if I ever accidentally refer to this member, I immediately know. (If you are wondering why this is necessary, the short of it is that this member does not function properly. For a better explanation and further discussion, I refer you to Dungeon Warden). Save and exit. That being done, go to 'General Settings' and change the leader to Member 1 and remove all the other team members. I also empty the money, but that is a matter of personal preference. Set the Start Location to your created map (TestBattle) (0,0,1). Under the custom tab, you may want to empty the item bag and set all battle scripts to 'none' and set the encounter ration to 0%. Removing the battle scripts now makes them easier to delete later. Save and exit.
/**You may at this point want to see that you have done something. Go to Test Game and walk around your dungeon. Congratulations to you. More importantly, I suggest you begin every new game in this manner, and continue in the general flow laid out here.**/
|
|
|
Post by vespuleth on Aug 10, 2006 22:45:10 GMT -5
Save your progress if you have not yet. After the data is saved, go to 'Object Models'. Create a new object and name it 'Tile'. Find an object to use as a tile. I suggest the River. Save the tile. Now open your scripts database. Create New Scripts. The first three are all action scripts named 'Controller, Origin, and TileControl' respectively. The final will be a content script named 'EnterTestBattle'. I hardly ever use notes, but I clear out what is there to distinguish my scripts from the defaults. How you deal with this is up to you. Save your scripts (the should all be blank or empty) and quit. Now access the event database. Create a new event. Name it 'EnterTestBattle' and set the type to system. IN the apply slot, select your corresponding script. Save the event. Create another new event and name it Controller. In the motion slot, apply the corresponding script. This event needs no model. Save the event. Create another event, named 'Origin'. Set the model to 'Tile' (You will have to change the type to 'Object') and in the motion slot, put the corresponding script. Save the event. Create one more event, named '(0,1)'. The model is again the tile, but the motion script will be 'TileControl'. Save the event and leave the database. Go to event placement and create a new database 'TestBattle'. Set the data to 'TestBattle' (under dungeon) and edit. Place the controller event at (0,0,0); this places it under the ground when done correctly. Save and quit. Go back to World Organization and select your created datafile 'TestBattle'. Under events place the newly created database of the same name. Under 'Script>Enter Map' place your 'EnterTestBattle' event. Save and Quit. Save your progress (on your memory card).
/**This concludes the setup phase. All of the following steps have the goal of building a functional Tactical Battle System with specified features. The steps getting increasingly difficult and are therefore broken into smaller chunks. I intend to move through as much as possible at a adequate pace as not to lose any to boredom or confusion. The steps so far have been a poor indicator of that.**/
//Memory Check: 334016
|
|
|
Post by vespuleth on Aug 18, 2006 2:08:59 GMT -5
Last week, when we left off, we had done all of the preliminary setup necessary to begin building a TBS. This week, we continue, ending with a almost fully functional deployment grid. To begin, open the Controller Script, and add these lines:
Repeat: Flag 0: off -input buttons: constant wait -conidtion: input button = 4 --duplicate Origin (0, 0, 16) -end condition end repeat
This makes it so that whenever the triangle is pressed, the Origin is duplicated one square above the Controller event (because the controller event is underground, remember?). Now open the Origin Script and add:
Bypass objects: yes Bypass members: yes Event>>Effects>>Size (100,100,1)
This changes the depth of the river so that it is just barely above the surface of the ground. The Bypass objects/members will be necessary to make origin movement functional, which we will now address. To move the Origin (and all other moving items), create a new script:
Script Name: Move Script Type: Action
load event info repeat while event x < tempvar0 -move e 1 step (0F) -load event info end repeat repeat while event x > tempvar0 -move w 1 step (0F) -load event info end repeat repeat while event y < tempvar1 -move s 1 step (0F) -load event info end repeat repeat while event y > tempvar1 -move n 1 step (0F) -load event info end repeat
Add a call 'Move' to the very end of the Origin script. Go back to the Controller script, and add these lines before the origin is duplicated:
load game info party x = tempvar0 party y = tempvar1
Now the origin will deploy and find the party.
|
|
|
Post by vespuleth on Aug 18, 2006 2:15:34 GMT -5
Now that the origin is finding the party, the next goal is to deploy a grid at the origin. You will need to flatten (0,1) much like the Origin before the grid will deploy, so go ahead and do that now. Add these lines to the TileControl script:
Bypass objects: yes Bypass members: yes Event>>effects>>size (100,100,1)
Now go and name a variable TileSort.
Create a new script:
Script Name: TileSort Scirpt Type: Action
Sort var TileSort -if 1 --duplicate event (0,1) -to end -no application -to end end sort
We will add to this script as we create more tiles, but its function is probably apparant now. Each number will spawn a new tile. Go back to the Origin Script and add the following lines to the end:
TileSort = 0+1 Call [TileSpawn]
Now, the Origin will duplicate our first tile, (0,1). Finally, open the TileControl script and, for testing purposes, add the following line to the end:
Direction Move: 1 step north, fixed facing
Check your progress testing the file. When you press triangle, the origin should find the party and deploy tile (0,1), which will move to the north of the party one square. If this workd, save your progress.
|
|
|
Post by vespuleth on Aug 18, 2006 2:25:56 GMT -5
If you pressed triangle more than once, you noticed that the tiles do not go away. This will be dealt with in due time. Right now, go to the Event Database and copy event (0,1) and paste it 3 times, changing the names to (-1,0), (0,-1), and (1,0). Add these as 2,3, and 4 to the TileSpawn Script. Now, as the bottom of the TileControl Script, add:
TileSort=TileSort+1 Call [TileSpawn]
If you have done this right, you have 5 unique events line up heading north when you test. You will have to move off the corner to test, as we have not built in edge of the map handling yet (in due time...). Be sure that each event is unique; this will be important later.
|
|
|
Post by vespuleth on Aug 18, 2006 3:01:44 GMT -5
The next goal is to get these four tiles to form a layer around the party. Each at the coordinate its named after. To do this we need anotehr variable: 'GridTurn'. However, before I go into the actual procedure to do this, I want to explain a little of what is going on, or how it will work. As you know from the current scripts, the origin only spawns one tile, (0,1). (0,1) then spawns (-1,0), (-1,0) spawns (0,-1) and so forth. This means that each tile is spawning at the previous tile's ending location rather than the origin, so instructions to get to the proper location are going to need to be relatable to the previous tile. You will also notice that, by the coordinates, we will be moving, starting at 1N, counterclockwise around the Party. As more layers are added, we will be sprilaing counter clockwise around the party. If this does not make sense, stop and draw a spiral. Imagine that evry line is a row of tiles. I do not know how to better explain it. To implement this, create a new script:
Script Name: GridTurnSort Script Type: Action
Sort GridTurn -Apply if 0 --TempVar1-1 -To End -No Application -To End end sort Back in your tile control script, delete the Move North line and replace it with 2 calls:
Call [GridTurn] Call {Move}
Remember that in our 'Move' Script we identified tempVar0 as X and TempVar1 as Y. By subtracting 1 from TempVar1, we tell the tile to go one step north. If you play the game right now, nothing will look different from last time.
To get the other tiles to go to their proper positions, we need to add more GridTurns. To add these turns, we need to calculate how we must manipulate the TempVar0/1. For instance, (-1,0) will be duplicated at (0,1)'s position. To locate it properly, it needs to move 1 West and 1 South. This means TempVar0-1, TempVar1+1 (if this does not make sense, spend some time re-examining the 'Move' Script). From this position, to get to (0,-1) we need to go 1S,1E, or TV0+1, TV1+1. Finally, to go from (0,-1) to (1,0) we need to go 1E,!N, or TV0+1, TV1-1. So, the GridTurnSort script should be as follows:
Sort 'GridTurn' -If 0: TV1-1 to end -If 1: Tv0-1, TV1+1 to end -if 2: TV0+1, TV1+1 to end -if 3: TV0+1, TV1-1 to end -No App to end end sort GridTurn=GridTurn+1 if GT=4 -GridTurn=GridTurn-GridTurn endif
If GridTurn gets higher than the number of turns, it will reset and the turn cycle will start over. Test your game and watch a perfect first layer deploy. Save.
|
|
|
Post by vespuleth on Aug 18, 2006 3:29:50 GMT -5
Copy your last tile and create 8 more: (1,1), (0,2), (-1,1), (-2,0), (-1,-1), (0,-2), (1,-1), and (2,0). Add them in that order to your TileSpawn script. If you tested after doing this in hopes of seeing a grid 2 layers thick, you were dissappointed. There is a problem with the GridTurnSort script that needs to be addressed. The problem is that tile 6 is moving one space west and one space south when it needs to go 1W1N (if the two things stated in this sentence do not make sense, analyze the GridTurnSort script and draw out a grid to identify the necessary turns). This can be fixed, but it takes a little work. First, we need more variables: GridTurnRepeat, GTRT (GridTurnRepeatTracker), and GridLayer. With these variables named, open the 'GridTurnSort' script. First, change GT1-3 to 2-4. Insert a new GT1. We know that it needs to go here because tile 5 performs GT0 and tile 6 needs to perform a different turn from all that exist. insert this as GT1:
Apply if 1: TV0-1, TV1-1 to end
While this fixes tile 6, we know that tile 2 now needs to perform GT2 rather than GT1. We also know that both tile 7 and 8 need to perform GT2 to arrive at the proper destination. Again, if this is not clear, draw it out. Or ask. There is a rule we can gather from this:
Turn 0 always needs to be performed only once Turn 1 needs to be performed one less times than the number of the current active layer Turns 2-4 need to be performed as many times as the number of the current active layer.
This means that in the first layer, Turn 1 is not present (and we have seen that this is true) and turn 2-4 will all need to be performed once. In the second layer, turn 1 will run once, and 2-4 twice. Representing this in scripts will be a little different. First, we need to add some to the bottom of GridTurnSort. After the sort, Change GridLayer=GridLayer+1 to GTRT=GTRT+1. Make the condition if GTRT >= GridTurnRepeat, and inside of it GridTurn+1. Now add another Condition GridTurn >4 and set GridLayerRepeat and GridTurn=0 and add GridLayer+1. The final part of the script should be:
GTRT=GTRT+1 if GTRT>= GridTurnRepeat -GTRT=GTRT-GTRT -GridTurn=GridTurn+1 -if GridTurn > 4 --GridTurnRepeat=GridTurnRepeat-GridTurnRepeat --GridTurn=GridTurn-GridTurn --GridLayer=GridLayer+1 -endif endif
the GridTurnRepeat needs to be set to 0 so that the first turn never has a repeat value carry over from GT4.
Now we need to set the GridTurnRepeat for each turn. for GT0, none is necessary. For GridTurn=1, it will be GridTurn=GridLayer-1. Put this line right after the apply if 1:
Apply if 1: -GridTurnRepeat=GridLayer-1 ...
for GT2-4, it will be GridTurnRepeat=GridLayer. Now go back to GT=1. WE need to put a condition in to return tot the top if GridTurnRepeat=0. INsert this right under the GridTurn=GridLayer-1. The Apply if GT=1 should look like the following:
Apply if 1 -GridTurnRepeat=GridLayer-1 -If GridTurnRepeat=0 --GridTurn=GridTurn+1 --to top -end if -TV0=TV0-1 -TV1=TV1+1 to end
Finally, we need to add GridLayer=1 to the origin script, just above TileSort=1:
... GridLayer=0+1 TileSort=0+1 ...
//It is generally bad form to start a variable with 1 rather than 0. I do it here because otherwise it throws the GridTurnRepeat off. It also makes aesthetic sense, as a Grid with 0 layers would not exist.
If you test this you should see two well deployed layers. If it does not work, the best thing to do is insert a line into the Orign and TileControl scripts to change the transparency to 60% after they have arrived at their proper location, and then slow the steps in 'Move' to 10 frames and watch for each tile to find its proper location and better help to identify bugs. I highly suggest doing this even if the grid does deploy correctly, so that you better understand how everything works so far. When you have gotten everything to work and are satisfied, implement as many rows as you like, but be careful not to go over the event limit. I use a 6 layer grid which uses 84 tiles. To find out how many tiles are needed, the formula is 2x^2+2x where x=the number of desired layers. And dont forget to save.
Memory Check=(w/6 layers) 315680
|
|
|
Post by vespuleth on Sept 20, 2006 18:55:16 GMT -5
While at this point, the grid will deploy, there are still a number of problems. Of most importance is that if a tile goes off the map, the grid crashes (go ahead and try it...). I would like to address this issue now.
To begin with, some variables are needed. Create six variables:
XMin, XMax, YMin, YMax, ZMin, ZMax
Note that the last two will be used later.
In the 'EnterTEstBattle' Script, which has been blank until now, add these lines (These values only apply to the current map described in an earlier step; see the following for more details):
Data>>Varable: XMin=0 Data>>Variable: XMax=14 Data>>Variable: YMin=0 Data>>Variable: YMax=14
These values set the 'boundaries' for the map. Because we have a 15x15 square, our mins and maxes reflect that. They are equal to the last possible X or Y coordinate a battle participant or tile can occupy and still be on the map. Please note that this only applies to a square or rectangular map. Boundary setting on irregularly shapped maps will be discussed another time (if at all...).
Next, access your 'TileControl' script, and, where the Move Script call is, delete the call and insert the following:
Condition: TempVar0>= XMin -Condition: TempVar0<=XMax --Condition: TempVar1>=YMin ---Condition: TempVar1>=YMax ----Call {Move} ---end condition --end condition -end condition end condition
Now the tiles will bypass boundaries and still go to their appropriate locations, wrapping around the boundary. This is because the TempVars are still modified; and only the move is not made.
|
|
|
Post by vespuleth on Sept 20, 2006 20:15:54 GMT -5
The Grid is far from perfect. However, to finish the grid, some other boundaries need to be implemented. To prepare for these, we will move toward implementing character involvement. To begin this, go to your game settings and create two new variables: OriginX and OriginY. Now go into your 'Origin' script, and, following the move call, place these lines:
Event Info Load OriginX = Event X OriginY = Event Y
This gives us permanant acces to the origin's location.
Now, go into the event database and create two new events: Participant1 and Participant2.
Make their models any two characters for now, but ensure that they each have a different model so you can tell them apart. Now go to the script database and create a new action script, ParticipantSort. Go back to Game Settings and create a new variable. Participant. In your new script, sort your new variable, and if 0 or 1, change control to the appropriate of the two participants created. Don't forget a 'no application' in the sort:
Sort Var: Participants -apply if: 0 --Control Participant 1 -to end -apply if: 1 --Control Participant 2 -to end -No app -to end end sort Event Info Load
Now place your Participant events on the map (actually deploying party members will be covered later).
//I have participant1 @ (5,6,1) and participant2 @ (8,9,1)
|
|
|
Post by vespuleth on Sept 20, 2006 20:54:42 GMT -5
The Controller script we have been utilizing has been sufficient to perform the tasks needed so far, but now we are going to need the controller to be able to distinguish a variety of different situations. To this end, we will be modifying the Controller script extensively. It is probably best to comment out or delete all that you have so far, so that your controller script has only the following:
Repeat while Flag0 = off -Input Button: Constant Wait --Condition: button = 4 --end condition end repeat
This is because alot of what has been happening in the ControllerScript will now be performed from called scripts for efficiency, and to lower chances of confusion and mistake.
To begin our editing, several new flags and variables need to be created.
Flags:
GridDeployed? MemberFound?
Variables:
MaxParticipants ActiveParticipi Enemies
With all of that created, we can work on a better controller script. To do this, the first thing we need to do is actually create another script, an action script 'FindMember'. This file will look like the following:
Repeat while Participants<MaxParticipants -Call[ParticipantSort] -If Event X = Party X --if Event Y = Party Y ---ActivePartici = Participants ---MemberFound=on ---to end //this ends the repeat when a character is found --end if -end if end repeat
This loads each participants information and compares it to that of the party.
In the EnterTestBattle Script, set Max Participants=2 (the current number of participants on the map)
In your Controller Script, add these lines inside of the Condition UserButton=4:
Flag: No Movement = on Participants = 0 Game Info Load Call [FindMember] Participants = 0 if MemberFound=on end if if MemberFound=off end if Flag: No Movement = off
//yes, these conditions are empty on purpose.
|
|