Home   Help Search Login Register  

Author Topic: Vehicle Height Check Script  (Read 2043 times)

0 Members and 1 Guest are viewing this topic.

Offline Pilot

  • Contributing Member
  • **
Vehicle Height Check Script
« 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.
« Last Edit: 25 Jan 2005, 22:43:21 by Student Pilot »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:Vehicle Height Check Script
« Reply #1 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.
« Last Edit: 25 Jan 2005, 20:54:39 by Mr.Peanut »
urp!

Offline Pilot

  • Contributing Member
  • **
Re:Vehicle Height Check Script
« Reply #2 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.
« Last Edit: 25 Jan 2005, 22:43:41 by Student Pilot »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:Vehicle Height Check Script
« Reply #3 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.)
« Last Edit: 25 Jan 2005, 21:10:38 by Mr.Peanut »
urp!

Offline Pilot

  • Contributing Member
  • **
Re:Vehicle Height Check Script
« Reply #4 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! ::)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:Vehicle Height Check Script
« Reply #5 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]
urp!

Offline Pilot

  • Contributing Member
  • **
Re:Vehicle Height Check Script
« Reply #6 on: 26 Jan 2005, 03:35:32 »
Thank you for the replies, Mr. Peanut!
 :cheers: