OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: Joiner on 26 Nov 2009, 12:06:57
-
Hi everyone!
I'm making an MP mission in which the attacking side captures enemy territories and then respawns in each newly captured area. For this purpose, I use "moving" respawn points (via markers). However, the attacking side has a helicopter that supports the attacks, and after the attacking side captures one of the enemy areas, all the players of this side will respawn in that zone, including the pilots of the helicopter. What I need to do is to make it possible to respawn the pilots on the main base, where the helicopter is, while the others must respawin in the newly captured areas. Is it possible to do that? Any example will be appreciated.
Also, is it possible to have players respawned in vehicles? E.g. players respawn in a heli in the cargo place and then make a HALO.
Thanks in advance!
-
What you could do is to respawn everyone at plaze xyz, somewhere remote where they won't affect the mission OR somewhere where most of them would respawn anyway, then setPos them to the correct location once they've spawned.
Ie. you'd put this to the pilots' init-lines:
if (local this) then
{
this addEventHandler ["Killed",{_this spawn "myRespawn.sqf"}];
};
myRespawn.sqf
if (local (_this select 0)) then
{
if (baseRespawn) then
{
waitUntil {alive player};
player setPos somePosition;
}
else
{
//whatever should happen if they don't spawn at base
};
};
just set the variable "baseRespawn" to true or false based on where you want the pilots to respawn.
-
Norrins revive script can respawn you in many locations and its fairly simple to implement.
-
I did as you sugested, but it looks like the script does't work... I use the following:
if (local (_this select 0)) then
{
if (baseRespawn) then
{
waitUntil {alive player};
player setPos (getPos h1);
}
else
{
};
};
h1 is the name of an object. What is supposed to be instead of baseRespawn?
-
true or false. If it's true they respawn at base, if it's false they won't.
-
Thanks, but the script still doesn't work. The pilots appear on the base along with the other players.
I used (baseRespawn = false) and (baseRespawn = true) - didn't help. Maybe because I use the F2 template (former BAS f)? :dunno:
-
What exactly did you use? Post the exact code please. Also that snippet only works for human players.
-
In the Init field of each pilot I entered the following:
if (local this) then
{
this addEventHandler ["Killed",{_this spawn "PilotRespawn.sqf"}];
};Then I created the PilotRespawn.sqf file with the following code:
if (local (_this select 0)) then
{
if (baseRespawn = true) then
{
waitUntil {alive player};
player setPos (getPos h1);
}
else
{
};
};in which h1 is the name of an object. Then when previewing the mission I, being a pilot, killed myself and I was respawned at the main base, not at the place where the h1 object is.
-
:)
like this:
baseRespawn = true;
if(baseRespawn) then
...
You must set it to true or false before the if-statement checks it, not inside the if. Of course you'd want to move the baseRespawn = true; to for example init.sqf, so that it doesn't get re-set to true every time a pilot respawns. Then whenever during the mission you want the pilots to stop respawning at the base you run this somewhere, for example a trigger: baseRespawn = false;
-
Thanks a lot for your help, but it doesn't work for some reason... :confused:
I'll try using Norrins revive script.