How to add manpower. (ATG)

Discuss and post your mods and scenarios here for others to download.

Moderator: Vic

Post Reply
User avatar
ernieschwitz
Posts: 4240
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

How to add manpower. (ATG)

Post by ernieschwitz »

Here is a quick lesson in how to add manpower for Any scenario in ATG.

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


Image
Attachments
Guide001.jpg
Guide001.jpg (175.82 KiB) Viewed 102 times
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4240
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How to add manpower. (ATG)

Post by ernieschwitz »

Then, once you have done this.. do this...

Image
Attachments
Guide002.jpg
Guide002.jpg (142.46 KiB) Viewed 102 times
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4240
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How to add manpower. (ATG)

Post by ernieschwitz »

Then once you have set the starting values for all regimes, for the manpower you think is appropriate... do the following:


Image
Attachments
Guide003.jpg
Guide003.jpg (206.55 KiB) Viewed 102 times
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4240
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How to add manpower. (ATG)

Post by ernieschwitz »

Now that you have set all items you want to cost Manpower, and set that manpower at whatever levels you like... do this...

Image
Attachments
Guide004.jpg
Guide004.jpg (71.54 KiB) Viewed 102 times
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4240
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How to add manpower. (ATG)

Post by ernieschwitz »

Now comes the hard part...
The coding of an event...
But don´t panic, i´ve written it for you... just follow the instructions.

Image
Attachments
Guide005.jpg
Guide005.jpg (158.03 KiB) Viewed 102 times
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4240
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How to add manpower. (ATG)

Post by ernieschwitz »

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. :)
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4240
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How to add manpower. (ATG)

Post by ernieschwitz »

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).

Image
Attachments
Guide006.jpg
Guide006.jpg (89.9 KiB) Viewed 102 times
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4240
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How to add manpower. (ATG)

Post by ernieschwitz »

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 :)
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
ernieschwitz
Posts: 4240
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How to add manpower. (ATG)

Post by ernieschwitz »

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 ;)
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
mgaffn1
Posts: 175
Joined: Fri Nov 20, 2009 3:54 pm

RE: How to add manpower. (ATG)

Post by mgaffn1 »

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.
Mike
ghoward
Posts: 147
Joined: Fri Nov 09, 2007 8:32 pm

RE: How to add manpower. (ATG)

Post by ghoward »

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.
lancer
Posts: 2963
Joined: Tue Oct 18, 2005 8:56 am

RE: How to add manpower. (ATG)

Post by lancer »

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
ghoward
Posts: 147
Joined: Fri Nov 09, 2007 8:32 pm

RE: How to add manpower. (ATG)

Post by ghoward »

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.
lancer
Posts: 2963
Joined: Tue Oct 18, 2005 8:56 am

RE: How to add manpower. (ATG)

Post by lancer »

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
User avatar
ernieschwitz
Posts: 4240
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: How to add manpower. (ATG)

Post by ernieschwitz »

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.
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
Post Reply

Return to “Mods and Scenarios”