Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Find the HQ

 
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 >> Find the HQ Page: [1]
Login
Message << Older Topic   Newer Topic >>
Find the HQ - 4/21/2011 11:34:07 PM   
Ande

 

Posts: 197
Joined: 7/5/2007
From: Göteborg/Sweden
Status: offline
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?
Post #: 1
RE: Find the HQ - 4/21/2011 11:45:31 PM   
Tufkal2

 

Posts: 834
Joined: 12/31/2008
From: Germany
Status: offline
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.



< Message edited by Lunaticus -- 4/21/2011 11:48:15 PM >


_____________________________


(in reply to Ande)
Post #: 2
RE: Find the HQ - 4/22/2011 12:32:57 AM   
Ande

 

Posts: 197
Joined: 7/5/2007
From: Göteborg/Sweden
Status: offline
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

(in reply to Tufkal2)
Post #: 3
RE: Find the HQ - 4/22/2011 12:55:40 AM   
Tufkal2

 

Posts: 834
Joined: 12/31/2008
From: Germany
Status: offline
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.

_____________________________


(in reply to Ande)
Post #: 4
RE: Find the HQ - 4/22/2011 10:32:49 AM   
Ande

 

Posts: 197
Joined: 7/5/2007
From: Göteborg/Sweden
Status: offline
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?

(in reply to Tufkal2)
Post #: 5
RE: Find the HQ - 4/22/2011 10:50:14 AM   
Tufkal2

 

Posts: 834
Joined: 12/31/2008
From: Germany
Status: offline
You can try
-> ExecSingleMutateSFType
-> ExecSingleMutateSFTypeXY
-> ExecMutateSFType
Best regards and have fun modding


_____________________________


(in reply to Ande)
Post #: 6
RE: Find the HQ - 4/22/2011 4:49:13 PM   
Ande

 

Posts: 197
Joined: 7/5/2007
From: Göteborg/Sweden
Status: offline
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?

(in reply to Tufkal2)
Post #: 7
RE: Find the HQ - 4/22/2011 5:08:01 PM   
ernieschwitz

 

Posts: 3893
Joined: 9/15/2009
From: Denmark
Status: offline
Try to check if the rulevar for allowing action cards is enabled.
I ran into something like this, and that was the problem :)

(in reply to Ande)
Post #: 8
RE: Find the HQ - 4/22/2011 5:08:22 PM   
Tufkal2

 

Posts: 834
Joined: 12/31/2008
From: Germany
Status: offline
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?

_____________________________


(in reply to Ande)
Post #: 9
RE: Find the HQ - 4/22/2011 6:09:33 PM   
Ande

 

Posts: 197
Joined: 7/5/2007
From: Göteborg/Sweden
Status: offline
I found the rulevar and the game is now displaying the card, thank you.

(in reply to Tufkal2)
Post #: 10
RE: Find the HQ - 4/22/2011 6:27:26 PM   
ernieschwitz

 

Posts: 3893
Joined: 9/15/2009
From: Denmark
Status: offline
No problem at all :)
Glad i could help!

(in reply to Ande)
Post #: 11
RE: Find the HQ - 4/22/2011 11:04:41 PM   
Ande

 

Posts: 197
Joined: 7/5/2007
From: Göteborg/Sweden
Status: offline
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

< Message edited by Ande -- 4/22/2011 11:16:28 PM >

(in reply to ernieschwitz)
Post #: 12
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> Find the HQ 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

1.340