OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: X75TIGER75X on 14 Nov 2008, 21:34:17

Title: Refuel and Resupply the plane (SOLVED)
Post by: X75TIGER75X on 14 Nov 2008, 21:34:17
How can you make airplane refuel and rearms their spent ammonium when they enter a trigger?

I wanted to recreate Air Combat game named Ace Combat, if player runs out a ammonium, they fly back to south to rearm the weapons and back to the combat.

Thanks to anyone who replied!
Title: Re: Refuel and Resupply the plane
Post by: bedges on 14 Nov 2008, 21:38:49
Create the trigger, group it with the aircraft and in the 'On Activation' field enter

Code: [Select]
vehicle (thislist select 0) setfuel 1; vehicle (thislist select 0) addmagazine "whatever the name of the magazine is"
Untested, but should work fine.  :good:

EDIT - tested in OFP and it works
Title: Re: Refuel and Resupply the plane
Post by: X75TIGER75X on 14 Nov 2008, 22:44:34
Nope, It didn't work, I'm using F18 Addon, I put 
Code: [Select]
vehicle (thislist select 0) setfuel 1; vehicle (thislist select 0) addmagazine "fz_f18_m61"
In trigger "On Activation" and grouped it with my F18, didnt rearm my gun.
Title: Re: Refuel and Resupply the plane
Post by: bedges on 14 Nov 2008, 22:49:27
Try adding a

Code: [Select]
hint format["%1", name (thislist select 0)]
to the 'On Activation' field, which will tell you the name of the unit. If it's not the player's name, then that's the problem.

And please don't quote the post you're replying to  :good:
Title: Re: Refuel and Resupply the plane
Post by: X75TIGER75X on 14 Nov 2008, 23:31:21
I named the aircraft Vehicle, when I play the map, it tells me the code is missing ; and etc and lots of error.
Title: Re: Refuel and Resupply the plane
Post by: bedges on 14 Nov 2008, 23:36:41
'vehicle' is a reserved term, use something like my_vehicle. The 'On Activation' code should be

Code: [Select]
vehicle (thislist select 0) setfuel 1; vehicle (thislist select 0) addmagazine "fz_f18_m61"; hint format["%1", name (thislist select 0)]
When you have multiple commands one after the other they need to be separated by a ;
Title: Re: Refuel and Resupply the plane
Post by: Spooner on 15 Nov 2008, 01:41:44
You might consider using setVehicleArmor and setVehicleAmmo commands to repair and refit the planes, as well as ensuring that you only resupply aircraft, rather than any vehicle or man within the trigger:
Code: [Select]
{ if (_x isKindOf "Air") then { _x setFuel 1; _x setVehicleArmor 1; _x setVehicleAmmo 1; }; } forEach thisList;
Title: Re: Refuel and Resupply the plane
Post by: X75TIGER75X on 15 Nov 2008, 19:20:50
Spooner's script worked =P Yay!

Thank you everyone =P

EDIT: Wait, I forgot something, I also need repair too

EDIT 2: Never mind I didnt read completely, it does repair too.