Forum Jump :

Author Message


Posts: 23
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name: ravajava

 
#1 Posted at 2016-06-02 23:41        
     
I was wondering if anyone knew how to do this. I've been stalking forums for a few days, seen a few similar questions, but none that worked as I was hoping.

What I wish to do exactly is have it so that, in multiplayer, when BluFor players die, they respawn in the cargo slots of a set helicopter or car. The vehicle itself is not respawning, just the players. AI wouldn't need to respawn either, just people. If anyone could help me figure out how to get that working, it would be greatly appreciated.

I'm not dumb. I just have a command of thoroughly useless information ~Bill Watterson

Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 60
In-game name: Kobayashi Maru

 
#2 Posted at 2016-06-03 06:51        
     
In mission folder (where mission.sqm is), create a file onPlayerRespawn.sqf (or add lines if already exits):

_unit = _this select 0;
waitUntil {_unit == player};
  _vehicles = vehicles select {(side _x == side _unit) && canMove _x};
  if (count _vehicles > 0) then {
  _unit moveInCargo (_vehicles select random (count _vehicles -1));
}

The second problem is to avoid respawning AI units. If AI units are not playable, no problem, they don't respawn.
For playable units, 2 solutions:
- disable the remaining slots in lobby (but no more JIP);
- forget the onPlayerRespawn.sqf above , handy for players but useless for AIs and replace it with this code (in init.sqf or even a trigger):

0 = [] spawn {
  if (!isServer) exitwith {};
  {
    _x addEventHandler ["respawn",{
      _unit = _this select 0; 
      if (!isPlayer _unit) exitWith {deleteVehicle _unit}; 
      _vehicles = vehicles select {(side _x == side _unit) && canMove _x}; 
      if (count _vehicles > 0) then { 
         _unit moveInCargo (_vehicles select random (count _vehicles -1))
      }; 
   }]
  } foreach playableUnits
}

This post was edited by Pierre MGI (2016-06-03 18:03, ago)

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 22
In-game name: Wak

 
#3 Posted at 2016-06-03 10:18        
     
You can put this code in init.sqf to move respawned players in to the cargo of a vehicle (If a seat is available). In this case the vehicle is named respawnVeh.

if (hasInterface) then {
    player addEventHandler ["Respawn", {
        player moveInCargo respawnVeh;
    }];
};

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Author Message


Posts: 23
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name: ravajava

 
#4 Posted at 2016-06-03 21:17        
     
# 654wak654 : You can put this code in init.sqf to move respawned players in to the cargo of a vehicle (If a seat is available). In this case the vehicle is named respawnVeh.

if (hasInterface) then {
    player addEventHandler ["Respawn", {
        player moveInCargo respawnVeh;
    }];
};

Thanks, that worked perfectly.

To Pierre, I'll give what you gave me a try at another time.

I'm not dumb. I just have a command of thoroughly useless information ~Bill Watterson

Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 60
In-game name: Kobayashi Maru

 
#5 Posted at 2016-06-03 21:57        
     
No problem, it's just a randomization for multiple vehicles.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS