Jump to content
Sign in to follow this  
satexas69

Fuel Draining Issue - Oddity

Recommended Posts

I have a mission where I have a field of choppers, and I don't want them used until the first objective is completed.

Creative players will find them, and abuse this, of course.

I need to start the choppers off with fuel, so when they respawn, they have fuel.

SO, when the mission starts, I set up a trigger, and drain them on activation, which WORKS:

on Act:  AP1 setfuel 0; AP2 setfuel 0; AP3 setfuel0

(They naturally get their fuel back when the first objective is completed BTW - via another refueling trigger)

HOWEVER, if I go to the choppers, and blow them up, wait for them to respawn, they come back with fuel.

Ok, no big deal - so I make a trigger that's really small, put it on top of each chopper and drain it again -

on Act: AP5 setfuel 0

but that does NOT work (the re-draining on trigger activation). Is there a bug in the game? I can't get the fuel out!

Ideas?

COULD it be that the respawn script isn't keeping the unit's names? Does anyone have a great respawn script that DOES?

Share this post


Link to post
Share on other sites
COULD it be that the respawn script isn't keeping the unit's names? Does anyone have a great respawn script that DOES?

Yes, these scripts delete the original vehicles and create new ones. The name is not preserved.

Share this post


Link to post
Share on other sites

Does anyone know of a good respawn method/script that does?

Share this post


Link to post
Share on other sites
Does anyone know of a good respawn method/script that does?

No, because you can't really. But there are other ways you can do this. First one I can think of is to edit the respawn script. Use a global variable in your mission (something like EnableChoppers), in one of the chopper's init fields write EnableChoppers = false. Then, when you want them to be usable (you can use your existing trigger that sets their fuel to 1), set EnableChoppers to true. Then in the script, find the part where the new chopper is created and below that add a line to check the status of EnableChoppers, and if it's not true then remove all its fuel:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if(!(EnableChoppers))then{_vehicle setfuel 0};

Of course you need to find out what the local variable used for the new vehicle is in the script and replace _vehicle with that variable (if it isn't already _vehicle, it wouldn't be a very surprising coincidence).

And of course this is just one of many potential ways of doing it, as with most things in mission editing, and you just have to be creative with all the assets available to you (triggers, scripts, etc..) and find an effective solution (hopefully the easiest). If you do happen to think of another, easier solution then by all means use it. wink_o.gif

Share this post


Link to post
Share on other sites

Kyle,

Good advice, and thank you for the example. I will duplicate and modify my spawning script just for this specific task/scenario - that's a good idea.

Again, thank you for the advice.

EDIT UPDATE: The script-modify method worked great, and now it's doing exactly as intended. Thank you. I consider this matter "RESOLVED"

Russ

Share this post


Link to post
Share on other sites

I know this is considered resolved but it is possible to rename a vehicle once it has respawned using a VRS script.

In the vehicle init line you'll need to send the vehicle (eg. Hmm2) name to the script so something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">v = [this,"Hmm2"] execVM "vrs_AI.sqf"

and then define it at the start of your vrs script using code like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_name_vcl = _this select 1;

and later in the script once the vehicle is created you need to rename the created vehicle using this setVehicleVarName cmd so the code looks like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vcl = _type createVehicle _pos;

_vcl setVehicleVarName _name_vcl;

player groupchat format ["%1", VehicleVarName _vcl];

I include the last line to confirm that the new vehicle has the correct name. I use this code in my AI respawn/vehicle respawn scripts and as far as I can tell it works nicely.

Share this post


Link to post
Share on other sites

Why not lock the vehicles instead?

It would be better to lock the vehicles because you would probably want refuel trucks in the base, and people could easily cheat by refueling the choppers. That would prevent people from getting in in the first place.

Share this post


Link to post
Share on other sites
I know this is considered resolved but it is possible to rename a vehicle once it has respawned using a VRS script.

In the vehicle init line you'll need to send the vehicle (eg. Hmm2) name to the script so something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">v = [this,"Hmm2"] execVM "vrs_AI.sqf"

and then define it at the start of your vrs script using code like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_name_vcl = _this select 1;

and later in the script once the vehicle is created you need to rename the created vehicle using this setVehicleVarName cmd so the code looks like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vcl = _type createVehicle _pos;

_vcl setVehicleVarName _name_vcl;

player groupchat format ["%1", VehicleVarName _vcl];

I include the last line to confirm that the new vehicle has the correct  name.  I use this code in my AI respawn/vehicle respawn scripts and as far as I can tell it works nicely.

Yes you can name created vehicles, but you cannot 'get' the name of the original vehicle. Second, I think just setting their fuel to 0 in the respawn script works better anyway.

Share this post


Link to post
Share on other sites
Why not lock the vehicles instead?

It would be better to lock the vehicles because you would probably want refuel trucks in the base, and people could easily cheat by refueling the choppers. That would prevent people from getting in in the first place.

Never thought of the locking, LOL... but either way, I'd have to code it the same (lock them, then unlock them).

No refuel trucks since choppers re-spawn anyway - why? Cause people would rather just crash or dump it for another than take the time to fuel it.

Why? Cause it's really about re-arming it, and right now in ArmA, rearming FFAR's and Hellfire's is FUBAR.

Share this post


Link to post
Share on other sites

M8 you may have already tried this, but if you haven't you could possibly run a script to specifically re-arm your choppers.  

I've made a simple mission using a modded version of KaRRiLLioN's vrs script and triggers to re-arm specific ammo into a Harrier that may help.  You can get it from here

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  

×