Jump to content
daskunk

Vehicle Respawn Module

Recommended Posts

After seeing a post about vehicle respawns I checked out the new module for this.

It seems to work well with just placing the module and then synchronizing it with the vehicles you want to respawn, then using the start respawn option.

What I noticed was vehicles don't spawn exactly on there start positions if you choose that option in the module, they spawn near it.

This then led me to choose the default spawn location and no respawn at all same with the other options associated with respawning at the start spawn point.

How exactly do you use this to get them to respawn exactly in the default position they have been placed in the mission start.

Skunk

Share this post


Link to post
Share on other sites

hello ... I have the same problem, the vehicle respawn in different positions

peppe

Share this post


Link to post
Share on other sites

...and without their init's being filled again. BIS if you see this - if the vehicle respawn module could have a text field for custom init's that'd be awesome.

Share this post


Link to post
Share on other sites

Fixed in today's dev branch build (not today's stable branch patch):

Fixed: Vehicles synced to Vehicle Respawn Module with position set to "starting position" were not spawned precisely on the starting position.

Share this post


Link to post
Share on other sites
...and without their init's being filled again. BIS if you see this - if the vehicle respawn module could have a text field for custom init's that'd be awesome.

Try putting a call/spawn/execVM in the expression field inside of the Vehicle Respawn Module then send the augument (the Vehicle being respawned) to the function/script.

I came here looking for some help with the Vehicle Respawn Module, as above, you can run scripts or functions for the vehicles that respawn by using the expression field. However, I can only get it to work on a hosted server and NOT a dedicated server. Does anyone have the same problem?

Here is the script in question:

if(isDedicated or isServer)then{execVM "serverFunctions.sqf";sleep 0.1;call serverFuncTest;};
waitUntil{!(isNull player)};
execVM "functions.sqf";
sleep 0.1;
execVM "Script.sqf";

serverFunctions.sqf

vehInit =
{
clearWeaponCargo _this;
clearMagazineCargo _this;
_this addWeaponCargo ["arifle_Katiba_F",2];
_this addMagazineCargo ["30Rnd_65x39_caseless_green",8];
};
serverFuncTest =
{
"O_Heli_Attack_02_black_F" createVehicle [3781.24,7919.35,0];
};

Ok, in a hosted server, the respawned vehicles call the vehInit function from the Vehicle Respawn Module's expression field.

In a dedicated server the vehicles respawn but they don't call the function even though they should because the expression field is unchanged.

The serverFuncTest is just to see if the functions are being loaded properly.

Edited by chaoticgood

Share this post


Link to post
Share on other sites
vehInit =
   {
   clearWeaponCargoGlobal _this;
   clearMagazineCargoGlobal _this;
   _this addWeaponCargoGlobal ["arifle_Katiba_F",2];
   _this addMagazineCargoGlobal ["30Rnd_65x39_caseless_green",8];
   }; 

Your cargo commands need to be global

Share this post


Link to post
Share on other sites

Thanks Larrow,I just figured it out after I called it quits for tonight and I was going to wait and see if someone had a solution until tomorrow, then I was going try and make my own vehicle respawn script if I couldn't find an answer.

Share this post


Link to post
Share on other sites

Module still iffy 50/50 of the time, Planes don't respawn at all with it. Grr....

Share this post


Link to post
Share on other sites

Yea planes do not meet the conditions of being a vehicle >.< and the vehicles still spawn random around

Share this post


Link to post
Share on other sites

I'm bumping this thread because it still is NOT fixed, and I have to say: It's slowly bugging me off.....

I would really like to see a modifier letting us choose to check possible collision or not.

Maybe I'm going to create a feedback tracker later on (if there isn't one open yet)

Share this post


Link to post
Share on other sites

I think i've found the problem. In moduleRespawnVehicle in line 232 the position isn't set the right way.

if (_position == 0) then {_newVeh setpos _respawnPos;};

... actually needs to be

if (_position == 0) then {_newVeh setPosATL _respawnPos;};

I've tested it in my own respawn script and think that it should work this way. Prior in the script the starting position is allready determined by getPosATL so it actually makes sense.

Edited by donyfreaky

Share this post


Link to post
Share on other sites

I also noticed on my dedicated server sometimes some how I get two vehicles spawned instead of one randomly throughout the match

Share this post


Link to post
Share on other sites
I also noticed on my dedicated server sometimes some how I get two vehicles spawned instead of one randomly throughout the match

Yes, it's a bug, easy to reproduce...

Set a deserted delay and a respawn delay.

Go into the vehicle, getout wait a few seconds then destroy it.

You will get 2 vehicles respawned...

Share this post


Link to post
Share on other sites

Thanks for info, will be fixed in the upcoming dev build.

Share this post


Link to post
Share on other sites
Thanks for info, will be fixed in the upcoming dev build.

The way i tried is to delete the desertedscript when the vehicle is destroy. I can't reproduce the bug anymore when i leave the vehicle but sometimes when i crash with the heli it does it again.

I suppose that's because the event "getout" is not remove from the vehicle or not as fast as necessary and the variable deserted script is not yet synchro. (because you are ejected from the vehicle)

As the script is only for server, maybe you should remove the "true" for the set and getvariable. No need to be public

Share this post


Link to post
Share on other sites
Thanks for info, will be fixed in the upcoming dev build.

Thanks! Than I finally can finish my personal armory mission.

Share this post


Link to post
Share on other sites

So it's supposed to be fixed. Can someone confirm this? Haven't had time to update on the dev-built yet.

Share this post


Link to post
Share on other sites

Are we allowed multiple vehicle respawn modules? I have one synced to a vehicle when the vehicle and the module are placed in the mission editor and that works great.

 

But I also have a vehicle which is spawned in script and then synced using synchronizedobjectsadd to a second vehicle respawn module (placed in the editor) but it doesn't do anything when the vehicle is destroyed. The synchronizedobjects command says they are synced.

Share this post


Link to post
Share on other sites

What's so bad about it? Other than this problem, it seems to be fine.

Share this post


Link to post
Share on other sites

But I also have a vehicle which is spawned in script and then synced using synchronizedobjectsadd to a second vehicle respawn module (placed in the editor) but it doesn't do anything when the vehicle is destroyed.

Syncing vehicles spawned in a running mission will not add the respawn functionality to them, BUT it is used as part of the modules script for checking the vehicle for desertion and also respawn position if 'Position > Respawn positions synchronised to vehicle' is used.

All the module does at start is call BIS_fnc_moduleRespawnVehicles passing it the module(logic).

It then reads the settings supplied via the module from the editor and recalls itself for each vehicle synced to the module, passing the vehicle and settings.

When passing a vehicle as param 0 the vehicle, depending on its passed settings, is given MPKilled MPHit GetIn and GetOut EHs being Respawn, CanMove and the last two(Get's) for desertion respectively.

Of which the MPKilled and MPHit EHs again call back on BIS_fnc_moduleRespawnVehicle passing the killer as the last param.

So to add a vehicle during a running mission...

  • Sync the vehicle if you are using desertion or respawn on module position.
  • Call the function passing the vehicle and needed settings.
[ _veh, _delay, _desertedDelay, _respawnCount, _init, _position, _positionType, _wreck, _showNotification, _forcedRespawn, _desertedDistance, _respawnWhenDisabled ] call BIS_fnc_moduleRespawnVehicle;
Check the function header in the function viewer for param descriptions.

There is also a scriptedEH available when ever a vehicle is respawned being

[missionNamespace,"respawn",{//someCode}] call BIS_fnc_addScriptedEventHandler
it is passed [newVeh,oldVeh]

Share this post


Link to post
Share on other sites

Yes, thanks Larrow. You're right, even though the vehicle shows as being synced in the output from synchronizedObjects, it doesn't do anything. As a workaround, I knocked up my own simple vehicle respawn system. I'll use your code as above as I prefer to use existnig systems to keep it all simple.

 

As an aside the module says it passes [oldveh, newveh] to anything run in the expression field, but I've always got nul from the 2nd element by the time it gets to the called script.

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

×