OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: haroon1992 on 26 Aug 2009, 15:02:48

Title: [SOLVED] Artillery Script [The bombs only goes on a certain side of the object?]
Post by: haroon1992 on 26 Aug 2009, 15:02:48
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.........................
Title: Re: Artillery Script [The bombs only goes on a certain side of the object?]
Post by: Luke on 27 Aug 2009, 00:38:23
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
Title: Re: Artillery Script [The bombs only goes on a certain side of the object?]
Post by: haroon1992 on 27 Aug 2009, 14:24:51
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..........................

Title: Re: Artillery Script [The bombs only goes on a certain side of the object?]
Post by: Luke on 29 Aug 2009, 00:06:08
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
Title: Re: Artillery Script [The bombs only goes on a certain side of the object?]
Post by: haroon1992 on 29 Aug 2009, 10:17:03
So you mean if i drop the  "sh_120_he"s from 40 m high , everything will be solved.....
Title: Re: Artillery Script [The bombs only goes on a certain side of the object?]
Post by: Luke on 29 Aug 2009, 20:42:41
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
Title: Re: Artillery Script [The bombs only goes on a certain side of the object?]
Post by: haroon1992 on 30 Aug 2009, 12:58:26
Thank you Luke  :clap: ..........
Title: Re: [SOLVED] Artillery Script [The bombs only goes on a certain side of the object?]
Post by: Luke on 16 Sep 2009, 19:09:45
No problem.  :D