Home   Help Search Login Register  

Author Topic: Refuel Loop  (Read 789 times)

0 Members and 1 Guest are viewing this topic.

Iwesshome

  • Guest
Refuel Loop
« 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?
« Last Edit: 14 Mar 2003, 15:46:11 by IW »

Plizkin

  • Guest
Re:Refuel Loop
« Reply #1 on: 14 Mar 2003, 15:58:40 »
so much I understand ???  you, try this:

#nochmal
UnitName SetFuel Amount
goto "nochmal"


cheers

Iwesshome

  • Guest
Re:Refuel Loop
« Reply #2 on: 14 Mar 2003, 16:51:53 »
???

Quote
#nochmal
UnitName SetFuel Amount
goto "nochmal"
What is #nochmal?

So - If I placed this into a script it would look like this?

Quote
; [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?



Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Refuel Loop
« Reply #3 on: 14 Mar 2003, 18:56:42 »
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
Not all is lost.

Iwesshome

  • Guest
Re:Refuel Loop
« Reply #4 on: 14 Mar 2003, 19:50:22 »
Quote
;[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

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Refuel Loop
« Reply #5 on: 14 Mar 2003, 22:23:51 »
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.
Not all is lost.

Iwesshome

  • Guest
Re:Refuel Loop
« Reply #6 on: 14 Mar 2003, 22:55:09 »
Artak,

Thanks for your help... I am heading home to try it out.

IW

Iwesshome

  • Guest
Re:Refuel Loop
« Reply #7 on: 17 Mar 2003, 02:50:16 »
Yep... that worked.

Thanks for the help  ;D

IW