Jump to content
WilliamMaxwell

Keep vehicle appearance and attributes on vehicle respawn?

Recommended Posts

Hi! I'm kinda new to advanced mission edditing scene. In the past, I've been able to plop the units I want and the vechiles I need down using either Zeus or spawning them before the misssion in abundance. Now, I know a bit about using the Eden Editor, and I've been able to find lots of help within this forum. But recently, I've been unable to find how to have a vehicle keep it's custom init, paintjob, and other atributes after respawn. I'm unsure if this is even possible. I have a helicopter which my server plans to use as a mobile rearm station, using an amazing virtual arsenal script I've found on this site. Since this server will be up nearly 24/7, and my squadmates are not the best at flying, I'm attempting to ensure that when and if the helicopter is crashed, it will respawn with the proper init. Any help would be greately apprciated! 

Share this post


Link to post
Share on other sites

Try:

_veh setVariable ["BIS_enableRandomization", false];  if you spawn it,

or this setVariable ["BIS_enableRandomization", false]; in init field of the vehicle.

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

Try:

_veh setVariable ["BIS_enableRandomization", false];  if you spawn it,

or this setVariable ["BIS_enableRandomization", false]; in init field of the vehicle.

Hey! Thanks for the help. I tried the second script(? not really sure what to call it when it's in the init field). I set a vehicle to sync to a respawn module, set it to a different paint job, and blew it up in SP. However, when the vehicle respawned, it had the default paint job, and the atributes were reset (including the init field). I'm not sure how to use the first script you've posted. Could you link me to a thread that shows what that is and how to use it? I assume I'm not supposed to put it in the init field. Is there supposed to be a .int file or some other such addition in the mission folder? Again, I'm VERY new to the mission editing scene, and have been only using in game functions. I'm trying to learn about these additional files, but it's slow going. 

Share this post


Link to post
Share on other sites

This is one way to do it, with the Eden respawn module.

 

1. Place the vehicle in Eden.

2. Place a vehicle respawn module.

3. Sync the module with the vehicle.

4. Double click the respawn module. 

5. In Expression, put: _this execVM "myVehicleRespawnScript.sqf";

6. In your mission root folder, create the file "myVehicleRespawnScript.sqf".

 

myVehicleRespawnScript.sqf:

_vehicle = _this select 0;
clearWeaponCargoGlobal _vehicle;
clearMagazineCargoGlobal _vehicle;
_vehicle addItemCargo ["Toolkit", 1];

Feel free to put anything in that file that you want to be applied to the vehicle. setObjectTextureGlobal for example.

Share this post


Link to post
Share on other sites
8 hours ago, BlindNavigator said:

Feel free to put anything in that file that you want to be applied to the vehicle. setObjectTextureGlobal for example.

 

So I have to set the attributes for the vehicle specifically? Meaning I can't set the attributes in Eden, follow your listed instructions, and then play it? I have to specifically set the instructions in the .sqf file? Alternatively, say I wanted a vehicle to open it's ramp every time it respawns. I put "this animate ["cargodoor_1",1]; this animate ["cargodoor_2",1];" in the init field, and it will execute that script. However, if I wanted to have it do that every time it respawns, would I make a .sqf file named "PelicanRespawnScript.sqf", place the ramp script, and have the respawn module execute "PelicanRespawnScript.sqf"?

 

Again, please forgive me, I'm super new to all this and reading forums as fast as I can figure out what I'm trying to do.

Share this post


Link to post
Share on other sites

Yes, put your commands in the sqf. You can still have the attributes set in Eden, this script is for when the vehicle respawns.

If you follow my example with myVehicleRespawnScript.sqf the vehicle is referenced by "_vehicle" instead of "this".

 

The first line:

_vehicle = _this select 0;

means that what ever vehicle synced with the module will be called _vehicle inside the script. It's almost like _vehicle = this in this case.

 

 

 

 

So your: 

this animate ["cargodoor_1",1];

should be: 

_vehicle animate ["cargodoor_1",1];

when you put it in the script.

 

 

 

Other than reading my earlier post again, you have to just test it. It will be easier for you to understand while in the game, playing around with it.

Share this post


Link to post
Share on other sites

I'm still not sure this is working for me. I'm attempting to use the script you gave me, but am unable to get it working. I followed your instructions to the letter. Any idea on what i should do?

Share this post


Link to post
Share on other sites

Hi,

I don't want to make a new thread, because my question is near the same as this one. I search for a solution to directly add full arsenal to a respawned vehicle with the Eden respawn module.

We normally don't use vehicle respawn or Arsenal in our missions, but now we want to use it for one mission and I don't get it work on dedicated server. It works for hosted mission.

My current solution is pretty near to BlindNavigator's script.

 

To expression line in the vehicle respawn module:

_this execVM "car_respawn.sqf";

 

The script itself is:

_car = _this select 0;
_car addAction ["<t color='#FFFF00'>Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal}];

 

Works perfect with host, will not work on server. I hope anyone can help me, because I'm new and still learning and I don't have a clue how to fix this for dedicated server. 

 

Thanks

Laru

Share this post


Link to post
Share on other sites

Read Biki:

 

Quote

This command has local effect. Created action is only available on the computer where command was executed. To make action available to all players, command must be executed on all connected clients (see remoteExec). addAction is also ignored on dedicated server, because of no user interface.

 

especially example 4.

Share this post


Link to post
Share on other sites

Thanks Pierre.

In the meantime I already recognized myself that this local effect cannot work on dedicated server and also found the remoteExec in the Wiki, but I don't figure out how to use remoteExec correctly with addAction.

I think example 4 wil be exactly what I need. I will give it a try after work today. I will give an update if I got it running on my server.

 

Share this post


Link to post
Share on other sites

Even with good informations from Pierre I didn't get a solution for respawning vehicle with addAction and Full Arsenal on dedicated server. But that doesn't mean anything, as I told before I'm an absolutely beginner.

I used custom made inventoryin the vehicle and no arsenal. I respawned vehicle with my custom made inventory. That will be ok.

 

If anyone can post a solution how to respawn vehicle on dedciated server with Arma respawn module + remoteExec script for adding complete arsenal to that vehicle I really apreciate. I don't need it anymore for the mission, but just want to see how that can be done. Hope to learn something from it. Thanks.

 

Share this post


Link to post
Share on other sites

did you try:

[( _this select 0),{_this addAction ["<t color='#ffff11'>Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal},nil,10,false,true,"", ""]} ] remoteExec ["call"];

 

or even:

_this spawn {sleep 1; [( _this select 0),{_this addAction ["<t color='#ffff11'>Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal},nil,10,false,true,"", ""]} ] remoteExec ["call"]};

 

Sorry for any better suggest.

Share this post


Link to post
Share on other sites

Thanks Pierre, tried both, but will not work on dedicated Server. 

 

EDIT! Sry, works. I had a wrong script path in the module. :)

Thanks

 

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

×