OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: snozzdog on 29 Jun 2008, 16:04:09

Title: IED explosions
Post by: snozzdog on 29 Jun 2008, 16:04:09
How do i make a trigger that will set off an IED next to a vehicle as it drives past?

If possible, can i have a formula to put in the trigger so the IED sets off at any west vehicle but doesnt destroy it completely, so my vehicle can go through a few before getting destroyed

In other words a whole convoy doesnt get destroyed by one IED
Title: Re: IED explosions
Post by: schuler on 29 Jun 2008, 17:50:30
hi snozzdog

Code: [Select]
[thislist select 0, "grenadehand", 0, 1] exec "ied.sqs"


_vehicle = _this select 0
_ammo = _this select 1
_offset = _this select 2
_variance = _this select 3
_posX = (getPos _vehicle select 0) + (random _variance) - (_variance / 2)
_posY = (getPos _vehicle select 1) + (random _variance) - (_variance / 2)
_dir = getDir _vehicle
_speed = (speed _vehicle) / 15
_offset = _speed + (_offset + (random _variance) - (_variance / 2))
_cX = _posX + (sin(_dir) * _offset)
_cY = _posY + (cos(_dir) * _offset)

call format [{_boom = "%1" camCreate [%2,%3,0]},_ammo,_cX,_cY]
exit

the smaller the trigger size, the closer the exsplotion will be to the vehicle, and it will only be the power of a hand grenade

cheers schuler
Title: Re: IED explosions
Post by: snozzdog on 30 Jun 2008, 10:07:13
Ahh cheers, do i put that all in the 'init' field of the trigger?
Title: Re: IED explosions
Post by: Gcfungus on 30 Jun 2008, 18:27:45
I think
Code: [Select]
[thislist select 0, "grenadehand", 0, 1] exec "ied.sqs"goes in the on activation of the trigger.

And the rest goes in a script called ied.sqs