Jump to content
Sign in to follow this  
1para{god-father}

Grouping and Waypoints

Recommended Posts

Sorry but just can not work it out , I have spawned in 4 vehicles and i need "VIP2" to load into _veh2 , then group them and move them to the WP

use a waituntill - untill any of the vehicles are destroyed - to spawn stuff in..

so far i have....


_veh1 = [_convoystart, 001, "Ural_INS", east] call bis_fnc_spawnvehicle;

_veh2 = [_convoystart, 001, "SUV_TK_EP1", east] call bis_fnc_spawnvehicle;
////move vip2 on map into SUV//////
vip2 moveInCargo _veh2;
vip2 moveInCargo _veh2;

_veh3 = [_convoystart, 001, "Ural_INS", east] call bis_fnc_spawnvehicle;
_veh4 = [_convoystart, 001, "Ural_INS", east] call bis_fnc_spawnvehicle;

(units _veh1 + units _veh2 + units _veh3 + units _veh4) joinSilent _grp;

////add waypoints
_wp1 = _grp addWaypoint [_convoyend, 1];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "FULL";

////need to wait untill any of them are destroyed to spawn stuff in
waitUntil{({!alive _x} count [_veh1,_veh2,_veh3,_veh4]) != 0};

////Spawn stuff here ....

Edited by psvialli

Share this post


Link to post
Share on other sites

What is _convoystart. if it is a 3-argument, integer-based array with your position then ok, but if it is a logic or marker then you need to use getPos.

also i presume that _grp is already established, if not then you would need to do _something = group veh1;

and then the joinSilent would be joinSilent _something;

otherwise i can't see what is wrong, and if all what i mentioned is ok then there must surely be other code so i'd say post it.

Share this post


Link to post
Share on other sites

Still no Joy.

They spawn in find, but spawn on top of each other that is never good, any way to solve that ?

Then VIP2 does not enter the vehicle and they just site there and do not move to there wp.

All i am trying to do is spawn a small convoy in that go from point a to be with a VIP in cargo that we need to extract.

_veh1 = [_convoystart, 001, "Ural_INS", east] call bis_fnc_spawnvehicle;
_group = group _grp;
_veh2 = [_convoystart, 001, "SUV_TK_EP1", east] call bis_fnc_spawnvehicle;
////move vip2 on map into SUV//////
vip2 moveInCargo _veh2;
vip2 moveInCargo _veh2;

_veh3 = [_convoystart, 001, "Ural_INS", east] call bis_fnc_spawnvehicle;
_veh4 = [_convoystart, 001, "Ural_INS", east] call bis_fnc_spawnvehicle;

(units _veh1 + units _veh2 + units _veh3 + units _veh4) joinSilent _grp;

////add waypoints
_wp1 = _grp addWaypoint [_convoyend, 1];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "FULL";
_wp1 setbehaviour 'CARELESS'; 

waitUntil{({!alive _x} count [_veh1,_veh2,_veh3,_veh4]) != 0};

Share this post


Link to post
Share on other sites

Here is why:

Return Value:

Array - 0: created vehicle (Object), 1: all crew (Array of Objects), 2: vehicle's group (Group)

So to use for example "_veh1" you need to change the line slightly:

_veh1 = ( [_convoystart, 001, "Ural_INS", east] call bis_fnc_spawnvehicle ) select 0;

Heres the new version:

_veh1 = ( [_convoystart, 001, "Ural_INS", east] call bis_fnc_spawnvehicle ) select 0;
_group = group _grp;
_veh2 = ( [_veh1 modelToWorld [0,15,0], 001, "SUV_TK_EP1", east] call bis_fnc_spawnvehicle ) select 0;
////move vip2 on map into SUV//////
vip2 moveInCargo _veh2;
vip2 assignAsCargo _veh2;


_veh3 = ( [_veh2 modelToWorld [0,15,0], 001, "Ural_INS", east] call bis_fnc_spawnvehicle ) select 0;
_veh4 = ( [_veh3 modelToWorld [0,15,0], 001, "Ural_INS", east] call bis_fnc_spawnvehicle ) select 0;

(units _veh1 + units _veh2 + units _veh3 + units _veh4) joinSilent _grp;

////add waypoints
_wp1 = _grp addWaypoint [_convoyend, 1];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "FULL";
_wp1 setbehaviour 'CARELESS'; 

waitUntil{({!alive _x} count [_veh1,_veh2,_veh3,_veh4]) != 0};

When you move units into a vehicle, make sure to also use the assignAsCargo command. That makes sure the AI actually knows that it is supposed to be in there.

Share this post


Link to post
Share on other sites

well selectBestPlace might help for the spawning, give it a search, otherwise a manual way to do it would be stuff like x - 20, so something like this in the spawn array where _convoystart is:

[((getPos _convoystart) select 0) - 20, _convoystart, 1]

as for the actual problem unless there is small error somewhere in the name, or the error report log is showing anything, i can't think what it could be. try diagnostic with a hint and waypoints command to make sure the waypoint is ok, if incidentaly it is MP then you may want to assign a global variable to _veh2.

also you have stated vip2 moveInCargo _veh2; twice over and i'm still not sure whether _grp exists? if not then replace with _veh1 or whatever vehicle you want the leader to be.

Share this post


Link to post
Share on other sites
[((getPos _convoystart) select 0) - 20, _convoystart, 1]

modelToWorld is a much easier and more effective way to do that. Especially because it takes the direction of the other unit into account.

One of my favourite commands actually :D

Share this post


Link to post
Share on other sites

@ Panther44 ... Me to but just cannot seem to get it to work , had the Guy getting in the car as per previous post but then had other issues as above !

OK getting there slowly... VIP in car, spawn vehicle all in a row mow as well

but they just stay there they do not move to waypoint ? so am I not creating the group , i thought " _group = group _grp;" creates the group ?

getting this in .rpt

Error in expression <spawnvehicle ) select 0;
_group = group _grp;
_veh2 = ( [_veh1 modelToWorld [0,1>
 Error position: <_grp;
_veh2 = ( [_veh1 modelToWorld [0,1>
 Error Undefined variable in expression: _grp

Share this post


Link to post
Share on other sites

OK all seems to work now they move off to there WP but this bit does not seems to work as i go not get the hint

waitUntil{({!alive _x} count [_veh1,_veh2,_veh3,_veh4]) != 0};

I need to detect when one of the Vehicles have been destroyed

Thanks

_grp = creategroup EAST;
_veh1 = ( [_RandomTownPosition1, 001, "Offroad_DSHKM_INS", east] call bis_fnc_spawnvehicle ) select 0;
_veh2 = ( [_veh1 modelToWorld [0,10,0], 001, "SUV_TK_EP1", east] call bis_fnc_spawnvehicle ) select 0;
////move vip2 on map into SUV//////
vip2 moveInCargo _veh2;
vip2 assignAsCargo _veh2;
_veh3 = ( [_veh2 modelToWorld [0,10,0], 001, "Offroad_DSHKM_INS", east] call bis_fnc_spawnvehicle ) select 0;
_veh4 = ( [_veh3 modelToWorld [0,10,0], 001, "Offroad_DSHKM_INS", east] call bis_fnc_spawnvehicle ) select 0;

(units _veh1 + units _veh2 + units _veh3 + units _veh4) joinSilent _grp;

////add waypoints
_wp1 = _grp addWaypoint [_RandomTownPosition2, 1];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "FULL";
_wp1 setbehaviour "CARELESS"; 

waitUntil{({!alive _x} count [_veh1,_veh2,_veh3,_veh4]) != 0};

Hint "Boom";

Share this post


Link to post
Share on other sites

waitUntil {(!(alive _veh1) or !(alive _veh2) or !(alive _veh3) or !(alive _veh4))};

Share this post


Link to post
Share on other sites

for sake of dynamics you may want:

waitUntil {{!alive _x} count units _grp};

is better than manually entering each vehicle.

Share this post


Link to post
Share on other sites

OK I thought I had this working but the Check to see if any Vehicle has been destroyed just does not work I never get the hint.

Any suggestions ?


_grp = creategroup EAST;
_veh1 = ( [_RandomTownPosition1, 001, "Offroad_DSHKM_INS", east] call bis_fnc_spawnvehicle ) select 0;
_veh2 = ( [_veh1 modelToWorld [0,10,0], 001, "SUV_TK_EP1", east] call bis_fnc_spawnvehicle ) select 0;
////move vip2 on map into SUV//////
vip2 moveInCargo _veh2;
vip2 assignAsCargo _veh2;
_veh3 = ( [_veh2 modelToWorld [0,10,0], 001, "Offroad_DSHKM_INS", east] call bis_fnc_spawnvehicle ) select 0;
_veh4 = ( [_veh3 modelToWorld [0,10,0], 001, "Offroad_DSHKM_INS", east] call bis_fnc_spawnvehicle ) select 0;

(units _veh1 + units _veh2 + units _veh3 + units _veh4) joinSilent _grp;

////add waypoints
_wp1 = _grp addWaypoint [_RandomTownPosition2, 1];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "FULL";
_wp1 setbehaviour "CARELESS"; 


waitUntil {(!(alive _veh1) or !(alive _veh2) or !(alive _veh3) or !(alive _veh4))}; 

///Also does not work
//_Array = units _grp;
//waitUntil{!({alive _x}foreach _Array)};

HINT "BLOOOOMMMM";




Share this post


Link to post
Share on other sites

_wp1 setbehaviour "CARELESS";

should be

_grp setbehaviour "CARELESS";

Share this post


Link to post
Share on other sites

try this one:

waitUntil {(!alive _veh1) or (!alive _veh2) or (!alive _veh3) or (!alive _veh4)};

Also, do you realize you are creating _veh2 in front of _veh1, and then _veh3 in front of _veh2, and so on... So your vehicles are placed in reverse order, not that it makes a whole lot of difference, but if you were expecting the VIP to be in the second vehicle from the front, he is actually in the second from the rear in case you were trying to take him out.

Share this post


Link to post
Share on other sites

Thanks mate ,I did wounder why they was in that order :)

Sorry but that also does not work for some reason ? I never get the hint, is it something to do with them being in a Group ?

Share this post


Link to post
Share on other sites

maybe hint is case sensitive, try hint instead of HINT...

or try this with the vehicle check, but all that have been posted so far should have worked.

_vehArray = [_veh1, _veh2, _veh3, _veh4];

waitUntil{!({alive _x}foreach _vehArray)};

Your variables are initialized, right? Add _vehArray to your list if so.

Share this post


Link to post
Share on other sites
try this one:

waitUntil {(!alive _veh1) or (!alive _veh2) or (!alive _veh3) or (!alive _veh4)};

Also, do you realize you are creating _veh2 in front of _veh1, and then _veh3 in front of _veh2, and so on... So your vehicles are placed in reverse order, not that it makes a whole lot of difference, but if you were expecting the VIP to be in the second vehicle from the front, he is actually in the second from the rear in case you were trying to take him out.

OK Just tested it again not sure why but now it does work, maybe i forgot to save it !!!

Thanks for all your help !

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  

×