Home   Help Search Login Register  

Author Topic: Artillery script only goes two ways? (up and down)  (Read 821 times)

0 Members and 1 Guest are viewing this topic.

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Artillery script only goes two ways? (up and down)
« on: 12 Dec 2005, 10:48:34 »
Hey guys, I made an artillery script modified from Bedger's code and the "shells" only go up and down (not the z axis up and down but the y axis up and down!) Here's the code:

Code: [Select]
_x = getpos target select 0
_y = getpos target select 1
_dir = getdir target
_randomdir = random 360
_i = 0

#create
_r = random 500
target setdir _randomdir
_bang = "maverick" camcreate [_x + (_r*sin(dir)), _y + (_r*cos(dir)), 400]
_i = _i + 1

#godown
_bang setvelocity [0,0,-550]
? not (alive _bang) : goto "create"
?not (_i>=20):goto "godown"

exit
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline Flauta

  • Members
  • *
  • There is no knownledge, that is no power
    • Chek mi FLog
Re:Artillery script only goes two ways? (up and down)
« Reply #1 on: 12 Dec 2005, 17:25:25 »
Im not very experienced whit the SIN/COS thing.. but.. what are they doing there??? =P and have you added some delay to the script??

and.. what all the setdir random 360 means??? =P

Saludos

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Artillery script only goes two ways? (up and down)
« Reply #2 on: 12 Dec 2005, 19:02:11 »
So what's the problem?   Apart from the fact that you use dir instead of _dir in the script, and the check for _bang being alive will always be true assuming alive works in this case.
Plenty of reviewed ArmA missions for you to play

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Artillery script only goes two ways? (up and down)
« Reply #3 on: 12 Dec 2005, 20:23:05 »
Is there a specific reason why you are creating maverick missles? I believe when you camcreate a missle, it will propel itself forward like when it is fired. If you just want shells to drop from the sky, use "shell120" or another class.

My suggestion however would be to use Fision's Generic Artillery script. The wheel has already been invented, so you don't have to make your own script :). It's the script I've always used. And it is generic, yet customizable so you can get exactly the type of barrage you need.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:Artillery script only goes two ways? (up and down)
« Reply #4 on: 13 Dec 2005, 00:08:45 »
The missile gives the trail effect and it reminds me a bit of battlefield 2. I have not added a loop but it doesn't lag much either. I added a a 360 dir thingy too so maybe the direction of the target changes (logic) and it actually fires more than 2 ways but it seems to still fire 2 ways (north and south). Yes the checking if it's alive works because they do come down after each other. Oh and I've updated my script and it doesn't work anymore! What have I done wrong!?

Code: [Select]
[side player, "hq"] sideChat "Artillery firing! ETA. 30 seconds!"
_pos = _this select 0
"targmarker" setmarkerpos _pos
target setpos (getpos _pos)

~33

_x = getpos target select 1
_y = getpos target select 2
_dir = getdir target
_i = 0

#create
_r = random 100
_bang = "maverick" camcreate [_x + (_r*sin(_dir)), _y + (_r*cos(_dir)), 400]
_i = _i + 1

#godown
_bang setvelocity [0,0,-550]
? not (alive _bang) : goto "create"
?not (_i>=20):goto "godown"

exit

The shells come down alright but somewhere in the sea to the west! What have I done wrong with the _pos? Is there any variable that determines the map click? e.g. MapClick :P?
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:Artillery script only goes two ways? (up and down)
« Reply #5 on: 13 Dec 2005, 03:26:46 »
I fixed it :D! I created 4 scripts (all the same except they get _bang1 to _bang4 and target1 to target4.

I placed the 4 logic targets on top of each other facing these directions:
0 and 90 for the first two and 45 and 315 for the last two. It's awesome!

edit: It isn't random enough :(! They keep coming down on almost the same spots!
« Last Edit: 13 Dec 2005, 03:36:53 by OFPfreak »
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline Pilot

  • Contributing Member
  • **
Re:Artillery script only goes two ways? (up and down)
« Reply #6 on: 13 Dec 2005, 04:48:48 »
If you want the artillery randomly exploding in an area with a radius of 100 meters, do something like this:
Code: [Select]
_bang = "maverick" camcreate (random 100 - random 100), (random 100 - random 100), 400]
Or if you want the area with a diameter of 100, do something like this:
Code: [Select]
_bang = "maverick" camcreate (random 50 - random 50), (random 50 - random 50), 400]
Naturally the shells will be more concentrated in the middle, but they should be quite randomnized.

-Pilot
« Last Edit: 13 Dec 2005, 04:49:24 by Pilot »

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:Artillery script only goes two ways? (up and down)
« Reply #7 on: 13 Dec 2005, 23:30:06 »
Does that actually make the shells come down at the "target"? I don't see it anywhere.
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline Pilot

  • Contributing Member
  • **
Re:Artillery script only goes two ways? (up and down)
« Reply #8 on: 13 Dec 2005, 23:34:13 »
No, the shells should fall on their own accord.  My code simply randomnizes the footprint the shells will create.

-Pilot