Hi,
I am trying to write my first serious script in ARMA. But I can't get it to work.
So here is the problem to be solved:
I want all players in a multiplayergame to respawn. All "real" players (no AI and no playable units).
I'm just focussing on BLUFOR site here.
A dead player should respawn at the location of the other alive players. And if noone is alive, all should respawn at the base.
My approach:
Every "real" player gets an Empty marker attached to his/her position. The name is respawn_westx (x is a consecutive number, e.g. player01 has the marker respawn_west01).
By this way, a number of possible respawn points is set.
In the description.ext:
respawn = "BASE";
respawndelay = "45";
My respawn.sqf:
//set private variables
private ["_mpcount", "_base_x", "_base_y", "_mpnames", "_currentplayer", "_i", "_markername", "_markerstr"];
//number of real players (not AI)
_mpcount = 6;
//base coordinates
_base_x = 3285;
_base_y = 2928;
//get playable unit objects
for [{_i=0}, {_i<_mpcount}, {_i=_i+1}] do {
_currentplayer = _this select _i;
_mpnames = _mpnames + [_currentplayer];
};
//while player is initialized
while {not isnull player} do {
//put all real (not AI) and alive players in an array
for [{_i=0}, {_i<_mpcount}, {_i=_i+1}] do {
_currentplayer = _mpnames select _i;
if (isPlayer _currentplayer && alive _currentplayer) then {
_markername = format ["respawn_west%1", _i];
_markerstr = createMarker [_markername, [1,1]];
_markerstr setMarkerShape "ICON";
_markername setMarkerType "mil_dot";
_markername setmarkerpos getpos _currentplayer;
};
};
//place respawn_westBASE if no player is alive
if (count _mp == 0) then {
_markerstr = createMarker ["respawn_westBASE", [1,1]];
_markerstr setMarkerShape "ICON";
_markername setMarkerType "b_air";
_markername setmarkerpos [_base_x,_base_y];
};
sleep 1;
};
I've set the marker to something visible, to see what happens.
But the problem is, nothing happens.
There are also no errors displayed in the arma3.rpt...!
So please help: Where is my error in reasoning and how can I get this to work?
Greetings
rooster