OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bobthedinosaur on 15 Jan 2004, 23:52:28

Title: places satchel charges before a mission starts
Post by: bobthedinosaur on 15 Jan 2004, 23:52:28
is there a way to place a load of satchel charges at certain places using the editor and then give a unit the trigger to blow them all up?
Title: Re:places satchel charges before a mission starts
Post by: _hammy_ on 16 Jan 2004, 00:13:27
yes, you can do it with scripts

Code: [Select]
; satchel.sqs

Unit = _this select 0
; how to use [dudes name] exec "satchel.sqs"

Normal = Unit AddAction [FORMAT["Blow up satchels"],"blowbomb.sqs"]
; add the action to blow up the bombs

exit

Code: [Select]
; blowbomb.sqs

Unit RemoveAction Normal
; remove the action that was added in satchel.sqs
; Add more of these to blow up more satchels replace Pipey with the name of the satchel
"LASERGUIDEDBOMB" camCreate getpos Pipey
; create a explosion at the satchel charge
~0.35
Pipey setpos [getpos Pipey select 0, getpos Pipey select 1, (getpos Pipey select 2) -10]
; make it so the satchel charge is no longer viewable
~0.1

"LASERGUIDEDBOMB" camCreate getpos Pipey2
; create explosion at another satchel
~0.35
Pipey2 setpos [getpos Pipey2 select 0, getpos Pipey2 select 1, (getpos Pipey2 select 2) -10]
; make it so satchel charge is no longer visible
~0.1

exit

This is taken from one of my scripts that was made a long long time ago, so i dont know if it still works.

You could probably replace
Code: [Select]
Pipey setpos [getpos Pipey select 0, getpos Pipey select 1, (getpos Pipey select 2) -10] lines
with
Code: [Select]
deletevehicle Pipey
 ;)
Title: Re:places satchel charges before a mission starts
Post by: bobthedinosaur on 16 Jan 2004, 00:36:08
ok thanx, i'm a bit dumb though and i know nothing about scripts

could you explain a few things about what you just said?
Title: Re:places satchel charges before a mission starts
Post by: _hammy_ on 16 Jan 2004, 01:10:04
ok, i added some comments to the code previously posted.
Title: Re:places satchel charges before a mission starts
Post by: macguba on 16 Jan 2004, 01:48:40
bobthedinosaur, read snYpir's Friendly Intro to Code snippets and also Johan Gustafsson's scripting guide, if you haven't already.
Title: Re:places satchel charges before a mission starts
Post by: desper8 on 16 Jan 2004, 14:01:53
ok
while the subject is up

im after a script were a sachel will start (maybe at a flagpole if it makes it EZer)

and it will detonate in 3 seconds
Title: Re:places satchel charges before a mission starts
Post by: _hammy_ on 17 Jan 2004, 00:23:40
try this

Code: [Select]
; boom.sqs
; use by:
; [satchel_charge_name, flagpole_name] exec "boom.sqs"
_sat = _this select 0
_moveto = _this select 1
_tim = 0

_sat setpos getpos _moveto

#loop
~1
_tim = _tim + 1
?(_tim >= 3):goto "next"
goto "loop"

#next
"LASERGUIDEDBOMB" camCreate getpos _sat
~0.5
deletevehicle _sat

exit

then place a satchel charge on the map somewhere and a flagpole somewhere too

Then run this script and the satchel will move over were the flag pole is and blow up in 3 second.

you could also put the line
Code: [Select]
_sat setpos getpos _moveto in the init.sqs script so the satchel moves to the flagpole at the start of the missions :)
Title: Re:places satchel charges before a mission starts
Post by: Leech on 18 Jan 2004, 23:33:21
can u actually start with a satchel charge sitting there and not use the laserguided bomb trick?
Title: Re:places satchel charges before a mission starts
Post by: Artak on 19 Jan 2004, 07:28:43
You can camcreate a 'timebomb' but it takes 30 seconds to explode. I don't know how to make the time shorter nor I know how to make camcreated 'pipebomb' explode because setting damage to it doesn't work.
Title: Re:places satchel charges before a mission starts
Post by: _hammy_ on 19 Jan 2004, 19:22:02
no, you cant make satchel charges explode without camcreated a explosion over them then removing the satchel charge.