Jump to content
Sign in to follow this  
kinismo

How to make cannons fire?

Recommended Posts

How can i get d-30 cannons to fire in air ? They are not supposed to hit anything but it would look nice if they fired like real artillery. confused_o.gif

Share this post


Link to post
Share on other sites

This script will give you a basic idea:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Gun=_This Select 0;

_Gun DoWatch (_Gun ModelToWorld [0,50,50]);

WaitUntil

       {

       Sleep 10;

       _Gun Fire ((Weapons _Gun) Select 0);

       !((Alive _Gun) Or (SomeAmmo _Gun))

       };

Adjust the sleep command according to the reload rate and the rate of fire you want.

Share this post


Link to post
Share on other sites

Thanks a lot but i wonder why it says "generic error in expression" when executing waituntil command?

Share this post


Link to post
Share on other sites
Quote[/b] ]but i wonder why it says "generic error in expression" when executing waituntil command?

How are you calling the script?

Share this post


Link to post
Share on other sites

I wrote it in sqs and activating it in cannons init field.

Share this post


Link to post
Share on other sites

waitUntil is used in SQF files.

@ is used in SQS files.

smile_o.gif

The snippet he gave you is written in an SQF format.

Here's how I did it, this will actually create explosions at the marker "tgt" in a 50 square meter zone as well...

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

_posX = getMarkerPos "tgt" select 0

_posY = getMarkerPos "tgt" select 1

_arty doWatch [_posx, _posy, 6000]

                 

~((random 2.5) + 3)

_arty fire "D30"            

~8

_posX = _posX + ((random 100) - 50)

_posY = _posy + ((random 100) - 50)

"SH_125_HE" createVehicle [_posx, _posy, 0]

IMPACT = true;

if (local server) then {publicVariable "IMPACT"}

exit

I call it from 3 different D30's.. that's why the random wait is in there. So they don't all fire at exactly the same time.

i.e. [arty1] exec "fire.sqs"; [arty2] exec "fire.sqs"; etc.

Share this post


Link to post
Share on other sites
Quote[/b] ]waitUntil is used in SQF files.

@ is used in SQS files.

The snippet he gave you is written in an SQF format.

Here's how I did it, this will actually create explosions at the marker "tgt" in a 50 square meter zone as well...

Code Sample

_arty = _this select 0

_posX = getMarkerPos "tgt" select 0

_posY = getMarkerPos "tgt" select 1

_arty doWatch [_posx, _posy, 6000]

~((random 2.5) + 3)

_arty fire "D30"

~8

_posX = _posX + ((random 100) - 50)

_posY = _posy + ((random 100) - 50)

"SH_125_HE" createVehicle [_posx, _posy, 0]

IMPACT = true;

if (local server) then {publicVariable "IMPACT"}

exit

I call it from 3 different D30's.. that's why the random wait is in there. So they don't all fire at exactly the same time.

i.e. [arty1] exec "fire.sqs"; [arty2] exec "fire.sqs"; etc.

@ Fire control

How would i add a loop to this so that i can get conitous fire

Just that i want to use this to film a cutscene and i have 6 d30's

Any help would be much appreciated thanks

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  

×