Home   Help Search Login Register  

Author Topic: prevent unit to follow group leader action  (Read 518 times)

0 Members and 1 Guest are viewing this topic.

juxie

  • Guest
prevent unit to follow group leader action
« on: 15 Oct 2004, 05:11:53 »
Everytime the unit from a group respawn, it will follow the action that the group leader does.
For example, if leader prone, unit will also prone.
I am trying to prevent this to happen.

Any idea how it can be done?

Kammak

  • Guest
Re:prevent unit to follow group leader action
« Reply #1 on: 15 Oct 2004, 06:13:11 »
This is controlled by the "setUnitPos" command.  It defaults to the string "AUTO", which means the AI will follow the leader's lead.

It accepts "DOWN" and "UP" as well.

Setting it to UP will keep the AI from going prone.
ex:

guy setUnitPos "UP"


where guy is a unit or variable for a unit.

juxie

  • Guest
Re:prevent unit to follow group leader action
« Reply #2 on: 15 Oct 2004, 11:11:53 »
hmmm... it doesn't seem to work.
weird

any other idea?

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:prevent unit to follow group leader action
« Reply #3 on: 15 Oct 2004, 13:35:45 »
you have named the soldier, haven't you? ::)

if you haven't then it won't work. If you want to do it to any unit w/o a name, then you have to type
Code: [Select]
this setUnitPos "AUTO"
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

juxie

  • Guest
Re:prevent unit to follow group leader action
« Reply #4 on: 21 Oct 2004, 07:10:26 »
weird...... all suggested doesn't seem to work  ???

I am trying to make my soldier move after respawn.
I have a respawn script.
I embedded the suggested script into my respawn script.
However, it doesn't work.

Please help.

Thank you.


Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:prevent unit to follow group leader action
« Reply #5 on: 21 Oct 2004, 20:37:14 »
It might help if you actually posted the relevant code.

That way, we might see where it is going wrong.


Planck
I know a little about a lot, and a lot about a little.

juxie

  • Guest
Re:prevent unit to follow group leader action
« Reply #6 on: 22 Oct 2004, 03:07:36 »
Code: [Select]
~(random 0.3)
requiredVersion "1.85"
_name = _this select 0
_method = _this select 1
_hasrifle = false
_unit = call format["%1",_name]
?_method == 0:_return = "checklocal";goto "guncheck"

#checklocal
_unit = call format["%1",_name]
?local _unit:goto "respawnloop"
~(1 + (random 3))
goto "checklocal"

#respawnloop
@!alive _unit
#checkmethod
?_method == 1:_return = "waitforlife";goto "guncheck"

#waitforlife
@alive call format["%1",_name]
_unit = call format["%1",_name]
_unit removemagazine (magazines _unit select 0)
_unit removeweapon (weapons _unit select 0)
"_unit addmagazine _x" foreach _mags
?_hasrifle:_guns = _guns - [_prigun];_guncount = count _guns
_c = 0
while "_c <= (_magcount - 1)" do {_unit addmagazine (_mags select _c); _c = _c + 1}
_c = 0
while "_c <= (_guncount - 1)" do {_unit addweapon (_guns select _c); _c = _c + 1}
?_hasrifle:_unit addweapon _prigun;_gun = _guns + [_prigun]
;//If unit has a rifle select it
?_hasrifle:goto "selectrifle"

;//No rifle - if unit has a pistol, select it
?_unit hasweapon ((weapons _unit - [secondaryweapon _unit,"Binocular","NVGoggles"]) select 0):_unit selectweapon ((weapons _unit - [secondaryweapon _unit,"Binocular","NVGoggles"]) select 0);goto "respawnloop"

;//No rifle or pistol, select secondary weapon
_unit selectweapon secondaryweapon _unit
goto "respawnloop"

#selectrifle
;// BUG WORKAROUND! - Added to compensate for selectweapon bug
;// Any gun with more than one muzzle (grenadelaunchers) cannot be selected with selectweapon!
;// Default Grenadelaunchers supported - Add your own types if you need to.
_unit selectweapon _prigun
?_prigun == "M16GrenadeLauncher":_unit selectweapon "M16Muzzle"
?_prigun == "Ak74GrenadeLauncher":_unit selectweapon "AK74Muzzle"
?_prigun == "Ak47GrenadeLauncher":_unit selectweapon "AK47Muzzle"

;//SAF bug fix additions
?_prigun == "M203":_unit selectweapon "sar21Muzzle"

goto "respawnloop"


#guncheck
_guns = weapons _unit
_mags = magazines _unit
~(random 0.5)
_guncount = count _guns
_magcount = count _mags
?_unit hasweapon (primaryweapon _unit):_hasrifle = true;_prigun = primaryweapon _unit;goto _return
_hasrifle = false
goto _return

I actually tried to add the codes below into "waitforlife" or "respawnloop":
Code: [Select]
_unit setUnitPos "UP"
_unit doMove getMarkerPos "aMarker"
the weird thing is I realised that these codes doesn't take effect at all
Please help
Thank you