Jump to content
Sign in to follow this  
OberSchutze

What am I doing wrong?

Recommended Posts

I am trying to make a aircraft tractor move vehicles and repair and rearm them.

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: Robert Larson, larson@20thsfg.com
//////////////////////////////////////////////////////////////////


_tractor = _this select 0

_tactor addAction ["Hook Up", [attachTo, air,[0,0,1]]];
_tactor addAction ["Detach", [detach, air, [0,0,1]]];



transportAmmo = 10000;
transportRepair = 10000;
transportFuel = 3000;

Share this post


Link to post
Share on other sites

The second argument to addAction is the name of a script, not commands. Put the attachTo stuff in separate scripts.

Share this post


Link to post
Share on other sites

To be honest, attachTo won't be the most realistic of towing methods, but here's a way to do it:

In the init of your tractor put:

this addAction ["Hook Up","hookup.sqf",[],1,false,true,"","_this == driver _target"];

That will allow the driver only to activate the command.

Then for the actual towing, there's a few methods of doing it, one would be using cusorTarget perhaps. Just turn your head and look at the vehicle you wanted to to and Hook Up. Here's the code for that limiting it to only Ospreys. The attachTo numbers need work, it's really tough getting this to look good.

hookup.sqf:

_towed = cursorTarget;

if ((typeOf _towed) == "MV22") then {

_towed attachTo [tow1, [0,-13,2]];
} else {
hint "You can't tow that!";
};

So yeah, not happy with this, but it's basically what you need to do. :)

Share this post


Link to post
Share on other sites

OK this is my INIT line

veh = [tractor, 5, 120, 0, FALSE, FALSE, "nul=[tractor] execVM ""Scripts\tractor.sqf"""] execVM "Scripts\vehicle.sqf"; nul=[tractor] execVM "Scripts\tractor.sqf"; this setPosASL [getposASL this select 0, getposASL this select 1, 16.20];

The help script won't load the addaction and my other stuff isn't loading either.

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: Robert Larson, larson@20thsfg.com
//////////////////////////////////////////////////////////////////

_tractor  = 	_this select 0

_tractor addAction ["Hook Up","Scripts\hookup.sqf",[],1,false,true,"","_this == driver _target"];



transportAmmo = 10000;
transportRepair = 10000;
transportFuel = 3000;

Share this post


Link to post
Share on other sites

OK I have that part working, thanks. Do you know why the other part doesn't work? Is that all I need to add to make something rearm refuel and repair?

Share this post


Link to post
Share on other sites

To repair a vehicle it's

unitname setdamage 0;

for fuel it's

unitname setfuel 1;

If your using the script from Kylania then the unit name would be _towed and you would place the code after in the first If statement.

Ammo is more complex as it has to be the right type and something I haven't tried as I keep getting config.bin errors.

Share this post


Link to post
Share on other sites

So I need to stick some repair trucks on the top of my aircraft carrier?

Share this post


Link to post
Share on other sites

You won't need repair or fuel trucks, if those lines are placed in the script.

Share this post


Link to post
Share on other sites

Well what I guess I am saying is that it kinda ruins the mood to see a 5t truck on top of a flight deck, and no the other commands aren't working either.

Share this post


Link to post
Share on other sites

Or you can cover carrier area with trigger and tweak following code from Weasel [PXS] to match your needs.

// Written by Weasel [PXS] - andy@andymoore.ca

// This script rearms, refuels, and repairs vehicles.
// Vehicles must be less than height 2 (typically landed, if air vehicles) and must remain in the
// trigger area for 3 seconds. It then drains all fuel, repairs, rearms, and refuels.
//
// Setup a trigger area to activate this (F3 in map editor) with the following settings:
//
// Trigger REPEATEDLY, BLUFOR, PRESENT
// Name: Rearmlist
// Condition: this;
// Activation: {[_x] execVM "rearm.sqf"} foreach thislist;
//
// Warning: If this trigger area overlaps another trigger area (such as ammo-transport Scripts), sometimes
// things don't work as planned. Keep this seperate if you can.

_unit = _this select 0;

// Don't start the script until the unit is below a height of 2, and make sure they hold that
// height for at least 1 seconds.
WaitUntil{(getPos _unit select 2)<2};
sleep 1;
if((getPos _unit select 2)>2 || not (_unit in list Rearmlist)) exitWith{};

//_unit setFuel 0;
_unit VehicleChat "Repairing...";
sleep 3.5;
_unit setDammage 0;
_unit VehicleChat "Rearming...";
sleep 3.5;
_unit setVehicleAmmo 1;
_unit VehicleChat "Refueling...";
sleep 3.5;
_unit setFuel 1;
_unit VehicleChat "Finished.";

if(true) exitWith{};

Share this post


Link to post
Share on other sites

That script works fine on land, but as soon as I put it on the carrier it doesn't work at all.

---------- Post added at 01:02 PM ---------- Previous post was at 12:36 PM ----------

I got it to work, I appearently had a playable slot on the trigger. I only have two other questions if you would be kind enough to help me with them. First I need to figure out how to get enemies to fly in on a helicopter and para drop out the back after bluefor hits a trigger, every 10 minutes until a tower is blown up. The other is linking the operability of some IGLA pods to a radar dish. Any additional help would be much appreacheated.

Share this post


Link to post
Share on other sites

For the first question, just play Domination. :)

For the second, maybe put a trigger on the tower that when it's destroyed you remove ammo from the pods?

Share this post


Link to post
Share on other sites

Well I just wanted to make the mission more challenging by adding the reinforcements. I figured it would encourage a more rapid assault on the towers. They don't even have to come every 10 minutes, maybe just one wave of reinforcements.

As for the trigger would I make a SQF for it to execute?

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  

×