How to Count? (Full Version)

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



Message


GunnyJarhead -> How to Count? (4/25/2014 2:41:27 AM)

I am trying to figure out how to count the number of a particular landscape type (or Items or ocations etc...) that a regime owns at the start of there turn.

Added a Regime Slot "Wheat"
Set Each Regime's Slot to Zero

I want to count how many fields a regime owns at the start of its turn and add 1 to the regime slot wheat for each field hex owned

Any Help will be appreciated!







ernieschwitz -> RE: How to Count? (4/25/2014 3:08:10 AM)

You want to know how many fields (that is how many of the landscape type fields) is owned?

You need to make a looper, or rather two loopers.

The first looper will go across the board from 0 to mapwidth

The second looper will go down the board from 0 to mapheight

after these you need to set a check for hextype = fields

then a counter (tempvar) that you assign the value +1

end check

end looper

end looper

That is more or less the structure of it.




GunnyJarhead -> RE: How to Count? (4/25/2014 3:50:11 AM)

Ok this is what I have

I can Count just cant add to the regimevariable


0) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
1) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
2) CHECK: CheckLandscapeType(TempVar0, TempVar1) == 3
3) SETVAR: ????????????
5) END CHECK
7) END LOOPER
8) END LOOPER




ernieschwitz -> RE: How to Count? (4/25/2014 4:03:35 AM)

I see where you are having trouble...

Do you want it to be the regimevar for the current regime?




ernieschwitz -> RE: How to Count? (4/25/2014 4:13:46 AM)

If so I imagine you want to add a few lines to your function...

0) SetVar: TempVar2 == CheckTurn
1) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
2) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
3) CHECK: CheckLandscapeType(TempVar0, TempVar1) == 3
4) CHECK: CheckHexOwner(TampVar0, Tempvar1) == TempVar2
5) SETVAR: TempVar3 + 1
6) END CHECK
7) END CHECK
8) END LOOPER
9) END LOOPER
10) SETVAR: TempVar3 + ChechRegimeVar(TempVar2, "WheatVarNr")
11). EXECUTE: ExecSetRegimeVar (TempVar2, "WheatVarNr", TempVar3)

Where "WheatVarNr" is the RegimeVarNr of wheat.




GunnyJarhead -> RE: How to Count? (4/25/2014 4:35:35 AM)

I kept reading what you wrote and was able to come up with the following:

0) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
1) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
2) ' Check Map for LandTyp 10 Forest Loaf
3) CHECK: CheckLandscapeType(TempVar0, TempVar1) == 10
4) ' I think this checks the LandTyp 10 to see if it belongs to Regime 0
5) CHECK: CheckHexOwner(TempVar0, TempVar1) == 0
6) ' Now I want it to add the number of LandTyp 10 that belongs to Regime 0 to the regime variable "Lumber"
7) SETVAR: Peoples Republic_Lumber(#11) + 1
8) END CHECK
9) END CHECK
10) END LOOPER
11) END LOOPER


It did indeed do what I wanted it to do. It counts the Forest or the Lumber or whatever and it displays the count at the start of the regimes turn.

This works for one regime. Is there a way to:

Set it up so that I dont have to type the code for each individual regime?

Also on top of the main screen where it displays the count at the start of the turn for example 100. When a unit takes control of one more field hex the new count is 101. But the display stays at 100.



Thank you for the help!




GunnyJarhead -> RE: How to Count? (4/25/2014 4:42:44 AM)

I think we crossed posts.

I think I was pretty close to what you had. I also think that you answered my question about having to type the code for each individual regime with the checkturn function.

Im not sure what your lines 10 and 11 are doing but I will copy and add them to test it out!

Thanks..Im getting closer I do believe




GunnyJarhead -> RE: How to Count? (4/25/2014 4:53:29 AM)

Awesome!! Thanks Ernie.

now I just need to figure out how to get it to display at the top correctly. But that is Minor!





ernieschwitz -> RE: How to Count? (4/25/2014 5:06:15 AM)

No problem :)




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.578125