vurelo 3 Posted March 27, 2016 _spawnpos = [ (getMarkerPos "recruit_west") select 0, (getMarkerPos "recruit_west") select 1, 0]; _unit = group player createUnit ["B_medic_F", _spawnpos, [], 1, "PRIVATE"]; this way i can spawn a medic, but how can I do to create a medic with a specific name? like name1 or name2 ... Share this post Link to post Share on other sites
sarogahtyp 1108 Posted March 27, 2016 I dont know if that works with createUnit but it does with createVehicle. to name it mymedic1 u do: mymedic1 = createVehicle [type, position, markers, placement, special]; 1 Share this post Link to post Share on other sites
vurelo 3 Posted March 27, 2016 I dont know if that works with createUnit but it does with createVehicle. to name it mymedic1 u do: mymedic1 = createVehicle [type, position, markers, placement, special]; I'm doing this way: private ["_spawnpos", "_mymedic1"]; _spawnpos = [ (getMarkerPos "recruit_west") select 0, (getMarkerPos "recruit_west") select 1, 0]; _mymedic1 = createVehicle ["B_medic_F", _spawnpos, [], 1, "PRIVATE"]; The unit spawn, but don't have the "mymedic1" name and i want him in my group. Share this post Link to post Share on other sites
vurelo 3 Posted March 27, 2016 I dont know if that works with createUnit but it does with createVehicle. to name it mymedic1 u do: mymedic1 = createVehicle [type, position, markers, placement, special]; this way works ... private ["_spawnpos", "_mymedic1"]; _spawnpos = [ (getMarkerPos "recruit_west") select 0, (getMarkerPos "recruit_west") select 1, 0]; _mymedic1 = group player createUnit ["B_medic_F", _spawnpos, [], 1, "PRIVATE"]; but the medic don't spawn with name mymedic1. Share this post Link to post Share on other sites
soolie 189 Posted March 27, 2016 _mymedic1 is just a local variable to recognize that unit in a scripting capacity. It's not the actual name of the unit. I think you want this https://community.bistudio.com/wiki/setName _mymedic1 setName "New Name"; Share this post Link to post Share on other sites
vurelo 3 Posted March 27, 2016 _mymedic1 is just a local variable to recognize that unit in a scripting capacity. It's not the actual name of the unit. I think you want this https://community.bistudio.com/wiki/setName _mymedic1 setName "New Name"; i try this and don't work private ["_unit", _spawnpos"]; _spawnpos = [ (getMarkerPos "recruit_west") select 0, (getMarkerPos "recruit_west") select 1, 0]; _unit = group player createUnit ["B_medic_F", _spawnpos, [], 1, "PRIVATE"]; _unit setName "AAA"; Share this post Link to post Share on other sites
Persian MO 82 Posted March 27, 2016 _grp = createGroup Civilian; Informer = _grp createUnit ["C_man_polo_1_F_euro", _informerpos, [], 0, ""]; Share this post Link to post Share on other sites
sarogahtyp 1108 Posted March 27, 2016 this spawns definetly ur unit and stores the object in the global variable mymedic1. that global variable is known by the machine which created the unit. mymedic1 = createVehicle ["B_medic_F", position player]; dont put an underscore before mymedic1 because the variable would be local in the actual running script then. if u want that this variable is known by all machines as a global variable in multiplayer then u have to use publicVariable after creating the unit. maybe u should be more specific with describing what u want. but as i understood u wanna a "name" todo things with as mymedic1 setDamage 1; or if (!alive mymedic1) then {hint "medic is dead"}; those things will work in every script on a machine which knows about mymedic1 with the above mentioned createVehicle command. with mymedic1 join group player; u can get ur medic join players group... 1 Share this post Link to post Share on other sites
vurelo 3 Posted March 28, 2016 this spawns definetly ur unit and stores the object in the global variable mymedic1. that global variable is known by the machine which created the unit. mymedic1 = createVehicle ["B_medic_F", position player]; dont put an underscore before mymedic1 because the variable would be local in the actual running script then. if u want that this variable is known by all machines as a global variable in multiplayer then u have to use publicVariable after creating the unit. maybe u should be more specific with describing what u want. but as i understood u wanna a "name" todo things with as mymedic1 setDamage 1; or if (!alive mymedic1) then {hint "medic is dead"}; those things will work in every script on a machine which knows about mymedic1 with the above mentioned createVehicle command. with mymedic1 join group player; u can get ur medic join players group... can u give me some exemple of publicVariable? all this is for a MP coop mission. I want to use ACE medical system with spawn medic, and for this i have to name the medic. Share this post Link to post Share on other sites
sarogahtyp 1108 Posted March 28, 2016 this broadcasts the created object over the network to all connected clients and server: publicVariable "mymedic1"; this broadcast the object only to the client which has client_id as its id: client_id publicVariableClient "mymedic1"; the cient_id is provided by client_id = owner object_on_client; owner command can be executed by server only. object_on_client is any object which is owned by the client. a client owns all objects which are created by client machine. a client owns vehicles where it was the latest driver too. if u want to get a object/variable only broadcasted to server then u use: publicVariableServer "mymedic1"; realy important is the use of google while scripting to crawl th wiki where all infos r stored. if someone tells you use command lkzbw to solve ur problem then ur google search string is: arma 3 script lkzbw the wiki entry of the command lkzbw is on top of googles result list then. the wik has examples for almost every command. Share this post Link to post Share on other sites
Nemanjic 71 Posted August 6, 2021 _spawnpos = getMarkerPos "m2"; private _grp1 = createGroup independent; sec1 = _grp1 createUnit ["ISspec_operative", _spawnpos, [], 1, "2"]; - this way a got both variables for group and unit spawned so I can manipulate with during mission so let's say this works nice (unit is spawned in marker m2 exactly with name "sec1" in group called _grp1) but when executed it gives an error "error Foreign error: Unknown enum value: "2". I am plan to use this script a lot in next scenario (few days operation) so it is important to me that I can count on this script for sure. My question is what this error means? Is it safe to ignore it due to script finishes the job even if error is in it. I searched of course, trying to understand the whole line but everytime it points me here because this thread is only that include all three elements to be provided which I looks for (varNames and spawn position). After this I can use findSafePos, setWaypointTimeout etc...without issues which is very important for my missions and randomizing operational groups on terrain in every possible way.. edited: So I think that I am manage to understand almost all but not all: _spawnpos = getMarkerPos "m2"; (it defines that spawnpos is actually position of marker called m2) private _grp1 = createGroup independent; (tells the game to create group container for unit and that group is _grp1 independent sided) sec1 = _grp1 createUnit ["ISspec_operative", _spawnpos, [], 1, "2"]; (tells to creeate unit inside group created before, exact unit from config and to place that unit in predefined position called spawnpos) but next few elements I can not understand: [], 1, "2"]; ...which gives that no dangerous error.. Share this post Link to post Share on other sites
sarogahtyp 1108 Posted August 7, 2021 May favourite prayer "read biki entry" 😉 createUnit [type, position, markers, placement, special] markers: Array - Placement markers means you can pass an array of markers here and the unit will spawned on the position of one of those markers. empty array [] means to use the position (2nd parameter) instead. placement: Number - Placement radius this is meant to have some placement variance. passing a 1 here means the unit gets spawned inside a circle with radius of 1 meter. special: String - Unit placement special, one of: "NONE" - The unit will be created at the first available free position nearest to given position "FORM" - Not implemented, currently functions the same as "NONE". "CAN_COLLIDE" - The unit will be created exactly at passed position "CARGO" - The unit will be created in cargo of the group's vehicle, regardless of the passed position (see Example 5). If group has no vehicle or there is no cargo space available, the unit will be placed according to "NONE". To check available cargo space use: _hasCargo = _veh emptyPositions "CARGO" > 0; this is the part where the error comes from. as u can see "2" is not a valid option. use "NONE" and createUnit will spawn your unit on a safe place, not colliding with anything... Edit: for the special parameter mostly "NONE" or "CAN_COLLIDE" is used. "CAN_COLIDE" is faster cause it has not to check for collisions. A scripter should only use "CAN_COLLIDE" if he knows for sure that the object to be spawned will not collide with any other objects on spawning position. 2 1 Share this post Link to post Share on other sites
Nemanjic 71 Posted August 7, 2021 Yea I see now.. Was copied code from above On 3/27/2016 at 7:07 AM, vurelo said: _unit = group player createUnit ["B_medic_F", _spawnpos, [], 1, "PRIVATE"]; so I thought it reference to rank of the soldier and changed to sergeant, corporal etc until ended up with "2" somehow don't even know why, but error was the same. The guy who wrote this probably knows exactly what he was doing, unlike me 🙂 Thank you mate this was very helpful! Share this post Link to post Share on other sites