Home   Help Search Login Register  

Author Topic: Transferring from vehicle to vehicle.  (Read 986 times)

0 Members and 1 Guest are viewing this topic.

Offline kouji

  • Members
  • *
Transferring from vehicle to vehicle.
« on: 03 Feb 2008, 08:09:07 »
I have only just started editing so I still have much to learn.

I'm making a user action script for a tank. Currently, when I click on the user action, it will create a helicopter and I will automatically get out of the tank and into the helicopter. My problem now is that I am unable to make a script to return from the helicopter into the original tank.

Problem:
I initialise the values for the script in the tank:
_array = _this select 0
_tank = _array select 0
_crew = _array select 2

Now, when I make another script in the tank to transfer the crew back from the helicopter instantly into the tank(script/user action belongs to the tank), it fail because there is no crew in the tank (already transferred into the helicopter).

I could put the script/user action into the helicopter so that the values can be initialised, but then I have no idea how to transfer the crew into the original tank as opposed to creating a new tank and placing the crew there.

Any help would be appreciated. Thanks!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Transferring from vehicle to vehicle.
« Reply #1 on: 03 Feb 2008, 09:19:58 »
Whitout your script here it is difficult to figure out what else might be wrong, so far:
Code: [Select]
_array = _this select 0
_tank = _array select 0
_crew = _array select 2

->
Code: [Select]
_array = _this select 0
_tank = _array select 1
_crew = _array select 2

Offline kouji

  • Members
  • *
Re: Transferring from vehicle to vehicle.
« Reply #2 on: 03 Feb 2008, 12:18:46 »
My 'transfer-to-helicopter' script is similar to an ejection script in the sense that I create a vehicle and transfer to that vehicle. It doesn't work as an independent action unless I tie it to the 'Eject' user action.

Script:
Code: [Select]
_array = _this select 0
_tank = _array select 1
_crew = _array select 2

_crew action ["GETOUT", _tank]
_helicopter = "AH64" createvehicle [0,0,0]
_helicopter setpos [(getpos _crew) select 0,(getpos _crew) select 1, ((getpos _crew) select 2)+5]
_helicopter setdir direction _tank
_crew moveindriver _helicopter
_helicopter engineon true
_vel = velocity _tank
_vx = (_vel select 0)
_vy = (_vel select 1)
_vz = 80 +(_vel select 2)
_helicopter setVelocity [_vx, _vy, _vz]
exit

Config.cpp
Code: [Select]
class switchchopper
{
displayName = "Switch To Chopper";
position = "OsaHlavne";
radius = 5;
condition = "alive this";
statement = "[this] exec {\VersatileTank\scripts\switch.sqs}";
};


The second problem is, once I get into this helicopter, I am unable to get into my previous Tank directly (Without exiting the helicopter and re-entering the tank manually) without creating a new one. I have insufficient knowledge of scripting to accomplish that.