OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: MythPro1 on 23 Jul 2004, 01:09:11

Title: Fuel Script
Post by: MythPro1 on 23 Jul 2004, 01:09:11
I'm just looking for a script that when you pass a trigger your fuel supply will continuously drain quickly. I know there is a script in the Editor's Corner for OFPEC but that zip file is corrupted when I always download it for some reason.
Title: Re:Fuel Script
Post by: j-man on 23 Jul 2004, 05:51:40
This might be the script you talking about:

drainfuel.sqs
Code: [Select]
;***************************************
;* Drain Fuel script                   *
;* By [icarus_uk]                      *
;* http://furryclan.net                *
;***************************************

; Call with [VehicleName]exec "drainfuel.sqs"

_vehicle = _this select 0

#drain

_amount = fuel _vehicle

;increase the value of 0.01 to a larger value (eg 0.1)
;to have the fuel drain faster.
;With a value of 0.1, it will take 5 seconds for a full tank to drain.

_amount = _amount - 0.01

_vehicle setfuel _amount

? _amount <= 0 : goto "exit"

~0.5
goto "drain"

#exit
exit
Title: Re:Fuel Script
Post by: MythPro1 on 23 Jul 2004, 06:14:53
Yep, that is exactly what I was looking for. Thank you very much  :D
Title: Re:Fuel Script
Post by: MythPro1 on 25 Jul 2004, 03:53:21
but one slight problem, i save that text in notepad and I name it "drainfuel.sqs". I put it in the missions folder but when I try to execute it, its telling me the script cannot be found. It is in the correct place  ???  ???
Title: Re:Fuel Script
Post by: Planck on 25 Jul 2004, 13:59:05
This is probably because it is really named 'drainfuel.sqs.txt'.

If you did not choose the All Files option for the File Type in Notepad save dialogue, this is what happens.  So it saves as type 'Text' and appends .txt to the end of your file name.

You will not be able to see the .txt extension if you have 'Hide file extensions for known file types enabled in your folder properties.


Planck
Title: Re:Fuel Script
Post by: MythPro1 on 26 Jul 2004, 00:03:24
Yup that fixed it, thanks a bunch. Now another problem has arisen, I go through the trigger and then it says "_vehicle = _this select 0|#| Error Select: Type Object, expected Array"
i tried putting in the vehicle name where it says "vehicle" but that turned up with the same error.  
Title: Re:Fuel Script
Post by: Roni on 28 Jul 2004, 04:07:24
Make sure that you haven't confused your "this's" with your "_this's".  :P

If your vehicle is named "car" then you need to put this in the script activation line -

[car] exec "drainfuel.sqs"

NOT

car exec "drainfuel.sqs"

otherwise the script will look for an element in an array that doesn't exist.

Just my suggestion . . .



Roni
Title: Re:Fuel Script
Post by: DBR_ONIX on 22 Aug 2004, 10:57:38
Yeah, it's [this] exec "drainfuel.sqs"
- Ben
Title: Re:Fuel Script
Post by: Bluelikeu on 22 Aug 2004, 15:27:06
Or, you could just change the script from
_Vehicle = _This Select 0

To

_Vehicle = _This


!!!!!!!!!!!!!!!!
WOW----- :P
!!!!!!!!!!!!!!!!