Find the HQ (Full Version)

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



Message


Ande -> Find the HQ (4/21/2011 11:34:07 PM)

Hello
I decided to venture into the world of eventwriting but encountered problems. I want to creates an event that finds the active players supreme HQ and gives it new troops. I'm almost certain there is some easy way to do this. At it's hardest it would be to loop through every hex on the map to make a check. The problem is I don't know what checks I should do and I can't find any references on the functions. There are some in the editor but most of them gives only input and no output description. Because such a simple thing is beyond me to find, I need to waste everyones time to get this solved: How do I find the highest HQ of a regeme and how do I give it troops?




Tufkal2 -> RE: Find the HQ (4/21/2011 11:45:31 PM)

There is one thing to consider and that is: Is there always one supreme HQ? There could be several unconnected chains of units.
If you are very sure there is one supreme HQ you can use the very nice new ATG feature which is that units are now numbered.

So you can start with any unit on the side you are looking it (possibly by looping over all units). Lets say this is unit Tempvar1
Then you can use the function CheckUnitHQ(Tempvar1) which gives you the number of the HQ unit of unit Tempvar1. If you repeat this long enough you will get to a supreme HQ of the side in question:

Loop Tempvar10 from 0 to 2
Tempvar10 = 0
Tempvar2 = CheckUnitHQ(Tempvar1)
  Check Tempvar2 = Tempvar1
     Tempvar10 = 2
  EndCheck
EndLoop

Edit: Sorry forgot to say how to add troops:
You can use ExecAddUnit which add a new unit (e.g. in the same hex as the Supreme HQ) or ExecUnitGiveTroops which will add troops to the unit in question.





Ande -> RE: Find the HQ (4/22/2011 12:32:57 AM)

Ah, thanks alot.
If I only could write it in a more familiar way
while(unit=unit.getHQ()){
    supremeHQ=unit;
}

I would be very happy. If I knew how to format the script inside the scenariofile i could probably write the compiler myself.
Anyway, enough with the ramblings.
In order find the supreme HQ I need to loop through the whole map, looking for units of the current regeme and then count which supreme HQ has the most subunits? If the tempvar is a number referencing to a unit in some sort of list, is it possible to access this list directly? ie, loop through every unit in the unitlist and do the checks directly. It would be even better if the list was regeme specific allowing me to completly do without the regemecheck




Tufkal2 -> RE: Find the HQ (4/22/2011 12:55:40 AM)

I think you need to find only one unit of the regime in question.
If there is a supreme HQ going up one level repeatedly will lead you to the highest HQ of that unit. If there is a supreme HQ this will be it.
So you need to cycle through units only until you find one possible starting unit.

And yes you can go through the unit list directly without going through the map. You can directly access the units with checks and execs if you have the number. The list of units is not regime specific but you can add

checkunitowner(tempvar10) = REGIME (whichever you require)
[]
endcheck

and then you will cycle through only the units of the regime in question.




Ande -> RE: Find the HQ (4/22/2011 10:32:49 AM)

Ok, I found a better way of doing what I want. Now I need to know how to replace all SFTs of one type with another. The simple way of doing this is to first remove all SFTs of the first type and then add an equal number of the new SFTs. My problem now is that I can't find a way of removing a specific SFT from a unit. The closest thing available is removing all SFTs of a given group in a given hex. Do I need to rework my mechanics again?




Tufkal2 -> RE: Find the HQ (4/22/2011 10:50:14 AM)

You can try
-> ExecSingleMutateSFType
-> ExecSingleMutateSFTypeXY
-> ExecMutateSFType
Best regards and have fun modding




Ande -> RE: Find the HQ (4/22/2011 4:49:13 PM)

Thank you very much. Now I have more problems. I have created an card and a event that deals it to all players. The card section in decisions is unavailable as if the card was never dealt. I added a message to make sure that the code was executed and it was. I'm trying to make alteration to the new generic file, does that mean there are some option I need to enable to use cards?




ernieschwitz -> RE: Find the HQ (4/22/2011 5:08:01 PM)

Try to check if the rulevar for allowing action cards is enabled.
I ran into something like this, and that was the problem :)




Tufkal2 -> RE: Find the HQ (4/22/2011 5:08:22 PM)

Well if a message confirmed that the card was dealt it should be there. Could you maybe post your coding together with some info as to regime numbers and card numbers etc?




Ande -> RE: Find the HQ (4/22/2011 6:09:33 PM)

I found the rulevar and the game is now displaying the card, thank you.




ernieschwitz -> RE: Find the HQ (4/22/2011 6:27:26 PM)

No problem at all :)
Glad i could help!




Ande -> RE: Find the HQ (4/22/2011 11:04:41 PM)

where do you control the SFTs of the starting HQ in the generic game? I did *something* and now the HQ starts with 10 subs III. I have really no idea what I did to make it so.
EDIT: nevermind I found the rulevars
Lesson learned: odd behavior-->rulevar overlooked




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
5.074219