Jump to content

createVehicle despawns immediately


tdavison

Recommended Posts

I have this in my script:

 

//create helicopter and position it
_heliPosition = [5541.9214,16432.719,60];
_supplyHeli = createVehicle ["I_Heli_light_03_unarmed_F", _heliPosition, [], 90, "FLY"];
 
//add crew to vehicle
createVehicleCrew (_supplyHeli);
 
 
In the game, it spawns the helicopter in the air (which is what I wanted it to do), adds the crew, but then the helicopter de-spawns and the crew falls to their deaths. Aside from being funny, does anyone know why the helicopter de-spawns within seconds of spawning?
 
Thanks
Link to comment
Share on other sites

  • 1 month later...

Hi!

 

I am relatively new to scripting and I'm trying to do nearly exactly this same thing. I have tried as many variations as I can think of, including the previously mentioned snippets from stonXer, yet I am still having issues with the helicopter disappearing.

 

The helicopter will do what ever I tell it, but It seems like as soon as I get within 100 meters or so, it goes poof. And yes, it is fun to watch the AI fall to their deaths, but that's not what i'm going for. :)

 

Any help I could get would be greatly appreciated.

 

Thanks!

Link to comment
Share on other sites

Thanks- It is working now. I have a feeling the setVToken is what allowed it to stay. Funny thing now is when the crew sees me approach, it moves away. I'll get all that handled in the script though. Thanks very much for your responses.

That's right.

 

I had the same issue, added setVToken line and auto-immediate-deletion stopped.

(I have not added the other line "EPOCH_server_vehicleInit").

Link to comment
Share on other sites

are you using stock Epoch AntiHack? do you have anything at all in server-side RPT log?

 

I am using stock antihack. Even when I disabled it, the vehicle disappeared. Also, there is nothing related in my RPT log.

 

I do have SEM and A3EAI running and some additional scripts. I'll start disabling those and see what happens.

 

Thank you much for helping.... I really appreciate it. Any other ideas?

Link to comment
Share on other sites

I am using stock antihack. Even when I disabled it, the vehicle disappeared. Also, there is nothing related in my RPT log.

 

I do have SEM and A3EAI running and some additional scripts. I'll start disabling those and see what happens.

 

Thank you much for helping.... I really appreciate it. Any other ideas?

Sorry, nothing else comes to mind.

As I said, the only time I run into an issue was resolved with this > _veh call EPOCH_server_setVToken;

If you already have that line I don't have any further fixes.

 

Disabling other scripts to test is a good idea, though. Good luck.

Link to comment
Share on other sites

Sorry, nothing else comes to mind.

As I said, the only time I run into an issue was resolved with this > _veh call EPOCH_server_setVToken;

If you already have that line I don't have any further fixes.

 

Disabling other scripts to test is a good idea, though. Good luck.

 

Well, still no luck. Starting with a PURE vanilla epoch server build with stock AH turned off and one script called from onPlayerRespawn.sqf  ...

 


_SpawnBoxPosition = [23600.4,18001,0];
 
_InitSpawnPosition = getposATL player;
 

_supplyHeli = createVehicle ["C_Heli_Light_01_civil_F", _SpawnBoxPosition , [], 200, "FLY"];   _supplyHeli call EPOCH_server_setVToken;

createVehicleCrew (_supplyHeli);

_supplyHeli move _InitSpawnPosition;  

...and when the chopper gets close.....BAM. I have two AI falling on me. LOL

 

Again, MGM... Thank you for your help! Maybe someone else will come along that can add some input. :)

Link to comment
Share on other sites

Wow... Thank you everyone!

 

I modified the scripts mentioned in the posts by elbabar and now have the vehicles spawning on server start and acting the way I want....

 

For the life of me I cant figure out how to fire off the script by a client action though. I have to admit that I am pretty new at this and maybe should just walk away! LOL... I've been researching event handlers and public variables, but i can't seem to wrap my head around it. Maybe someone has an example they could point me to?

 

Ultimately, what I am playing with is when a player dies and respawns, if they have a parachute on their back when they teleport (parachute provided by a loadout script), they respawn in the cargo bay of a helicopter moving from waypoint to waypoint all over the map.

 

It seems i have it all working except the part where the player is put in the cargo of the helicopter. Too ambitious?

 

Again... Thank you all for the help you have provided so far! :)

Link to comment
Share on other sites

Give the vehicle a name like "bruno" and use

player moveInCargo bruno
.

Or You could replace "bruno" with "spawn_heli" or something similar.

Greez KiloSwiss

 

 

 

Yep....What worked for me is...

 

_supplyHeli setVehicleLock "UNLOCKED";

Player assignAsCargoIndex [_supplyHeli, 0];
Player moveInCargo _supplyHeli;

 

And for me, as soon as the player moved to the helicopter is disappeared.

 

Still working on learning how the code. :) I feel as if when i create the object, i need to give it a global variable name. Then when the client script get triggered, it has a variable (eg: _supplyHeli) to use.

 

Am I on the right track? Sorry for being such a noob! LOL

Link to comment
Share on other sites

Yep....What worked for me is...

 

And for me, as soon as the player moved to the helicopter is disappeared.

 

Still working on learning how the code. :) I feel as if when i create the object, i need to give it a global variable name. Then when the client script get triggered, it has a variable (eg: _supplyHeli) to use.

 

Am I on the right track? Sorry for being such a noob! LOL

this might be too obvious but you said you're very new so:

you do know that any variable name beginning with the underscore character is automatically a local variable, right?

on the goal: I think you're on the right track, you will need to do testing and tweaking till it works though. unless somebody else has coded the exact same script, it's difficult to say whether it will work or not.

it might be a better utilization of your time if you search the web and sites like armaholic for a working in-vehicle spawn script. give credits and take tested code. about 150x faster method for new scripters.

Link to comment
Share on other sites

Hey everyone... I got it working!!!!

 

In summary, I created a .PBO in the addons folder that creates the vehicle and it stays put. Then I use event handlers, global variables and client side scripts to interact with it.

 

If anyone wants more specifics on exactly what I did, feel free to message me!!

 

...and now onto other scripts!

 

Thank you all again for your help in pointing me in the right direction. I learned quite a bit!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...