Home   Help Search Login Register  

Author Topic: Need help for slight script modifications.  (Read 459 times)

0 Members and 1 Guest are viewing this topic.

Milwot

  • Guest
Need help for slight script modifications.
« on: 22 Aug 2003, 04:20:42 »
I have a script which I modified from Skumball's Airstrike (Map Click). Instead, I just want a bomb to fall from the sky as if from a Bomber from 50,000 feet. It works, sort of. I just need advice on getting rid of the error message. Here's the script...


;Airstrike (map click) v1.2
;by Skumball (simongoddard4@yahoo.co.uk)


;NOW MODIFIED BY MILWOT


;Thanks to Viriato for making the bombs fall correctly and LCD for incorporating the script into the radio
;
;Requires:
;OFP v1.85
;1 Pilot named "strikePilot"

;1 Trigger (Activation: Radio Alpha, Repeatedly. Text: Air Strike. On Activation: onMapSingleClick {[_pos] exec "airstrike.sqs"}; strikePilot sideChat "Give me a target")






onMapSingleClick {}
1 setRadioMsg "Null"

_pos = _this select 0

"target" setMarkerPos _pos
"target" setMarkerType "destroy"

_Bomb = "LaserGuidedBomb" camCreate (getMarkerPos "target")
_Bomb setPos [(getPos _Bomb select 0),(getPos Bomb select 1),(getPos Bomb select 2)+800]
_Bomb setDir 180

"target" setMarkerType "empty"

strikePilot sideChat "Ready"

1 setRadioMsg "Air Strike"

exit

deaddog

  • Guest
Re:Need help for slight script modifications.
« Reply #1 on: 22 Aug 2003, 04:40:05 »
It's more helpful if you tell us what the error message is.  But, in this case, I see a problem:

Quote
_Bomb setPos [(getPos _Bomb select 0),(getPos Bomb select 1),(getPos Bomb select 2)+800]
Those should be _bomb, not bomb.

Quote
_Bomb setDir 180
This line is useless.  It doesn't matter where the bomb is pointing.

You should probably replace this:
Quote
_Bomb = "LaserGuidedBomb" camCreate (getMarkerPos "target")
_Bomb setPos [(getPos _Bomb select 0),(getPos Bomb select 1),(getPos Bomb select 2)+800]
with this:

Quote
_Bomb = "LaserGuidedBomb" camCreate [_pos select 0,_pos select 1,800]
otherwise, the bomb will probably explode when it is created because it is created on the ground.

Milwot

  • Guest
Re:Need help for slight script modifications.
« Reply #2 on: 22 Aug 2003, 04:55:19 »
Yeah, I knew it was something simple, thats why I didn't post the actual error message. Thanks.

Milwot

  • Guest
Re:Need help for slight script modifications.
« Reply #3 on: 22 Aug 2003, 05:24:30 »
Well, here's a new problem. The line

_Bomb = "LaserGuidedBomb" camCreate [_pos select 0,_pos select 1,800]

doesn't work.
It says somethin like ...._pos select 1,800] # .... Error Zero Divisor.

Any Ideas?

Milwot

  • Guest
Re:Need help for slight script modifications.
« Reply #4 on: 22 Aug 2003, 05:27:29 »
Wait! Sorry, it does work, but the bomb misses by quiet a bit. How to fix this?

deaddog

  • Guest
Re:Need help for slight script modifications.
« Reply #5 on: 22 Aug 2003, 05:46:06 »
I just tried this in the editor (i used a barrel as a target).  It does miss by a few meters.  If you change the height to 100 meters instead of 800, you can actually see the bomb fall.  It has a forward velocity to it.  That's the problem.

You can probably fix this by using setvelocity in a loop:

#loop
bomb setvelocity [0,0,-30]
?alive bomb:goto "loop"

or something similar.
« Last Edit: 22 Aug 2003, 05:46:30 by deaddog »

Milwot

  • Guest
Re:Need help for slight script modifications.
« Reply #6 on: 22 Aug 2003, 06:07:49 »
Well, I got it, and it works beautifully. Thanks a lot. Here's the final script in case you'd care to see it.

;Thanks to Viriato for making the bombs fall correctly and LCD for incorporating the script into the radio
;
;Requires:
;OFP v1.85
;1 Pilot named "strikePilot"

;1 Trigger (Activation: Radio Alpha, Repeatedly. Text: Air Strike. On Activation: onMapSingleClick {[_pos] exec "airstrike.sqs"}; strikePilot sideChat "Give me the coordinates")




onMapSingleClick {}
1 setRadioMsg "Null"

_pos = _this select 0

"Target" setMarkerPos _pos
"Target" setMarkerType "destroy"
~8
strikepilot sidechat "Roger"
~4
strikepilot sidechat "Bombs Away"
~35

_Bomb = "LaserGuidedBomb" camCreate [_pos select 0,_pos select 1,1000]

#loop
_Bomb setvelocity [0,0,-200]
?alive _Bomb:goto "loop"

"target" setMarkerType "empty"

~15

strikePilot sideChat "Ready"

1 setRadioMsg "Air Strike"

exit




Maybe later I'll try to make it work with the laser designator, so I can cause some REAL death and destruction  8) ...

deaddog

  • Guest
Re:Need help for slight script modifications.
« Reply #7 on: 22 Aug 2003, 15:19:09 »
Excellent  :thumbsup:  I always like to see a script come together and work like it should.

Just to experiment, I had replaced "laserguidedbomb" with a "shell120" and it worked without the setvelocity part.  It seems only the bomb has forward motion.