OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Captain Crunch on 26 Jan 2004, 23:56:42

Title: Group Teleporting
Post by: Captain Crunch on 26 Jan 2004, 23:56:42
Hi!

   I try to teleport a group of troops to a marker. I get an error message that says:

"Type group, expected object"

  In the "Init" field of the group leader I typed this:

"Police01 = Group This"

And in an "On Activation" field of a waypoint, I have typed this:

 Police01 SetPos GetMarkerPos "PoliceM01"

Looking at the error message, (Type group, expected object) I suppose it is possible. (Because of the "Type group" part)

What am I doing wrong? Well, if it's even possible!!

   Thanks a lot!!!

                                                  crunch
Title: Re:Group Teleporting
Post by: _hammy_ on 27 Jan 2004, 00:16:43
try changing
Police01 SetPos GetMarkerPos "PoliceM01"

to

"_x setpos setpos getmarkerpos "PoliveM01"" Foreach units group Police01

its probably wrong, you could always put
This setpos setpos getmarkerpos "PoliveM01"
in each of the units init field :P
Title: Re:Group Teleporting
Post by: Chris Death on 27 Jan 2004, 00:17:23
"_x setpos getmarkerpos {policem01}" forEach police01


:edit - yeah hammy u were faster but wrong if there hasn't
been changed anything lately.

"_x setpos getmarkerpos "policem01"" forEach police01
doesn't work, as it should be:

"_x setpos getmarkerpos ""policem01""" forEach police01

:note - watch the dbl-quotation marks

np. anyway - and no offense meant in anyway  :D

~S~ CD
Title: Re:Group Teleporting
Post by: h- on 27 Jan 2004, 00:20:26
Never mind...

:beat: Got beaten by many before me :beat:
Title: Re:Group Teleporting
Post by: macguba on 27 Jan 2004, 00:21:32
The underlying points is that some commands take a group as an argument, and other commands take a unit.   Some commands take either.    The comref usually makes it clear.

The error message in this case is very helpful:  the game found a group when it was expecting an object.    When you get a message like this look through your code to find a group - and there's your problem.

The proposed solution should work just fine.
Title: Re:Group Teleporting
Post by: Chris Death on 27 Jan 2004, 00:23:38
errm - scripts are always useful and handy, but in this case,
i would suggest the one-liner  ;)

Maybe you could use a script, if u don't want them to get
beamed into the very same spot, but even that wouldn't
be a problem, as they would imidiately step back into the right
place of their formation, once needed.

:what the hell is goin on in this thread??

one types a reply, just to edit it, because others already
started typing a reply  :o  ;D

~S~ CD
Title: Re:Group Teleporting
Post by: _hammy_ on 27 Jan 2004, 00:30:47
pfft i never knew it had to be double quotes ;)
Title: Re:Group Teleporting
Post by: h- on 27 Jan 2004, 00:31:25

:what the hell is goin on in this thread??

one types a reply, just to edit it, because others already
started typing a reply  :o  ;D

~S~ CD
;D

Guilty...  :D

I'm alawys too slow on replying... same info ten times won't do any good  ;)
Title: Re:Group Teleporting
Post by: Captain Crunch on 27 Jan 2004, 01:02:13
Thanx guys!!

   Though neither syntax actually worked!!
I played around with You guys' ideas and mixed a little of Your responses.

   Here is the correct syntax:


"_X SetPos GetMarkerPos ""PoliceM01""" ForEach Units Police01


And to MacGuba:

  Hi! I remember having such problem (even just recently) :-[ You had actually told me the same thing!!! I'm sorry!  :-[

I'll watch myself, I'll think about my problem longer before posting next time!

  Many thanks again!!



Title: Re:Group Teleporting
Post by: Chris Death on 27 Jan 2004, 02:05:04
Quote
Though neither syntax actually worked!!
I played around with You guys' ideas and mixed a little of Your responses.

  Here is the correct syntax:


"_X SetPos GetMarkerPos ""PoliceM01""" ForEach Units Police01

So what's then been wrong with the syntax, i posted in my
2nd reply?

Anyway, if my first suggestion didn't work for you, i suppose
you're using pre-resistance then - don't you?

If not, suggestion 1 should work aswell, if yes, {} brackets
were not supported by OFP engine before one of the
patches after 1.75

~S~ CD
Title: Re:Group Teleporting
Post by: Captain Crunch on 27 Jan 2004, 05:21:51
no, I have version 1.91

   The part missing was the "Units" word!! between "ForEach" and "Police01".

And about Your syntax, sorry, I made a mistake and didn't typed the right brakets in!!
I had used [] instead of {}!

  But thanx!!  ;D
Title: Re:Group Teleporting
Post by: Chris Death on 27 Jan 2004, 06:07:16
Ah yeah, i can see now  :D

I might have been working too much with arrays
the last days then.

Ya know: "_x dosummit" forEach ARRAY
                "_x dosummit" forEach units group/unit

you see forEach array doesn't require the units, but
forEach group/unit does.

That's because: units group/unit represents an array of
units aswell, while the name of a group just represents
an object.

hmm - will this accusation get me out of ma typo  ::)

 ;D

~S~ CD