OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: westy159 on 04 Oct 2006, 20:19:05
-
In my MP mission a number of players will be randomly lost on the island. Enemy patrols everywhere and hinds flying over naturally. Using nothing but their navigation skills each player has to get back to the friendly base. If players decide to (or unintentionally) find each other I want them to get grouped together. The join command wont work as it is activated automatically. I want units to be grouped only if they happen to find each other (say, be a distance of 10 metres or so apart).
Is this possible?
Cheers.
-
Yes, you use
Distance
But you'll have to write a script. Have it loop with a distance command in between each loop. When the Distance question is met, have the script go to a new section where you'll join the groups.
#Loop
? Distance Man1 <= 25 : GoTo "Join"
GoTo "Loop"
#Join
Man2 join mygrp
~5
Exit
Something like that. You'll have to check the syntax.
-
The join command wont work as it is activated automatically.
I quite don't understand your remark here. The join command works fine in MP, as far as I know. It is possible to make something like you requested.
But I wouldn't use a distance boolean. I would use the knowsAbout command.
I suppose the script would look something like this:
;; I assume all units are players
;; Example: [[P1,P2,P3,P4,P5]] exec "thisscript.sqs"
;; Contains all the player units
_units = _this select 0
? not local player : exit
_units = _units - [player]
#loop
@({player knowsAbout _x >= 0.105} count _units > 0 Or {alive _x} count _units == 0 Or not alive player)
? not alive player : exit
_i = 0
_amount_units = count _units
while (_i < _amount_units) do {if (player knowsAbout (_units select _i) >= 0.105) then {[player] join (group (_units select _i)); _units = _units - [(_units select _i)]; _amount_units = _amount_units - 1}}
? (_amount_units > 0) : goto "loop"
exit
I don't know if it is bug free (can't test it on a machine that can't run OFP). But the code looks pretty solid to me.
Edit: found a small flaw in the script, fixed it.
-
Whats wrong with the distance command?
Also:
? Distance Man1 <= 25 : GoTo "Join"
Wouldnt you need to say what is meant to be 25 distance from Man1? Ive always had unknown operator errors if I remember correctly.
-
Whats wrong with the distance command?
Also:
? Distance Man1 <= 25 : GoTo "Join"
Wouldnt you need to say what is meant to be 25 distance from Man1? Ive always had unknown operator errors if I remember correctly.
If you're in a forest and one player is in the radius of another player, without either of them knowing either's position, then it makes no sense to join each other's group, wouldn't it?
And yes, the command should be like ? man1 distance man2 <= 25 : goto "Join"