Page MenuHomeFeedback Tracker

broken createunit-syntax - 'side unit' return wrong side after createunit
New, WishlistPublic

Description

this code doesn't change unit side to given side:
{
grp = creategroup resistance;
unit = grp createunit ["B_soldier_F",getMarkerPos "ziel",[],1,""];
}
side unit return west and should return resistance

-------

but this wrks fine
{
grp = creategroup resistance;
"B_soldier_F" createunit [getMarkerPos "ziel",grp,"unit=this;"];
}
side unit return resistance as it should {F21257}

Details

Legacy ID
3813383086
Severity
None
Resolution
Open
Reproducibility
Always
Category
AI Control / Commanding
Steps To Reproduce
  1. place a trigger BlueFor / Once / Present ON ACT. {grp = creategroup resistance; grp createunit ["B_soldier_F",getMarkerPos "ziel",[],1,""];}
  1. place a trigger @ same postion as first trigger Independent / Once / Present On ACT. {hint "Hallo!";}
  1. place a Marker with the name "ziel" @ same position as the triggers
  1. place the player, a blue rifleman, outside the triggers
  1. click PREVIEW
  1. run with your soldier into the trigger area

The new soldier will be created once you enter the triggerarea,
but the second trigger don't run the ON ACT. code, no hint will appear.
Open the Map, and no green soldier is shown, the created soldier appear in blue.

Additional Information

Don't know, but I think both syntax-versions should give the same side-result.
If the first syntax-version is broken or out of date then the script-wiki should tell us something about that.

Event Timeline

CJoke edited Steps To Reproduce. (Show Details)Aug 5 2013, 2:51 PM
CJoke edited Additional Information. (Show Details)
CJoke set Category to AI Control / Commanding.
CJoke set Reproducibility to Always.
CJoke set Severity to None.
CJoke set Resolution to Open.
CJoke set Legacy ID to 3813383086.May 7 2016, 3:51 PM

both ways work for me

CJoke added a subscriber: CJoke.May 7 2016, 3:51 PM
CJoke added a comment.Aug 5 2013, 3:14 PM

with latest dev update, few minutes ago, 0.75.108541
and with the mission attached to this issue, I got the failure again

It works. First syntax returns created object, second doesn't. You need to join created soldier into the group for it to work with the trigger:

grp = creategroup resistance;
soldier = grp createunit ["B_soldier_F",getMarkerPos "ziel",[],1,""];
[soldier] join grp;

CJoke added a comment.Aug 5 2013, 4:42 PM

yes, I need to join the created soldier into the group
-> and that is the failure, because the first argument given to createunit is the group:
unit = _group_ createunit [...];
the soldier should allready be in that group after calling createunit with that syntax...

It makes no problems if create a green soldier with a I_Soldier-Class:

grp = creategroup resistance;
grp createunit ["I_soldier_F",getMarkerPos "ziel",[],1,""];

works fine (will create a green-faction Soldier), but

grp = creategroup resistance;
grp createunit ["B_soldier_F",getMarkerPos "ziel",[],1,""];

not and create a blue-faction soldier.

the side given to the created unit should not depend on the vehicle-classname...

The soldier you create is already in the group you can check it by

hint str group soldier

It is just that in order for the trigger to react to the newly created unit you need to force join.

CJoke added a comment.Aug 5 2013, 6:04 PM

yes, but the side is worng

try
hint str side soldier
after this:
grp = creategroup resistance;
soldier = grp createunit ["B_soldier_F",getMarkerPos "ziel",[],1,""];

hint str side soldier
will return "west"

this should be resistance without force a join

CJoke added a comment.Aug 5 2013, 6:16 PM

I saw some spawn-scripts using this syntax without a join after createunit

that syntax make no problems if soldierclass fit to the side.
resistance -> I_soldier_F
perhaps most people don't mix soldierclasses and sides, so nobody cares.

but if you want to create a B_soldier_F Class unit, with that syntax, into a resistance group something goes wrong... and engine return wrong side

imho, to force a join after calling createunit is only a workarround

You don't need to join the unit in the first syntax.

[quote]perhaps most people don't mix soldierclasses and sides, so nobody cares.
[/quote]
Well I care, but don't agree with your conclusions. I think the second syntax is broken.

Basically everything is a mess with sides. It is the side of the group that determines who is enemy and who is friend. But the side of the unit determines how it appears on the map and whether the 'built-in' trigger conditions apply.

Even having sides on a units themselves doesn't make sense. You can put civilian, blufor. opfor and independent units in the same group and they fight together, so why bother having sides on units; why not just limit sides to groups?

I think BI should completely restructure the side/factions system (for Arma 4, probably too late for 3 now), so that you can decide which factions are on which sides for a mission. Its a complete mess to create a joint NATO-Soviet mission at the moment.

CJoke added a comment.Aug 5 2013, 7:36 PM

@Muzzleflash thx for info :)
I didn't noticed before, that this are two things: group-side and unit-side

I create (near finish) a very big SP-Mission in FarCry3-Style with 4 sides:
the pirates, a para-military group, civilians and the touristgroup with player
http://cloud-2.steampowered.com/ugc/901002374273042188/28BD871509659E2FF35DBB31F76502A25F1A1CC5/
complex spawn-system over whole island and problems with sides & triggers now getting bigger...

But most problems i got in friendly fire between blue and green are friends, a major bug with side-friendly fire:
Issue 12376 http://feedback.arma3.com/view.php?id=12376
friendly fire between friendly sides grenn and blue will destroy all repeatly triggers in mission :(

I have to change/rewrite somethig to finish this farsmyle thing

Is this issue resolved (i.e. not a bug)?

CJoke added a comment.Aug 9 2013, 6:12 PM

No, it's open:

this code doesn't change unit side to given side:

{
grp = creategroup resistance;
unit = grp createunit ["B_soldier_F",getMarkerPos "ziel",[],1,""];
}

"side unit" return 'west' and should return 'resistance'
with this syntax the unit-side depends on unit-classname (B_Soldier_F) and not on group-side (resistance)

I would like to add a bit more research to it:

Create civilian unit for yourself so you dont get killed and open debug console then paste:

_grp = createGroup civilian;
"B_soldier_F" createUnit [position player, _grp ];
"O_soldier_F" createUnit [position player, _grp ];
"I_soldier_F" createUnit [position player, _grp ];
{
player globalChat str [typeOf _x, side _x, side group _x];
} forEach allUnits;

sidechat shows all units are CIV both for the unit side and group side so no one shoots anyone. Now restart and paste:

_grp = createGroup civilian;
_grp createUnit ["B_soldier_F", position player, [], 0, "NONE"];
_grp createUnit ["O_soldier_F", position player, [], 0, "NONE"];
_grp createUnit ["I_soldier_F", position player, [], 0, "NONE"];
{
player globalChat str [typeOf _x, side _x, side group _x];
} forEach allUnits;

The side of the unit now corresponds to the unit model however their group side is CIV. This results in BLUFOR and GUER shooting down OPFOR and not each other. Now restart and paste:

_grp = createGroup west;
_grp createUnit ["B_soldier_F", position player, [], 0, "NONE"];
_grp = createGroup east;
_grp createUnit ["O_soldier_F", position player, [], 0, "NONE"];
_grp = createGroup independent;
_grp createUnit ["I_soldier_F", position player, [], 0, "NONE"];
{
player globalChat str [typeOf _x, side _x, side group _x];
} forEach allUnits;

Now both group of the unit and group of the side correspond to model and all three factions are going to shoot each other.

At this point I'm not sure anymore if this is a bug or intended behaviour but it is definitely very messy.

I believe this is intended behaviour, we have setFriend for side manipulations. The command does by default what is to be expected, the group parameter is there to set the group, NOT the side of the unit. It is only an afterthought the usage mentioned in the OP.

and to make East and West not kill each other:
EAST setFriend [WEST, 1];
WEST setFriend [EAST, 1];

more at - https://community.bistudio.com/wiki/Side_relations

sh4dow added a subscriber: sh4dow.May 21 2017, 3:50 AM