OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: sgt.scorpion on 01 Nov 2002, 17:14:41

Title: Checking for Leader
Post by: sgt.scorpion on 01 Nov 2002, 17:14:41
Hi I am making a CO-OP mission that doesn't included any waypoints for the players squad, is there a way to make sure the leader is selected from the person selection screen before the mission loads?

Sgt. Scorpion
Title: Re:Checking for Leader
Post by: CareyBear on 01 Nov 2002, 22:35:56
Not that I know of.

One solution: put

disabledAI=1;

in your description.ext file. This will, however, disable all AI 'playable' units, so it might not be ideal for your mission - it will guarantee you a player leader though.

If you really want a group of a certain size, do this:

Disable the AI with the description.ext
Create a backup group of the same size as your original group of playables less one.
Once the mission starts, count the units in the player's group, then use the 'join' command (unit join group) to fill the player's group out to the number you want. Deletevehicle any remaining backups.

There may be a much more elegant solution, but I don't know what it is...  ;)
Title: Re:Checking for Leader
Post by: sgt.scorpion on 02 Nov 2002, 05:24:57
Thanks CareyBear
if I use ?(player == leadergrp) and comes back false,when I delete that ai leader will the game assign a player as a leader?
or another ai? just a thought.
Title: Re:Checking for Leader
Post by: CareyBear on 02 Nov 2002, 05:57:13
Next highest rank will become leader.

But remember, you're MP scripting. player is different on each machine, and therefore all machines except leader will eval to false if you do that.

maybe make all evaluate, then if one is true, publish publicvariable. Check for publicvariable a few seconds later, if not present, delete group leader. Repeat... slow, awkward solution though. mebbe go with the disabledAI = 1; solution