Jump to content
Sign in to follow this  
Harnu

Barrels in cargo?

Recommended Posts

I'm trying to create a script in which barrels can be hauled in the back of a boat. A few troubles I've encoureted:

1) The barrles "push" the boat forward even though they are in the back not touching anything.

2) If you turn, the barrels float beside the boatand aren't staying in cargo.

How can I keep the barrels in the back cargo section of the boat? The boat i'm using is the standard BIS "boat" for east.

Before I start writing a big script I start with just a simple one to see if I can do it. I wrote this and am not sure how to keep the barrels IN the boat.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">#start

_x = getpos boat1 select 0

_z = getpos boat1 select 1

_y = getpos boat1 select 2

_dirboat1 = getdir boat1

barrel1 setdir (_dirboat1)

Barrel1 setpos [(_x) - 1.5, (_z) - 2, (_y) + 1.75]

goto "start"<span id='postcolor'>

Like I said, simple just to see if I can do it.

Share this post


Link to post
Share on other sites
Guest jacobaby

Gah....it wont work like that.......trust me sad.gif

We have been trying to get vehicles into chopper for ages now, and its all crap mad.gif

One thing you could do for yours which I think would work, I use it successfully to attach a firing soldier to a helo.

Make a drop script to drop a tiny and invisible particle in a position over the boat. Have it loop every 0.001 secs.

Have the boat as the object in the final element of the array, and use the position part accordingly.

Make the lifetime of the dropped particle also 0.001.

In the section of the array called "beforedestroy.sqs" you should then call a script to move the barrels.

The position of the dropped particle is passed to the second script, so just setpos the barrels to that position.

eg

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

barrells setpos getpos _this

exit

<span id='postcolor'>

Hope that helps.

TJ

Share this post


Link to post
Share on other sites

Ahh thx.  I was just referncing the drop scripts to see how it gets smoke in the same spot all the time.  You idea sounds like a good solution, I'll try that now.

edit:

I can't get it to work.  I named the smoke "_smoke55", why aren't the barrels going to it?

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">Barrel1 setpos [(getpos _smoke55 select 0, getpos _smoke55 select 1, getpos _smoke55 select 2) + 0]<span id='postcolor'>

|#| Error: Type any, expected number

confused.gif?confused.gif?

-edit again

Barrel1.sqs

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">#start

_dirboat1 = getdir _boat

barrel1 setdir (_dirboat1)

barrel1 setpos _smoke55

~ 0.001

goto "start"<span id='postcolor'>

Barrel2.sqs

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">#start

_smoke = [50, 50, 50, .3]

_smoke2 = [50, 50, 50, 0]

_smoke55 = drop ["cl_basic", "", "Billboard", 1, .001, [0, -2, 0.3], [0, 1, 1], 1, 1, 0.85, 0, [0.00001, 0.00001],[_smoke,_smoke2],[0],0.15,0.25,"","barrel1.sqs",_boat]

~ 0.001

goto "start"<span id='postcolor'>

Barrel2 activates first, then barrel1. I'm not getting anymore error messages but the barrles just don't move anymore.

Share this post


Link to post
Share on other sites

You might also want to look at that script at OFPEC that puts an M2 in a HMMWV. I haven't seen it myself, but..just an idea.

Doolittle

Share this post


Link to post
Share on other sites
Guest jacobaby

OK,

Im not sure if you can name the smokes like that, dont think you can, and at any rate local script variables are not passed to nother script, you would have to remove the _ to make it work that way.

HOWEVER, thats not the way to do it

biggrin.gif

For your barrel1.sqs you need this;

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#start

_dirboat1 = getdir _boat

barrel1 setdir (_dirboat1)

barrel1 setpos _THIS

~ 0.001

goto "start"

<span id='postcolor'>

The position of the smoke is passed to the script (_this), so you set the barrels to that position.

You may want to have some kind of exiting clasue there though, say if the boat gets whacked.

Try that.

TJ

Share this post


Link to post
Share on other sites

Alrighty, workin good so far. But now the barrels wont setdir to the boat. They just sit there not turning with the boat. confused.gif

Share this post


Link to post
Share on other sites
Guest jacobaby

You have the boat name as a local (to script) variable.

Name the boat and use

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_boatdir = getdir BOATNAME

<span id='postcolor'>

then set the barrels to that

TJ

Share this post


Link to post
Share on other sites

On a side note:

Jacobaby, can you tell me the script I could use to get soldiers firing from a Helicopter.

Doing Vietnam era and that would be very cool.

Thanks again.

Share this post


Link to post
Share on other sites
Guest jacobaby

You can do this in a similar way to the barrels.

But you will find you have very limited range, about 10 degrees of turn.

If it was possible to get extra gunners on a helo, we would have done it at BAS, we worked long and hard at it.

TJ

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  

×