OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Resources Beta Testing & Submission => Topic started by: Pilot on 15 Jan 2005, 16:23:23

Title: Vehicle Height Check Script
Post by: Pilot on 15 Jan 2005, 16:23:23
I have been amazed at the durability of vehicles in OFP.  Especially when they drive off a very high cliff, hit the ground, and keep going. :o

So I wrote this script.

This script checks if a vehicle has exceeded a certain height above the ground, when it drives off a cliff for example.  When the vehicle does exceed the specified height, the script will destroy the vehicle upon impact with the ground.
Title: Re:Vehicle Height Check Script
Post by: Mr.Peanut on 25 Jan 2005, 18:18:44
You might want to consider adding a small delay, say ~0.2, inside your "Loop" and "Fall"  loops.  Might save a little cpu time that way.  Any fall big enough to kill will take longer than 0.2 seconds.


Also add the following line inside your "Loop" loop:
Code: [Select]
if !(alive _car) : exitso that if the car is destroyed in some way other than falling the script is terminated.
Title: Re:Vehicle Height Check Script
Post by: Pilot on 25 Jan 2005, 20:35:33
Ok, I added a .5 second delay into my script, and also added the line to check if the vehicle is alive.  I also changed this:
Code: [Select]
?(getpos _car select 2) < 3: _car setdammage 1 and goto "Die"
to:
Code: [Select]
?(getpos _car select 2) < 5: _car setdammage 1 and goto "Die"
I didn't think 3 meters was getting the job done well enough.
Title: Re:Vehicle Height Check Script
Post by: Mr.Peanut on 25 Jan 2005, 21:06:18
You have inserted the code:
Code: [Select]
?!(alive _car): exit in your "Fall" loop.  This code line should only be in your "Loop" loop.  The idea is that if the vehicle is dead the script is no longer needed to run. However, you do not want to add this line to your "Fall" loop because you want the people inside to always die. Upload your script again and I'll test-drive it. (And if you click on "modify" on any of your posts you can delete the previous versions of your script.)
Title: Re:Vehicle Height Check Script
Post by: Pilot on 25 Jan 2005, 22:47:26
Ok, sorry about that, a moment of stupidity ::)

I moved the alive check to the proper place.

As I said in the readme, please excuse the extremely simple test mission! ::)
Title: Re:Vehicle Height Check Script
Post by: Mr.Peanut on 26 Jan 2005, 02:27:45
Tested. P-Nut Approved.   :)

[size=0]Don't worry about demo being simple.  It does the job.[/size]
Title: Re:Vehicle Height Check Script
Post by: Pilot on 26 Jan 2005, 03:35:32
Thank you for the replies, Mr. Peanut!
 :cheers: