OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: marcus3 on 29 Nov 2005, 15:05:09

Title: Spawn and Join script
Post by: marcus3 on 29 Nov 2005, 15:05:09
ok i have made this little script, it will be exec'd when a town is taken over, its supposed to make the unit apper and then move to the town

Code: [Select]

_town = _this select 1

_x = (getpos _town select 0) + 30
_y = (getpos _town select 1) + 0
_z = getpos _town select 2

_townset = [_x,_y,_z]

_bob = "OfficerGHG" createUnit [getmarkerPos "bar",fakegrp]

~0.002

[_bob] join grpnull


_bla = group _leader

_men = 0

#top

?(_men >= 6) : goto "moveout"

_man1 = "SoldierGB" createUnit [getmarkerPos "bar",fakegrp]

_men = _men +1

[_man1] join grpnull

[_man1] join _bob

~1

goto "top"


#moveout


_lead domove getpos _townset

exit

ok, the untis all get made, but then they jst move to the Game Logic called, fakegrp. i have no idea why its not working, but it getting annoying, so, help?
thanks  :-\
Title: Re:Spawn and Join script
Post by: macguba on 29 Nov 2005, 15:19:14
Quote
_lead domove getpos _townset
may be the problem.    _townset is already a position, you don't need getpos.   And _lead is undefined.    

You define _bla then don't use it.

You mention a gamelogic but it doesn't appear to come into the script.  If it exists, it should have a different name from the group fakegroup, otherwise you will get a variable conflict.

Title: Re:Spawn and Join script
Post by: marcus3 on 30 Nov 2005, 00:07:37
nvm, thanks guys  :)