Respawning a plane with customized weapon pylons?
The vehicle respawn module respawns the planes with their default loadout instead of the loadout set in the editor. Has anybody figured out how to keep the custom loadouts on respawn?
Posted May 31, 2017, 1:28 AM UTC
12
Its a good idea to not think of it as "that plane respawning", but rather that plane getting destroyed and a completely new one spawning. The process might be called "respawn" but the old entity has nothing to do with the new entity.
You have to save characteristics of the old entity, and apply these characteristics to the new entity after it is spawned.
the general idea in SQF would look like this:
[deleted]
So in my usual "Why would anyone do it that way???" way, I figured out a fairly convenient (for me) way to do it.
I used
in the init line of the planes, base respawn, with respawn markers, and
(from this) with every _vehicle changed to the variable of the vehicle in the On Respawn field.
EDIT: PASTEHERE is where the actual loadout goes.
Just wanted to make this a bit more clear for others like me who may be really new to scripting but want to make this work.
You want to respawn a vehicle. First you need to place a marker wherever you want the craft to respawn at with the prefix respawn_vehicle_west (assuming it's for blufor), you can add any text after that to specify multiple spawn points; they will be picked at random if you have more than one. Then go into attributes > multiplayer > respawn and select respawn on custom position. (I had three different ones named respawn_vehicle_west_1 etc)
Then you place your helicopter or plane you want to respawn and set up the pylons how you want them. You name it something in the variable field of its attributes, in my case "ah6_hydra"
Then in the init line below that you need to tell the craft to copy its pylon settings to your clipboard so you can replace that in the "PASTEHERE" spot.
So in the init line, you put:
Load into the game, then paste the pylon output to a text file or whatever you want, just hang onto it for now.
Then delete the copy line in the init line and replace it verbatim, with:
Then toward the bottom of attributes there's a category called "Event Scripting". You take PlusP38's code and literally find and replace all instances of "_vehicle" with whatever you named your plane/helo, and replace "PASTEHERE" with your pylon settings you copied. In my case:
Where do I paste my final code that I've collected?
So I'm assuming you mean the the fully prepared version of the large bit of code, it goes in the On Respawn section of the vehicle's attributes.
If you meant the code that
gives you, there's a spot in the block of code with PASTEHERE where it goes.
If it's neither I might be an idiot and you need to eli5 lol
I don't see that. I'm using vanilla Eden. Is that an advanced feature or a modded version?