Home   Help Search Login Register  

Author Topic: MoveToGunner Action Command Error  (Read 1633 times)

0 Members and 1 Guest are viewing this topic.

Offline AirCav

  • Members
  • *
  • I'm a llama!
MoveToGunner Action Command Error
« on: 10 Jun 2008, 01:00:56 »
Hi all, this is my first post. 

I'm trying to create a trigger that will cause a squad leader to recognize when a vehicle gunner is dead and then order a unit in cargo to replace him.  Seems simple enough, but I can''t get the movetogunner action to work.  The editor gives me an error code every time I try to enter the movetogunner or getout action command.  I've searched the forums and found a similar topic from 2003 for OFP.  I think the coding has changed some since then.  I am using version 1.08 since i'm in Iraq and can't download the 140mg patch.   

SETUP
I have an empty M119 (Named: A_8) and a squad of five soldiers (A_8Crew - Gun Crew Group).  Three units are occupying the Gunner and Cargo slots of the M119.   I got it to work just fine with the gunner assigned to the gun in the Init field.  The problem comes when I put the rest of the squad in the M119's Cargo slots. 

The Squad is five soldiers.  Details below:
The Group leader is occupying a cargoslot2 (guy standing with arms folded) Init. Line -
Code: [Select]
A_8Crew = group this; this assignAsCargo A_8; this moveInCargo A_8;
1x Rifleman Init. Line:
Code: [Select]
this assignAsGunner A_8; this moveInGunner A_8;

1x Rifleman Init. Line:
Code: [Select]
this assignAsCargo A_8; this moveInCargo A_8;
1x Rifleman is acting as a radio operator.  He stands near the gun.  Init. Line:
Code: [Select]
removeAllWeapons this; this addWeapon "binocular"; this selectWeapon "binocular"; this setUnitPos "UP"; this disableAI "MOVE";
1x Rifleman is acting as a soldier off duty sitting in a truck nearby.  This is the guy i actually want the Squad leader to assign to replace a dead gunner.  Init. Line:
Code: [Select]
this assignAsCargo A_8T; this moveInCargo A_8T;
I created a trigger with a size 0,0, Activation NONE, REPEATEDLY. Timeout: 5/10/7

In the 'Condition line':
Code: [Select]
! (alive (gunner A_8)
In the On Act. Line for the Trigger I first tried just having the gunner slot occupied and everyone else standing nearby.  This line worked just fine in testing.
Code: [Select]
A_8GNR = (units A_8Crew) select 1; A_8GNR assignasgunner A_8; [A_8GNR] ordergetin true;
The problem starts when I put everyone into the cargo slots and tried to add either the movetogunner command or the GetOut command.  Both approaches locked the trigger menu and displayed error messages. 

First Attempt using the ‘GetOut' command.  The thought was we would exit the gun then reoccupy it in the gunner position.  This resulted in a ‘Invalid Number in Expression' error.  It didn't dawn on me until later that I was giving contradictory orders in the same line (I finally figured out that trigger fields are read as a whole and not sequentially).  No matter, it should still accept the code.   
Code: [Select]
A_8GNR = (units A_8Crew) select 1; A_8GNR assignasgunner A_8; A_8GNR action ["GetOut", A_8]; [A_8GNR] ordergetin true;
My primary source is the ArmA Actions Referrence for all commands. file:///C:/Users/Matt/Desktop/ArmA%20_Actions.htm#MoveToDriver
Quote
GetOut (ArmA Actions Reference)
Description:    Causes a person to disembark from a vehicle, without a parachute in the case of aircraft. See also eject.

Syntax:    unit action ["getOut", targetVehicle]
           Where unit is the person to disembark, and targetVehicle is the vehicle to disembark from.
Example:    soldierOne action ["getOut", carOne]
John action ["getout", LittleBird1]

Second Attempt using the ‘MoveToGunner' command.  This also resulted in a ‘Invalid Number in Expression' error:
Code: [Select]
A_8GNR = (units A_8Crew) select 1; A_8GNR assignasgunner A_8; A_8GNR action ["MoveToGunner", A_8];
Quote
MoveToGunner (ArmA Actions Referrence)
Description:    Move a unit to the primary gunner's position within a vehicle. If another unit is already in that position, the units will swap positions. See also moveToTurret.

Syntax:    unit action ["moveToGunner", targetVehicle]
           Where unit is a unit within targetVehicle.
Example:    player action ["moveToGunner", vehicle player]


Does anyone know what I'm doing wrong here?

-Air

Side Note: The 4th Rifleman is acting as the guns radio operator (Name: A_8RTO).  For both tests above, I ungrouped him to remove that factor.  In the future, I plan to have the RTO rely assigned targets to the gun crew.  Basically, he starts shouting when the radio crackles.  Anyway, it' important that he doesn't get assigned as a gunner.  I eventually want him to also spot short range targets for the crew pick up his rifle (laying beside as a stand alone object) if events deteriate into a short ranged fight.  Lots of problems making all of this work, but I'll save that for another post.
« Last Edit: 10 Jun 2008, 18:25:51 by Planck »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: MoveToGunner Action Command Error
« Reply #1 on: 10 Jun 2008, 06:23:21 »
Hi there AirCav, and welcome to OFPEC!

First of all: are you sure the unit inside the vehicle is "units A_8Crew select 1"? Otherwise you'll try to feed a nil unit into the code, which will always cause problems. I do get what you're trying to do though - always select the unit second in command to the leader to replace the dead gunner, so there should be no problem. Make sure A_8GNR is properly assigned to a unit by adding a  "hint format ["%1", A_8GNR]" after assigning the variable - if it returns the typical "scalar bool array string 0xef...." error, then it means that gunner doesn't exist and everything you do will cause errors.

Oh, and make sure the M119 is named correctly too!

Secondly, you're not using the moveToGunner command correctly: as far as I know, the moveTo commands, new to ArmA, are equivalents of the actions you get while sitting inside a vehicle: i.e. "move to gunner seat", "move to driver's seat" etc. So it only works while the unit is actually inside the vehicle. Which might be causing the errors.

As to the actual complicated matter of getting your guy unassigned from his current vehicle, then assigned to a new and ordered to get in...well, it's more complicated than it seems :D If the M119 site isn't central to the player (i.e., he can't really see it most of the time) then I suggest simply using a moveIngunner command to teleport the poor guy, since that's just plain the easiest solution. See, AI squad leaders are twitchy with the whole ordering people into and out of vehicles - ever tried as a grunt enter a vehicle without your leader ordering you? First he tells you to exit, and a moment later he tells you to board it again...they get confused easily.

It would be easier already if the man wasn't inside another vehicle to begin with - why not have him loafing somewhere nearby? Stop him using either one of the disableAI commands (such as "Move") or doStop (which will sadly be disabled by a save/load, I think). Then just enableAI/dofollow him before assigning him his new spot and ordering him to enter the gun. If you absolutely have to have him inside the vehicle, I would suggest using the "eject" action instead, together with an unassignvehicle command, potentially a ordergetin false. And only THEN reassigning and reordering him.

Finally, although this has nothing to do with the error message, you might want to make sure the leader knows the gunner is dead before going anywher else. Sometimes they forget to check, which will most certainly screw up any "ordergetins" for the gunner position. Simply add a reveal command somewhere in the beginning of the trigger between the dead gunner and the leader, should do it.

Note, in many cases the AI leader will be clever enough to independently order someone else to fill up the gunner seat, although it might as well be himself...  ::)

Good luck! It's a tricky business!

Wolfrug out.

"When 900 years YOU reach, look as good you will not!"

Offline AirCav

  • Members
  • *
  • I'm a llama!
Re: MoveToGunner Action Command Error
« Reply #2 on: 12 Jun 2008, 01:07:22 »

Thanks for the reply.  Your talking a little over my head.  If I understand your post correctly, the M119 does not allow units to move from one position to another utilizing the "MoveTo" command.   So my options are either have him exit/eject the vehicle and re-enter it or use the 'MoveInGunner' command.  I'd rather avoid the cheat option so question is: how do I input a two step process into a single trigger 'On Act.' line?  Could I order a unit to exit/eject a vehicle in the 'On Act' line then re-enter vehicle as the gunner in the 'On Deact.' line?  Or does it all go in the same line such as below? 

Condition:
Code: [Select]
! (alive (gunner A_8)
On Activation:
Code: [Select]
hint format ["%1 units in area",count A_8GNR]; A_8GNR = (units A_8Crew) select 1; A_8GNR assignasgunner A_8; A_8GNR action ["EJECT", A_8T]; [A_8GNR] ordergetin true;I should have emphasized it, but I have 'A_8Crew = group this' in the group leader's Init. Line.

I've tried plugging in the "hint format ["%1", A_8GNR]" line a few places in the trigger, but didn't see any difference.  Did you mean to create a new trigger for that or plug it into the trigger only trigger I described above?  Where exactly should it go? 

I keep running into dead ends on this one.  Any help is appreciated.