OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: danturn on 28 Jul 2009, 22:28:40

Title: drop disarmed bomb?
Post by: danturn on 28 Jul 2009, 22:28:40
If a plane is carrying a "Bo_GBU12_LGB" in it's loadout, is it possible to drop it without it going off? So that you cann effectivly drop a disarmed bomb that will just land onto the ground without exploding as an object?

Basically what I am after is a missle to drop as an object so it can be interacted with, for example placed as cargo with rksl cargo, or to have the ability to interact with it like a satchel charge where you can set a timer or blow up where it is etc.

I think I can probably write scripts for the actions, just unsure as of how to deactivate the dropped bomb etc.

I would also like to have it as a seperate action, so the player would be able to fire the weapons as normal, but has the option to drop the payload without harm via the action menu whilst deducting the dropped item from the aircrafts payload.

Thanks
Title: Re: drop disarmed bomb?
Post by: Luke on 30 Jul 2009, 06:36:43
You may be able to do what I call "museum piecing,"
(that is make a static floating vehicle or ammo like in an aviation musem).

However what this does is its still 'live' ammo;
if it hits the ground or a vehicle, it will blow.

However, if you have a shell "Sh_1xx_HE/Sabot" it uses the same model as "bomb",
which is not 'live.'

As far as the LGB goes, I am not sure if it even can be disabled.

However, here is the museum piece script. 
When executed it will stop the device cold.

Place it in your mission folder and call it using the following : [bombname] execvm "museum.sqf"

Code: (museum.sqf) [Select]
_bomb=_this select 0;
_pos = getpos _bomb;
_bomb setvelocity [0,0,0];
_vdir= _bomb getvectordir;
_vup= _bomb getvectorup;
_i = 0;

while {not(isnull _bomb)} do
   {
   _bomb setpos _pos;
   _bomb setvelocity [0,0,0]
   _bomb setvectordir _vdir;
   _bomb setvectorup _vup;
   sleep .001;
   };


Note that all weapons have a lifetime, and after the bomb's expires, it vanishes.

@Community, if anyone know the LGB's lifetime, could they please reply.

If I find out, I can improve on this, but am away from ARMA at the moment.

Hope that helps,
Luke
Title: Re: drop disarmed bomb?
Post by: Worldeater on 30 Jul 2009, 07:04:13
@Community, if anyone know the LGB's lifetime, could they please reply.

120 seconds
Title: Re: drop disarmed bomb?
Post by: danturn on 30 Jul 2009, 19:17:06
Cheers, unfortunately if it's still active and wont sit around for more than two minutes then it won't work for what i need it for :(, thanks though

any other ideas?
thanks
Title: Re: drop disarmed bomb?
Post by: Trexian on 30 Jul 2009, 20:14:57
Maybe loop it?

Untested, seat of the pants code-ishness:
Code: [Select]
_dudPos =  ; // whatever position
_dud = "Sh_1xx_HE/Sabot" createVehicle _dudPos;
while {!(isNull _dud)} do
   {
   sleep 110;   // maybe don't even need this
   waituntil {isNull _dud};
   _dud = "Sh_1xx_HE/Sabot" createVehicle _dudPos;
   sleep 1;
   };
That is an endless loop, though. ;)  (Bad mojo.)  Should probably have another variable, like while the player is alive, or something like that.  The idea, though, is that as soon as the bomb life expires, it gets re-set.
Title: Re: drop disarmed bomb?
Post by: Luke on 31 Jul 2009, 03:36:57
Thanx Worldeater,

Here's the update.
Code: (museum.sqf) [Select]
_bomb=_this select 0;
_type = typeof _bomb;
_tyme = getText (configFile >> "CfgAmmo" >> _type >> "timeToLive")
_dell = "logic" createvehicle [0,0,0];
_dell setvariable ["delete",0];
_pos = getpos _bomb;
_bomb setvelocity [0,0,0];
_vdir= _bomb getvectordir;
_vup= _bomb getvectorup;
_i = 0;

_x=daytime;
_runt=(daytime - _x) * 3600;
while {_i < 1} do
   {
   _runt=(daytime - _x) * 3600;  
   _bomb setpos _pos;
   _bomb setvelocity [0,0,0]
   _bomb setvectordir _vdir;
   _bomb setvectorup _vup;
   if (_runt > (_tyme-(_tyme*.005))) then
      {
      _dell setvariable ["delete",1];
      deletevehicle _bomb;
      if ((_dell getvariable "delete") == 0) then {_i = 1};
      _bomb = _type createvehicle _pos;
      _x=daytime;
      _bomb setpos _pos;
      _dell setvariable ["delete",0];
      sleep .001;
      };
   sleep .001;
   };

deletevehicle _dell;
deletevehicle _bomb;

Not sure about the gettext command, but if it works, then it will work for any ammotype (I believe). @Community, if anyone knows if I used the gettext correctly, could they please reply.

Hope that helps,
Just don't run into the bomb!!

Luke

P.S. This what you looking for Trexian??  :P
Anyway, hope this is in line with what you were trying to do.
Title: Re: drop disarmed bomb?
Post by: danturn on 01 Aug 2009, 21:10:55
Is the ammo not still live though? Were you not saying if anything touches it then it will explode?
Title: Re: drop disarmed bomb?
Post by: Luke on 03 Aug 2009, 16:43:20
Unfortunately,

Yes.

Beyond what I have given you,
there is nothing short of an addon that I think would serve what you need.

Hope, what you have is workable for what you need.
(have it .5 meters off the ground and someone needs to disarm it, maybe?
Just don't get to close!!)

Luke