OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: hazydave420 on 15 Jun 2012, 00:59:32

Title: [Script] Replacing current weapon projectile with _ammoType = Bo_GBU12_LGB
Post by: hazydave420 on 15 Jun 2012, 00:59:32
First off I have to say that I'm loving this ArmA community. I've been a fan of the series since Operation Flashpoint but have only recently subscribed to Broadband Internet Service in my country.

I have been working on a custom mission script to make your current weapon shoot _ammoType = Bo_GBU12_LGB.

Not too much luck, I've decided to dive into the scripting wiki and do some research but let me tell you IT IS CONSUMING!  :no:

If anyone could help me out I'd be really thankfull

hopefully I can make this script stop when I change weapons or make a way to change back to regular ammo

EDIT: I've come to a realization that I may need to spawn a GBU right when the bullet impacts instead to simulate this "bullet bomb" effect i desire.
Title: Re: [Script] Replacing current weapon projectile with _ammoType = Bo_GBU12_LGB
Post by: Worldeater on 15 Jun 2012, 21:03:04
Hmm. I've seen this "bomb shooting" before: it was on a public server when some cheater removed our base with his assault rifle. :dry:

Whatever.

This could be done from a units Fired (http://community.bistudio.com/wiki/ArmA_2:_Event_Handlers#Fired) event handler:
* spawn a bomb where the projectile is (createVehicle, getPos)
* point the bomb where the projectile points to (vectorDir, vectorUp, setVectorDirAndUp)
* set the speed of the bomb (setVelocity)
* delete the projectile (deleteVehicle)

Note that you'll lose the original ballistics this way.


Edit: :welcome:
Title: Re: [Script] Replacing current weapon projectile with _ammoType = Bo_GBU12_LGB
Post by: CameronMcDonald on 16 Jun 2012, 09:24:25
Can't help you, but I had to laugh as this reminds me of the old "Ultra M16" and "Ultra M60" from one of HYK's old OFP weapon packs. :)
Title: Re: [Script] Replacing current weapon projectile with _ammoType = Bo_GBU12_LGB
Post by: Coyle[13thSFG] on 04 Jul 2012, 03:27:43
How would you trigger an event at the point of impact?  Like say shoot an M24 at a tank and have a Bo_GBU12_LGB explode at point of impact.  The idea is to preserve the ballistics of the m24.  Would make for a great DM.
Title: Re: [Script] Replacing current weapon projectile with _ammoType = Bo_GBU12_LGB
Post by: h- on 04 Jul 2012, 15:57:11
In the firing unit's init:
Code: [Select]
this addEventHandler ["Fired",{(nearestObject [_this select 0,_this select 4]) execVM "boom.sqf"}]
boom.sqf:
Code: [Select]
private["_pos"];

while {alive _this} do {
_pos = position _this;
sleep 0.01;
};

"Bo_GBU12_LGB" createVehicleLocal _pos;