Home   Help Search Login Register  

Author Topic: group setGroupId ["GroupAlpha", "GroupColor0"]...hmmm  (Read 583 times)

0 Members and 1 Guest are viewing this topic.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Hi you scripting guru's

i'm still fooling around with a createunit script.....no no, creating units works fine....the setgroupid makes me some troubles.

afaik you can have 12 soldiers in one group, Group ID's are GroupAlpha to GroupKilo and theres also a possibility to create 8 different colors, say GroupAlpha Groupcolor0, GroupAlpha GroupColor1 and so on......but when i try to use this on my script created units, it wont work...may some of you scripting god's take a look on this and tell me what i'm doing wrong....oh, and i also tried with variations of "" () [] {}

here comes the script:

; InfPatrol.sqs
;*******************************************************************************************
; Script to insert East Patrols during mission
; written by [sT]-Myke-[CO]
;*******************************************************************************************
;   Insert a single Unit and put the following in it's INIT box:
;   GroupAlpha=group this; deletevehicle this
;   valid group names are: ALPHA, BRAVO, CHARLIE, DELTA, ECHO, FOXTROT, GOLF, HOTEL, KILO
;   Valid group Colors are: Groupcolor0 to Groupcolor7
;*******************************************************************************************
; Two markers are needed:
;   Creating point (marker1)
;   Moving point (marker2)
;*******************************************************************************************
; 3 Different Patrols are supported
;   Standard Infantry (INF)
;   Anti Tank Infantry (AT)
;   Anti Air Infantry (AA)
;*******************************************************************************************
; ["INF", "marker1", "marker2", GroupAlpha, "GroupColor0"] exec "InfPatrol.sqs"   <-----do not take this as you see it....tried with and without "" at groupcolor

; check if script runs on Server (create a GL named "Server")
?!local Server: exit

; getting the settings
_type = _this select 0
_pos = _this select 1
_target = _this select 2
_group = _this select 3
_color = _this select 4

; jump to the corresponding patrol
?(_type == "INF"): Goto "inf"
?(_type == "AT"): Goto "at"
?(_type == "AA"): Goto "aa"

; No type was found so alert creator theres a typo
_errorText = Format["ERROR: INVALID TYPE %0", _type]
Hint _errorText
Exit

; Creating the standard Infantry Patrol
#inf
"OfficerE" CreateUnit [[GetMarkerPos _pos select 0, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 1, "LIEUTENANT"]
"SoldierEMG" CreateUnit [[(GetMarkerPos _pos select 0) +3, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.9, "SERGEANT"]
"SoldierELAW" CreateUnit [[(GetMarkerPos _pos select 0) +6, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "CORPORAL"]
"SoldierEMedic" CreateUnit [[(GetMarkerPos _pos select 0) +9, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEB" CreateUnit [[(GetMarkerPos _pos select 0) +12, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEB" CreateUnit [[(GetMarkerPos _pos select 0) +15, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEMG" CreateUnit [[(GetMarkerPos _pos select 0) +18, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierELAW" CreateUnit [[(GetMarkerPos _pos select 0) +21, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEB" CreateUnit [[(GetMarkerPos _pos select 0) +24, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEB" CreateUnit [[(GetMarkerPos _pos select 0) +27, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEMG" CreateUnit [[(GetMarkerPos _pos select 0) +30, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEB" CreateUnit [[(GetMarkerPos _pos select 0) +33, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
goto "target"

; Creating AT Infantry Patrol
#at
"OfficerE" CreateUnit [[GetMarkerPos _pos select 0, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 1, "LIEUTENANT"]
"SoldierEMG" CreateUnit [[(GetMarkerPos _pos select 0) +3, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.9, "SERGEANT"]
"SoldierELAW" CreateUnit [[(GetMarkerPos _pos select 0) +6, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "CORPORAL"]
"SoldierEMedic" CreateUnit [[(GetMarkerPos _pos select 0) +9, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEAT" CreateUnit [[(GetMarkerPos _pos select 0) +12, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierELAW" CreateUnit [[(GetMarkerPos _pos select 0) +15, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEMG" CreateUnit [[(GetMarkerPos _pos select 0) +18, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierELAW" CreateUnit [[(GetMarkerPos _pos select 0) +21, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEB" CreateUnit [[(GetMarkerPos _pos select 0) +24, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierELAW" CreateUnit [[(GetMarkerPos _pos select 0) +27, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEAT" CreateUnit [[(GetMarkerPos _pos select 0) +30, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierELAW" CreateUnit [[(GetMarkerPos _pos select 0) +33, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
goto "target"

; Creating AA Infantry Patrol
#aa
"OfficerE" CreateUnit [[GetMarkerPos _pos select 0, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 1, "LIEUTENANT"]
"SoldierEMG" CreateUnit [[(GetMarkerPos _pos select 0) +3, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.9, "SERGEANT"]
"SoldierELAW" CreateUnit [[(GetMarkerPos _pos select 0) +6, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "CORPORAL"]
"SoldierEMedic" CreateUnit [[(GetMarkerPos _pos select 0) +9, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEAA" CreateUnit [[(GetMarkerPos _pos select 0) +12, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEAA" CreateUnit [[(GetMarkerPos _pos select 0) +15, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEMG" CreateUnit [[(GetMarkerPos _pos select 0) +18, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierELAW" CreateUnit [[(GetMarkerPos _pos select 0) +21, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEAA" CreateUnit [[(GetMarkerPos _pos select 0) +24, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEAA" CreateUnit [[(GetMarkerPos _pos select 0) +27, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEMG" CreateUnit [[(GetMarkerPos _pos select 0) +30, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
"SoldierEAA" CreateUnit [[(GetMarkerPos _pos select 0) +33, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 0.8, "PRIVATE"]
goto "target"

; Set Group Settings
#target
_group setBehaviour "COMBAT"
_group setCombatMode "RED"
_group move getMarkerPos _target
exit

End of Script

And just to have it said....i use 1.46....no asking why, i have my reasons  ;)
« Last Edit: 29 Jan 2004, 00:30:40 by myke13021 »

deaddog

  • Guest
Re:group setGroupId ["GroupAlpha", "GroupColor0"]...hmmm
« Reply #1 on: 29 Jan 2004, 00:49:23 »
1. You don't need to set the group id for every unit, just one.

2.  You're using group id wrong.  The variable _group is a group name, alpha, bravo, etc  but setgroupid requires the group name to be a string ("alpha","bravo",etc), not a variable of type group.  

You can pass the group name for the setgroupid command as another parameter when calling the script.

["INF", "marker1", "marker2", GroupAlpha, "Alpha","GroupColor0"] exec "InfPatrol.sqs"


Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:group setGroupId ["GroupAlpha", "GroupColor0"]...hmmm
« Reply #2 on: 29 Jan 2004, 01:01:50 »
thx Deaddog for your fast reply...

i see what you mean and it looks logic as far i can tell.....just one question...how do i handle this new string inside the script?
Do i have to add some in this part also?

; getting the settings
_type = _this select 0
_pos = _this select 1
_target = _this select 2
_group = _this select 3
_color = _this select 4

as i'm a beginner in scripting, it would be a great help if you could point out the lines which need a change....only examples, not every single line if there are some similar (quote: 1. You don't need to set the group id for every unit, just one.)

deaddog

  • Guest
Re:group setGroupId ["GroupAlpha", "GroupColor0"]...hmmm
« Reply #3 on: 29 Jan 2004, 01:14:45 »
Maybe something like this:

_type = _this select 0
_pos = _this select 1
_target = _this select 2
_group = _this select 3
_groupstring=_this select 4
_color = _this select 5

Then remove all the "this setgroupid ...." stuff from your createunit commands,

Then add a line here:

#target
_group setgroupid [_groupstring,_color]
_group setBehaviour "COMBAT"
_group setCombatMode "RED"
_group move getMarkerPos _target


I got to thinking about what you where trying to do.  Even if it did work the way you wanted, you would be limited to only 8 groups (alpha thru hotel).  This way, you can use any name you wish for the group and get many more groups out of it.  Of course, you can always use the same group names over again if you want to respawn when all the units are dead.

Hope that helps :)

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:group setGroupId ["GroupAlpha", "GroupColor0"]...hmmm
« Reply #4 on: 29 Jan 2004, 03:42:42 »
thx alot deaddog

Even if it did work the way you wanted, you would be limited to only 8 groups (alpha thru hotel).

I don't hope so....my opinion was to have more than 9 groups (Alpha to Kilo).  What i hope is, that it gives me more possible groups as i need more than 9. In my calculating it would be 9 x 8 = 72 Groups max possible...well i don't need 72, but a few more than 9.

I saw once a topic about saying exactly this. Else i'm asking myself where's the reason to use CroupColor?

And even then...did you ever played a map with more than 9 (ungrouped) Slots to play in? I bet you did....if it is like you said (not more than 9 groups) this wouldn't be possible, as every playable unit is a Group for itself.

As i said, this is how i do understand it.....tell me if i'm wrong plz

deaddog

  • Guest
Re:group setGroupId ["GroupAlpha", "GroupColor0"]...hmmm
« Reply #5 on: 29 Jan 2004, 14:15:30 »
You misunderstood me.

You were trying to use the groupnames alpha, bravo, ... hotel as both the actual group name and the group name needed by the setgroupid command. That is only eight group names.

Code: [Select]
"OfficerE" CreateUnit [GetMarkerPos _pos select 0, getmarkerpos _pos select 1], _group, "this setgroupid [_group, _color]", 1, "LIEUTENANT"]
Notice that the variable _group appears in both commands.  If this code would have worked the way you intended, then you would have been limited to only eight groups at a time created by this script.

Let's say you had already created a group named Alpha Blue.  If you try to create a group named Alpha Green, the group name Alpha is already used and the script would fail if the first group already had 12 members.  If the first group had less than 12, then new units would be created in the first group until the limit of 12 is reached and the group ID would be changed from alpha blue to alpha green.  You would only end up with one group, not two separate groups.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:group setGroupId ["GroupAlpha", "GroupColor0"]...hmmm
« Reply #6 on: 29 Jan 2004, 15:07:51 »
setGroup ID does nothing except create the title you see when a group gives a radio message.

Alpha Black 1 "blah blah blah"

The game automatically applies a setgroupid command to any group that you have not done it for manually.

setgroupid is totally different from the group name, which is what you use when giving command to the group in scripts etc.

Each side could have a group with the ID Alpha Black.   But in the whole mission there may be only one group named Alpha.
Plenty of reviewed ArmA missions for you to play

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:group setGroupId ["GroupAlpha", "GroupColor0"]...hmmm
« Reply #7 on: 30 Jan 2004, 04:57:30 »
ok...i think i see it...so it is impossible to have more than i group named "Alpha" when it has 12 units.

So using the groupcolor wont allow me to have several groups "alpha" with different colors (Alpha Black, Alpha Green and so on).

The only way to get around this, is to make sure that group "Alpha" is completely dead to get a new group "Alpha" with 12 new units.

Damn, i hoped i could get around with Groupcolor.

Hey, now i see it.....i hope i'll find a way to get around this limitation.

thx alot for your help guys......ofpec.com is still the best...i hope the site will be back online as soon as possible.

Let me tell you you do a great job, all.