Matrix Games Forums

New information and screenshots for Pike & ShotDeal of the Week Pride of NationsTo End All Wars Releasing on Steam! Slitherine is recruiting: Programmers requiredPandora: Eclipse of Nashira gets release dateCommunity impressions of To End All WarsAgeod's To End All Wars is now availableTo End All Wars is now available!Deal of the Week: Field of GloryTo End All Wars: Video, AAR and Interview!
Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

How to add manpower. (ATG)

 
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 >> How to add manpower. (ATG) Page: [1]
Login
Message << Older Topic   Newer Topic >>
How to add manpower. (ATG) - 2/5/2013 7:30:38 AM   
ernieschwitz

 

Posts: 1561
Joined: 9/15/2009
From: Denmark
Status: offline
Here is a quick lesson in how to add manpower for Any scenario in ATG.

Ready? Here goes... (read the yellow text)





Attachment (1)

< Message edited by ernieschwitz -- 2/5/2013 7:31:00 AM >
Post #: 1
RE: How to add manpower. (ATG) - 2/5/2013 7:31:36 AM   
ernieschwitz

 

Posts: 1561
Joined: 9/15/2009
From: Denmark
Status: offline
Then, once you have done this.. do this...




Attachment (1)

(in reply to ernieschwitz)
Post #: 2
RE: How to add manpower. (ATG) - 2/5/2013 7:32:49 AM   
ernieschwitz

 

Posts: 1561
Joined: 9/15/2009
From: Denmark
Status: offline
Then once you have set the starting values for all regimes, for the manpower you think is appropriate... do the following:





Attachment (1)

(in reply to ernieschwitz)
Post #: 3
RE: How to add manpower. (ATG) - 2/5/2013 7:33:59 AM   
ernieschwitz

 

Posts: 1561
Joined: 9/15/2009
From: Denmark
Status: offline
Now that you have set all items you want to cost Manpower, and set that manpower at whatever levels you like... do this...




Attachment (1)

(in reply to ernieschwitz)
Post #: 4
RE: How to add manpower. (ATG) - 2/5/2013 7:35:13 AM   
ernieschwitz

 

Posts: 1561
Joined: 9/15/2009
From: Denmark
Status: offline
Now comes the hard part...
The coding of an event...
But don´t panic, i´ve written it for you... just follow the instructions.




Attachment (1)

(in reply to ernieschwitz)
Post #: 5
RE: How to add manpower. (ATG) - 2/5/2013 7:41:06 AM   
ernieschwitz

 

Posts: 1561
Joined: 9/15/2009
From: Denmark
Status: offline
Alright, now for explaining the event...

First we set the TempVar2 to be the current players turn. This is the same value as that players regime number. Useful to know.

Then we set the values for TempVar3 to TempVar5. They are what each city, capitol city, and town produce. I set them at 2, 4 and 1... but any value will do, as long as you think it is fitting.

Then we check all hexes on the map. We do this by making two loops. The first one goes across the map, looking at each hex, the second downwards, looking at each hex. Together they will cover the entire map.

For each hex we do a check. We check if the hex is owned by the current player, if it is we check if it is one of the location types (0, 1 and 20) that we noted earlier.

If it is, we set the RegimeVar that is the current players turn, to a value, the one we defined in TempVars3 to 5. And here i discover i have made a coding error....

Never fear, we can change that fast... will get right on it. :)

(in reply to ernieschwitz)
Post #: 6
RE: How to add manpower. (ATG) - 2/5/2013 7:51:36 AM   
ernieschwitz

 

Posts: 1561
Joined: 9/15/2009
From: Denmark
Status: offline
Right, as I was saying... there is an error in the code i made before, here is the new one. (Goes to show, you should always check the code before publishing).




Attachment (1)

(in reply to ernieschwitz)
Post #: 7
RE: How to add manpower. (ATG) - 2/5/2013 7:54:48 AM   
ernieschwitz

 

Posts: 1561
Joined: 9/15/2009
From: Denmark
Status: offline
As i was saying...

We check each hex, for a location, and if that location is something that we want it to be, we add this value to TempVar 6, which i just added to the code in Line 4, and set it´s initial value to 0.

If there is a location we add the values we selected for TempVar3 to 5, to TempVar6... thus getting a sum of numbers as we work through the map.

When all that is said and done.

We take our current value for TempVar 6 and add to it the value in the regimevar 6 (manpower). Getting the new manpower value.

We add this to the RegimeVar for the current players turn...

And we are done :)

(in reply to ernieschwitz)
Post #: 8
RE: How to add manpower. (ATG) - 2/5/2013 8:15:01 AM   
ernieschwitz

 

Posts: 1561
Joined: 9/15/2009
From: Denmark
Status: offline
There is still an error in the code!

DID YOU SPOT IT?

If not it is in the last two lines.
They should read:

SETVAR: TempVar6 + CheckRegimeVar(TempVar2,6)
EXECUTE: ExecSetRegimeVar(TempVar2, 6, TempVar6)

SO just imagine i wrote TempVar6 and not TempVar5 in those two lines, ok ;)

(in reply to ernieschwitz)
Post #: 9
RE: How to add manpower. (ATG) - 2/5/2013 6:56:07 PM   
mgaffn1

 

Posts: 165
Joined: 11/20/2009
Status: offline
This is a great thread - thanks for posting. Especially the coding.
You can take this and apply it to other resources: gold, manpower, depleted uranium, deuterium (for a sci fi scenario), virturally anything you can imagine.

(in reply to ernieschwitz)
Post #: 10
RE: How to add manpower. (ATG) - 2/6/2013 11:22:59 PM   
barerabbit

 

Posts: 139
Joined: 11/9/2007
Status: offline
Beautiful Job! Thank you. I think it is time for me to learn about event coding, and
I will use this as a start. It has always been easier for me to start with a working bit of code so I am not fighting syntax issues. Someone posted something about the npp editor here about a year ago, and he felt it was helpful in creating and organizing event code for AT(G). I would like to find the post if anyone can rember it's location or title. My searches have come up empty. Again, Thanks for the effort and patients here. This took a little while to do.

(in reply to ernieschwitz)
Post #: 11
RE: How to add manpower. (ATG) - 2/7/2013 5:20:42 AM   
lancer

 

Posts: 630
Joined: 10/18/2005
Status: offline
G'day Barerabbit,

I posted about using Npp which you can easily customise for use with the ATG editor. It's a big help.

Zen and the art of coding

Cheers,
Lancer

(in reply to barerabbit)
Post #: 12
RE: How to add manpower. (ATG) - 2/7/2013 11:48:12 PM   
barerabbit

 

Posts: 139
Joined: 11/9/2007
Status: offline
Thanks, Lancer. I have it working now. I think the editor might take some getting used to. I don't think you CAN make a syntax error.

(in reply to lancer)
Post #: 13
RE: How to add manpower. (ATG) - 2/8/2013 8:13:38 AM   
lancer

 

Posts: 630
Joined: 10/18/2005
Status: offline
G'day Barerabbit,

Syntax errors aren't your problem.

Once you start writing code modules you run into three main issues. First is Check/Unchecks. Very easy to write a Check and forget to do the Uncheck. Major reason for strange behaviour. Try and get in the habit of immediately inserting an Uncheck before doing anything else. In fact, it's a good idea to write the code module as a pure skeleton of check/unchecks and loop/unloops prior to putting in all the details. Get the structure in place first then backfill with the meaty bits.

Getting tangled up with a whole bunch of variables all over the shop can lead you to the same dark place of frustration. Take a moment to figure out a consistent variable naming convention and stick to it throughout. Pays dividends. I keep a separate Word file with tables containing master lists of all the variables, stringlists, regimevars, pics etc.

Lastly the code, once written, is just about unreadable. All those numerical variables and strange functions. Comment your code and then comment it again. If you haven't put a comment in, on average, after every three or four lines of code, you're going to find yourself left with a unreadable, unserviceable bunch of nothing. Try coming back to it three months later and figuring out what the heck you've done.

If you can avoid the above (I've crashed and burned with all three at various times) it'll be smooth sailing.

Cheers,
Lancer

< Message edited by lancer -- 2/8/2013 10:07:37 AM >

(in reply to barerabbit)
Post #: 14
RE: How to add manpower. (ATG) - 2/8/2013 9:32:16 AM   
ernieschwitz

 

Posts: 1561
Joined: 9/15/2009
From: Denmark
Status: offline
Totally agree with lancer on these points.

Also something that might be useful, at least for me, compile a list of what each rulevar does... looking at code and then coming to something akin to change rulevar this and that using this tempvar and that tempvar, is very very frustrating, at least when you are reading code.

(in reply to lancer)
Post #: 15
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> How to add manpower. (ATG) 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.102