Hello guys, need some help over here!
I'm quite new to scripting so i might be doing a stupid and obvious mistake, since my script is very simple.
What i'm trying to do is create a script that will create a random pre-defined man when someone on the group dies.
First, here's my script:
_target = _this select 0
_units = _this select 1
_respnumb = _this select 2
_objpos = _this select 3
_group = grp
_respawns = _respnumb * _units
_respawnrem = _respnumb * _units
_count = 0
#chec
_unitnumb = count units grp
~2
?_unitnumb < _units: goto "create"
?_unitnumb == _units: goto "chec"
goto "chec"
#create
~0.1
"SoldierWB" createunit [getpos _objpos, grp]
leader _group move getpos leader _target
_count = _count + 1
_respawnrem = _respawnrem - 1
hint format["There are " + "%1" + " respawns left", _respawnrem]
?_count == _respawns: goto "end"
goto "chec"
#end
exit
This script will simple create a soldier from "_objpos" when one or more guys died. This one works fine, but the problem is when i add some more guys to be spawned, like this:
_target = _this select 0
_units = _this select 1
_respnumb = _this select 2
_objpos = _this select 3
_group = grp
_respawns = _respnumb * _units
_respawnrem = _respnumb * _units
_count = 0
#chec
_unitnumb = count units grp
~2
?_unitnumb < _units: goto "create"
?_unitnumb == _units: goto "chec"
goto "chec"
#create
~0.1
_rand = (random 2) + 1
?_rand = 1 : "OfficerW" createunit [getpos _objpos, grp]
?_rand = 2 : "SoldierWB" createunit [getpos _objpos, grp]
?_rand = 3 : "SoldierWLAW" createunit [getpos _objpos, grp]
leader _group move getpos leader _target
_count = _count + 1
_respawnrem = _respawnrem - 1
hint format["There are " + "%1" + " respawns left", _respawnrem]
?_count == _respawns: goto "end"
goto "chec"
#end
exit
Doing this, the script just don't work. Any sugestions?
Thanks for your time!
PS: Sorry my bad english, i'm Br :X
Forget it fellas, i solved it myself!
A hurraah for the trial and error!
Thanks again...