Jump to content
Sign in to follow this  
jaenak

Artillery scripting

Recommended Posts

I was wondering a few days ago how I could script an artillery shelling like the kind that happens on the single mission "Underhill". I played it recently and it appears to be random. Or it could be a bunch of explosion sites put on the map with a probability of existance other than 100%. However it happens I know it can be done, but I don't know how to do it myself, so I'm asking.

And another thing, how would you go about triggering it to start by sending a radio message (Alpha for an example) like on the mission entitled "Fireworks" in the resistance campaign?

Share this post


Link to post
Share on other sites

You make random artillery barrages by camcreating shells over an area. An example snippet of a script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_mkrpos = getmarkerpos "artmarker"

_power = "heat125"

_mx = _mkrpos select 0

_my = _mkrpos select 1

_mz = _mkrpos select 2

#Setup

_i = 0

_b = 0

#Randomize

_dir = random 360

_rx = (sin _dir) + 50

_ry = (cos _dir) + 50

#Boom

_shell = _power camcreate [_mx + _rx, _my + _ry, _mz + 50]

_i = _i + 1

?(_i == 6): goto "check"

~1

goto "randomize"

#Check

_b = _b + 1

?(_b == 3): exit

~8

goto "randomize"

The trig isn't guaranteed tounge_o.gif .

Share this post


Link to post
Share on other sites

Making an artillery script execute from the radio is quick and simple. Make a trigger, and set it to be activated by a radio signal (For example, Radio Alpha). In the On Activation field, put:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[conditions] exec "artillery.sqs"

Change conditions to whatever conditions the script takes, and change artillery.sqs to the artillery script's name.

Now in the player's init field put:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">1 setradiomsg "Artillery - Start"

Edit - To use the provided script, all you'd need to execute the script would be:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] exec "artillery.sqs"

You also need a marker named artmarker to designate the area that the artillery would strike at.

Share this post


Link to post
Share on other sites

Bah, no scripting necessary.

A) place the radio trigger where you want the artillery barrage to be

B) name it "ArtTrigger"

C) set to "Radio Alpha"

D) in the "on activation" field, put:

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

artx = getpos ArtTrigger select 0; arty = getpos ArtTrigger select 1; {dropalt = _x; {dist = random 50; dir = random 360; xo = dist * (sin dir); yo = dist * (cos dir); myshell = "Shell120" createvehicle [artx + _xo, arty + _yo, dropalt]} ForEach [1,2,3,4]} ForEach [20,40,80]

That should give you a nice effect.

---------

Dinger

The Chain of Command

CoC Unified Artillery: http://www.website.thechainofcommand.net/coc_ua1.htm

Share this post


Link to post
Share on other sites

@Dinger - Can you create a barrage effect with that technique?

Share this post


Link to post
Share on other sites

Yeah. That should be three salvos there. If you increase the value in the right foreach (the 20, 40, 80), you can get some barrage effect. For example:

[48, 490, 1500]

would give better spacing.

Of course, all shells have to hit the ground in twenty seconds.

For a sustained barrage, you'd need two triggers:

the "on activation" of the radio alpha could be:

ArtCounter = 0; ArtGo = True

And the other trigger (type none, call it arttrigger and leave the radio alpha trig unnamed) would have:

Min, Mid, Max activation time: 12 seconds

Condition:

(ArtCounter < 4) && ArtGo

On Activation:

artx = getpos ArtTrigger select 0; arty = getpos ArtTrigger select 1; {dist = random 50; dir = random 360; xo = dist * (sin dir); yo = dist * (cos dir); myshell = "Shell120" createvehicle [artx + _xo, arty + _yo, 49]} ForEach [1,2,3,4]; ArtGo = False

On Deactivation:

ArtCounter = ArtCounter + 1; ArtGo = true

Note that in multiplayer, you'll need to add to the condition list: && local arttrigger

Share this post


Link to post
Share on other sites

I'm not designing a multi-player map, just single player.  And I'm designing my first mission so you guys totally lost me there.  All that went way over my head.  (I'm not completely ignorant, just enough to not understand what you all said.)

Share this post


Link to post
Share on other sites

really sorry for hashing up and old thread but im not allowed to post a new topic for some reason. im trying to get mortars to fire on random positions within a trigger zone but with the one i have right now it always ends up right on top of the target position, anyone  know of a non virtual script for mortars with random dispersion within zone??? 

Share this post


Link to post
Share on other sites

really sorry for hashing up and old thread but im not allowed to post a new topic for some reason. im trying to get mortars to fire on random positions within a trigger zone but with the one i have right now it always ends up right on top of the target position, anyone  know of a non virtual script for mortars with random dispersion within zone??? 

Take a look here:

http://www.ofpec.com/editors-depot/index.php?action=search

Share this post


Link to post
Share on other sites

Hey Jordans pc im not fully familiar with this topic but i know nice no camcreate artilery/mortar scritp by Doolittle:
http://www.ofpec.com/editors-depot/index.php?action=details&id=243&game=OFP
here you are.
I very like this because it's quite simple and uses projectile motion real phisic. It taught me alot.

btw He used telephone as shell ;plol

You can change random valutes for scatter. This is onmapclick type artilery but youcan easly convert it to trigger loc.

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  

×