Jump to content
Purzel

Script problem (waypoint: crew not as group defined)

Recommended Posts

Hello there:

What´s wrong with this script:
(an AI-unit called "pablo" (and his AI-bodyguard) should spawn as cargo in a flying plane, which should land at Bala-airstrip on Tanoa, where "pablo" should get out and walk to a Jeep (jeep1) and get in it.
I get the message "crew not defined"...script stops.)

Whats wrong here???

Thanks for your help!

if (isServer) then
{
// -------------- Spawn Helicopter and Crews ----------------------------------------------
 
_heli1crew = [[getMarkerPos "pablospawn" select 0, getMarkerPos "pablospawn" select 1], MarkerDir "pablospawn", "C_Heli_Light_01-civil_F", West] call Bis_fnc_spawnvehicle; // BIS_fnc_spawnCrew ???
_heli1 = _heli1crew select 0 ;
_heli1 setPos [getpos _heli1 select 0, getpos _heli1 select 1, 400];
_heli1 allowdamage false;
// (vehicle leader _heli1crew) flyInHeight 200;
//_heli1crew setbehavior "CARELESS";

sleep 2;
pablo assignAsCargo _heli1;
bodyguard assignAsCargo _heli1;
pablo MoveInCargo _heli1;
bodyguard MoveInCargo _heli1;



// -------------- Create waypoints for heli1crew ----------------------------------------------
_wp1a = _heli1crew addWaypoint [getMarkerPos "pablospawn", 0];
_wp1a setWaypointType "MOVE";
_wp1a setWaypointStatements ["true", ""];
_wp1a setWaypointBehaviour "SAFE";
//_wp1a setWaypointSpeed "LIMITED";
_wp1a setWaypointCombatMode "WHITE";
sleep 2;
_wp2a = _heli1crew addWaypoint [getMarkerPos "pablokommt3", 0];
_wp2a setWaypointType "MOVE";
_wp2a setWaypointStatements ["true", ""];
_wp2a setWaypointBehaviour "SAFE";
//_wp2a setWaypointSpeed "LIMITED";
_wp2a setWaypointCombatMode "WHITE";
sleep 3;
_wp3a = _heli1crew addWaypoint [getMarkerPos "pablokommt4", 0];
_wp3a setWaypointType "TR UNLOAD";
_wp3a setWaypointStatements ["true", ""];
_wp3a setWaypointBehaviour "SAFE";
//_wp3a setWaypointSpeed "LIMITED";
_wp3a setWaypointCombatMode "WHITE";
//_heli1crew setbehavior "AWARE";

while {pablo in _heli1} do {sleep 5};

pablo assignAsCargo jeep1;
bodyguard assignAsCargo jeep1;
[pablo] orderGetIn true;
[bodyguard] orderGetIn true;
};

Share this post


Link to post
Share on other sites

Not 100% sure, but I believe you have the helicopter you're spawning as named _helicrew1. Try this: 

_helicrew1 = creategroup GUER; //Assuming they're IND faction
_heli1 = [[getMarkerPos "pablospawn", MarkerDir "pablospawn", "C_Heli_Light_01-civil_F", _helicrew1] call Bis_fnc_spawnvehicle;
_helicrew1 allowdamage false;
_heli1 allowdamage false; //Disallow damage to helicopter, not just crew

Also, delete the _wpa1 waypoint. They already spawned there, don't need a waypoint to move there. Then continue with your script. 

 

Fair warning: I'm pretty drunk, and haven't tested or double checked anything I've done or you have done. 

Share this post


Link to post
Share on other sites

Haha,

this is one of my favorite answers...

(...I'm pretty drunk...) thumbs up!!!

Nevertheless...

any suggestions..?

Greetz Purzel

Share this post


Link to post
Share on other sites

 

Hello there:

What´s wrong with this script:

(an AI-unit called "pablo" (and his AI-bodyguard) should spawn as cargo in a flying plane, which should land at Bala-airstrip on Tanoa, where "pablo" should get out and walk to a Jeep (jeep1) and get in it.

I get the message "crew not defined"...script stops.)

Whats wrong here???

Thanks for your help!

if (isServer) then
{
// -------------- Spawn Helicopter and Crews ----------------------------------------------
 
_heli1crew = [[getMarkerPos "pablospawn" select 0, getMarkerPos "pablospawn" select 1], MarkerDir "pablospawn", "C_Heli_Light_01-civil_F", West] call Bis_fnc_spawnvehicle; // BIS_fnc_spawnCrew ???
_heli1 = _heli1crew select 0 ;
_heli1 setPos [getpos _heli1 select 0, getpos _heli1 select 1, 400];
_heli1 allowdamage false;
// (vehicle leader _heli1crew) flyInHeight 200;
//_heli1crew setbehavior "CARELESS";

sleep 2;
pablo assignAsCargo _heli1;
bodyguard assignAsCargo _heli1;
pablo MoveInCargo _heli1;
bodyguard MoveInCargo _heli1;



// -------------- Create waypoints for heli1crew ----------------------------------------------
_wp1a = _heli1crew addWaypoint [getMarkerPos "pablospawn", 0];
_wp1a setWaypointType "MOVE";
_wp1a setWaypointStatements ["true", ""];
_wp1a setWaypointBehaviour "SAFE";
//_wp1a setWaypointSpeed "LIMITED";
_wp1a setWaypointCombatMode "WHITE";
sleep 2;
_wp2a = _heli1crew addWaypoint [getMarkerPos "pablokommt3", 0];
_wp2a setWaypointType "MOVE";
_wp2a setWaypointStatements ["true", ""];
_wp2a setWaypointBehaviour "SAFE";
//_wp2a setWaypointSpeed "LIMITED";
_wp2a setWaypointCombatMode "WHITE";
sleep 3;
_wp3a = _heli1crew addWaypoint [getMarkerPos "pablokommt4", 0];
_wp3a setWaypointType "TR UNLOAD";
_wp3a setWaypointStatements ["true", ""];
_wp3a setWaypointBehaviour "SAFE";
//_wp3a setWaypointSpeed "LIMITED";
_wp3a setWaypointCombatMode "WHITE";
//_heli1crew setbehavior "AWARE";

while {pablo in _heli1} do {sleep 5};

pablo assignAsCargo jeep1;
bodyguard assignAsCargo jeep1;
[pablo] orderGetIn true;
[bodyguard] orderGetIn true;
};

Firstly, addWaypoint should be used with a group, not a vehicle (heli1). Try using the helicopter's group, third element in the returned array from bis_fnc_spawnVehicle:

 

_heli1crew select 2;

Share this post


Link to post
Share on other sites

Thanks for your help...!

:D

 

Seems logical...
I changed it, but it does not work anyway...
I don´t know, whats still wrong...

 

Any suggestions???

Share this post


Link to post
Share on other sites

Sorry for pushing...
but I really need help with this...

 

I tried a lot of stuff, but it does not work...

Maybe someone could be my hero...? ;) :P

Share this post


Link to post
Share on other sites

Could you post the exact error message from the rpt and I'll take a look in a few hours when I get off work.

Share this post


Link to post
Share on other sites

So... here we go:

I hope you can find the problem.
I´ve tried
_plane1 = _aircraftcrew select 1 (0 and 2 too!)  -> nothing works...

 

 

RPT-Error-message:
Error in expression <aircraftcrew select 1 ;_plane1 setPos [getpos _plane1 select 0, getpos _plane1 >
Error position: <getpos _plane1 select 0, getpos _plane1 >
Error getpos: Typ Array, erwartet Objekt,Location                                  << ----   Translated: Type Array,  awaiting object,location
File H:\Documents\Arma 3 - Other Profiles\Purzel\mpmissions\TMP-Schneefall.Tanoa\scripts\pabloscript2.sqf, line 10
 

Here´s the pabloscript2.sqf:

// Pablo kommt per Cessna
hint "Pablo Escobar kommt per Flugzeug!";

if (isServer) then
{
// -------------- Fahrzeuge und Crews spawnen ----------------------------------------------
_aircraftcrew = createGroup resistance;
_aircraftcrew = [[getMarkerPos "pablospawn" select 0, getMarkerPos "pablospawn" select 1], MarkerDir "pablospawn", "C_Plane_Civil_01_F", West] call Bis_fnc_spawnvehicle; // BIS_fnc_spawnCrew ???
_plane1 = _aircraftcrew select 1 ;
_plane1 setPos [getpos _plane1 select 0, getpos _plane1 select 1, 400];
_plane1 allowdamage false;
// (vehicle leader _aircraftcrew) flyInHeight 200;
//_aircraftcrew setbehavior "CARELESS";

sleep 1;
pablo assignAsCargo _plane1;
bodyguard assignAsCargo _plane1;
pablo MoveInCargo _plane1;
bodyguard MoveInCargo _plane1;

// sleep 10;
// -------------- OPZ-Funkspruch kommt rein. ------------------------------------------------------
// [] execVM "scripts\funkspruch2.sqf";
// -------------- Wegpunkte für Flugzeug erstellen ------------------------------------------------------
_wp1a = _aircraftcrew addWaypoint [getMarkerPos "pablospawn", 0];
_wp1a setWaypointType "MOVE";
_wp1a setWaypointStatements ["true", ""];
_wp1a setWaypointBehaviour "SAFE";
//_wp1a setWaypointSpeed "LIMITED";
_wp1a setWaypointCombatMode "WHITE";
sleep 2;
_wp2a = _aircraftcrew addWaypoint [getMarkerPos "pablokommt3", 0];
_wp2a setWaypointType "MOVE";
_wp2a setWaypointStatements ["true", ""];
_wp2a setWaypointBehaviour "SAFE";
//_wp2a setWaypointSpeed "LIMITED";
_wp2a setWaypointCombatMode "WHITE";
sleep 3;
_wp3a = _aircraftcrew addWaypoint [getMarkerPos "pablokommt4", 0];
_wp3a setWaypointType "TR UNLOAD";
_wp3a setWaypointStatements ["true", ""];
_wp3a setWaypointBehaviour "SAFE";
//_wp3a setWaypointSpeed "LIMITED";
_wp3a setWaypointCombatMode "WHITE";
//_aircraftcrew setbehavior "AWARE";

while {pablo in _plane1} do {sleep 5};

pablo assignAsCargo jeep1;
bodyguard assignAsCargo jeep1;
[pablo] orderGetIn true;
[bodyguard] orderGetIn true;
};

Share this post


Link to post
Share on other sites
_plane1 = _aircraftcrew select 1 ;

This has to be select 0; because bis_fnc_spawnVehicle returns and array like this: [vehicle,crew,crew's group]

 

Additionally, the first line should be changed to

 

createGroup resistance;

 

don't declare variables when they are not used.

 

Last but not least, I am not sure if the following line will work that way

 

[[getMarkerPos "pablospawn" select 0, getMarkerPos "pablospawn" select 1]

 

BIS_fnc_spawnVehicle needs a position I believe in [X,Y,Z], not in [X,Y], though the wiki lacks the details on this one.

 

 

It's a good habit to write systemChat str _someVar; after every line where you define a new variable. That way you can immediately see what's wrong.

Share this post


Link to post
Share on other sites
_plane1 = _aircraftcrew select 1 ;

This has to be select 0; because bis_fnc_spawnVehicle returns and array like this: [vehicle,crew,crew's group]

 

Additionally, the first line should be changed to

 

createGroup resistance;

 

don't declare variables when they are not used.

 

Last but not least, I am not sure if the following line will work that way

 

[[getMarkerPos "pablospawn" select 0, getMarkerPos "pablospawn" select 1]

 

BIS_fnc_spawnVehicle needs a position I believe in [X,Y,Z], not in [X,Y], though the wiki lacks the details on this one.

 

 

It's a good habit to write systemChat str _someVar; after every line where you define a new variable. That way you can immediately see what's wrong.

 

Thank you for this it's helped me in my own script

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

×