OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: XPS on 11 Jul 2006, 22:09:40
-
I have a unit with in his init field:
grp1 = group this
I want the name of the group he is in when he enters a trigger.
So the result I want is: grp1
How can I do this?
-
as far as i know, variables you assign to groups and units as their identifiers cannot be returned through scripts as discrete names.
put another way, think of the group as a colour - the name you give it is "red", but asking flashpoint what colour the group is will not return 'red', it can only show you the actual colour.
does that make sense?
to develop on your question, to find out the group to which a unit activating a trigger belongs, in the on-activation line put
mygroup = group (thislist select 0)
you can now use the global variable mygroup to point to whichever group that activating unit is in.
-
If I use this code:
Hint Format["%1", group Player]
Then it returns: CIVL Alpha Black and if I am another player it returns CIVL Bravo Black
etc. etc.
What are those names?
-
they appear to be side (CIVL) followed by the group name. this raises odd questions.
what are we talking about when we say "group name"? what are we talking about when we say "player's name"?
when you place a unit on the map, make it the player and then stick a variable in the 'name' box, is that the player's name? if you use setidentity to give a unit a name, is that its name?
it might be simpler to think of them as variables and monikers. variables can be recognised and used by flashpoint. monikers are just decoration. the data in the name box is a variable.
name player
gives the player's moniker. you couldn't put
XPS addweapon "lawlauncher"
because flashpoint wouldn't know what XPS stands for, even though that's what it returns as the player's name.
similarly, CIVL Alpha Black is just a moniker. it's the name used in sidechats to identify you and your group, but flashpoint hasn't a clue what it really means.
-
Ok, I understand that.
So it isn't possible to return the value I put in the 'name' box?
The reason I ask it is that I need to know which one of my units is entering the trigger.
-
ah, now that is doable. returning the name you enter into the 'name' box cannot be done, but that's just a name you define to let flashpoint know what you're talking about. you can get at the information another way though.
as mentioned farther above, to find out the group to which a unit activating a trigger belongs, in the on-activation line put
trig_loon = (thislist select 0)
which defines a temporary variable trig_loon which refers to the first loon to walk into your trigger. then in a script you could put
_name = name trig_loon
_group = group trig_loon
_groupcount = count units _group
_leader = name leader _group
and anything else you can think of. it all comes down to referring to the units using temporary variables.
-
Thanks :)