Home   Help Search Login Register  

Author Topic: Spawn Script  (Read 661 times)

0 Members and 1 Guest are viewing this topic.

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Spawn Script
« 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
« Last Edit: 10 Jun 2005, 21:12:02 by greg147 »
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Spawn Script
« Reply #1 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
« Last Edit: 10 Jun 2005, 21:06:39 by THobson »

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re:Spawn Script
« Reply #2 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.
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re:Spawn Script
« Reply #3 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?  :-[
« Last Edit: 13 Jun 2005, 19:29:40 by greg147 »
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Spawn Script
« Reply #4 on: 13 Jun 2005, 20:09:52 »
i can do better ;)

see attached...

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re:Spawn Script
« Reply #5 on: 14 Jun 2005, 08:04:12 »
Thanks you, I will try that soonist  ;D
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re:Spawn Script
« Reply #6 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?  ;)
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Spawn Script
« Reply #7 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 ;)

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re:Spawn Script
« Reply #8 on: 15 Jun 2005, 19:07:30 »
Yep, that did the trick perfectly ;D
It works now

Thanks for the help Bedges  ;)
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Spawn Script
« Reply #9 on: 15 Jun 2005, 19:08:55 »
's why we're all here :)