Home   Help Search Login Register  

Author Topic: Oh man!  (Read 606 times)

0 Members and 1 Guest are viewing this topic.

Offline Captain Crunch

  • Members
  • *
Oh man!
« on: 20 Jan 2004, 03:05:38 »
  In the "Init" field of a group, I have seen in an original MP mission of the game:

Code: [Select]
AK1 = Group This; AK1 AllowFleeing 0
  OK, I have done the same but added something more:

Code: [Select]
AK1 = Group This; AK1 AllowFleeing 0; AK1 SetUnitPos "Up"
  Does this makes sense at all?? Cos it's not working.

Also, In a script, I want to check, using the group array (AK1) if they both got into a chopper:

Code: [Select]
@ AK1 In Chopper
I get a error code saying:
Quote
Generic error in expression

Now, is it only that my syntax isn't good or is it my idea that simply just don't make sense??
Back to the forest!

m21man

  • Guest
Re:Oh man!
« Reply #1 on: 20 Jan 2004, 03:10:44 »
1. setunitpos affects single units, not groups. Try using "_x setunitpos "up"" foreach units AK1.

2. Maybe "_x in chopper" foreach units AK1.
« Last Edit: 20 Jan 2004, 03:11:12 by m21man »

Offline Captain Crunch

  • Members
  • *
Re:Oh man!
« Reply #2 on: 20 Jan 2004, 03:30:58 »
Hi m21man !

   Thanx man! Though it doesn't work! :-\ Could it be that it's because I am using the "@" command before it??

Code: [Select]
@ "_X In Chopper" ForEach Units AK1
Or is it because I should then use a little different syntax?

Thanks a lot for your help man! :D
Back to the forest!

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Oh man!
« Reply #3 on: 20 Jan 2004, 03:31:44 »
You need to get your head straight about the difference between a unit and a group.     For example

Quote
In the "Init" field of a group

doesn't make any sense.    Units have init fields, groups do not.    Some commands apply to units, some apply to groups and some can apply to either.   The command reference always makes it clear which is the case for any particular command.    

Most of the points you've raised are because you are passing a group to a command that requires a unit.  Conseqently the game is getting confused and giving you error messages.

m21man is right.     Often a good way to get round this problem is to use the forEach command.   If you're not familar with it read the online version of the official command ref and also the unofficial command reference guide, both available in the Editors Depot.

If you havne't already, read the Editing tutorials by Johan Gustafsson and Abuu in Getting Started in the Ed Depot.
Quote
« Last Edit: 20 Jan 2004, 03:31:57 by macguba »
Plenty of reviewed ArmA missions for you to play

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Oh man!
« Reply #4 on: 20 Jan 2004, 03:36:19 »
Ah, now we have a slightly different problem.     _x in chopper foreach is not going to work as a condition.   You'd think it would work, but OFP doesn't think like that.     @ requires a boolean and foreach can't return one.  forEach is used to give commands, it doesn't return anything. (I think)

Fortunatly there is a count version of foreach which is what you use in circumstances like this.

@ ("_x in chopper" count units AK1 == count units AK1)

syntax not guaranteed at all, but its something along those lines.
Plenty of reviewed ArmA missions for you to play

Offline Captain Crunch

  • Members
  • *
Re:Oh man!
« Reply #5 on: 20 Jan 2004, 03:42:05 »
Thanx MacGuba!

   Yes I do have the official and unofficial comrefs. I have downloaded them more than a year ago. Could it be that they were updated?

  I should appologize, I'm not very fast with this scripting idea. But eh! Thanx a lot for all of You people's help and support in OFP!
« Last Edit: 20 Jan 2004, 03:46:45 by Captain Crunch »
Back to the forest!

Offline Captain Crunch

  • Members
  • *
Re:Oh man!
« Reply #6 on: 20 Jan 2004, 03:56:36 »
Your syntax is good MacGuba. It works fine!! Many thanx a lot amigo!!
Back to the forest!

deaddog

  • Guest
Re:Oh man!
« Reply #7 on: 20 Jan 2004, 04:27:47 »
Just to present another way, not necessarily better.

@("vehicle _x ==_x" count units ak1 == 0)


Offline Captain Crunch

  • Members
  • *
Re:Oh man!
« Reply #8 on: 20 Jan 2004, 05:15:59 »
Thnx deaddog! ;)

Yet more questions, dunno if I should have opened a new thread but here it goes:

In the editor, I place an empty Mi-24 named "Chopper". Not far from there, two "Pilot" units on the east side named "ChopperP" and "ChopperG" with three waypoints. (They are regrouped)

1. move     2. Get In     3. S&D

First question: In a script, which named should I invoke if I want to give orders? For example: "SetSpeedMode" or "DoMove" or "DoWach"??

Second question: Could it be that the two "Pilot" units are not as good as if I would put an east chopper with the two original units in already??

Many thanx again!
Back to the forest!

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Oh man!
« Reply #9 on: 20 Jan 2004, 11:56:42 »
Glad to help.   :)   The Comrefs have not been updated, all I meant was you should always go back and consult them every time you use a command you are not very familiar with or when you get an error message.    OFP scripting language is too subtle to be used mechanically - you have to understand what you are doing otherwise it won't work.  

I tell everybody to read the comref from front to back, like a book.   Don't stop to understand every command, that would be far too long an boring, but get a feel for what's there and how the person who wrote the scripting language thinks.   Solving a crossword puzzle is much easier if you know the style of the puzzle creator:  OFP scripting is similar.

Now, the new questions.   For most commands you should probably use the driver.  However this is a good case for experiment as you go to see what works best.     Use move (which is an order for a group, which is what the crew of the chopper is) rather than doMove (which is appropriate for a single loon).

2.  It makes no difference.     It's probably slightly simpler to insert a working chopper rather than have the crew seperate, but it really depends on the exact circumstances.
Plenty of reviewed ArmA missions for you to play

Offline Captain Crunch

  • Members
  • *
Re:Oh man!
« Reply #10 on: 20 Jan 2004, 18:37:01 »
 :D Very nice of You, Thank You!

If it wasn't for Your help and the people of this forum, my mission editing would still be placing two units on the map and have them picking daisies from point A to point B!!!  ;D

I will read the comrefs the way You suggested me. Sounds like a good idea!
 Merci!! ;)
Back to the forest!