How to add manpower. (ATG) (Full Version)

All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios



Message


ernieschwitz -> How to add manpower. (ATG) (2/5/2013 7:30:38 AM)

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

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


[image]local://upfiles/32858/903501664A0A429EBA435DDA62A226D2.jpg[/image]




ernieschwitz -> RE: How to add manpower. (ATG) (2/5/2013 7:31:36 AM)

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

[image]local://upfiles/32858/A1DFC03A154A44C4897DE1B4A3B9C292.jpg[/image]




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

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


[image]local://upfiles/32858/40D4B50AA42D4A95B866DE6EE6CD203A.jpg[/image]




ernieschwitz -> RE: How to add manpower. (ATG) (2/5/2013 7:33:59 AM)

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

[image]local://upfiles/32858/F874F3EDB8AD448E9AA75D6FC980C3EF.jpg[/image]




ernieschwitz -> RE: How to add manpower. (ATG) (2/5/2013 7:35:13 AM)

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]local://upfiles/32858/ACD048A5389C4F939040E4E0E84C08B7.jpg[/image]




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

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




ernieschwitz -> RE: How to add manpower. (ATG) (2/5/2013 7:51:36 AM)

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]local://upfiles/32858/6698FB49F9594C2C87C037078F0EEC15.jpg[/image]




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

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




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

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




mgaffn1 -> RE: How to add manpower. (ATG) (2/5/2013 6:56:07 PM)

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.




barerabbit -> RE: How to add manpower. (ATG) (2/6/2013 11:22:59 PM)

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 -> RE: How to add manpower. (ATG) (2/7/2013 5:20:42 AM)

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




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

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 -> RE: How to add manpower. (ATG) (2/8/2013 8:13:38 AM)

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




ernieschwitz -> RE: How to add manpower. (ATG) (2/8/2013 9:32:16 AM)

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.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
2.734375E-02