Jump to content

Recommended Posts

Hello:
With this small code I try to place on the map two civilians with their corresponding name "CIVILIAN_1" and "CIVILIAN_2", but it does not work. Can somebody help me? Grateful..

 

if (!isServer) exitWith {}; 

_markerstr = createMarker ["CIVILIAN_1",[2747.08,2417.49]];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerType "hd_dot";
_height = 4.76837e-007;
_pos = getMarkerPos "CIVILIAN_1";
_CIVILIAN_1 = [ [_pos select 0, _pos select 1, _height], EAST, ["C_man_hunter_1_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{ group _x setFormDir 270; _x allowFleeing 0; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _CIVILIAN_1;
_CIVILIAN_1 setVehicleVarName "CIVILIAN_1"; CIVILIAN_1 = _CIVILIAN_1;

sleep 4;

_markerstr = createMarker ["CIVILIAN_2",[2748.23,2412.76]];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerType "hd_dot";
_height = 0;
_pos = getMarkerPos "CIVILIAN_2";
_CIVILIAN_2 = [ [_pos select 0, _pos select 1, _height], EAST, ["C_man_sport_3_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{ group _x setFormDir 270; _x allowFleeing 0; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units CIVILIAN_2;
_CIVILIAN_2 setVehicleVarName "CIVILIAN_2"; CIVILIAN_2 = _CIVILIAN_2;

 

 

Share this post


Link to post
Share on other sites

They can be a little more didactic. My knowledge is quite limited. Grateful.

Share this post


Link to post
Share on other sites

ask your questions and u ll get an answer.

we are helpers not teachers.

anyways you should read a bit and try something and if you get stuck then u should just ask...

  • Like 2

Share this post


Link to post
Share on other sites

The two civilians appear on the map. What I intend is that each civilian has his own name. Thus, when the two are killed, a trigger will be activated (! Alive CIVILIAN_1;! Alive CIVILIAN_2;) and a helicopter will start the flight. The same code, with vehicles, works perfectly, but with IA units, no. I repeat, thank you for your interest.

Share this post


Link to post
Share on other sites

You wrote:

_CIVILIAN_1 = [ [_pos select 0, _pos select 1, _height], EAST, ["C_man_hunter_1_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{ group _x setFormDir 270; _x allowFleeing 0; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _CIVILIAN_1;

 

So, _CIVILIAN_1 is a group, not a unit. As, it's also a single man group, just:

 

_leader = leader _CIVILIAN_1;
_leader setVehicleVarName "CIVILIAN_1"; CIVILIAN_1 = _leader;

In MP, you need to broadcast it. Something like:

[_leader,"CIVILIAN_1"] remoteExecCall ["setVehicleVarName",0,true];

CIVILIAN_1 = _leader;

publicVariable "CIVILIAN_1"; 

// or missionNameSpace setVariable ["CIVILIAN_1", _leader, true];  // instead of the 2 last lines

 

(not tested sorry)

 

  • Like 1

Share this post


Link to post
Share on other sites

I understand that the correct code would be the following one, yes?

 

if (!isServer) exitWith {}; 

_markerstr = createMarker ["CIVILIAN_1",[2747.08,2417.49]];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerType "hd_dot";
_height = 4.76837e-007;
_pos = getMarkerPos "CIVILIAN_1";
_CIVILIAN_1 = [ [_pos select 0, _pos select 1, _height], EAST, ["C_man_hunter_1_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{ group _x setFormDir 270; _x allowFleeing 0; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _CIVILIAN_1;
_leader = leader _CIVILIAN_1;
_leader setVehicleVarName "CIVILIAN_1"; CIVILIAN_1 = _leader;

sleep 4;

_markerstr = createMarker ["CIVILIAN_2",[2748.23,2412.76]];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerType "hd_dot";
_height = 0;
_pos = getMarkerPos "CIVILIAN_2";
_CIVILIAN_2 = [ [_pos select 0, _pos select 1, _height], EAST, ["C_man_sport_3_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{ group _x setFormDir 270; _x allowFleeing 0; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units CIVILIAN_2;
_leader = leader _CIVILIAN_2;
_leader setVehicleVarName "CIVILIAN_2"; CIVILIAN_2 = _leader;

Share this post


Link to post
Share on other sites

Yes. You should try it. In MP, see above (saying that because I remarked the isServer condition).

Share this post


Link to post
Share on other sites

The code works, but gives an error: VARIABLE ERROR NOT DEFINED IN THE EXPRESSION: CIVILIAN_2. line 22.

Excuse my awkwardness.

Share this post


Link to post
Share on other sites

typo:

... forEach units CIVILIAN_2

read:

... forEach units _CIVILIAN_2;

Share this post


Link to post
Share on other sites

With its latest contribution to MP, the code would look like this:

 

_markerstr = createMarker ["CIVILIAN_1",[2747.08,2417.49]];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerType "hd_dot";
_height = 4.76837e-007;
_pos = getMarkerPos "CIVILIAN_1";
_CIVILIAN_1 = [ [_pos select 0, _pos select 1, _height], EAST, ["C_man_hunter_1_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{ group _x setFormDir 270; _x allowFleeing 0; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units CIVILIAN_1;
[_leader,"CIVILIAN_1"] remoteExecCall ["setVehicleVarName",0,true];
CIVILIAN_1 = _leader;
publicVariable "CIVILIAN_1"; 

sleep 4;

_markerstr = createMarker ["CIVILIAN_2",[2748.23,2412.76]];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerType "hd_dot";
_height = 0;
_pos = getMarkerPos "CIVILIAN_2";
_CIVILIAN_2 = [ [_pos select 0, _pos select 1, _height], EAST, ["C_man_sport_3_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{ group _x setFormDir 270; _x allowFleeing 0; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units CIVILIAN_2;
[_leader,"CIVILIAN_2"] remoteExecCall ["setVehicleVarName",0,true];
CIVILIAN_2 = _leader;
publicVariable "CIVILIAN_2"; 

 

I do not understand the typographical error, the first part of the code is CIVILIAN_1 and the second part is CIVILIAN_2. Now I will do a test on the server.

 

 

Share this post


Link to post
Share on other sites

With that code, civilians are killed when they start the test on the dedicated server.

 

Share this post


Link to post
Share on other sites

Simple: if you spawn a group name _CIVILIAN_X  (with underscore as any local variable) you need to refer to _CIVILIAN_x for units command.

You're doing the contrary of what I pointed at!

Be logic, your CIVILIAN_X is not defined before you setVehicleVarName.

 

if (!isServer) exitWith {}; 

_markerstr = createMarker ["CIVILIAN_1",[2747.08,2417.49]];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerType "hd_dot";
_height = 4.76837e-007;
_pos = getMarkerPos "CIVILIAN_1";
_CIVILIAN_1 = [ [_pos select 0, _pos select 1, _height], EAST, ["C_man_hunter_1_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{ group _x setFormDir 270; _x allowFleeing 0; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _CIVILIAN_1;
_leader = leader _CIVILIAN_1;
[_leader,"CIVILIAN_1"] remoteExecCall ["setVehicleVarName",0,true];
missionNameSpace setVariable ["CIVILIAN_1", _leader, true];

 

sleep 4;

_markerstr = createMarker ["CIVILIAN_2",[2748.23,2412.76]];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerType "hd_dot";
_height = 0;
_pos = getMarkerPos "CIVILIAN_2";
_CIVILIAN_2 = [ [_pos select 0, _pos select 1, _height], EAST, ["C_man_sport_3_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{ group _x setFormDir 270; _x allowFleeing 0; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _CIVILIAN_2;
_leader = leader _CIVILIAN_2;
[_leader,"CIVILIAN_2"] remoteExecCall ["setVehicleVarName",0,true];
missionNameSpace setVariable ["CIVILIAN_2", _leader, true];

 

Share this post


Link to post
Share on other sites
1 minute ago, Coladebote said:

With that code, civilians are killed when they start the test on the dedicated server.

 

 

On the other hand, you declared they are EAST side....  (see your spawn group)

Share this post


Link to post
Share on other sites

I'm sorry, but I'm really lost. This situation surpasses me. I can not understand you.

According to my way of seeing it, in this part of the code the marker where the unit appears is defined.

 

_markerstr = createMarker ["CIVILIAN_1",[2747.08,2417.49]];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerType "hd_dot";
_height = 4.76837e-007;
_pos = getMarkerPos "CIVILIAN_1";

 

In this second part of the code, it indicates what kind of unit and what are its properties.

 

_CIVILIAN_1 = [ [_pos select 0, _pos select 1, _height], EAST, ["C_man_hunter_1_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{ group _x setFormDir 270; _x allowFleeing 0; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _CIVILIAN_1;

 

Unless my interpretation is wrong, I do not appreciate repetition.

For example, this small code works perfectly for vehicles, both in the editor and in the dedicated server:

 

_markerstr = createMarker ["CAR_1",[4532.79,21476.5]];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerType "hd_dot";
_height = 0;
_vehicle = createVehicle ["CUP_O_Ural_Reammo_RU", (getMarkerPos "CAR_1"),[],0,"NONE"]; 
_dir = 175; 
_vehicle setDir _dir;
_vehicle setVehicleVarName "CAR_1"; CAR_1 = _vehicle;

 

I repeat, excuse me, but I'm a mess. Thank you.

Share this post


Link to post
Share on other sites

The code I wrote you (the one with colored typo)  should work.

When you say: my civs are killed, that could be the fact they are on EAST side, so enemies, or the fact they die because colliding with something... I can't guess what you're making 'and I'm sure it's same for other readers here). Check the positions... Avoid also some _height = 4.76837e-007; (imho it's useless)

 

What I can affirm:

- There is no difference spawning a vehicle or an infantry unit (or a civ). Just some collision / fall  which can make the difference.

- if you don't appreciate repetition, who does? I gave you a working code. You tried to understand some very, very basic scripting but with no success.

 

Share this post


Link to post
Share on other sites

I'll keep trying. I have already told you that I am starting on this topic. Sometimes it is better to leave something to mature and then try again. Thanks again for your time.

Share this post


Link to post
Share on other sites

 

Hello, Pierremgi:
 

With more calm and less heat, tonight I have reviewed all the conversation yesterday. All perfect.

 

This code works perfectly in the editor:

 

_markerstr = createMarker ["CIVILIAN_1",[2747.08,2417.49]];

_markerstr setMarkerShape "ICON";

_markerstr setMarkerType "hd_dot";

_height = 0;

_pos = getMarkerPos "CIVILIAN_1";

_CIVILIAN_1 = [ [_pos select 0, _pos select 1, _height], CIVILIAN, ["C_man_hunter_1_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;

{ group _x setFormDir 270; _x allowFleeing 1; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _CIVILIAN_1;

_leader = leader _CIVILIAN_1;

_leader setVehicleVarName "CIVILIAN_1"; CIVILIAN_1 = _leader;

 

sleep 4;

 

_markerstr = createMarker ["CIVILIAN_2",[2748.23,2412.76]];

_markerstr setMarkerShape "ICON";

_markerstr setMarkerType "hd_dot";

_height = 0;

_pos = getMarkerPos "CIVILIAN_2";

_CIVILIAN_2 = [ [_pos select 0, _pos select 1, _height], CIVILIAN, ["C_man_sport_3_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;

{ group _x setFormDir 270; _x allowFleeing 1; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _CIVILIAN_2;

_leader = leader _CIVILIAN_2;

_leader setVehicleVarName "CIVILIAN_2"; CIVILIAN_2 = _leader;

 

This other code works perfectly in the editor and the dedicated server:

 

if (!isServer) exitWith {};

 

_markerstr = createMarker ["CIVILIAN_1",[2747.08,2417.49]];

_markerstr setMarkerShape "ICON";

_markerstr setMarkerType "hd_dot";

_height = 0;

_pos = getMarkerPos "CIVILIAN_1";

_CIVILIAN_1 = [ [_pos select 0, _pos select 1, _height], CIVILIAN, ["C_man_hunter_1_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;

{ group _x setFormDir 270; _x allowFleeing 1; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _CIVILIAN_1;

_leader = leader _CIVILIAN_1;

[_leader,"CIVILIAN_1"] remoteExecCall ["setVehicleVarName",0,true];

missionNameSpace setVariable ["CIVILIAN_1", _leader, true];

 

sleep 4;

 

_markerstr = createMarker ["CIVILIAN_2",[2748.23,2412.76]];

_markerstr setMarkerShape "ICON";

_markerstr setMarkerType "hd_dot";

_height = 0;

_pos = getMarkerPos "CIVILIAN_2";

_CIVILIAN_2 = [ [_pos select 0, _pos select 1, _height], CIVILIAN, ["C_man_sport_3_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;

{ group _x setFormDir 270; _x allowFleeing 1; _x setdir 270; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _CIVILIAN_2;

_leader = leader _CIVILIAN_2;

[_leader,"CIVILIAN_2"] remoteExecCall ["setVehicleVarName",0,true];

missionNameSpace setVariable ["CIVILIAN_2", _leader, true];

 

I publish the conclusions for the case that someone from the community, now or in the future, wants to take advantage of these verified codes.

 

Thanks for your help, experts like you make Arma III a great game. I insist, thank you for your time and patience. Greetings from Spain.

 

 

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

×