Jump to content
Sign in to follow this  
infiltrator_2k

Naming Spawned Vehicle

Recommended Posts

I've been trying to name this script spawned vehicle without success. Every posted answer to this type of question hasn't worked. Can someone please tell me what code I need to enter to this script to name the vehicle.

Cheers

Ian


_tankcrew = [];
_tankframe = [];


if (isServer) then {


_tankcrew = creategroup EAST; 
_tankframe = [getMarkerPos "SpawnA", 180, "O_MBT_02_cannon_F", _tankcrew] call BIS_fnc_spawnVehicle;
_SpawnA = _tankcrew addWaypoint [(getmarkerpos "SpawnA"), 0];
_SpawnA setWaypointType "SAD";
_SpawnA setWaypointSpeed "LIMITED";
_SpawnA setWaypointBehaviour "NORMAL";


};

sleep .50

Share this post


Link to post
Share on other sites

Look at the return value for BIS_fnc_spawnVehicle

_tankcrew = createGroup EAST;
_tankframe = [getMarkerPos "SpawnA", 180, "O_MBT_02_cannon_F", EAST] call BIS_fnc_spawnVehicle;

_Vehicle = _tankframe select 0; // The Vehcile object.
_Crew = _tankframe select 1; // Array of all the units i.e. : [unit1,unit2,unt3.....]
_tankcrew = _tankframe select 2; // Group

_wp = _tankcrew addWaypoint [getmarkerpos "SpawnA", 0];
_wp setWaypointType "SAD"; 
_wp setWaypointSpeed "LIMITED"; 
_wp setWaypointBehaviour "NORMAL"; 

Share this post


Link to post
Share on other sites
Look at the return value for BIS_fnc_spawnVehicle

_tankcrew = createGroup EAST;
_tankframe = [getMarkerPos "SpawnA", 180, "O_MBT_02_cannon_F", EAST] call BIS_fnc_spawnVehicle;

_Vehicle = _tankframe select 0; // The Vehcile object.
_Crew = _tankframe select 1; // Array of all the units i.e. : [unit1,unit2,unt3.....]
_tankcrew = _tankframe select 2; // Group

_wp = _tankcrew addWaypoint [getmarkerpos "SpawnA", 0];
_wp setWaypointType "SAD"; 
_wp setWaypointSpeed "LIMITED"; 
_wp setWaypointBehaviour "NORMAL"; 

But I can't use _vehicle in a trigger as it's a 'local variable' in a global space :/

Share this post


Link to post
Share on other sites
then remove the underscore's (Global variable)

For what ever reason when I'm using !alive tvehicle (can't use vehicle) in a trigger it's not working. I'm using a simple hint to validate the trigger. However, if I use any other named object, when it's destroyed I get the hint :/

Share this post


Link to post
Share on other sites

Vehicle is a command so you will need to name it somethnig else.

Share this post


Link to post
Share on other sites
Vehicle is a command so you will need to name it somethnig else.

Yeah, that's why I renamed it to tvehicle. Still no joy though.

Share this post


Link to post
Share on other sites

Why use the trigger? Just add a waituntil command at the end of the script with the local variable and then run whatever you had in the trigger afterwards.

Share this post


Link to post
Share on other sites

_tankcrew = createGroup EAST;
_tankframe = [getMarkerPos "SpawnA", 180, "O_MBT_02_cannon_F", EAST] call BIS_fnc_spawnVehicle;
sleep 1;
TVehicle = _tankframe select 0; // The Vehcile object.
_Crew = _tankframe select 1; // Array of all the units i.e. : [unit1,unit2,unt3.....]
_tankcrew = _tankframe select 2; // Group

_wp = _tankcrew addWaypoint [getmarkerpos "SpawnA", 0];
   _wp setWaypointType "SAD"; 
   _wp setWaypointSpeed "LIMITED"; 
   _wp setWaypointBehaviour "NORMAL"; 

TVehicle setdamage 1;// works fine in script or in trigger

Whatever your doing it's not the script it's working just fine here.

How are your trigger settings, does the vehicle spawn at game start?

For testing make sure there are no other OPFOR units in Trigger area.

Share this post


Link to post
Share on other sites
_tankcrew = createGroup EAST;
_tankframe = [getMarkerPos "SpawnA", 180, "O_MBT_02_cannon_F", EAST] call BIS_fnc_spawnVehicle;
sleep 1;
TVehicle = _tankframe select 0; // The Vehcile object.
_Crew = _tankframe select 1; // Array of all the units i.e. : [unit1,unit2,unt3.....]
_tankcrew = _tankframe select 2; // Group

_wp = _tankcrew addWaypoint [getmarkerpos "SpawnA", 0];
   _wp setWaypointType "SAD"; 
   _wp setWaypointSpeed "LIMITED"; 
   _wp setWaypointBehaviour "NORMAL"; 

TVehicle setdamage 1;// works fine in script or in trigger

Whatever your doing it's not the script it's working just fine here.

How are your trigger settings, does the vehicle spawn at game start?

For testing make sure there are no other OPFOR units in Trigger area.

Stupid ass me not removing the underscore in the script :/ I was thinking you still had to include the underscore in the script. I didn't know you could use local variables in a script. I thought the were only used in an object's init field. But it's all working good now thanks guys . I knew it was something I was doing wrong my end, I just didn't know what.

Edited by Infiltrator_2K
Incorrect Information

Share this post


Link to post
Share on other sites
Look at the return value for BIS_fnc_spawnVehicle

_tankcrew = createGroup EAST;
_tankframe = [getMarkerPos "SpawnA", 180, "O_MBT_02_cannon_F", EAST] call BIS_fnc_spawnVehicle;

_Vehicle = _tankframe select 0; // The Vehcile object.
_Crew = _tankframe select 1; // Array of all the units i.e. : [unit1,unit2,unt3.....]
_tankcrew = _tankframe select 2; // Group

_wp = _tankcrew addWaypoint [getmarkerpos "SpawnA", 0];
_wp setWaypointType "SAD"; 
_wp setWaypointSpeed "LIMITED"; 
_wp setWaypointBehaviour "NORMAL"; 

I've got it working, but what actually went on? I can see that the _tankframe variable as been assigned the global variable of _Vehicle, which of course I had to rename as Vehicle is itself a command and make a local variable in order to use it in a trigger condition. But how did the select command use that particular element order when the elements can't be seen in an array to reference from? And what's with the _crew variable? Is it a variable where I can actually assign names to the actual tank crew?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×