Jump to content
Sign in to follow this  
manzilla

Spawn vehicle with specific unit in passenger and variable attached

Recommended Posts

I'm trying to spawn a truck with a driver but have a specific unit in the passenger city. In this case it's a local commander being driven to a meeting at a certain location. What I'm intending is for the player to snipe the target. I'd like a marker attached to the target and I'd also like to give him a certain face so he can be identified and so I can put a picture of him in the briefing.

I know how to create the vehicle and give it way points but I do not know how to add a certain unit to the passenger side with a certain face and a marker attached. I think I know how to make said unit disembark at the target area as well but we can get to that later.

Here's what I have for spawning the truck and wp. If anyone could help me script the other stuff I'd greatly appreciate it. I've checked via search but it brings up so much complicated stuff that my search is in vain.

_grp1 = [getMarkerPos "Insgroup4", east,["LandRover_MG_TK_INS_EP1"]] call BIS_fnc_spawnGroup;


_grp1 addWaypoint [getMarkerPos "attackwp1", 0];
_wp setWaypointType "MOVE"; 
_wp setWaypointSpeed "FULL";
_wp setWaypointCombatMode "BLUE";
_wp setWaypointBehaviour "SAFE";
_wp setWaypointFormation "LINE";

Edited by Manzilla

Share this post


Link to post
Share on other sites

* setIdentity for the face parts.

* createunit array for the man part, or you can add him into the spawn group. and use the below commands to move him into cargo.

_faceman = _grp1 createUnit ["typeOfFaceMan", (getPos (leader _grp1)), [], 0, "FORM"];
_faceman [url="http://community.bistudio.com/wiki/assignAsCargo"]assignAsCargo[/url] (vehicle (leader _grp1));
_faceman [url="http://community.bistudio.com/wiki/moveInCargo"]moveInCargo [/url](vehicle (leader _grp1));

* setMarkerPos used for tracking him.

while {alive _faceman} do {
  "someMarker" setMarkerPos (getPos (vehicle _faceman));
  sleep 0.5;
};
[url="http://community.bistudio.com/wiki/deleteMarker"]deleteMarker [/url]"somemarker";

Edited by Demonized

Share this post


Link to post
Share on other sites

Thanks for the links. I checked those but I'm still having troubles. I mergerd what you gave with what I had but it doesn't seem to be spawning the leader. There's no script errors coming up so I'm not sure what's going on but obviously I'm not doing this right.

_grp1 = [getMarkerPos "southco", east,["LandRover_MG_TK_INS_EP1"]] call BIS_fnc_spawnGroup;


_faceman = _grp1 createUnit ["face35", (getPos (leader _grp1)), [], 0, "FORM"];
_faceman assignAsCargo (vehicle (leader _grp1));
_faceman moveInCargo (vehicle (leader _grp1));

_grp1 addWaypoint [getMarkerPos "mission1a", 0];
_wp setWaypointType "MOVE"; 
_wp setWaypointSpeed "FULL";
_wp setWaypointCombatMode "BLUE";
_wp setWaypointBehaviour "SAFE";
_wp setWaypointFormation "LINE";

while {alive _faceman} do {
  "someMarker" setMarkerPos (getPos (vehicle _faceman));
  sleep 0.5;
};
deleteMarker "somemarker";

I physcally placed a marker on the map and called it someMarker. Not sure if that's correct.

The truck spawns and drives to to marker but the passenger seat is empty. No marker following the truck and no unit appears on the map either.

Share this post


Link to post
Share on other sites

is the leader same side as the vehicle group?

edit:

i dont think "face35" is a valid unit classname :D

unless your playing the A-Team mod :D

for the setIdentity you need to add a description.ext file to your mission folder and in there you declare a identity with a face, and then run that identity on the created leader man.

Edited by Demonized

Share this post


Link to post
Share on other sites

Ahhh yes, I missed the class name. Got the passenger to spawn but the marker doesn't appear.

Share this post


Link to post
Share on other sites

It's erroring out since you don't declare _wp anywhere so never gets to the marker section.

Change this:

[color="Red"]_wp = [/color]_grp1 addWaypoint [getMarkerPos "mission1a", 0];

Share this post


Link to post
Share on other sites

This code worked fine for me. Pre-placed southco, mission1a and someMarker markers, Functions Module and an existing TK_INS unit.

_grp1 = [getMarkerPos "southco", east,["LandRover_MG_TK_INS_EP1"]] call BIS_fnc_spawnGroup;


_faceman = _grp1 createUnit ["TK_INS_Warlord_EP1", (getPos (leader _grp1)), [], 0, "FORM"];
_faceman assignAsCargo (vehicle (leader _grp1));
_faceman moveInCargo (vehicle (leader _grp1));

_wp = _grp1 addWaypoint [getMarkerPos "mission1a", 0];
_wp setWaypointType "MOVE"; 
_wp setWaypointSpeed "FULL";
_wp setWaypointCombatMode "BLUE";
_wp setWaypointBehaviour "SAFE";
_wp setWaypointFormation "LINE";

while {alive _faceman} do {
  "someMarker" setMarkerPos (getPos (vehicle _faceman));
  sleep 0.5;
};
deleteMarker "somemarker";

"someMarker" followed him and disappeared when I killed him. Make sure that marker it's empty.

Share this post


Link to post
Share on other sites

Ahhhh I don't have an existing TK Ins unit on the map.

Another thing. I'm trying to create a trigger that sets a variable to true, for test purposes, when the taki warlord(_faceman) is dead. I can't seem to get to work though.(hint1 true activates a trigger on the actual map but the trigger is not going off.

_trgc_4 = createTrigger["EmptyDetector", getMarkerPos "mission1a"];
_trgc_4 setTriggerArea[600,600,0,false];
_trgc_4 setTriggerActivation["EAST","NOT PRESENT",false];
_trgc_4 setTriggerStatements["!(alive _faceman)","hint1 = true;",""];

EDIT:

Hmmm even with the Tk unit on the map there's no marker. I hope ACE2 aint the cause.

Edited by Manzilla

Share this post


Link to post
Share on other sites

The reference to _faceman in your spawned trigger condition field won't work since that would be a local variable in a global scope.

This works, but uses a global name for the unit:

_grp1 = [getMarkerPos "southco", east,["LandRover_MG_TK_INS_EP1"]] call BIS_fnc_spawnGroup;


faceman = _grp1 createUnit ["TK_INS_Warlord_EP1", (getPos (leader _grp1)), [], 0, "FORM"];
faceman assignAsCargo (vehicle (leader _grp1));
faceman moveInCargo (vehicle (leader _grp1));

_wp = _grp1 addWaypoint [getMarkerPos "mission1a", 0];
_wp setWaypointType "MOVE"; 
_wp setWaypointSpeed "FULL";
_wp setWaypointCombatMode "BLUE";
_wp setWaypointBehaviour "SAFE";
_wp setWaypointFormation "LINE";

while {alive faceman} do {
  "someMarker" setMarkerPos (getPos (vehicle faceman));
  sleep 0.5;
};
deleteMarker "somemarker";

_trgc_4 = createTrigger["EmptyDetector", getMarkerPos "mission1a"];
_trgc_4 setTriggerArea[600,600,0,false];
_trgc_4 setTriggerActivation["EAST","NOT PRESENT",false];
_trgc_4 setTriggerStatements["!(alive faceman)","hint1 = true;",""];

Share this post


Link to post
Share on other sites

this works by not using any global name or variable:

 _condition = format["!alive %1",_faceman];
_trgc_4 setTriggerStatements[_condition,"hint1 = true;",""];

Share this post


Link to post
Share on other sites

I'm not sure why this aint working for me. I've copy and pasted exactly what is here. No marker, no hint when he dies.

The hint is just for test purposes when hint1 = true. That's activated via trigger with condition line of hint1 and Onact hint "He's dead."

Eventually there will be a script activated here, and a few other things but for now it's just a hint that's activated.

Share this post


Link to post
Share on other sites
I'm not sure why this aint working for me. I've copy and pasted exactly what is here. No marker, no hint when he dies.

The hint is just for test purposes when hint1 = true. That's activated via trigger with condition line of hint1 and Onact hint "He's dead."

make sure that the marker placed is not EMPTY type.

place it somewhere you can check if its been moved.

make it a US flag or something easy to spot.

also make sure to set

hint1 = false;

in a unit init or something so the trigger knows itc checking the bool, or you can maybe use instead of just hint1:

!isNil hint1

to check if its not yet defined. (not set to false prior ro trigger creation.)

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  

×