Jump to content
code34

Dynamic Civilian Life (DCL) scripts

Recommended Posts

6x2Ma3.jpg

Dynamic Civilian life (DCL) is a simple & efficient scripts that create civilians Life.

Dynamic Civilian life:

- create dynamic civilians life in all towns of map

- civilians pop only when players are near of their positions

- Mp compatible

[b]Usage:[/b]
	put the directory DCL in your mission directory
	put this code into your mission init.sqf
	[] execVM "DCL\init.sqf";

Information:

This script is a part of the civilian modules from WIT - ARMA2. All modules/functions of civilians modules from WIT are not distribute in this script.

Download:

https://www.dropbox.com/s/fb9pa2bh4iv69p9/dynamic_civilian_life_1.2.Altis.zip

Licence:

Under Gpl, you can share, modify, distribute this script but don't remove the licence and the name of the original author

[b]logs:[/b]
	1.2
		add HC client support
		add civilian side
		replace side detection by player detection (fix depop problem)
	1.1 
		MP support - tune optimization
		Fix side support 
	1.0 original version - pedestrian life on ALTIS

Github:

https://github.com/code34/dynamic_civilian_life.Altis

Edited by code34

Share this post


Link to post
Share on other sites

Ok this looks good.

Question about the performence in MP.

Is it possible to use this script without any problems?

Share this post


Link to post
Share on other sites

I made a few tests and it seems like your script only ever works if you play on "WEST". I tried changing the values in the init.sqf, but it doesn't matter what, only "WEST" spawns civs for me. Even if I edit the setTriggerActivation line in generate_zones.sqf directly.

/Edit: Found the error. You have various

(west countside list _active > 0)

in your script. Rewriting the west fixes it.

Btw. It would be fancy if you could also spawn a few cars here and there.

Edited by Lexx

Share this post


Link to post
Share on other sites

Fix 1.1 :

MP support - tune optimization

Fix side support

https://www.dropbox.com/s/ykdal6ygz9u1lwm/dynamic_civilian_life.Altis.zip

---------- Post added at 17:28 ---------- Previous post was at 17:27 ----------

Ok this looks good.

Question about the performence in MP.

Is it possible to use this script without any problems?

yes it s an MP script with cache feature

---------- Post added at 17:30 ---------- Previous post was at 17:28 ----------

I made a few tests and it seems like your script only ever works if you play on "WEST". I tried changing the values in the init.sqf, but it doesn't matter what, only "WEST" spawns civs for me. Even if I edit the setTriggerActivation line in generate_zones.sqf directly.

/Edit: Found the error. You have various

(west countside list _active > 0)

in your script. Rewriting the west fixes it.

Btw. It would be fancy if you could also spawn a few cars here and there.

fix in the 1.1.

For the cars, it s a first realase. I will check what could be ported from WIT A2.

Edited by code34

Share this post


Link to post
Share on other sites

WOWOWOW

Another great one CODE34 !!!

Thanks for the community

Share this post


Link to post
Share on other sites

Nice script works fine , would be nice to be able to add stuff to Spawned Civilians i.e add a EH to all civilains

_civ addEventHandler  ['killed',{_this execVM 'civdeath.sqf'}];

so we can do stuff like monitor kills etc... a Search option to them all so we can search them so we can interact with them , and be able to plant Intel % of them - just some food for thought :)

Share this post


Link to post
Share on other sites

Yeah works fine on HC with "West" parameter.

Thanks a lot Code34 !!!

You rule !!!

Share this post


Link to post
Share on other sites

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Hey code34,

first of all: Good work with the script! Love it but i encountered a problem concerning the multiplayer.

I have a PvP Mission called "Where is the Agent?" in which a team of independent have to hunt down an Agent (CSAT). I wanted to use your script so the agent is a bit harder to spot in the cities. But if for example the CSAT soldier kills 2-3 civilians the script wont work anymore (only for the CSAT soldier). Same happens with the Independent if you crash your UAV or kill to many civilians. So i think it has something to do with the typical AI behaviour, that you are set as an enemy if you kill to many Civilians and/or destroy your UAV. Regarding that it might be a BIS problem i don't know if you can fix the problem. Non or less i wanted to give you that feedback and it would be awesome if someone knew how to fix that or turn of the "set_as_enemy" if you kill civilians.

Share this post


Link to post
Share on other sites

You can set a killed EH to the spawned civ units.

_unit addEventHandler ["killed" _this call TAG_addRating];

and save this as a function:

TAG_addRating = 
{
    _pl = _this select 1;
    _pl addRating 10000;
};

Good work code34 btw :)

Share this post


Link to post
Share on other sites
Hey code34,

first of all: Good work with the script! Love it but i encountered a problem concerning the multiplayer.

I have a PvP Mission called "Where is the Agent?" in which a team of independent have to hunt down an Agent (CSAT). I wanted to use your script so the agent is a bit harder to spot in the cities. But if for example the CSAT soldier kills 2-3 civilians the script wont work anymore (only for the CSAT soldier). Same happens with the Independent if you crash your UAV or kill to many civilians. So i think it has something to do with the typical AI behaviour, that you are set as an enemy if you kill to many Civilians and/or destroy your UAV. Regarding that it might be a BIS problem i don't know if you can fix the problem. Non or less i wanted to give you that feedback and it would be awesome if someone knew how to fix that or turn of the "set_as_enemy" if you kill civilians.

The script doesn't drag SERVERFPS down when running on pvp mission?

Can you please monitor your SFPS vs number of players ?

Thanks

Share this post


Link to post
Share on other sites
You can set a killed EH to the spawned civ units.

_unit addEventHandler ["killed" _this call TAG_addRating];

and save this as a function:

TAG_addRating = 
{
    _pl = _this select 1;
    _pl addRating 10000;
};

Good work code34 btw :)

But where would you add that to this script ?

Share this post


Link to post
Share on other sites

This one would be wonderfull with HeadlessClient Support. Could be very well for serverFPS. :)

Share this post


Link to post
Share on other sites
This one would be wonderfull with HeadlessClient Support. Could be very well for serverFPS. :)

Tried it on HC : works well

Try changing "ANY" parameter to "WEST" : it helps a lot in saving your SFPS

Share this post


Link to post
Share on other sites
Hey code34,

first of all: Good work with the script! Love it but i encountered a problem concerning the multiplayer.

I have a PvP Mission called "Where is the Agent?" in which a team of independent have to hunt down an Agent (CSAT). I wanted to use your script so the agent is a bit harder to spot in the cities. But if for example the CSAT soldier kills 2-3 civilians the script wont work anymore (only for the CSAT soldier). Same happens with the Independent if you crash your UAV or kill to many civilians. So i think it has something to do with the typical AI behaviour, that you are set as an enemy if you kill to many Civilians and/or destroy your UAV. Regarding that it might be a BIS problem i don't know if you can fix the problem. Non or less i wanted to give you that feedback and it would be awesome if someone knew how to fix that or turn of the "set_as_enemy" if you kill civilians.

Just to report having the same issue if I kill more than 3 civilians they no longer spawn in any town and they ones that where in the same town disappear in front of your eyes

Share this post


Link to post
Share on other sites

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Not sure why but i have a EH "killed" added to civilians/ OPFOR etc... and after i kill 3 Civilians all my EH stop working ,Any idea why All my "Killed" EH stop working?

They all work fine until i add this script in so i know something in this script

BTW they no longer remove after i kill 3 civilians so that bit is fixed b:)

Share this post


Link to post
Share on other sites
BTW they no longer remove after i kill 3 civilians so that bit is fixed b:)

Are the civs with this script being cached and/or deleted at any point?

Edited by Iceman77

Share this post


Link to post
Share on other sites

yes, the units are cached, when they depop and after pop the handler had been delete.

if you want to use EH add them directly in the script at the pop point.

Share this post


Link to post
Share on other sites

I have it added @ line 119 in generate_zones.sqf

			_civil setvariable ["civilrole", (_x select 2), true];
			_civil setvariable ["destination", _position, false];
			_civil setvariable ["wcprotected", true, false];
			_civil addEventHandler  ['killed',{_this execVM 'civdeath.sqf'}];  

The EH fires fine and works on the first 3 civilians killed but the 3rd seems to stop working on any more kills and also removed my other EH on OPFOR ?

civdeath.sqf

_civ = _this select 0;
_killer =_this select 1;


private ["_killposition"];

if (isPlayer (_this select 1) AND side (_this select 1) == WEST ) then {

totalscore = totalscore  -150;
publicVariable "totalscore";

_whokiller = name _killer;
_text=format["Your side just killed a Civilian you just lost 150 Points your score is now.%1",str totalscore];
[_text, "new_fnc_MPhint", true, false] spawn BIS_fnc_MP; 

_cid = floor(random 10000);
_mname = format["killermarker%1",_cid];
_mname1 = format["Civilian killed by %1",_whokiller];
_marker =[_mname,_civ, "Icon", [1,1], "TEXT:", _mname1, "TYPE:", "mil_dot", "COLOR:", "ColorRed", "GLOBAL", "PERSIST"] call CBA_fnc_createMarker;
};

Share this post


Link to post
Share on other sites

you have a problem with your script. When you kill civil, your side change.

if (isPlayer (_this select 1) AND side (_this select 1) == WEST ) then { 

your condition doesnt work anymore.

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

×