Home   Help Search Login Register  

Author Topic: flyinheight and ForEach  (Read 684 times)

0 Members and 1 Guest are viewing this topic.

M_S_Holder

  • Guest
flyinheight and ForEach
« on: 28 Dec 2003, 17:46:03 »
I have a Real-time Stategy mission I've made for OFP.

My problem is that whenever I create a helicopter, I want to be able to set the pilot's flyinheight at different hieghts at different times.  For example, sometimes I want him at treetop level, and other times I want him really high.

Whenever I use the radio, this doesn't seem to work:

(_x flyinheight HHIEGHT) forEach (units group mygroup)

It does absolutely nothing.

Any Ideas?

deaddog

  • Guest
Re:flyinheight and ForEach
« Reply #1 on: 28 Dec 2003, 17:58:19 »
How does setting the flyinheight on the units in your group supposed to change a helicopters height?  Flyinheight is for aircraft, not humans.

heliname flyinheight ##

is the correct syntax.

M_S_Holder

  • Guest
Re:flyinheight and ForEach
« Reply #2 on: 28 Dec 2003, 18:25:12 »
Well then my question is this:

The empty helicopter has no name, so how do I run a script to change the helicopters height whenever I need to?

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:flyinheight and ForEach
« Reply #3 on: 28 Dec 2003, 21:00:06 »
{(vehicle _x) flyInHeight HHIEGHT} forEach units someGroup

Funny but that variable looks like a typo  ;D Also try (driver(vehicle _x)), I never remember the correct one.
« Last Edit: 28 Dec 2003, 21:01:27 by MI_Fred »
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

deaddog

  • Guest
Re:flyinheight and ForEach
« Reply #4 on: 28 Dec 2003, 21:28:32 »
Did you place the empty helicopter using the mission editor.  If so, then just give a name in the name box.

If you used createvehicle then just use the variable name you used when you created it:

heliname = "uh60" createvehicle.....

heliname flyinheight xxx

Don't use a local variable for the heli name (_heliname) if you want to access it from another script or trigger.

M_S_Holder

  • Guest
Re:flyinheight and ForEach
« Reply #5 on: 28 Dec 2003, 22:17:24 »
I'll check it out this evening, thanks.

I created the Helicopter with createvehicle at my helicopter factory.  But since I have no real limit on how many I can create, I don't assign the helicopters any names.

I want to set a radio trigger to make any guys in my group that are  currently flying a helicopter go to a certain altitude.  That's why I need a FOREACH.  Now I understand that not all of my men will flying a helicopter, but the FLYINHEIGHT shouldn't affect them.

deaddog

  • Guest
Re:flyinheight and ForEach
« Reply #6 on: 28 Dec 2003, 23:00:13 »
Oh, in that case just do this:

{(vehicle _x) flyinheight xxxx} foreach units group player

That will cover whatever aircraft they are in but have no effect otherwise.

M_S_Holder

  • Guest
Re:flyinheight and ForEach
« Reply #7 on: 28 Dec 2003, 23:21:50 »
Yes that works fine. 8)