Home   Help Search Login Register  

Author Topic: Forcing Units to get out and stay out  (Read 3413 times)

0 Members and 1 Guest are viewing this topic.

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Forcing Units to get out and stay out
« on: 05 Jul 2005, 23:56:00 »
ok... ive searched, and got nothing (i swear) and its just a simple question... I want to be able to force the driver, gunner and any cargo to get out of a vehicle and unassign themselves from that vehicle (so AI wont get back in)...

now, making the driver and gunner get out is easy:

Code: [Select]
unassignvehicle (gunner _vehicle)
(gunner _vehicle) action ["EJECT"]
unassignvehicle (driver _vehicle)
(driver _vehicle) action ["EJECT"]

but how would i go about removing the cargo when it could in theory be anyone on the map, not just a named group (where i could then use a simple eject script)
Proud Member of the Volunteer Commando Battalion

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Forcing Units to get out and stay out
« Reply #1 on: 06 Jul 2005, 00:08:46 »
hmmm... tested my code to get the gunner and driver to get out... they get out, but the AI just get back in again... even with the unassign bit...

i guess just one big script to encorporate anything in the vehicle would be better... but how do we stop thegit getting back in, even when i've unassigned them  >:(
Proud Member of the Volunteer Commando Battalion

Offline sharkyjoe

  • Members
  • *
  • Have you taken a BMP out at 500 meters??
Re:Forcing Units to get out and stay out
« Reply #2 on: 06 Jul 2005, 00:12:42 »
See the unassignvehicle under Command References and read Thobson memo underneath.
That should point ya in the right direction. ;)
Remember the 7 Ps??--- Proper Previous Planning Prevents Pathetically Poor Performance

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Forcing Units to get out and stay out
« Reply #3 on: 06 Jul 2005, 00:25:54 »
ok, got that much, but how about the troops in cargo... since they have no names i'd need to be able to find out who's in cargo and kick them out...
Proud Member of the Volunteer Commando Battalion

Offline sharkyjoe

  • Members
  • *
  • Have you taken a BMP out at 500 meters??
Re:Forcing Units to get out and stay out
« Reply #4 on: 06 Jul 2005, 00:58:36 »
Well, from my mission making which is limited, you may want to name each group and/or man. Sounds like a bunch of trouble to this but in the long run it will help. It has helped me, once i started to name men,goups, triggers, waypoints.

A thought just occured, maybe dowlaod snYpir's sp/mp pack and open it up. He has a lot of stuff that can be customized to your mission. Looks like he names things with variables too. That(pack) is found in the Editors Depot under Mod Editing-sp/mp.
« Last Edit: 06 Jul 2005, 01:05:55 by sharkyjoe »
Remember the 7 Ps??--- Proper Previous Planning Prevents Pathetically Poor Performance

Offline ezol

  • Members
  • *
  • blah
Re:Forcing Units to get out and stay out
« Reply #5 on: 06 Jul 2005, 01:23:01 »
A silly of doing it would be to get a pointer to every unit on the map and UnAssign them from the vehicle.  
I don't think it would cause any crashes but it's just nasty scripting and would take alot longer.  

Naming groups when there's alot is dull but it seems to be the only plausible way.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Forcing Units to get out and stay out
« Reply #6 on: 06 Jul 2005, 03:48:56 »
a simple loop grabs them other guys

Code: [Select]
_vehicle = _this select 0
_cargo = (crew _vehicle) - [(driver _vehicle), (gunner _vehicle)]
_i = 0
?(count +_cargo) = 0:exit

#loop
_man = _cargo select _i
unassignvehicle _man
_man action ["EJECT"]
_i = _i + 1
?_i >= (count _cargo):exit
goto "loop"

fairly simple anyway...


EDIT: to keep them out, i think i remember something about giving them a new group or something. like they're staying in the vehicles group, so they go back to it. not sure though
« Last Edit: 06 Jul 2005, 03:51:15 by Triggerhappy »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Forcing Units to get out and stay out
« Reply #7 on: 06 Jul 2005, 07:20:09 »
as a standby, you could also get the position and direction of the vehicle in question, and once the loons are all out, delete it, and then instantly create a new one of the same type in the same position facing the same direction.

saves you having to assign them to a new group perhaps.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Forcing Units to get out and stay out
« Reply #8 on: 06 Jul 2005, 07:59:12 »
Quote
but how about the troops in cargo
The command crew will give you everyone in the vehicle even those that are in cargo. So:

Code: [Select]
_occupants = crew vehiclename
{unassignVehicle _x} forEach _occupants
(_occupants) allowGetIn false

Will get everyone out of the vehicle and they should stay out.
« Last Edit: 06 Jul 2005, 08:04:43 by THobson »

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Forcing Units to get out and stay out
« Reply #9 on: 06 Jul 2005, 10:55:12 »
cheers gents... shall go try those suggestions out. I need to keep away from the looping commands, because they all need to be booted out at once due to the nature of the script... plus its being put into an addon, so any kind of looping script is bad for lag  :-\
Proud Member of the Volunteer Commando Battalion

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Forcing Units to get out and stay out
« Reply #10 on: 06 Jul 2005, 10:59:58 »
ok, that works excellently for AI grouped vehicles... but i also need it to kick the AI squad of a  player out too. With the current script they dont get out when the leader is a player...

basically this is a deploy camnet script. When deployed, no1 should be in the vehicle (to prevent a cam netted vehicle driving around, and the weapon being used) hence i'd need all humans kicked out and player lead AI... this is why i was initialy using the eject command as well...

Proud Member of the Volunteer Commando Battalion

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Forcing Units to get out and stay out
« Reply #11 on: 06 Jul 2005, 11:17:31 »
When the leader is the player they are all probably waiting to be ordered out.  Usually an unassignVehicle command would be sufficient for them.  Try also the EJECT action.
« Last Edit: 06 Jul 2005, 14:13:30 by THobson »

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Forcing Units to get out and stay out
« Reply #12 on: 06 Jul 2005, 11:35:38 »
something like this?

{action ["EJECT"]  _x} forEach _occupants
Proud Member of the Volunteer Commando Battalion

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Forcing Units to get out and stay out
« Reply #13 on: 06 Jul 2005, 13:02:29 »
From comref:

Quote
unit action action

Operand types:
unit: Object
action: Array
Type of returned value:
Nothing
Description:
Make unit to peform action. Format of action may be [type, target, param1, param2, param3]. Only type is required, target defaults to unit, param1, param2, param3 are type specific.

Example:
soldierOne action ["eject", vehicle soldierOne]



So it would be:
{_x action ["eject", vehicle _x]} forEach _occupants

Not tested.
« Last Edit: 06 Jul 2005, 13:03:00 by THobson »

bdfy1

  • Guest
Re:Forcing Units to get out and stay out
« Reply #14 on: 06 Jul 2005, 13:33:06 »
What are you discussing ? unassign command works nice ( no additional action needed ) , but it's slow - units disambarking one by one. If you want eject them faster just use EJECT function ( can be found in ED )