Jump to content
Laumi

Respawn at specific Location with exact same Editor Loadout

Recommended Posts

Hey, one if my missions is driving me crazy for weeks now

Here's what I'm trying to do:

There's 4 Groups of Players. 2 of them should be in the same faction, but not knowing about this fact. Nobody should know wich faction he's joining in the lobby. I placed Civilian and edited their loadout and I'm going to change the Faction of the Player in the Mission via Zeus with the Ares Mod. But I can't work out to have them respawned at their starting location with the Loadout I gave them in Editor. Only used the built-in respawn mechanics so far.

 

So is there a way to have the Unit/Player spawn at a given Location on the map with the given Loadout?

Or:

Is there a way to have Bluefor/Opfor/Inde Units spawned, but make them appear as civillians in the Lobby?

 

The Issue is, that I can't use the modules or the "respawn_west/east/.. marker" because with the current setup on mission loadup they are all still civillians until I change their faction manually

 

Share this post


Link to post
Share on other sites

First of all , you can disable the respawn on start;  add:

respawnOnStart = -1;

in the description.ext. (or avoid to choose "select respawn position" and select respawn loadout" in editor)

So, your units will have their loadout and their position as they don't respawn at start.

After that, you can change their side:

_grpEast = createGroup EAST;

[_unit1] joinSilent _grpEast; // for example.

 

And for recovering the loadout... here is my old but working script.

 

I'm trying to script a very short one like:

addMissionEventHandler ["entityKilled",{ 
  params ["_killed"]; 
  _killed setVariable ["ld",getUnitLoadout _killed]; 
}]; 
addMissionEventHandler ["entityRespawned",{ 
  params ["_new","_old"]; 
   _ld = _old getVariable "ld"; 
  _new setUnitLoadout _ld; 
}];

 

 

 

 

 

Share this post


Link to post
Share on other sites

So this:

_grpEast = createGroup EAST;

[_unit1] joinSilent _grpEast;

 

would need to go into the Unit-Init, given that I name the Unit "unit1" and do the same with all 23?

 

 

and this:

addMissionEventHandler ["entityKilled",{ 
  params ["_killed"]; 
  _killed setVariable ["ld",getUnitLoadout _killed]; 
}]; 
addMissionEventHandler ["entityRespawned",{ 
  params ["_new","_old"]; 
   _ld = _old getVariable "ld"; 
  _new setUnitLoadout _ld; 
}];

Into the Mission Init, right?

Share this post


Link to post
Share on other sites

Found a workaround with using the onPlayerRespawn.sqf and onPlayerKilled.sqf

Share this post


Link to post
Share on other sites
4 hours ago, Laumi said:

So this:

_grpEast = createGroup EAST;

[_unit1] joinSilent _grpEast;

 

Anywhere on server only, and you can use a full array of all your units:

so in init.sqf:

if (isServer) then {

   _grpEast = createGroup EAST;

   playableUnits joinSilent _grpEast; // works fine if you want to reach all playables units but make sure you don't disable the slots for AI in lobby or editor)

   // or [p1,p2,p3...] joinSilent _grpEast; // where p1 is the name you gave at player 1,etc.

};

 

4 hours ago, Laumi said:

addMissionEventHandler ["entityKilled",{


  params ["_killed"]; 
  _killed setVariable ["ld",getUnitLoadout _killed]; 
}]; 
addMissionEventHandler ["entityRespawned",{ 
  params ["_new","_old"]; 
   _ld = _old getVariable "ld"; 
  _new setUnitLoadout _ld; 
}];

Into the Mission Init, right?

 

Yes, but you'll catch the loadout at the time of the player dies. It can be different from the start.

If you need the same loadout as at start, remove the EH "entityKilled" and add in the little code above:

{_x setVariable ["ld",getUnitLoadOut _x]} forEach playableUnits;  // or [p1,p2,....] instead of playableUnits

 

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×