WAR!
#2
Now like I stated earlier, the very first map in my demo used a simple Map Event to change the values of three RMXP variables:

@>Control Variables: [0001: HERO ARMY Size] = 5000
@>Control Variables: [0002: ENEMY ARMY Size] = 5000
@>Control Variables: [0003: ENEMY ARMY Decision] = Random No. (0...3)


And again, all this does is reset both armies to have 5000 troops each and decides what the first action the enemy army will take. After that, your hero's characterset graphic was erased and you were then transported to the battlefield you chose. In this case...

WAR #1:
STATIC ARMIES

The basic premise of this war system is simply a 'Rock, Paper, Scissors' game. You only have three options to choose from in battle: Sword, Bow or Staff. And it works pretty much the same as the old 'Rock covers Paper' system. Sword attacks can beat the archers, Bow attacks can beat the mages and the Staff attacks work wonders on the infantry.


Screenshots.
Just one...


Setting up the look of the battlefield.
As this is a simple battlefield system, you only need one standard-sized map of 20x15. Decorate this 'battlefield map' as you see fit, but try to leave the bottom half of the screen relatively bare so your armies can be seen in the field. Of course, this is only a suggestion. You may alter or change the layout of your battlefield so the armies aren't facing each other side to side but top down.

Setting up the Armies
As a general practice, most event-based army battles are played with RPGMaker XP in a side-to-side fashion. Enemy troops placed along the left side of the screen and the hero's army along the right. Again, let me just say that this is just a suggestion and can be changed to suit your tastes.

The Hero's General
The master control of this battlefield is controlled through the Hero's Event. It is a map event that comprises 6 pages of event code and most of these are parallel process events. It is by this set of events that your battlesystem works and you get to decide the actions of your troops.

Page #1 - The Introduction Page:
Graphic is set to a hero's image
Switches are not used
Variables are not used
SelfSwitches are not used
Trigger is set to AutoRun
Options are set to 'Move Animation' and 'Always on Top'

Other than this page being the first event activated, not much is really performed in this page. It merely presents some dialog before the battle begins and 'may' give a briefing on how to play the battlesystem. After it has played out, it then (FINALLY) turns on Switch #1 to start the battlesystem.

Introduction Event Code

As you can see, the only value used here is the 0001: BATTLE Begin Switch. It activates the next series of pages and allows the battlesystem to function.

-----


Page #2 - The Hero Decision Page:
Graphic is set to a hero's image
Switches are set to #0001: BATTLE Begin
Variables are not used
SelfSwitches are not used
Trigger is set to Parallel Process
Options are set to 'Move Animation'

This is literally the heart of the system. Once the 1st page has completed performing its actions this page and its related 'Action' pages will take over and will continually run until the battle is over.

From here, your player will decide what action the army will take, be it Sword, Bow or Staff. And just to be on the safe side, this demo's system uses an extra 'Yes/No' confirmation in case the player chose the wrong option by accident. In any event, one of three switches (#3, #4 or #5) will be turned on to identify which action the player chose to take.

Hero Decision Event Code

To make it example simple here, I merely showed the 'Sword/Bow/Staff' decision and didn't show the additional 'Yes/No' choice. This was to show you that each decision available merely turned on a switch. If you chose the 'Sword', you activate the 0003: ACTION - Sword Switch. If you chose the 'Bow', you activate the 0004: ACTION - Bow Switch And if you chose the 'Staff', you activate the 0005: ACTION - Staff Switch.

Once you make your decision, control of the battlesystem will be turned over to a page in this event that has a matching Switch condition (which ever switch you just turned on: Sword, Bow or Staff).

Other than you inserting finer details like text of the 'yes/no' confirmation case (your choice), that is all that is necessary for this page.

-----


Page #3 - The Sword Action Page:
Graphic is set to a hero's image
Switches are set to #0001: BATTLE Begin and #0003: Action - Sword
Variables are not used
SelfSwitches are not used
Trigger is set to Parallel Process
Options are set to 'Move Animation'

One of the big 'Action Control' pages, this page becomes active once the '0003: ACTION - Sword' switch is turned on.

Basically, this event starts off by randomly choosing an action for the enemy, and then it branches to one of three conditions based on that random enemy action. Each of these three conditions calculat what the enemy and hero army losses are depending on that action against the hero's use of the 'Sword' action.

Let's look at it in a 'simplified' manner.

Sword Event Code

This sample code doesn't have the flashy graphics or sound effects as the demo does, but it does present you with the inner workings of the system.

Again... as I have stated earlier, this page will decide what action the enemy army will take. This is performed by choosing a random number between 1 to 3 and storing the value within variable 0003: ENEMY ARMY Decision. This random number represents the enemy's chosen action of 'Sword, Bow or Staff. After the random number is chosen, the system performs a series of Conditional Branches.

The first branch (Variable [0003: ENEMY ARMY Decision] == 1) plays out what would happen if both the Hero and Enemy use the sword... a tie with both armies losing 400 men. The hero's army is reduced by subtracting 400 from the. 0001: HERO ARMY Size variable and the enemy army is reduced by subtracting 400 from the 0002: ENEMY ARMY Size variable. And with each reduction in size, a message box will show to describe the results to the player. Remember your basic text options: \v[1] will display the value in variable #1 and \v[2] will show the value in variable #2.

The second and third branches play out the same way, but the outcomes are different. The second branch assumes that the enemy used a bow and is overrun by the hero and he loses 600 men. Meanwhile the third branch assumes the enemy was fortunate and used the staff command, blasting the hero who loses 600 of his own.

And finally, after all of these decisions are done, the the 0003: ACTION - Sword switch is turned off. This releases control of the battlesystem back to the Hero Decision Page (Page #2), where you can decide upon another action... Sword, Bow or Staff.

-----


Pages #4 and #5 - The Bow and Staff Action Pages:
Graphic is set to a hero's image
Switches are set to #0001: BATTLE Begin and either #0004: Action - Bow or #0005: Action - Staff
Variables are not used
SelfSwitches are not used
Trigger is set to Parallel Process
Options are set to 'Move Animation'

These two pages are like the Sword Action page in that they too are large 'Action Control' pages. They only become active once the '0004: ACTION - Bow' or '0005: ACTION - Staff' switch is turned on.

Rather than re-displaying the entire code for both Bow and Staff pages, let me just say that the code within mirrors the Sword action pages with the exception of the outcome based on the enemy's reaction to the attack.

Again. this event starts off by randomly choosing an action for the enemy, and then it branches to one of three conditions based on that random enemy action. But unlike the Sword page, the outcomes will be based on the hero's use of either Bow or Staff. The same variables that determine the enemy's reaction (#0003) and the size of the Hero's and Enemy's armies (#0001 and #0002) are exactly the same. The only real differences will be within the conditional branches and the number of troops lost.

For the Bow page, the first condition will reflect the heroes using a bow while the enemy uses the sword. Basically, the hero loses 600 men. The second condition will reflect both heroes and enemies using bows so both lose 400 men. And the third condition in the Bow page will reflect the heroes pummelling the enemy, making the enemy lose 600 men.

The Staff page isn't that much different. It just reflects hero and enemy losses in a different manner.

And after all is performed, their respective 0004: ACTION - Bow or 0005: ACTION - Staff switch is turned off, releasing control back to the Hero Decision Page.

-----


Page #6 - The End Battle Page:
Graphic is set to a hero's image
Switches are set to #0002: BATTLE Ends
Variables are not used
SelfSwitches are not used
Trigger is set to Action Button
Options are set to 'Move Animation'

A necessary evil, this page holds no events calls and will halt all actions performed by this event. Basically, this ends the battlesystem's action system.


The Enemy's General
While the Hero's Event controls the working system, it is the Enemy's event that determines and controls 'end-of-battle' results. This map event has only 4 pages of event code that are mostly parallel processes or auto-run features. It's pretty much a simple system.


Page #1 - The Introduction Page:
Graphic is set to an enemy's image
Switches are not used
Variables are not used
SelfSwitches are not used
Trigger is set to Action Button
Options are set to 'Move Animation'

The first page is a blank page. In this instance there is nothing going as the battle hasn't started. It's pretty much dead weight, but necessary.

-----


Page #2 - The Judgement Page:
Graphic is set to an enemy's image
Switches are set to #0001: BATTLE Begin
Variables are not used
SelfSwitches are not used
Trigger is set to Parallel Process
Options are set to 'Move Animation'

This page runs constantly once the battle starts thanks to Switch #1 being turned on.

The function of this page is very simple. It runs checks on the enemy's and hero's army size and turns on a switch signalling the defeat of an army.

The code is so simple...

Judgement Event Code

See?

The first branch checks to see if the enemy's army (0002: ENEMY ARMY Size) had reached or gone below 0. This would mean the defeat of the enemy. Once that is done, the system would turn on two switches: 0008: DEFEAT - Enemy and 0002: BATTLE End. The first switch signals that the enemy's army was defeated (and not the hero's). The second switch turns off the battle.

The second branch mirrors the first as it checks to see if the hero's army (0001: HERO ARMY Size) had reached or gone below 0. Once that is confirmed, the system would turn on two switches: 0007: DEFEAT - Hero and 0002: BATTLE End. The first switch signals that the hero's army was defeated (and not the enemy), while the second switch turns off the battle.

That's really all there is.

-----


Page #3 - The Hero's Defeat Page:
Graphic is set to an enemy's image
Switches are set to #0007: DEFEAT - Hero
Variables are not used
SelfSwitches are not used
Trigger is set to AutoRun
Options are set to 'Move Animation'

This is one page that the player really doesn't wanna see, but is necessary. The page that runs when the player loses the war.

It is activated when the Hero's defeat is determined in the previous Judgement page. After the Judgement page turns the 0007: DEFEAT - Hero switch on, this page takes hold and runs uninterrupted thanks to the 'AutoRun' trigger.

No fancy switches turned on or off. No variables added to or subtracted from. Nothing. This page really doesn't do too much other than transferring the player to the 'Game Over' screen, but gamemakers will typically add text to personalize the defeat of the hero as you can see below.

@>Wait: 15 frame(s)
@>Text: Ahhhhh!
@>Wait: 20 frame(s)
@>Change Screen Color Tone: (-255,-255,-255,0), @20
@>Game Over
@>


-----


Page #4 - The Hero's Victory Page:
Graphic is set to an enemy's image
Switches are set to #0008: DEFEAT - Enemy
Variables are not used
SelfSwitches are not used
Trigger is set to AutoRun
Options are set to 'Move Animation'

Now this is the page the player WANTS to have run. This page runs when the player wins the battle the battle

Like the Defeat page above, this one doesn't have any fancy switches or variables being adjusted. What this page performs, however, is that you are transported out of the battlefield and the hero's characterset graphic is restored. Any additional text can be added to personalize the victory.

@>Wait: 15 frame(s)
@>Text: We WON! CHEEERRSSSS!
@>Wait: 20 frame(s)
@>Transfer Player:[002: VICTORY MAP], (009,007), Down
@>Change Actor Graphic: [Aluxes], 001-Fighter01, 0,,0
@>


The Troops
While the hero and enemy generals control the war system, it's the troops that fill the screen. Placed alongside or in front of their respective commanders on the map, these events represent the men on the field. Each event holds 2 pages or conditions based on troop strength and these two pages are devoid of event calls. They perform no action other than being displayed. Each of these troops are similar in design with the exception of the graphics used and the Army Size variable and value condition.

Page #1 - The Empty Page:
Graphic is left empty
Switches are not used
Variables are not used
SelfSwitches are not used
Trigger is set to Action Button
Options are set to 'Move Animation'

This page is intentionally left blank. No fancy switches, no variables and not even a graphic. This event is only turned on or activated if certain conditions or values are met.... Basically if this TROOP event is killed.

--

Page #2 - The Troop's Alive Page:
Graphic is set to either a hero's or enemy soldier's image
Switches are not used
Variables are set to 0001: HERO ARMY Size or 0002: ENEMY ARMY Size (and set to a value indicating army strength)
SelfSwitches are not used
Trigger is set to Action Button
Options are set to 'Move Animation'

This page is different. It is customized and reflects a number of troops on the field... from either the hero's or the enemy's army. If this event represents members of the hero's army, the graphic used in this page will be that of the hero's soldiers and the variable used would be 0001: HERO ARMY Size. Otherwise the graphic used in this page will be that of the enemy's soldiers and the variable used would be 0002: ENEMY ARMY Size.

And with each troop, you adjust the 'condition' to be met by the army size variable (either 0001 or 0002). The range of this value condition may be as low as '1' which is met if almost the entire army is wiped out, or as high as 4000 if the army has 4000 troops or more.

The number of troops for the hero's or enemy's army is really up to you, the game designer.

And after that... it's ready to run.


After the battle...
Well, this was designed for use once, but resetting the system is a piece of cake. It's just a matter of restoring your hero's characterset graphic (like I stated in the Hero's Victory page earlier), resetting your variables and switches, and making a new battlefield map with similar events. Dialog may be different... the army sizes may be different and the teleport event may take the hero to a different map... but the basic mechanics will be the same. But what you need to reset is pretty short:

Switches:
0001: BATTLE Begin
0002: BATTLE End
0003: ACTION - Sword
0004: ACTION - Sword
0005: ACTION - Sword
0007: DEFEAT - Hero
0008: DEFEAT - Enemy

Variables:
0001: HERO ARMY Size
0002: ENEMY ARMY Size
0003: ENEMY ARMY Decision

And there you have it. One complete War system.
Reply }


Messages In This Thread
WAR! - by DerVVulfman - 12-19-2008, 07:52 AM
RE: WAR! - by Raphael Rpg Games - 01-08-2014, 01:10 AM
RE: WAR! - by DerVVulfman - 01-08-2014, 04:34 AM
WAR! - by DerVVulfman - 12-19-2008, 07:53 AM
WAR! - by DerVVulfman - 12-19-2008, 07:55 AM
WAR! - by DerVVulfman - 12-19-2008, 08:01 AM
WAR! - by Habs11 - 03-28-2010, 11:47 PM
WAR! - by deValdr - 06-30-2010, 03:23 PM



Users browsing this thread: 4 Guest(s)