OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Evan Scown on 31 Aug 2006, 09:47:30

Title: Hazardous Area
Post by: Evan Scown on 31 Aug 2006, 09:47:30
Hey,

Okies my idea is, I'd like to make this hazardous area, kinda the napalm or like hazardous materials in an area, and I'd like for it to kill, or more deduct a persons health so that over time they pack it in (Die) it would also be cool if there was gas and alike....

A) Is this possible

B) How would/or has there been scripts made to make this possible?

Thankies!
Title: Re: Hazardous Area
Post by: bedges on 31 Aug 2006, 10:05:33
a) yes, it's possible

b) you'll need to read up on the drop command (http://www.ofpec.com/COMREF/index.php?action=list&letter=d#drop) to produce the gas-cloud effect, you'll need a trigger covering the area affected to capture all units entering it, and you'll need a script which setdamage (http://www.ofpec.com/COMREF/index.php?action=list&letter=s#setDamage)s them in very small amounts over time.

as to whether there's already a script out there which does this, i dunno.
Title: Re: Hazardous Area
Post by: Mr.Peanut on 01 Sep 2006, 00:36:39
There was a script that did this in the depot before the big crash...
Title: Re: Hazardous Area
Post by: rhysduk on 01 Sep 2006, 01:11:57
To kill a unit straight off the line:

Code: [Select]
this setdammage 1 is usually used.

For what you want use the below method.

Typical Scenario:

Code: [Select]
this exec "kill.sqs"
Code: [Select]
_list = (List killtrig)

~2

@ _this in List killtrig

_this setDammage 1

Exit

I know it works because ive tested it. If you get any problems let me know. I have an example mission if you'd like it.

 :wave:
Rhys
Title: Re: Hazardous Area
Post by: Raptorsaurus on 01 Sep 2006, 01:41:48
If you want it to kill slowly then change the script posted by rhysduk thusly:

Code: [Select]
_list = (List killtrig)

~2

#loop

? _this in _list : _this setDamage ((damage _this) + .05)
~ .1
? alive _this : goto "loop"

Exit

If you want to change the rate at which a unit loses health, change the .05 to a different value.
Title: Re: Hazardous Area
Post by: Chris Death on 01 Sep 2006, 01:59:27
Would work Rhysduk sure (if he named the trigger: killtrig)...

...but it would be very CPU stressing, running a script for each single unit to do that.

Here's another way to do it with a trigger and one single script:

Put a trigger over the area you need;

Activation: west / present / once
name: killtrig
condition: this
onActivation: [] exec "kill.sqs"

Now you must take care:
In the first unit's init field, which you place on the map put following code:
killlist = []

And into each unit's inti field, which should die when entering the area put following code:
killlist = killist + [this]

:note - the init fields of the units will be executed according to first placed first runs
this means the init field of the first unit being placed onto the map will become executed first.
Therefore you need to initialize the array 'killlist' from that unit's inti field.
Now if the first unit being placed should be included to the list also you can change the code
i said above into: killlist = [this]
If not, just make it: killlist = []

Now the script - make kill.sqs file in your missionfolder and put following code inside:

Code: [Select]
#loop
"if _x in list killtrig then {_x setdammage 1}" foreach killlist
~0.5
goto "loop"

:note - this script will every 0.5 seconds kill anybody who is included in the killlist AND inside the
trigger's area.
If you think you don't need this every 0.5 seconds, just change the ~0.5 into ~whatever_you_need.

I would recommend increasing the delay so that you again can save cpu power since it's usually not necessary
to check every half of a second for something like this (5 seconds should do it aswell).

::note - there's way more methods to do so, but this was the first one i've been thinking about and while posting
there came at least 3 or 4 more into my mind but we will see  ;)

~S~ CD
Title: Re: Hazardous Area
Post by: rhysduk on 01 Sep 2006, 02:01:42
Thanks CD,

I tried this method to begin with, but couldnt get it too work unfortunately  :no:

Thanks for that  :thumbsup:

Rhys
Title: Re: Hazardous Area
Post by: Evan Scown on 08 Sep 2006, 22:11:50
Just a question, looking back to the cloud thing. How do you work the drop array? I've been trying to work it out but I can't. I just want one to sit there for the entire mission. If anyone can help, that would be hot.
Title: Re: Hazardous Area
Post by: rhysduk on 08 Sep 2006, 22:25:27
Evan,

Try this link: Drop Tutorial (http://www.ofpec.com/ed_depot/tutes.htm) by Vecktorborson.

Havent used it myself unfortunately.

Rhys
Title: Re: Hazardous Area
Post by: bedges on 08 Sep 2006, 22:29:12
that would be my suggestion too. it's probably the best (if not only) tute on the subject. my own tips would be
Title: Re: Hazardous Area
Post by: Evan Scown on 08 Sep 2006, 23:05:42
YESSSSSsssss...thanks guys!