Jump to content
Sign in to follow this  
armakwalski

Using Unit Option when using CREATEVEHICLE

Recommended Posts

I have been searching around about using createVehicle. I have use it and its is successful, but then sometimes i want to have this object to not have ammo for example

so i have something like this >> obj4 = createVehicle ["LandRover_ACR",getMarkerPos "marker4",[], 100, "NONE"] ;

the landrover is randomly placed at the marker4, something which i like, but i like to have 70% damage and low on ammo for example. how do I do it?

other example is, maybe you want to put a script >> x= [this,70,50,30,2,false,1,3] execVM "scripts\IED\InitIED.sqf";

an IED script on the random object placement of a marker I put on editor.

Is there a way? or I can do it with something else?

Share this post


Link to post
Share on other sites

the thing is, i cannot put it in the vehicle init via editor. because "obj4 = createVehicle ["LandRover_ACR",getMarkerPos "marker4",[], 100, "NONE"] ;" is written in the init.sqf file of the mission. so I'm confused where you would put the "this setDamage 0.7;" or other stuff.

Share this post


Link to post
Share on other sites
if (isServer) then {

    obj4 = createVehicle ["LandRover_ACR",getMarkerPos "marker4",[], 100, "NONE"] ;
    obj4 setVehicleInit "this setDamage 0.7;this setVehicleAmmo 0.5";
    processInitCommands;

};

Share this post


Link to post
Share on other sites

Thank you very much. got it working like this :)

if (isServer) then {

    obj4 = createVehicle ["LandRover_ACR",getMarkerPos "Pos1",[], 20, "NONE"] ;
    obj4 setVehicleInit "this setDamage 0.7;this setVehicleAmmo 0.5";
 x = [obj4,100,100,50,1,true,2,3] execVM "scripts\IED\InitIED.sqf";
    processInitCommands;
};

was wondering cause maybe this would be easier. i put this code in Initialization box editor:

this setVehiclePosition [[], ["Pos1","Pos2","Pos3"], 0]

I have put marker for pos1,etc. the object (landrover) did not move to those marker. basicly i just want to put an object at random place in an area, but i like doing it with editor, not writing in init.sqf. am i doing wrong some where?

Share this post


Link to post
Share on other sites

Sorry didn't read your first post properly, it was late at night lol :).

Another example if you want to not use processInitCommands (you can only use it once!)

if (isServer) then {
    obj4 = createVehicle ["LandRover_ACR",getMarkerPos "marker4",[], 100, "NONE"] ;
    obj4  setDamage 0.7;
    obj4  setVehicleAmmo 0.5";
};

this setVehiclePosition [[], ["Pos1","Pos2","Pos3"], 0] - it's possible it doesn't like the empty [] - try:

this setVehiclePosition [[getPosATL this], ["Pos1","Pos2","Pos3"], 0]

4 random positions

If you don't like scripting there is another way in the editor. group the vehicle to the markers.

select group mode (F2), click on the vehicle, then draw a line connecting the vehicle to each marker.

see chapter 1.9 of this:

http://www.armaholic.com/page.php?id=4847

Share this post


Link to post
Share on other sites

Thanks Mattar_Tharkari, the [getPosATL this] didn't work, but I like the Grouping to marker. that work really well. thank you again for the tutorial book for editing. BIS should renew that tutorial to arma 2, or atleast for the upcomming arma 3. that would be really help us new to editing :)

Share this post


Link to post
Share on other sites
Thanks Mattar_Tharkari, the [getPosATL this] didn't work, but I like the Grouping to marker. that work really well. thank you again for the tutorial book for editing. BIS should renew that tutorial to arma 2, or atleast for the upcomming arma 3. that would be really help us new to editing :)

The guide is intended to show basic editing & scripting techniques / syntax. As far as that goes, not much has changed since A1. The guide is still very valid. A more advanced guide would be welcomed though imo.

Share this post


Link to post
Share on other sites

I am trying to spawn an enemy officer and make him patrol in my Assassinate HVT mission. When the mission starts.

I used createvehicle command which spawns him correctly but unable to set him to start taskPatrol like this.

However via createunit I can make him patrol with the bis_fnc_taskPatrol but dont know how to name him to use in "!alive.." command?

Share this post


Link to post
Share on other sites

I am trying to spawn an enemy officer and make him patrol in my Assassinate HVT mission. When the mission starts.

I used createvehicle command which spawns him correctly but unable to set him to start taskPatrol like this.

However via createunit I can make him patrol with the bis_fnc_taskPatrol but dont know how to name him to use in "!alive.." command?

You cannot spawn unit by createVehicle command. YOu have to use CreateGroup and CreateUnit instead.

 

Here is Example From my ambush mission:

 

You have to place few markers in editor and name them.

_grp1 = CreateGroup EAST;    // this creates a group with name _grp1. (youi need this!!!) 
_c = _grp1 createUnit ["INS_Soldier_Sniper", [(getMarkerPos "spwn_1" select 0),(getMarkerPos "spwn_1" select 1),0], [], 20, "CANCOLLIDE"]; //This adss ÄŒDKZ sniper named _c  to _grp1 who would spawn at marker spwn_1
_d = _grp1 createUnit ["INS_Soldier_Sniper", [(getMarkerPos "spwn_1" select 0),(getMarkerPos "spwn_1" select 1),0], [], 20, "CANCOLLIDE"]; //This ads another ÄŒDKZ Sniper named _d to _grp1


//Here i set waypoints for _grp1
_mg1 = _grp1 addWaypoint [getMarkerPos "amm_1",0 ]; //Create waypoint on position of marker amm_1
_mg1 setWaypointType "SAD" ;  
_mg1 setWaypointCombatMode "RED"; 
_mg1 setWaypointBehaviour "AWARE"; 
_mg1 setWaypointSpeed "FULL";
_mg1 setWaypointFormation "LINE";

Share this post


Link to post
Share on other sites

 

You cannot spawn unit by createVehicle command. YOu have to use CreateGroup and CreateUnit instead.

 

Here is Example From my ambush mission:

 

You have to place few markers in editor and name them.

_grp1 = CreateGroup EAST;    // this creates a group with name _grp1. (youi need this!!!) 
_c = _grp1 createUnit ["INS_Soldier_Sniper", [(getMarkerPos "spwn_1" select 0),(getMarkerPos "spwn_1" select 1),0], [], 20, "CANCOLLIDE"]; //This adss ÄŒDKZ sniper named _c  to _grp1 who would spawn at marker spwn_1
_d = _grp1 createUnit ["INS_Soldier_Sniper", [(getMarkerPos "spwn_1" select 0),(getMarkerPos "spwn_1" select 1),0], [], 20, "CANCOLLIDE"]; //This ads another ÄŒDKZ Sniper named _d to _grp1


//Here i set waypoints for _grp1
_mg1 = _grp1 addWaypoint [getMarkerPos "amm_1",0 ]; //Create waypoint on position of marker amm_1
_mg1 setWaypointType "SAD" ;  
_mg1 setWaypointCombatMode "RED"; 
_mg1 setWaypointBehaviour "AWARE"; 
_mg1 setWaypointSpeed "FULL";
_mg1 setWaypointFormation "LINE";

Thank you :)

 

by the way, what are the select 0 and select 1 for?:

[(getMarkerPos "spwn_1" select 0),(getMarkerPos "spwn_1" select 1),0]

Are they the 3 axis where the '0' at the end refers to the Z axis? But still dont know why the need for the (getMarkerPos "spwn_1" select 0) and (getMarkerPos "spwn_1" select 1)?

 

Thank you.

Share this post


Link to post
Share on other sites

Also remember if you put the code in a triger in editor use names without underscroll  ( _grp1 = > grp1)

Names with underscroll are for external scripts, the underscroll localises the variable.

Share this post


Link to post
Share on other sites

Also remember if you put the code in a triger in editor use names without underscroll  ( _grp1 = > grp1)

Names with underscroll are for external scripts, the underscroll localises the variable.

Thank you.

Share this post


Link to post
Share on other sites

Thank you :)

 

by the way, what are the select 0 and select 1 for?:

[(getMarkerPos "spwn_1" select 0),(getMarkerPos "spwn_1" select 1),0]

Are they the 3 axis where the '0' at the end refers to the Z axis? But still dont know why the need for the (getMarkerPos "spwn_1" select 0) and (getMarkerPos "spwn_1" select 1)?

 

Thank you.

Sorry i over looked this one. select 1 select 0 etc are what do you select from the array.   Coordinates are [ x,y,z] where the possitions of the coorsinates are [select 0, select 1,select 2]. Or at least this is how i understand it.

Share this post


Link to post
Share on other sites

Sorry i over looked this one. select 1 select 0 etc are what do you select from the array.   Coordinates are [ x,y,z] where the possitions of the coorsinates are [select 0, select 1,select 2]. Or at least this is how i understand it.

*thumbs up*

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  

×