OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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!
-
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.
-
There was a script that did this in the depot before the big crash...
-
To kill a unit straight off the line:
this setdammage 1 is usually used.
For what you want use the below method.
Typical Scenario:
- Put a West trigger over an area of land.
- In the On Activation field of each unit you dont want entering the area put
this exec "kill.sqs"- Make a .sqs file called kill (Note spelling and no upper case characters) and put it in the mission folder.
- In the script file put:
_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
-
If you want it to kill slowly then change the script posted by rhysduk thusly:
_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.
-
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:
#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
-
Thanks CD,
I tried this method to begin with, but couldnt get it too work unfortunately :no:
Thanks for that :thumbsup:
Rhys
-
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.
-
Evan,
Try this link: Drop Tutorial (http://www.ofpec.com/ed_depot/tutes.htm) by Vecktorborson.
Havent used it myself unfortunately.
Rhys
-
that would be my suggestion too. it's probably the best (if not only) tute on the subject. my own tips would be
- use the examples he gives as a starting point - copy/paste
- change only one of the values at a time until you understand what's going on
-
YESSSSSsssss...thanks guys!