Home   Help Search Login Register  

Author Topic: [SOLVED] Artillery Script [The bombs only goes on a certain side of the object?]  (Read 1832 times)

0 Members and 1 Guest are viewing this topic.

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
Two script co-operate together to carry on Artillery.....
First One

artscript.sqs
Code: [Select]
;firstly,the script executes another script called timer.sqs
[timeleft] exec "timer.sqs"

_bombtype=_this select 0;
_target=_this select 1;
_radius=_this select 2;
_height=_this select 3;
_timetowait=_this select 4;
_loopingenable=_this select 5;
_duration=_this select 6;

timeleft=_duration
;timeleft is a global variable to connect between the two scripts
;=========================================================================
#start

?timeleft==0 : exit
~_timetowait

_bombs=_bombtype createvehicle position _target
_bombs setpos [(getpos _target select 0)+random _radius/random 10,(getpos _target select 1)+random _radius/random 10,_height]
_bombs setdammage 1

?_loopingenable=="0" OR _loopingenable=="FALSE" : exit
?_loopingenable=="1" OR _loopingenable=="TRUE" : goto "start"
exit
;Artillery script written by Haroon1992


Second One
timer.sqs
Code: [Select]
#startcounting
?timeleft==0: exit
timeleft=timeleft - 1
~1
goto "startcounting"

Problem : _bombs setpos [(getpos _target select 0)+random _radius/random 10,(getpos _target select 1)+random _radius/random 10,_height]
Can someone show me how to make it so that the bombs will explode around a radius of for example 50...
[When i tested the script, i can only see them exploding on a certain side of the targeted  object >:(]

Very Very Thank You in advance......... :clap:
haroon1992.........................
« Last Edit: 04 Sep 2009, 17:22:52 by haroon1992 »
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Code: (Artscript.sqs) [Select]
;firstly,the script executes another script called timer.sqs
[timeleft] exec "timer.sqs"

_bombtype=_this select 0;
_target=_this select 1;
_radius=_this select 2;
_height=_this select 3;
_timetowait=_this select 4;
_loopingenable=_this select 5;
_duration=_this select 6;

timeleft=_duration
;timeleft is a global variable to connect between the two scripts
;=========================================================================
_dir = 0
#start

?timeleft==0 : exit
~_timetowait
#posloop
_bombs=_bombtype createvehicle position _target
_bombs setpos [(getpos _target select 0)+((random _radius/random 10)*sin(_dir)),(getpos _target select 1)+((random _radius/random 10)*sin(_dir)),_height]
_dir = _dir + 25 + random 40
_bombs setdammage 1
?(_dir<360): goto "posloop"

_dir = 0

?_loopingenable=="0" OR _loopingenable=="FALSE" : exit
?_loopingenable=="1" OR _loopingenable=="TRUE" : goto "start"
exit
;Artillery script written by Haroon1992

Try this!  :D

Luke
Pesky Human!!
Wort Wort Wort.

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
Thank you very much!  :clap:

I have RESOLVE my script by using the following :

_bombs setpos [(getpos _target select 0)+(random _radius+random - _radius),(getpos _target select 1)+(random _radius+random - _radius),_height]

And i found that the bomb goes off on any point around the target within the specified _radius   :cool2:


BUT...
can you please explain me these things ?

_bombs setpos [(getpos _target select 0)+((random _radius/random 10)*sin(_dir)),(getpos _target select  1)+((random _radius/random 10)*sin(_dir)),_height]

_dir = _dir + 25 + random 40


?(_dir<360): goto "posloop"


Also, i found that the bombs' firing points are static even when the bomb is created in the air [the bomb is exploding with flame in the air  5 meters  from ground!]
Are these bombs don't have GRAVITY???

I have used "bomb" as the bombtype.

Also, when the artillery is on a town, the bombs may goes off inside a building.....but  IS THERE some METHOD to make so that the BOMB will explode on ROOF tops,
I found the bombs exploding inside buildings is very bad when i saw a bomb explodes under the bridge i was supposed to be hiding from the artillery.....
How can i make so that the bomb will explode on the road of the bridge and not the ground beneath the bridge?

Thanks to all of you....
Haroon1992..........................

« Last Edit: 27 Aug 2009, 15:54:04 by haroon1992 »
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
For the bridge that depends on how high they spawn.

and as for gravity, change the bombtype to "sh_120_he",
and they'll fall, not quite as powerful though.

Explanation: it's 2d circular geometry, it creates a ring in 360 degrees around your target at distance radius from the centerpoint.

Hope that helps.

Luke
Pesky Human!!
Wort Wort Wort.

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
So you mean if i drop the  "sh_120_he"s from 40 m high , everything will be solved.....
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
As long as the bridge's height above land does not exceed 40 meters at any point.

Do note that there can be splash damage that may kill you as these are explosive shells.

Luke
Pesky Human!!
Wort Wort Wort.

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
Thank you Luke  :clap: ..........
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
No problem.  :D
Pesky Human!!
Wort Wort Wort.