Jump to content
Sign in to follow this  
Killy_McMurder

Scripting Help - Spot the bugs: LCU Beaching script

Recommended Posts

I've had a look around and i know that there's similar scripts that already exist that do pretty much what i'm attempting to do, but i'm trying to learn scripting for myself so i'd appreciate any help that i can get with this one.

Basically i'm building a script that moves an LCU with a tank already aboard to a shoreline, lowers the LCU ramp, and pushes out the tank. This is all for AI units, and having the LCU return isn't that important right now.

I've got a working script that has the tank attached to the LCU, at the moment the problem i'm having is with the "beaching" script... This is what i've got upto now:

'Attach script':


_tank = _this select 0;
_boat = _this select 1;

_tank setPos [getpos _boat select 0, getpos _boat select 1, 1.65];
_tank attachTo [_boat];

gunner _tank disableAI "AUTOTARGET";

//This action was just for testing, and also if i feel like driving!
_action = _tank addAction ["Detach tank", "detach.sqf"];

waitUntil [(getMarkerPos "beach") distance _boat <5] execVM "beach.sqf";

Problems with this one:

Stopping the gunner from rotating the turret. Apart from looking stupid, If the turret isn't aligned with the front of the hull when the tank is detached, the barrel poking throught the side makes both tank an LCU fly pretty high up in the air... i thought the disableAI com would do it but it won't work... Any Ideas?

The section that waits for the LCU to reach the "beach" marker. I put that together all by myself so i'm not surprised it won't work... there's a rectangular marker with the same name on the shore area i have the LCU's approaching, but again nothing happens when they reach it... Can anyone see what i've done wrong there?

'Beach script'


_boat animate ["lcuramp",1];

detach _tank;

_tank move [(getpos _boat select 0) + sin(getdir _boat)*60, (getpos _boat select 1) + cos(getdir _boat)*60];

Now i know that this one is incomplete, i know i haven't defined the _tank and _boat variable thingies, but i wasn't sure were to do this... and once i do, does there have to be something in the section of the 'attach' script that calls this script? (eg like i would in the init "nul=[tank, lcu] execVM "beach.sqf")

I'll probably be asking alot of questions since its a pretty big learning curve to from noob to decent ArmA scripter! I'd be grateful of anyone willing to help me out here,

-Killy

Share this post


Link to post
Share on other sites

Have you tried the other disableAI things? http://community.bistudio.com/wiki/disableAI

I thought to remove all the fuel from the tank as the turret moving usually starts the engine, but it still moves even with no fuel.

You could remove the gunner and only add him after the vehicle leaves the LCU?

Share this post


Link to post
Share on other sites
Have you tried the other disableAI things? http://community.bistudio.com/wiki/disableAI

I thought to remove all the fuel from the tank as the turret moving usually starts the engine, but it still moves even with no fuel.

You could remove the gunner and only add him after the vehicle leaves the LCU?

Yeah i tried "MOVE" aswel that didn't work, and reading the biki page the other options won't apply to what i'm trying to do. I thought about just adding the gunner once the tank was clear, i'll probably do that just for simplicity sake

Share this post


Link to post
Share on other sites

I don't have too much time to read all, but WaitUntil code is wrong, try this:

waitUntil {(getMarkerPos "beach") distance _boat <5};
_a = execVM "beach.sqf";

Share this post


Link to post
Share on other sites

OK i think i've got the majority of it working...

lcu.sqf:

_tank = _this select 0;
_boat = _this select 1;

_tank setPos [getpos _boat select 0, getpos _boat select 1, 1.65];
_tank attachTo [_boat];

gunner _tank disableAI "AUTOTARGET";

_action = _tank addAction ["Detach tank", "detach.sqf"];

waitUntil {(getMarkerPos "beach") distance _boat <6};
_a =[_tank, _boat] execVM "beach.sqf";

beach.sqf

_tank = _this select 0;
_boat = _this select 1;

_boat animate ["lcuramp",1];

detach _tank;

_tank move [(getpos _boat select 0) + sin(getdir _boat)*60, (getpos _boat select 1) + cos(getdir _boat)*60];

This all executes well... kind of.

I've used a rectangular marker but the 'beach' script is only executing when the LCU is less then 6m from the centre of the marker, this is causing problems with consistency - trying to get the LCU to hit the same point on the beach everytime with a waypoint. Can anyone suggest a better way i could do this section?

And - When the tank detaches it hits the LCU sending it backwards and knocking everything out of shape... Is there something i could do to 'anchor' as it were, the LCU in place just whilst the tank cleared?

Cheers

Edited by Killy_McMurder
i'm an idiot

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  

×