OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Wolf on 01 Oct 2002, 17:46:32

Title: Artillery Script
Post by: Wolf on 01 Oct 2002, 17:46:32
Alrighty, a while back someone gave me this line

shell = "Shell120"; radius = 60; "shell camcreate [((getpos boom) select 0) + (((_x mod 1)*radius)*sin _x), ((getpos boom) select 1) + (((_x mod 1)*radius)*cos _x), 20]" foreach [random 360, random 360, random 360, random 360]

To go in a trigger to create a random artillery barrage, that did not need the player to do anything to start it.

Now, this is very useful, but it is also quite tedias(spelling?) to set up the nessasary triggers for a prolonged barrage.
What I need to know is how to put that in a looping script with about 5 to 10 second delay, that can be called upon from a trigger, and will end when I want it to from a trigger?
Thank you.
Title: Re:Artillery Script
Post by: Dinger on 01 Oct 2002, 20:06:07
A. no script needed.  Somewhere (such as the player's init field -- or for MP the init field of some object that always appears), put
MyShell = "FxExploGround1" camcreate [0,0,0]

Set the trigger tot he condition you want, and add:
&& getpos Myshell select 0 == 0
e.g., if you wnat the boolean BARRAGE to control the trigger:
barrage && getpos myshell select 0 == 0

Use the drop time to create an interval, according to the formula:
distance = 4.9 *(seconds ^2)
so for 5 seconds, that's: 4.9 * 25 or 72.5

Now put in the activation field that Z value, and clal the shell MyShell, viz:
 
shell = "Shell120"; radius = 60; "MyShell = shell camcreate [((getpos boom) select 0) + (((_x mod 1)*radius)*sin _x), ((getpos boom) select 1) + (((_x mod 1)*radius)*cos _x), 72.5]" foreach [random 360, random 360, random 360, random 360]

voila`!

B. In a script:

shell = "Shell120"
 radius = 60
@condition

#loop

 "shell camcreate [((getpos boom) select 0) + (((_x mod 1)*radius)*sin _x), ((getpos boom) select 1) + (((_x mod 1)*radius)*cos _x), 20]" foreach [random 360, random 360, random 360, random 360]

?condition:goto "loop"
Title: Re:Artillery Script
Post by: Wolf on 01 Oct 2002, 22:06:03
Well, you kinda lost me on the A.

But, I'm just to copy what you got there for B. into an sqs file?
Title: Re:Artillery Script
Post by: Dinger on 01 Oct 2002, 23:00:57
on A, do what it says and you'll be fine.  Trust me, it's magic, and it's beautiful.  Option A will score the babes.
On B, yeah, but be sure to put a ~5 before the "goto loop"
Title: Re:Artillery Script
Post by: Wolf on 01 Oct 2002, 23:39:57
One more question.
How do I target it?
Will it come down on the object or trigger that has
[] Exec "script.sqs"
in it?
Or do I have to specify that in the script?
Title: Re:Artillery Script
Post by: Wolf on 02 Oct 2002, 17:23:56
Can anyone tell me the answer to my above question?
Thank you.
Title: Re:Artillery Script
Post by: Dinger on 02 Oct 2002, 21:24:47
Keep your pants on. sheesh ;)
make a gamelogic, and call it "boom"
that's where the shells will land.
Title: Re:Artillery Script
Post by: Wolf on 03 Oct 2002, 04:11:55
Looks like I solved to soon.

I tryed the script and it did nothing.
just silence.
I placed an item with the proper name, and executed the script but ingame, notta.

That other one, is it for Res versions? as I don't have Res and you mention a drop command.

What did I do wrong with this script?
Title: Re:Artillery Script
Post by: Dinger on 03 Oct 2002, 16:09:24
did you set condition = true?
Title: Re:Artillery Script
Post by: Wolf on 03 Oct 2002, 16:26:18
Tryed it
still don't work
Title: Re:Artillery Script
Post by: Dinger on 03 Oct 2002, 21:09:48
okay, then change the line so that it reads:


"MyShell = shell camcreate [((getpos boom) select 0) + (((_x mod 1)*radius)*sin _x), ((getpos boom) select 1) + (((_x mod 1)*radius)*cos _x), 72.5]" foreach [random 360, random 360, random 360, random 360]
Title: Re:Artillery Script
Post by: Wolf on 04 Oct 2002, 01:36:49
Works perfectly, thanks a bunch Dinger.