OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: rgbman on 11 Jan 2003, 20:54:28

Title: Help!... group gone upon leaders death... well kinda
Post by: rgbman on 11 Jan 2003, 20:54:28
Hello all, I'm a newbie to OFP editing and scripting... but I'm hooked.  

I seem to be a problem with naming groups.  Can someone help?

I've created a group of eastern solders.  I have a trigger setup to run a script that checks for their death.  Problem is, I want the ending to happen only when ALL of them have been killed.

I've noticed that when I name the group (EastAlpha setGroupId ["Alpha", "GroupColor1"]), the group just takes the name of the lead unit.  That mean that when he dies the group will reform under the name of the next unit in command.  This also means my trigger is getting set off because the script is looking for a group of a particular name.  This is making things hard to code since I don't really know (1 out of 9) who will be in command and thus the name of the group.  Am I missing something here?  Is it possible to name the group something other than the name of the lead unit?

On the groups lead unit I place this in the init field:

EastAlpha setGroupId ["Alpha", "GroupColor1"]

The unit is named: Alpha

I have a script that checks for the groups existance:

#Start

~15

_remaining = 0

_alphaAlive = EAST CountSide [Alpha]
;_bravoAlive = EAST CountSide [Bravo]
;_charlieAlive = EAST CountSide [Charlie]
;_deltaAlive = EAST CountSide [Delta]
;_echoAlive = EAST CountSide [Echo]
;_foxtrotAlive = EAST CountSide [Foxtrot]


? (_alphaAlive > 0) : _remaining = _remaining + _alphaAlive
;? (_bravoAlive > 0) : _remaining = _remaining + _bravoAlive
;? (_charlieAlive > 0) : _remaining = _remaining + _charlieAlive
;? (_deltaAlive > 0) : _remaining = _remaining + _deltaAlive
;? (_echoAlive > 0) : _remaining = _remaining + _echoAlive
;? (_foxtrotAlive > 0) : _remaining = _remaining + _foxtrotAlive

? (_remaining == 0) : Goto "Done"

Goto "Start"

#Done
~60
varComplete = True
Exit
Title: Re:Help!... group gone upon leaders death... well kinda
Post by: Kaliyuga on 11 Jan 2003, 22:48:22
I seem to be a problem with naming groups.  Can someone help?......... Is it possible to name the group something other than the name of the lead unit?

Hmm.. try placing this in the init field of that group leader instead :

 grp1 =group this


then that group should be designated as grp1 ;)




Title: Re:Help!... group gone upon leaders death... well kinda
Post by: Wolfrug on 11 Jan 2003, 22:53:53
aaah, you've fallen in that old trap :P

the correct way to name your group is by putting this line in one of group members' init field:

groupname=group this

try that one on for size instead ;)
the setgroupID only determins the name of the group when they're chatting (for instance: Alpha Black 1: blah blah blah)

right, g'luck! ;)

Wolfrug out.
Title: Re:Help!... group gone upon leaders death... well kinda
Post by: rgbman on 12 Jan 2003, 03:11:25
Thanks Kaliyuga and Wolfrug... It worked.  Much appreciated!

Title: Re:Help!... group gone upon leaders death... well kinda
Post by: Vortrog on 14 Jan 2003, 00:09:54
How about changing the status of this message to "solved" so caring people like me can shoot straight to the next unlsolved mystery...please?  :-)
Title: Re:Help!... group gone upon leaders death... well kinda
Post by: rgbman on 15 Jan 2003, 01:23:01
How about changing the status of this message to "solved" so caring people like me can shoot straight to the next unlsolved mystery...please?  :-)

Sorry... didn't even realize there was a "solved" status.  Done.

-noob