Jump to content
Sign in to follow this  
stilton

Does a unit 'remember' it's spawned group type?

Recommended Posts

I couldn't think of any other way to phrase this...

..But for example, say i spawn a unit using   BIS_fnc_spawnGroup.

 

Later, somewhere in a script i am iterating through   a foreach / allUnits.  I can easily determine which units are squad leaders using typeOf; will the squad leader, or group  'know'  about the type of group it is in, or was spawned in?  Will it contain any reference back  to it's original  spawned CfgGroup class?

 

I realise this information would instantly become  redundant because you can regroup people on the fly...  I am just curious.

Share this post


Link to post
Share on other sites
5 hours ago, stilton said:

I couldn't think of any other way to phrase this...

..But for example, say i spawn a unit using   BIS_fnc_spawnGroup.

 

Later, somewhere in a script i am iterating through   a foreach / allUnits.  I can easily determine which units are squad leaders using typeOf; will the squad leader, or group  'know'  about the type of group it is in, or was spawned in?  Will it contain any reference back  to it's original  spawned CfgGroup class?

 

I realise this information would instantly become  redundant because you can regroup people on the fly...  I am just curious.

 

Groups don't have classes like units/vehicles have, which you can return using typeOf.

CfgGroup only holds group templates containing unit/vehicle type and spawn position offset, nothing you can get using vanilla commands.

 

You can use setVariable/getVariable on a group and store/get its type after spawning it.

 

Cheers

Share this post


Link to post
Share on other sites

no, thank you.

- just what i wanted to know, i'm basically doing as you suggest  (storing a my own reference to my classification of the group's type/purpose when the mission starts and passing it along as a string to my script).  ... but i'm happy to see that i'm not reinventing the wheel.

 

Here's an unrelated followup question for you, or anyone :)

 

You can tell your units to watch a direction using 3 - 8 - 1  for watch north, or you can click the ground with alt  (you probably know this, but just for clarity as to what i'm talking about)

Then there's 'commandWatch' which is the scripting version of this command, you can give it a specific location -- but i'm curious as to the 'north'  part for the scripting command.

 

There seems to be pretty solid parity between the players ability to command subordinates the AI and the scripting of the AI.

I think i've noticed a discrepancy though but i'm not sure..   I just mention this because the commandWatch obviously has the additional effect (in addition to making the unit watch the direction) of giving radio commands,  so i understand you could 'fake it' by getting the relative position of the group leader for the 'effect of north'  but  i don't think it's the same...

 

- i'm going to test it infact, but i think you'd more likely get radio such as:

   '2 watch 054033'  [gridref]   or    '2 watch 500m north'  [relative pos] or   calling out landmarks which is not the same effect.   

I may test this and maybe post another topic... depends on how many hours i spend fannying about with this :D  

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×