OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Mock360 on 18 Aug 2007, 02:09:23

Title: Need Help Refining script
Post by: Mock360 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.
Title: Re: Need Help Refining script
Post by: JasonO 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?
Title: Re: Need Help Refining script
Post by: Mandoble on 18 Aug 2007, 19:59:20
what are tgt11-16?
Title: Re: Need Help Refining script
Post by: Mock360 on 18 Aug 2007, 20:33:49
Tgt11-16 are troops. Thanks for the help. Just trying to improve my scripting skills. :D
Title: Re: Need Help Refining script
Post by: Mr.Peanut on 21 Aug 2007, 19:37:46
I think you will want to remove the quotes around the items in _tgtarray.