Jump to content
Sign in to follow this  
dannyd488

Making Civilians hostile UNDER CERTAIN SITUATIONS.....

Recommended Posts

First I'd like to say hello! It took me a while to make an account....damn internet explorer sucks....kept saying...cookies not enabled omggg haha anyway....

I'm new at this but I'm already in over my head.

I know that adding (this addRating -10000;) will make civilians hostile but I'm looking to do much more than this....

Here's a list of the conditions and what I'm trying to accomplish

-In mission have all 4 sides (op-for ect.) set against each other, including independents

-Civs will be friendly until picking up a weapon or exiting a certain area

-Civs will be grouped "have a leader" forget what its called haha

-Civs will be friendly to each other....or at least the ones in the same group

-opfor will be guarding the area the civs are held in (done)

-either by running, picking up a weapon or leaving the area op-for and others will engage the civs and always fire on them after that point

Iv messed around with the this addRating -10000;...using different numbers and setting the op-for to hold fire....it worked for a bit....opfor would just hold their gun up...only shoot if shot(sometimes worked)...but when i increased the number of AI on both sides all hell broke loose. It also seems to work different depending on what op units i choose. Anyway, i realized that this addRating -2000; is basically the same as using 10000....and isn't going to work for me at all.

If someone can point me in the right direction that be great...

From what I've read on here messing with the civs hostility can make the game really buggy but even if what I'm trying to do isn't possible...maybe you can tell me what is?

BTW...the whole idea behind this is that the civs will be playing a jail break type game during an on going 3 way battle on Utes island. haha

Thanks!

---------- Post added at 23:41 ---------- Previous post was at 22:20 ----------

Just an update:

Im experimenting with these but they dont seem to be working? I'm confused if they should be on the civs init. or the opfor as well

I've set the civ as captive by using setCaptive as well as having the (this addrating) at the same time.

soldier1 addEventHandler ["fired",{(_this select 0) setCaptive false}] - should make him no longer be captive after firing a shot thus defaulting him back to the add rating of 10000

soldier1 spawn {waitUntil {!isNil primaryWeapon this};this setCaptive false} - should make him no longer captive after picking up a primary weapon

Share this post


Link to post
Share on other sites

Okay...I'm talking to my self at this point lol but maybe this will help someone or someone will have something to add....

setting my players addrating to -10000, setting captive to a single opfor unit and this line...soldier1 addEventHandler ["fired",{(_this select 0) setCaptive false}] works perfectly....

looks like i encountered some sort of bug with the previous unit type I choose....russian boss did not work...they would just disregard me.

Now I need to tackle the kill civ if running line of code....

Share this post


Link to post
Share on other sites
Okay...I'm talking to my self at this point lol but maybe this will help someone or someone will have something to add....

setting my players addrating to -10000, setting captive to a single opfor unit and this line...soldier1 addEventHandler ["fired",{(_this select 0) setCaptive false}] works perfectly....

looks like i encountered some sort of bug with the previous unit type I choose....russian boss did not work...they would just disregard me.

Now I need to tackle the kill civ if running line of code....

Hi dannyd488

Welcome to the forums :)

You will perhaps find some pointers in the work MadRussian did on making civs change sides - one thread is here:

Switching AI units from one Side to another -> Getting "Non-Reactive" units?

& if you search there are one or maybe two others he started.

Note that the bug he found was rapidly fixed, so what he (eventually) got to work might be useful to you.

NR

Orc

Share this post


Link to post
Share on other sites

No AI unit will shoot at civs.. to get around this the easiest thing to do is group them to whatever faction you need to, to get your your desired effect (blufor,opfor, gue).

when they are grouped to a different faction member they become that faction. so if civ gets grouped to bluefor and opfor is emeny to blufor, they will shot at them. in addition, AI will not find an unarmed unit of any kind (even if enemy) that much of a threat. they may still shoot and kill but sometimes they hesitate or even ignore.

to get around this, you add the -10000 rating to civs as well when the side is changed. this way enemy will see them as severe threat.

here's some more in depth detail that will help you

http://community.bistudio.com/wiki/Side_relations

notice at bottom it has an example of how to change a units side thru a script for ya.

and heres the script I use to change my civs to different faction

/*
   Change civ to blufor so opfor will shoot at them
-------------------------------------------------------------------
execute with: _civ = [name of unit] execVM "civBlufor.sqf";
if in units init line in editor, you can use this: _civ = [this] execVM "civBlufor.sqf";
*/

_unit = _this select 0;

_setEnemy = getPos _enemyPos;
_enemyPos setPos [0,5,0];

// Create the new unit
_eastCenter = createCenter west;
_dummyGroupEast = createGroup west;
_enemyUnit = _dummyGroupEast createUnit ["Drake",_setEnemy, [], 0, "COLONEL"]; 

[_unit] joinSilent _dummyGroupEast;
[_unit] joinSilent grpNull;

//Clear and delete enemy Unit
removeAllWeapons _enemyUnit;
{_enemyUnit removeMagazine _x;} forEach  magazines _enemyUnit;

deleteVehicle _enemyUnit;

Edited by Nimrod_Z

Share this post


Link to post
Share on other sites
No AI unit will shoot at civs.. to get around this the easiest thing to do is group them to whatever faction you need to, to get your your desired effect (blufor,opfor, gue).

when they are grouped to a different faction member they become that faction. so if civ gets grouped to bluefor and opfor is emeny to blufor, they will shot at them. in addition, AI will not find an unarmed unit of any kind (even if enemy) that much of a threat. they may still shoot and kill but sometimes they hesitate or even ignore.

to get around this, you add the -10000 rating to civs as well when the side is changed. this way enemy will see them as severe threat.

here's some more in depth detail that will help you

http://community.bistudio.com/wiki/Side_relations

notice at bottom it has an example of how to change a units side thru a script for ya.

and heres the script I use to change my civs to different faction

/*
   Change civ to blufor so opfor will shoot at them
-------------------------------------------------------------------
execute with: _civ = [name of unit] execVM "civBlufor.sqf";
if in units init line in editor, you can use this: _civ = [this] execVM "civBlufor.sqf";
*/

_unit = _this select 0;

_setEnemy = getPos _enemyPos;
_enemyPos setPos [0,5,0];

// Create the new unit
_eastCenter = createCenter west;
_dummyGroupEast = createGroup west;
_enemyUnit = _dummyGroupEast createUnit ["Drake",_setEnemy, [], 0, "COLONEL"]; 

[_unit] joinSilent _dummyGroupEast;
[_unit] joinSilent grpNull;

//Clear and delete enemy Unit
removeAllWeapons _enemyUnit;
{_enemyUnit removeMagazine _x;} forEach  magazines _enemyUnit;

deleteVehicle _enemyUnit;

Nice find!

Is there a way to make this work with the ambient civilian module? I want to populate a town, have OPFOR roll in and take over the town by force shooting *some* of the civilians. The rest of the civilians are spared as prisoners of the occupation, so to speak.

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
Sign in to follow this  

×