OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: greg147 on 10 Jun 2005, 21:00:10

Title: Spawn Script
Post by: greg147 on 10 Jun 2005, 21:00:10
Hi all,

I'm trying to use a script that makes a group be spawned from a location to another location when a trigger is activated. But i've run into trouble. Heres what I have so far:

Code: [Select]
c1 setpos[getpos logic2 select 0, getpos logic2 select 1, +1]
c2 setpos[getpos logic2 select 0, getpos logic2 select 1, +1]
c3 setpos[getpos logic2 select 0, getpos logic2 select 1, +1]
c4 setpos[getpos logic2 select 0, getpos logic2 select 1, +1]

c1/c2/c3 etc being the member of the squad, and l2 being the gamelogic I want them to be spawned to. (I don't know how to just get the whole group to be setposed at once, if anyone could help with that that would be good)

When I activate it, the squad is moved correctly and everything, but I get this error:

Code: [Select]
'c4 setpos[getpos logic2 select|#| 0, getpos logic2 select 1, +1]': Error getpos: Type Number, expected Object
Unfortunatly I have no idea how to fix this.  :-[
Does anyone know where I've screwed up?  ;)

Thanks
Title: Re:Spawn Script
Post by: THobson on 10 Jun 2005, 21:04:34
To move the whole squad use something like:

{_x setpos [getpos l2 select 0, getpos l2 select 1, 0]} forEach units group c1

It is a bit ugly though - they will all land on top of each other.


On your error message - have you defined an l3?

Actually it looks like 13 not l3
Title: Re:Spawn Script
Post by: greg147 on 10 Jun 2005, 21:10:47
Whoops, thats a typo. Its ment to be l2. I'll change it now.  ;)

To save confussion, I'm renaming the logic 'logic2'

Anyway, thanks for the other line. I'll try that.
Title: Re:Spawn Script
Post by: greg147 on 13 Jun 2005, 19:29:29
I don't usually bump topics, but I still really need this  :-[

Does anyone know why I'm getting the error and how to fix it?  :-[
Title: Re:Spawn Script
Post by: bedges on 13 Jun 2005, 20:09:52
i can do better ;)

see attached...
Title: Re:Spawn Script
Post by: greg147 on 14 Jun 2005, 08:04:12
Thanks you, I will try that soonist  ;D
Title: Re:Spawn Script
Post by: greg147 on 15 Jun 2005, 19:00:08
Well, I tried it. It didn't work too well.  :-[

It spawned the whole squad to the far corner of the map, either Aa00 or Zj99

Heres what I had in the activation line:

Quote
[able,logic2] exec "group_teleport.sqs"

Able being the group, and logic2 being the gamelogic destination.

I though copied the text you privided exactly though.   :-[
Anyone know where i've screwed up, or another way of getting the job done?  ;)
Title: Re:Spawn Script
Post by: bedges on 15 Jun 2005, 19:03:55
ah right.... well, firstly i can assure you it does indeed work. what it's looking for though is a positional array for the second parameter, so more like

Code: [Select]
[able,getpos logic2] exec "group_teleport.sqs"
that may do it ;)
Title: Re:Spawn Script
Post by: greg147 on 15 Jun 2005, 19:07:30
Yep, that did the trick perfectly ;D
It works now

Thanks for the help Bedges  ;)
Title: Re:Spawn Script
Post by: bedges on 15 Jun 2005, 19:08:55
's why we're all here :)