Forum Jump :

Author Message


Posts: 13
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2015-05-31 21:54        
     
Hello! I'm currently working on an assassination COOP where players are civilians and have to assassinate a target, but standard AI will only engage civilians if they have killed enough of their own faction. After quite a bit of searching I still have no solution.

I want the INDEPENDENT AI to mark CIVILIAN as OPFOR if they have been spotted with any weapon. I still want these civilians to be marked as OpFor even if they drop their weapon. And if it is possible that if they change their clothes they can be civilians again?

I figure if this is possible, you guys may be able to figure it out. It would be great and would not only improve my mission, but i think it would be a valuable utility for all missions (in my opinion, it should be an in-engine utility -- not that it matters).

Lacrosse, football, skiing, paintball, and Arma.

Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 58
In-game name: Kobayashi Maru

 
#2 Posted at 2015-06-01 05:30        
     
You can't change side of a unit except in these cases:

- make this unit captive (setCaptive) or kill it. Capture or killed unit becomes civilian (but i'm not sure second way is useful). Play with _unit setCaptive true/false and don't forget their behavior to be as quiet as civilian. That's the main way used by BI team for their campaigns and showcases.

- create (edit) a group with a unit coming from the desired side (B_officer_F for Blufor...) then make all unit you want them to change for this side, grouped with this unit. Leader must be the unit with this side. Then, set "condition of presence" of this unit to 0 (in editor). As you can see, this works only at the beginning of the mission. If you try this via a trigger during mission, you fail because unit is not present;

- you can spawn a group with disparate units and specify to which side this group belongs: use bis_fnc_spawnGroup;

So, now the problem is to change side of such a group.
- if you have a "referring" unit (editor or spawned) who belongs to the side you want, just script all the units you want changing side join the group of the referring unit, then 2 ways:
- hide the referring unit (hideObject this_unit);
- or, deleteVehicle this_unit, but the group then belongs to the side of n°2 unit. So pay attention with the n°2 rank in this case.

NB: after that, if during the mission, leader and successors are killed, no problem, the group remains as when formerly joined (or N°2 after leader deletion if you use deleteVehicle).
Hope this is clear. sorry for my English.

This post was edited by Pierre MGI (2015-06-01 06:07, ago)

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message


Posts: 13
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2015-06-02 16:02        
     
Thank you! This helps, but what about the weapon bit?

# Pierre MGI : You can't change side of a unit except in these cases:

- make this unit captive (setCaptive) or kill it. Capture or killed unit becomes civilian (but i'm not sure second way is useful). Play with _unit setCaptive true/false and don't forget their behavior to be as quiet as civilian. That's the main way used by BI team for their campaigns and showcases.

- create (edit) a group with a unit coming from the desired side (B_officer_F for Blufor...) then make all unit you want them to change for this side, grouped with this unit. Leader must be the unit with this side. Then, set "condition of presence" of this unit to 0 (in editor). As you can see, this works only at the beginning of the mission. If you try this via a trigger during mission, you fail because unit is not present;

- you can spawn a group with disparate units and specify to which side this group belongs: use bis_fnc_spawnGroup;

So, now the problem is to change side of such a group.
- if you have a "referring" unit (editor or spawned) who belongs to the side you want, just script all the units you want changing side join the group of the referring unit, then 2 ways:
- hide the referring unit (hideObject this_unit);
- or, deleteVehicle this_unit, but the group then belongs to the side of n°2 unit. So pay attention with the n°2 rank in this case.

NB: after that, if during the mission, leader and successors are killed, no problem, the group remains as when formerly joined (or N°2 after leader deletion if you use deleteVehicle).
Hope this is clear. sorry for my English.

Lacrosse, football, skiing, paintball, and Arma.

Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 58
In-game name: Kobayashi Maru

 
#4 Posted at 2015-06-02 17:58        
     
depends on your script and your choices!
some tracks:
- civilian spotted as OFPOR : try instead opfor_unit setcaptive true (not shot by AI, considered as civilian) and opfor_unit setbehaviour "CARELESS" (not killing everyone);
- removeallweapons opfor_unit at start probably?
- then choose the context this/these units take(s) a gun: your scenario;
- spotted by : ouch! more difficult. Try this function : https://community.bistudio.com/wiki/knowsAbout or simpler add a trigger area;
- does opfor_unit have a weapon?: if (count (weapons opfor_unit) !=0) then {....code }// this guy has a weapon;
- even if opfor_unit drops it's weapon: easy! just make your code without loop checking if this condition remains valid.
- being "civilian" with a cloth condition:
while {alive opfor_unit} do {sleep 2; if (uniform opfor_unit == "U_C_Poloshirt_blue") then {opfor_unit setcaptive true; opfor_unit setbehaviour "careless"}; // polo shirt blue is an example. check possibilities in your config viewer (cfgweapons)
Have a good scripting

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 21
In-game name: Wak

 
#5 Posted at 2015-06-02 18:11        
     
Don't know if it works on civilians but you can try the addRating command too. Something simple like:

while {true} do {
	waitUntil {independent knowsAbout player > 2}; //wait until indep faction knows enough about player
	if (primaryWeapon player != "") then {
		player addRating -999999; //set player as enemy (still not sure it this works)
		_uniform = uniform player; //get current uniform
		waitUntil {uniform player != _uniform}; //keep comparing current uniform to current uniform. I know...
		player setUnitRank 7500; //Used rank here because of reasons in wiki
	};
	sleep 2;
};

EDIT: Updated code. Thanks for knowsAbout Pierre.

This post was edited by 654wak654 (2015-06-02 18:32, ago)

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 58
In-game name: Kobayashi Maru

 
#6 Posted at 2015-06-03 01:30        
     
Yes addRating works with "native" civilian units (I mean civilian true side). Every units (player or not, civilian or not) becomes renegade and belongs to enemySide each time his rating is lower than - 2000 pts. But, when renegade, you're alone, eevery body is trying to kill you (even your old fellow team). You don't belong to a group anymore. If you reach again -2000 pts or above, killing your former enemies (not your old fellows), you recover your old group and your old side.

PS: You can change the side of a unit as explained above, but the "true" side of a unit (B_soldier_F is a Blufor, B_MRAP_01_F is a Hunter, blufor made vehicle empty or not) can't be changed. It's defined in the configVehicle of the unit by a number. So, if you need to work with a "true" side of objects/units, just :
	_side_x = getNumber (configfile >> "CfgVehicles" >> typeOf my_unit >> "side");
	switch (_side_x) do {
		    case 0: {_true_side_x = east};
		    case 1: {_true_side_x = west};
		    case 2: {_true_side_x = resistance};
		    case 3: {_true_side_x = civilian};
		    default {_true_side_x = sideUnknown};
		};
See also https://community.bistudio.com/wiki/CfgVehicles_Config_Reference#side
https://community.bistudio.com/wiki/Side_relations

This post was edited by Pierre MGI (2015-06-03 01:41, ago)

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS