Home   Help Search Login Register  

Author Topic: Need Help Refining script  (Read 1744 times)

0 Members and 1 Guest are viewing this topic.

Offline Mock360

  • Members
  • *
Need Help Refining script
« on: 18 Aug 2007, 02:09:23 »
I created the following script. It does the job but I know there has to be a more "elegent" way of doing it. If anyone has the time to give a quick critique, I would appreciate it. Basically a teleport in a multiplayer game. Script is activated by Radio Alpha. Spot1 and tgt1 are Game Logics.

?!(local server) : exit

; tgt1.sqs
;--------------------------

tgt11 SetPos (GetPos spot1)
tgt12 SetPos (GetPos spot1)
tgt13 SetPos (GetPos spot1)
tgt14 SetPos (GetPos spot1)
tgt15 SetPos (GetPos spot1)
tgt16 SetPos (GetPos spot1)
{_x SetDir 180} forEach units opfgrp1
~2
{_x domove GetPos tgt1} forEach units opfgrp1

Thanks in advance.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Need Help Refining script
« Reply #1 on: 18 Aug 2007, 18:37:05 »
Code: [Select]
?!(local server) : exit

; tgt1.sqs
;--------------------------

_tgtarray = ["tgt11","tgt12","tgt13","tgt14","tgt15","tgt16"]

{_x setpos (getpos spot1)} foreach _tgtarray
{_x SetDir 180} forEach units opfgrp1
~2
{_x domove GetPos tgt1} forEach units opfgrp1

Is that what you wanted?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Need Help Refining script
« Reply #2 on: 18 Aug 2007, 19:59:20 »
what are tgt11-16?

Offline Mock360

  • Members
  • *
Re: Need Help Refining script
« Reply #3 on: 18 Aug 2007, 20:33:49 »
Tgt11-16 are troops. Thanks for the help. Just trying to improve my scripting skills. :D

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Need Help Refining script
« Reply #4 on: 21 Aug 2007, 19:37:46 »
I think you will want to remove the quotes around the items in _tgtarray.
urp!