Icaruk 14 Posted June 18, 2014 (edited) Imagine a BLUFOR patrol. When they see a civilian nothing happens, but then the civilian attacks they will defend themselves. If I use addrating -2001 they will shoot on sight. Any ideas? Edited June 18, 2014 by Icaruk Share this post Link to post Share on other sites
barbolani 198 Posted June 18, 2014 What method are you using to make the civ attack the blufor? Because If you are using the typical [civilian] join OPFORgroup, BLUFOR won't attack him until that, so both engage the other in the moment you wish. If you want to ensure the first shot is made by the civ. A solution may be making the civvie setcaptive true, and with a "FIRED" eventhandler that makes him setcaptive false. Share this post Link to post Share on other sites
Icaruk 14 Posted June 18, 2014 What method are you using to make the civ attack the blufor?Because If you are using the typical [civilian] join OPFORgroup, BLUFOR won't attack him until that, so both engage the other in the moment you wish. If you want to ensure the first shot is made by the civ. A solution may be making the civvie setcaptive true, and with a "FIRED" eventhandler that makes him setcaptive false. I'm playing with a civilian, if I shoot at blufor they don't care until I kill so much units. I want to make this: If I shoot at them, they defend themselves, but when another disarmed civilian is near there, they will not attack him. Share this post Link to post Share on other sites
Magirot 14 Posted June 18, 2014 (edited) You could use an event handler. Put this in your init.sqf or similar place: { // forEach block start // only if the unit is blufor // _x is the magic variable referring to the current forEach unit if (side _x == blufor) then { // add an eventhandler for getting hit _x addEventHandler ["Hit", { // Object the event is attached to is the first variable passed _unit = _this select 0; // Object that caused the damage is the second variable passed _causedBy = _this select 1; if (side _causedBy == civilian) then { _causedBy addRating -2500; _unit removeAllEventHandlers "Hit"; // or //[_causedBy] joinSilent someOpforGroup; }; }]; // add an eventhandler for if the unit is killed _x addEventHandler ["Killed", { // Object the event is attached to is the first variable passed _unit = _this select 0; // Object that caused the damage is the second variable passed _causedBy = _this select 1; if (side _causedBy == civilian) then { _causedBy addRating -2500; _unit removeAllEventHandlers "Killed"; // or //[_causedBy] joinSilent someOpforGroup; }; }]; }; } forEach allUnits; // cycle through all units in the mission They won't react if the unit fires near them, which can look silly, but will turn hostile if the unit hits someone or kills someone. Edited June 18, 2014 by Magirot Share this post Link to post Share on other sites
Icaruk 14 Posted June 18, 2014 (edited) You could use an event handler. Put this in your init.sqf or similar place: { // forEach block start // only if the unit is blufor // _x is the magic variable referring to the current forEach unit if (side _x == blufor) then { // add an eventhandler for getting hit _x addEventHandler ["Hit", { // Object the event is attached to is the first variable passed _unit = _this select 0; // Object that caused the damage is the second variable passed _causedBy = _this select 1; if (side _causedBy == civilian) then { _causedBy addRating -2500; _unit removeAllEventHandlers "Hit"; // or //[_causedBy] joinSilent someOpforGroup; }; }]; // add an eventhandler for if the unit is killed _x addEventHandler ["Killed", { // Object the event is attached to is the first variable passed _unit = _this select 0; // Object that caused the damage is the second variable passed _causedBy = _this select 1; if (side _causedBy == civilian) then { _causedBy addRating -2500; _unit removeAllEventHandlers "Killed"; // or //[_causedBy] joinSilent someOpforGroup; }; }]; }; } forEach allUnits; // cycle through all units in the mission They won't react if the unit fires near them, which can look silly, but will turn hostile if the unit hits someone or kills someone. It worked, thank you so much! Edited June 18, 2014 by Icaruk Share this post Link to post Share on other sites
barbolani 198 Posted June 18, 2014 or... place an OPFOR unit in editor map, probability of presence 0%. Group the player to that unit, being the OPFOR leader of the group. On player's init: this setcaptive true; The eventhandler thing, you may tweak the wonderful code posted by Magirot just to make the player non-captive, replacing both _causedBy addRating -2500; by player setCaptive false; or... if you want just to make him a target after he fires, on player's init add: this addEventHandler ["FIRED", {player setCaptive false}]; Share this post Link to post Share on other sites
Icaruk 14 Posted June 18, 2014 or...place an OPFOR unit in editor map, probability of presence 0%. Group the player to that unit, being the OPFOR leader of the group. On player's init: this setcaptive true; The eventhandler thing, you may tweak the wonderful code posted by Magirot just to make the player non-captive, replacing both _causedBy addRating -2500; by player setCaptive false; or... if you want just to make him a target after he fires, on player's init add: this addEventHandler ["FIRED", {player setCaptive false}]; Thanks ^^ Share this post Link to post Share on other sites