OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Iwesshome on 14 Mar 2003, 15:45:08
-
Good Morning All,
My little mind is not ready to handle the world of creating scripts yet... heck I just learned how to use.
What I am trying to do is keep a helicopter in the air without ever having to go back to base to refuel.
UnitName SetFuel Amount
Ok I understand this part but how do I loop it over and over? If the value for empty is 0.0 and full is 1.0 how can I get this to refuel at 0.5?
-
so much I understand ??? you, try this:
#nochmal
UnitName SetFuel Amount
goto "nochmal"
cheers
-
???
#nochmal
UnitName SetFuel Amount
goto "nochmal"
What is #nochmal?
So - If I placed this into a script it would look like this?
; [Unitname] exec "refuel.sqs"
#nochmal
helo1 SetFuel 1.0
goto "nochmal"
What triggers the script to refuel to 1.0.... or is this constantly running and refueling to a full tank?
-
whoops.. don't do it like that or you'll propably end up crashing your ofp.
a proper script would be
#start
?!(alive helo1): exit
helo1 setfuel 1
~500
goto "start"
what does it do?
#start is a bookmark for the script
?!(alive helo1): exit checks if the chopper is not alive, and if so, then it exits the script so it won't run on the background for nothing.
helo1 setfuel 1 sets the maximum amount of fuel to helo1
~500 makes the script wait for 500 seconds untill it continues. In other words, it'll take 500 seconds for the chopper to be refueled again.
goto "start" makes the script go to a bookmark called start. In other words, goes to the begining of the script where everything starts all over again ;)
Oh, and btw, you shoul visit our Editors Depot. There's some amazing tutorials in there which are VERY USEFULL :D
-
;[unitname] exec "refuel.sqs"
_helo1 = _this select 0
#start
?!(alive helo1): exit
helo1 setfuel 1
~500
goto "start"
Thanks for the talking the time to explaining some simple script lingo for me... this look good before I go home tonight and try it?
IW
-
umm.. no :)
when you pass info to the script with the [unitname] blah blah.. and then save the info as a local variable, like in this case _helo1, you also use it :D
So if you want the script to work no matter what you name your chopper as (like you're doing), you'd change the script like this:
;[unitname] exec "refuel.sqs"
_helo1 = _this select 0
#start
?!(alive _helo1): exit
_helo1 setfuel 1
~500
goto "start"
See the difference? Using it like this the script will add the fuel to _helo1 and not helo1 which could be anything.
If you name your chopper to 'helicopter1' instead of 'helo1' the script will work anyhow because unitname = _helo1 and _helo1 is what the script uses.
-
Artak,
Thanks for your help... I am heading home to try it out.
IW
-
Yep... that worked.
Thanks for the help ;D
IW