Home   Help Search Login Register  

Author Topic: Setting group name  (Read 1651 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Setting group name
« on: 27 May 2005, 17:24:31 »
I have a coop mission with 1 group 12 slots named Player1...Player12.  AI is disabled.  In my init.sqs I have the following code:

Code: [Select]
;East Team
Zulu = Group Player1
Zulu = Group Player2
Zulu = Group Player3
Zulu = Group Player4
Zulu = Group Player5
Zulu = Group Player6
Zulu = Group Player7
Zulu = Group Player8
Zulu = Group Player9
Zulu = Group Player10
Zulu = Group Player11
Zulu = Group Player12
Zulu SetGroupID ["Zulu","GroupColor2"]

If I instead put the following will it still work if slot Player1 is empty? That is how can I guarantee the group's name is always set to "Zulu"?
Code: [Select]
;East Team
Zulu = Group Player1
Zulu SetGroupID ["Zulu","GroupColor2"]
 
« Last Edit: 27 May 2005, 17:39:11 by Mr.Peanut »
urp!

Offline 456820

  • Contributing Member
  • **
Re:Setting group name
« Reply #1 on: 27 May 2005, 19:19:13 »
erm well to the looks of it yes have a go at it even though im no expert it does look like it should work also you should always try it out first and if it doesnt work then you can post

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Setting group name
« Reply #2 on: 27 May 2005, 19:26:01 »
No, if player 1 slot is disabled, then the code doesn't exist
in current game.

Best you do is to put following lines into your init.sqs;

Code: [Select]
;init.sqs - player detection
;
player_pool = [player1,player2,player3,player4,player5,player6,player7,player8,player9,player10,player11,player12]

player_array = []

"if (alive _x) then {player_array = player_array + [_x]}" forEach player_pool

;now your zulu stuff

_leader = player_array select 0
zulugrp = group _leader
zulugrp setgroupID ["Zulu","Groupcolor2"]

:note - i've changed the groupname zulu into zulugrp, as zulu is
reserved and the wrong use as groupname may lead into some
variable conflict

:edit - ermm 456820 - he has had some thoughts, which made totally sense

Code: [Select]
if playerslot 1 is disabled, will it still work?
Multiplayer editing is a little bit different to sp missions or campaign making  ;)

He did absolutely well with comming here to ask for that (appart from starting the thread in the
wrong corner editing scripting: general instead of editing scripting: multiplayer

~S~ CD
« Last Edit: 27 May 2005, 19:31:23 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Setting group name
« Reply #3 on: 27 May 2005, 22:13:57 »
Err... why not just put this in the init fields of all the playable units?

this setgroupID ["Zulu","Groupcolor2"]

If the unit DNE, then the code will not be executed. Or am I missing something?
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Setting group name
« Reply #4 on: 27 May 2005, 23:12:16 »
GB, for sure you're method will work also, expecting you
will include into each unit's init-field zulu = group this,
but why make 12 times the same thing, if it can be done
in one piece?

OK, you could say now that 12 init.sqs + one on server side
will be same like 12 init fields (each executed seperately
on each machine - could be 12 * 12 init fields *cough*)

...but you for sure will know what i mean.

The method i suggested is multiplayer prooved and once somebody understand how it works, it will open up new dimensions and views for ppl who start working on mp maps.

:btw - again this groupname: zulu - ya know it's not right start messing
around with pre-reserved stuff - even if it's just a harmless string in this
case - but ya know what ppl tend to do with things, they learned to use
at their beginning without any major problems  ;)

~S~ CD
« Last Edit: 27 May 2005, 23:14:16 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Setting group name
« Reply #5 on: 28 May 2005, 09:31:16 »
Okay, as Mikero says: "I feel like one of us is a Martian". Must be me.

What I am getting is that Mr. Peanut wants to the player's radio-codename to be "Zulu". That is, EVERY player. But not the players that don't exist.

If that is the case, then all you would need to do is put this line in the init.sqs:

(group player) setgroupID ["Zulu","Groupcolor2"]

When run on each client, that line will point to the appropriate player. On a ded server (where player DNE), I don't think it will throw any errors. The "setgroupID" command must be run on each individual client, I have heard, so running it thru the init.sqs solves that.

Simple. So simple, I MUST be missing something. ???
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Setting group name
« Reply #6 on: 28 May 2005, 09:40:06 »
Sounds good to me GB  :) simple 'n easy

Peanut, you should give this a try, and keep in mind
the method i show'ed ya for things like setting groupnames
or other important stuff related to a whole playable group
(like getting the leader of the group for later use, or for checking how many playable's are still alive, etc).

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted