Jump to content
Sign in to follow this  
Asmodeuz

Attach trigger to vehicle on vehicle respawn

Recommended Posts

Hello, I am using the following setup (see the image below) to create a mobile spawn point for human players in a multiplayer mission.

 

trigger_attachTo_vehicle_zpsunxnoyrg.jpg

 

Vehicle respawn module is synced to the MSE-3 Marid so that the vehicle will respawn if players will desert it or it gets destroyed.

Respawn position is synced to the MSE-3 Marid thus creating a spawn position in the vehicle. This spawn position will also move with the vehicle.

 

The trigger there is set to OPFOR (Present). With this there has to be OPFOR players inside the trigger area for the Respawn position to be available to players.

 

Now, I would like this to be so that the trigger is attached to the MSE-3 Marid so that it would go everywhere where the vehicle is going.

I know that I can achieve this easily by typing the following eg. in the Marid's INIT-field:

toActivateOPFORPlayerRespawnInOPFORapc attachTo [OPFORapc,[0,0,0]];

Now the problem is that when the Marid gets respawned the trigger won't be attached to the vehicle anymore.

 

How to make it so that the trigger would be attached to the MSE-3 Marid at all times (= would get reattached on respawn)?

Share this post


Link to post
Share on other sites

I've managed to get something going with this:

 

adding the line

_this execVM "attachOnRespawn.sqf"  

in the vehicle respawn module's (ModuleRespawnVehicle_F) Expression field and then adding the attachTo command 

toActivateOPFORPlayerRespawnInOPFORapc attachTo [OPFORapc,[0,0,0]];

in the attachOnRespawn.sqf file does make the trigger to attach to the MSE-3 Marid when it respawns. So that functionality works but then another one sort of doesn't.

 

When the vehicle spawns again the respawn position for the players is in the respawn module (ModuleRespawnPosition_F, module in the bottom left control in the above picture) instead of the MSE-3 Marid where it should be.

 

If I remove the line _this execVM "handleVehicleRespawn.sqf"  from the vehicle respawn module's Expression field everytime the Marid respawns the respawn position gets correctly placed on the Marid.

 

Edit: using

params ["_newVehicle","_oldVehicle"]; if (_newVehicle == OPFORapc) then {toActivateOPFORPlayerRespawnInOPFORapc attachTo [OPFORapc,[0,0,0]];};

directly on the vehicle respawn module's Expression field works (the trigger gets attached to the MSE-3 Marid on its respawn) but still the respawn position (and the accompanying respawn marker) for players gets placed on the player respawn module.

 

Any ideas what is the cause for the aforementioned behaviour?

Share this post


Link to post
Share on other sites

I know someone else knows how to do this with custom stuff but here is my solution.

 

I just attach/connect one of the inf respawn modules to the vehicle, set it to the side I want to respawn and even after I take the jeep out, blow it up and it respawns and I can respawn to it. Even after I drove it off and then got out and naded myself I respawned back to it a second time.

 

Thing is I'm not using a custom vehicle respawn script. But you are using a custom inf respawn script that you don't really have to use. The plane old one in the editor works for this. The only thing you need to do is make the vehicle respawn when its abandoned by say 100 meters or so, which the vehicle respawn module in the editor will do. Put a 1 minute delay on it so that the opfor guys will have to come back to it to keep it alive. Don't even need a trigger. It will be a moving respawn position that the oprfor will have to stay near.

 

The only thing I left out is having opfor in the area so that their fellow opfors can respawn to it, they can without them near, but they can't go far or it will disappear within one minute after they are 100 meters away from it.

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
Sign in to follow this  

×