Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Random Game Hacks: Setting up Manpower

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> Random Game Hacks: Setting up Manpower Page: [1]
Login
Message << Older Topic   Newer Topic >>
Random Game Hacks: Setting up Manpower - 7/20/2019 7:43:10 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
I've been playing around a little with event code and have figured a few things out. I thought it might be nice to share my discoveries for other novices to use or learn from.

In this tutorial I will create a new resource called "Manpower". Each regime in a random game will start out with a certain amount of "Manpower" according to how many victory points it possesses and each turn "Manpower" will increase incrementally according to how many victory points each regime possesses. This way, the more victory points (via cities) a player controls, the more manpower they will generate each turn. And, since the starting manpower is also based on VPs, your starting manpower will fluctuate per game you start according to how many cities get placed on the map for each regime. The number of victory points (cities) a regime possesses at the start generally depends upon the map size you choose in setting up a random game and the number of other regimes you choose to inhabit your world.

STEP 1: Creating the resource "Manpower".

First click "Load Scenario" in the main menu and choose the anewdawn3.at2 file in the editor. (IMPORTANT NOTE: When you save your work, save it under a different name so you don't overwrite the standard anewdawn3.at2 file.)

In the editor click the "Setng" button.
1. Choose "RegimeSlotNames 0-499".
2. Choose an empty slot (in this case slot number 10 for me).
3. Click the "Change String" button and type the name of your new resource (in this case, "Manpower") in the little popup window that comes up.
4. Click the button next to "Show" to toggle the value to "True". "True" means the new Regime slot value (the total quantity that your regime possesses) will be shown on the menu bar at the top of the screen during the game just like "Political Points", "Raw", and "Oil" are. That way you can keep track of when you are running low on your new resource.




Attachment (1)

< Message edited by GaryChildress -- 7/20/2019 7:44:40 PM >
Post #: 1
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 8:27:52 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
STEP 2: Coding the event to establish the initial quantity of "Manpower".

For this part we're going to go into the "Event" part of the editor. So click on the little button in the top left of the editor called "Event". This will take you into a new screen. (NOTE: In order to exit this screen at any time you need to click on the pink X next to "Exit Event Screen".)

Once you open the event editor screen scroll to event #9 ("Random: Initial raw & oil") in the list of already created events. Event #9 sets the initial values of raw and oil when you first begin a random game. We're going to expand on this event to include the initial quantity of manpower that each regime will receive. After clicking on event #9 your screen should now look something like the picture below.




Attachment (1)

(in reply to GaryChildress)
Post #: 2
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 8:38:19 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
Now we're going to add three empty lines of code to event #9 on which we will later put our new code to set initial manpower.

1. Within event #9, click on the line of code numbered "3". It says "EXECUTE: ExecSetRegimeVar (TempVar0, 4, 5000)".
2. Once line #3 is selected, click three times on the light blue button with the "+" sign on it. Each time you click the button it will add a new line underneath the selected line.

The 3 new lines will all say "EMPTY" and should now be numbered lines 4 through 6 as shown below:





Attachment (1)

(in reply to GaryChildress)
Post #: 3
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 8:55:05 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
Next were going to fill the first empty line with a code that will tell the machine to set a temporary variable (TempVar1) equal to the number of victory points that a regime has at the start of the game.

quote:

(NOTE: The "LOOPER" at the beginning of event #9 basically sets up a sequence whereby each regime in a game is set to be represented in the code by TempVar0. So your TempVar0 will start out with a value of "0" and then go up to the number of regimes in a game (starting at 0). So in a game with 3 regimes, TempVar0 will start with a value of 0 and then loop through values 1 and 2 during the repeated sequence of operation.)


1. Choose line #4 by clicking on it.
2. Next click on the button that says "SETVAR" at the bottom of the event screen. clicking on that button will take us to the next picture.





Attachment (1)

(in reply to GaryChildress)
Post #: 4
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 9:16:59 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
1. Now line #4 should say, "SETVAR: Empty Empty Empty" and there should be a new set of 3 buttons at the bottom of the screen (each corresponding to one of the words "Empty" on line #4. the buttons should say:

SETVAR: Empty
SETTYPE: Empty
VALUE: Empty

"SETVAR" means you are going to set a variable in the code (a temporary one) and it will be given a value based on the operation you choose under "SETTYPE", the value itself being what you choose when you click on the "VALUE" button.

Let's go ahead and click on those buttons now:

2. Click on "SETVAR" and then click on TempVar in the next screen. A dialog box should pop up telling you to "Give a TempVar number between 0 and 999". type the number 1 in that screen. (We're choosing 1 because it should be a free number in this event since the event has so far only set a TempVar0 at the beginning. So any number other than 0 should be fine.

3. Now click on "SETTYPE". For this particular operation we want to tell the machine to give TempVar1 a value = to something. So choose the "=" function in the screen that follows.

4. Now click on "VALUE". We're going to tell the machine to set TempVar1 to equal the number of victory points possessed by the regime it is doing the operation for. So on the screen that follows choose "CheckType". "CheckType" will tell the code to check the value of something in the game and set TempVar1 equal to that value (in this case Victory Points). So when you click on "CheckType" go to the next post below and follow the steps shown.





Attachment (1)

(in reply to GaryChildress)
Post #: 5
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 9:32:00 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
We left off above, you clicked on the "VALUE" button and then chose "CheckType". That should have brought you to a screen that looks like the one below. Remember we want the code to check the number of victory points. To find that function we need to do the following:

1. Choose "Regimes" from the list of categories. This category makes sense because we want to know the number of victory points associated with a regime.

2. Down toward the bottom you will see a function called, "CheckVP". That's the one we want so highlight it.

3. Next click on the button in the upper right that says "Select" next to it. In the screen that follows you want to choose "TempVar" and then type "0" in the dialog box that follows.

Remember at the beginning of the code the looper said to set TempVar0 to the regime count? Now when the code reaches each regime in the count it will create a temporary variable called TempVar1 and assign it the number of victory points possessed by the regime being referred to in TempVar0.

So TempVar1 has now been set to the number of VPs owned by each regime in the sequence.





Attachment (1)

(in reply to GaryChildress)
Post #: 6
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 9:47:08 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
For the sake of this tutorial I'm going to multiply the number of victory points owned by each regime by 2000 to arrive at the initial amount of manpower for each regime. You can choose another number if you like, whatever feels right to you.

1. Go to the next line in the event.
2. Again choose, "SETVAR" to set a variable to a value.
3. Again, when the three buttons appear on the bottom, choose TempVar1 under "SETVAR". Remember, according to the line of code directly above, TempVar1 currently has a value equal to the number of victory points for the regime in the sequence. We want to multiply that number by 2000. Therefore
4. Click on "SETTYPE" and choose "Multiply".
5. Now click on "VALUE" and this time choose "Real Number" in the next screen and type 2000. This means that Temporary variable #1 which had a value equal to the number of VPs for the regime will now be multiplied by 2000 and the result will be the new value for Temporary variable #1. So TempVar1 now equals VPs x 2000.




Attachment (1)

< Message edited by GaryChildress -- 7/20/2019 9:49:08 PM >

(in reply to GaryChildress)
Post #: 7
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 10:16:58 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
Finally for this phase of the operation we want to set the manpower of the regime equal to TempVar1 (VPs x 2000). For that we're going to need to execute a predefined procedure.

1. Choose the empty line #6.
2. Click on the button that says "EXEC".
3. Now click on the button that says "EXECTYPE" at the bottom of the screen.






Attachment (1)

(in reply to GaryChildress)
Post #: 8
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 10:20:49 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
1. On the following screen click on the category "Logic & Vars".
2. Select the function "ExecSetRegimeVar".
3. Click the "Select" button.




Attachment (1)

(in reply to GaryChildress)
Post #: 9
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 10:36:09 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
1. After you click the select button you will be prompted to enter each of three values consecutively. The first value is the regime #. For that you click the TempVar button and type 0 because TempVar0 is the regime # in the line event. 2nd it prompts you for the variable #. If you recall I created a new RegimeSLot number in the very first post called "Manpower". The slot number was 10 because it was an empty slot. So for the 2nd value you want to type 10. And finally for the third value it wants the new value of the item in that regime slot. So choose "TempVar" again and type in 1 for the 3rd value. If you mess up at any point in the list just go to the bottom of the page at the end of the prompts and type in the values for each slot (in the picture #s 2, 3 & 4).

What that all means is that the code will "Execute" setting the regime variable #10 for the regime represented by TempVar0 to the value of TempVar1 (which was VPs x 2000). So in effect it is setting the "Manpower" slot of each regime to victory points possessed by that regime x 2000 for the start of the game.






Attachment (1)

(in reply to GaryChildress)
Post #: 10
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 10:49:11 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
STEP 3 in the process will be setting up Manpower to increase incrementally each turn as the game goes on. For that We'll need to do a brand new event in the editor.

1. Go to the end of the event list and click on the last event. That should be #140 in the anewdawn3.at2 scenario.
2. Click on the light blue button with a "+" on it on the top far right side of the screen to create a new line.
3. Name the event something like "Manpower Increase per Turn" by clicking on the button in the middle left side of the screen.
4. Now add a new blank line of code in the event and click on the blank line.
5. The rest of the buttons now populate the screen. Click a couple times on the button that should say "No Check" until the button says "Round Check" next to it. That creates the condition so that the event is run every turn of the game.
6. Next to line 141 where your new event is located it should now say "Round Check".




Attachment (1)

(in reply to GaryChildress)
Post #: 11
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 11:07:21 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
Now we're going to flesh out our new event a little.

1. click on the first empty line to highlight it.
2. next click on the light blue button with the "+" sign just above it 5 times. This will add 5 more lines to your event. There should now be 6 lines to the event (numbered 0 through 5).
3. With the first line still highlighted click on the button that says "LOOP" near the bottom of your screen. This will change the first line into a looping sequence.
4. As soon as you click on the "LOOP" button, 3 more buttons should appear on the bottom of the screen labeled, "TEMPVAR", "STARTVAL" and "ENDVAL. The "TEMPVAR button will default to a value of "TempVar0". We're going to leave it at that value.
5. Now go to the 6th line in your event (actually line #5) and highlight it.
6. Click on the button labeled "END.LP". This will end the loop so that it doesn't just keep repeating forever.




Attachment (1)

(in reply to GaryChildress)
Post #: 12
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 11:18:58 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
Let's add the other two components of the looper line now.

1. Click on the button next to "STARTVAL" and then click "Real Number" and type 0 in the pop up window that follows.
2. Click on the button next to "ENDVAL" and then click on "Check Type". Click on the category "Game & Map globals" and then choose "CheckRegimeCount" in the middle of the list that appears next to it.

This means you are going to run a loop equal to the number of regimes where TempVar0 will have a value equal to one of the regime numbers each time the loop is played through (and the loop will only play through the number of times equal to the regime count).




Attachment (1)

< Message edited by GaryChildress -- 7/20/2019 11:20:09 PM >

(in reply to GaryChildress)
Post #: 13
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 11:35:12 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
Now we're going to define a new variable and call it TempVar1 and like we did up above, we're going to set TempVar1 equal to the number of victory points owned by the regime already represented in TempVar0.

1. Choose the next empty line of your event (should be the 2nd line numbered "1").
2. Click on the "SETVAR" button.
3. Click on the button next to "SETVAR" that now appears on the bottom of the screen. Choose "Temp Var" from the follow up menu and type 1 in the pop up dialog box. This names our new variable "TempVar1".
4. Click the "SETTYPE" button and choose "=" from the list.
5. Click the "VALUE" button and choose "Temp Var" from the follow up menu and type 0 in the pop up box.

Now the line should read as shown below: "SETVAR: TempVar1 = CheckVP(TempVar0)"

You set up a new variable called TempVar1 and gave it the value of equals number of victory points for the regime represented by temporary variable 0.




Attachment (1)

(in reply to GaryChildress)
Post #: 14
RE: Random Game Hacks: Setting up Manpower - 7/20/2019 11:48:14 PM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
Remember for the initial value of Manpower to start a game we multiplied victory points by 2000. For the incremental increase each turn we'll be a little more sparing. Let's multiply victory points by 50 this time for the turn increments.

1. Choose line #2 (the third line in your event).
2. Click on the "SETVAR" button again.
3. Click to "SETVAR" at the bottom now and choose Temp Var and type 1 in the pop up window to follow.
4. Click "SETTYPE" to multiply.
5. Click "VALUE" and choose "Real Number" and type 50 in the window to follow.

Now your line should read: "SETVAR: TempVar1 * 50". This recalls temporary variable 1 which was set to number of victory points in the preceding step and multiplies that value by 50 to reset it's value to 50 multiplied by victory points.






Attachment (1)

(in reply to GaryChildress)
Post #: 15
RE: Random Game Hacks: Setting up Manpower - 7/21/2019 12:05:54 AM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
Next we want to add the amount of Manpower currently in stock for each regime to TempVar1 to come up with total manpower for the turn.

1. Choose the next open line.
2. Click on "SETVAR".
3. Click the "SETVAR" button that now pops up on the bottom, choose "Temp Var" and type 1 in the pop up window to follow.
4. Click "SETTYPE" to "+" (addition). We want to add the regimes current manpower to the newly created manpower to come up with the total.
5. So click the "VALUE" button and choose "Check Type". Then highlight the category "Regimes" and choose "CheckRegimeVar" in the list to the right. Now it will prompt you for two more values. The first value is going to be the regime number. For that you want to choose "Temp Var" and type 0 in the pop up window. Next it prompts for variable number (Var #). We already know what regime variable we want to work with so you want to choose "real number" and type 10 (the slot for Manpower).






Attachment (1)

(in reply to GaryChildress)
Post #: 16
RE: Random Game Hacks: Setting up Manpower - 7/21/2019 12:58:16 AM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
So now the value of temporary variable 1 is equal to (victory points x 50) + the amount of manpower already in stock. All you need to do now is actually set the value of manpower in game to that number (represented by TempVar1) for each regime. For that we'll use an "Execute" function.

1. Choose the final empty code line (the one just above "END LOOPER").
2. Click the "EXEC" button.
3. Click the EXECTYPE" button. Click on the category "Logic & Vars". Choose "ExecSetRegimeVar" from the list on the right and then the "Select" button. You'll be prompted for the regime number: choose "Temp Var" and type 0 in the pop up window. Then you'll be prompted for the variable number: choose "Real Number" and type 10 (the slot for Manpower). Finally it will ask you for the new value for that field. The new value is TempVar1, so choose "Temp Var" and type 1 in the pop up window.

the last line should already say "END LOOPER" so you're all set. Each and every turn (round) the game will run a check (round check) to determine how many VPs each regime has, multiply each regime's VPs by 50 and then add it to the "Manpower" pool.

The only thing left to do is add "Manpower" as part of the cost of producing an item.






Attachment (1)

(in reply to GaryChildress)
Post #: 17
RE: Random Game Hacks: Setting up Manpower - 7/21/2019 1:09:41 AM   
GaryChildress

 

Posts: 6760
Joined: 7/17/2005
From: The Divided Nations of Earth
Status: offline
For the final page of the tutorial: a quick demo of how to add "Manpower" as a cost of producing something.

1. Click on the "Items" button.
2. Choose each unit you wish to give a "manpower" cost to. (In this case I chose the "rifle" unit)
3. Click on any unused button that says "No RegimeSlotCost Needed". It will then prompt you for a regime slot. Again, if you recall, we used slot #10. So type 10 in the pop up. Then it asks for the amount of that resources used. For this example I used 3 for a rifle. (Perhaps I could use less for non-infantry formations.)

Repeat for each and every unit that you want to use manpower.

And you're done.

Save your work to a new file name. Then when you go to play a random game, choose your new scenario file instead of anewdawn3. (There's a button you can click on the New Dawn random game generator that allows you to substitute other files for the default one.)




Attachment (1)

(in reply to GaryChildress)
Post #: 18
RE: Random Game Hacks: Setting up Manpower - 11/7/2019 3:13:17 PM   
CSO_Talorgan


Posts: 723
Joined: 3/10/2007
Status: offline
Could something similar create "Supplies", upon which operations depend, and which we might fight over?

(in reply to GaryChildress)
Post #: 19
RE: Random Game Hacks: Setting up Manpower - 11/8/2019 2:47:49 AM   
ernieschwitz

 

Posts: 3212
Joined: 9/15/2009
From: Denmark
Status: offline
quote:

ORIGINAL: CSO_Talorgan

Could something similar create "Supplies", upon which operations depend, and which we might fight over?


Not sure what you mean. Supplies are already part of the game, but are not a regimevar so they are treated differently.

(in reply to CSO_Talorgan)
Post #: 20
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> Random Game Hacks: Setting up Manpower Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.148