Jump to content
Sign in to follow this  
tpw

TPW CIVS: ambient civilians and traffic for Arma 3

Recommended Posts

Just my vote but I really like having them in despite their homicidal/suicidal nature. Gives a little feeling of wild, unbridled life in the world -at least until we get some women....

Share this post


Link to post
Share on other sites
Excluding cars will be a little trickier, because although I can exclude certain kinds of road segments (eg runways) as traffic waypoints, I can't easily stop cars from using the excluded roads on their way between waypoints that aren't excluded. Better to just prevent any traffic spawning if the player is within eg 500m of a user defined location. For example, you could place game logics named TPW_CAR_EXC_1, TPW_CAR_EXC_2 etc on the areas you don't want civ traffic and the script will not spawn cars if you are within 500m of opne of these logics. I will attend to this shortly.

well i'm actually all about cars, for me atleast. as someone said, it's not totally unlikely to meet a civ in a military base. so having them spawn there isn't a problem. the problem is the crazy drivers ;) but don't worry about it. it's not game breaking or anything.

Share this post


Link to post
Share on other sites

@TPW,

I've found that if the car was broken, and the AI driver was still alive, then the car would vanish before my eyes. I test it by shooting the tire. If I just shoot the driver dead, the car didn't vanish, then I could took the car for a drive, but after I getting off the car, the empty car vanished promptly.

Another thing I do hope you could improve is the civilian's reaction to war zone, they basically ignore the danger of being hit and walk peacefully until there is a bullet hit his surrounding ground, this is not realistic.

What I mean is that if there is confllict happens in the town, once the civilian hear the fire, they should shout, flurry, flee out of town or run back into the houses and lock the doors.

Share this post


Link to post
Share on other sites
@TPW,

I've found that if the car was broken, and the AI driver was still alive, then the car would vanish before my eyes. I test it by shooting the tire. If I just shoot the driver dead, the car didn't vanish, then I could took the car for a drive, but after I getting off the car, the empty car vanished promptly..

Ok thanks for that, I am still looking!

Another thing I do hope you could improve is the civilian's reaction to war zone, they basically ignore the danger of being hit and walk peacefully until there is a bullet hit his surrounding ground, this is not realistic.

What I mean is that if there is confllict happens in the town, once the civilian hear the fire, they should shout, flurry, flee out of town or run back into the houses and lock the doors.

TPW EBS and WW AICOVER do exactly what you're asking :).

Share this post


Link to post
Share on other sites

Just noticed btw TPW, there is a spelling error in the script for civi.

2 - Call it with 0 = [1,5,150,15,10] execvm "tpw_civ.sqf";

Where it should be;

2 - Call it with 0 = [1,5,150,15,10] execvm "tpw_civs.sqf";

Was a 10min headache this morning, when I knew I just had to do that few days ago... hehe. Just a fyi :)

Share this post


Link to post
Share on other sites
Just noticed btw TPW, there is a spelling error in the script for civi.

Where it should be;

Was a 10min headache this morning, when I knew I just had to do that few days ago... hehe. Just a fyi :)

Thanks mate, will fix. Like the way I outsource my Quality Assurance? :)

Share this post


Link to post
Share on other sites
Thanks mate, will fix. Like the way I outsource my Quality Assurance? :)

Don't forget; In Russia, Quality Assurance outsources you ;)

Really enjoying this one tpw. Muchas gracias :)

Share this post


Link to post
Share on other sites

TPW CIVS v1.05: https://dl.dropboxusercontent.com/u/481663/TPW_CIVS_105.zip

Changes:

  • Civilians now only spawn at and travel between habitable buildings (class: land_i_house_)
  • Added traffic exclusion capability

Hi guys. Hopefully no more civs running or driving around bases etc. Please change tpw_civ_density[/b to a lower number to reflect that there are fewer habitable houses for them to spawn into. If you had it at 15, lower it to 5.

Share this post


Link to post
Share on other sites
TPW CIVS v1.05: https://dl.dropboxusercontent.com/u/481663/TPW_CIVS_105.zip

Changes:

  • Civilians now only spawn at and travel between habitable buildings (class: land_i_house_)
  • Added traffic exclusion capability

Hi guys. Hopefully no more civs running or driving around bases etc. Please change tpw_civ_density[/b to a lower number to reflect that there are fewer habitable houses for them to spawn into. If you had it at 15, lower it to 5.

-----Have you tweaked the car abruptly vanish thing?

Share this post


Link to post
Share on other sites
-----Have you tweaked the car abruptly vanish thing?

I've tried to, but I'm having trouble reproducing it. I might add some additional conditions to see if that helps.

Share this post


Link to post
Share on other sites

Mr Sir,

playing on DEV 109860

CIVS Addon 105

SP Editor / preview

CBA / dfs 3rd person / sthud / TPW Fall Civs Ebs / (and, per your suggestion; WWAICover)

'...ount tpw_civ_houses)));
_wp = getposasl |#|_house; 
_grp addwaypoint [_wp, 0];
[_grp...'
Error Undefined variable in expression; _house
File TPW_CIVS\tpw_civs.sqf, line 95

I was spawned in what appears to be a soccer field at 036133, on Altis

Also, on a previous test run, based on earlier posts in this thread, I tried shooting and killing a civ driver that came driving by - then all I did was turn my back to him and the car for 1 second and turned around again, and he and the car had disappeared. I realize this might not be a 'bug', but perhaps it's not ideal. Maybe wait until not only is driver dead and car not in my line of sight, but perhaps also wait until car with dead driver is a certain distance from me before deleting him. I don't normally play that way (shooting civs), just wanted to see if it happens that way.

PS - I fully respect and expect you to make/code/conjure what it is that interests you (its good to be the chef), but please consider working a civ kill counter option into your mod. So that those of us who would like the additional gameplay challenge of identifying target first, then shooting, can be forced to avoid killing civilians as we go about our missions.

Edited by R.Flagg

Share this post


Link to post
Share on other sites

TPW CIVS v1.06: https://dl.dropboxusercontent.com/u/481663/TPW_CIVS_106.zip

Changes:

  • Undefined variable bugfix
  • Cars will not be removed if less than 100m from the player, regardless of their visibility status

@R.Flagg: Thanks so much for the detailed report of that bug, which I have tracked down and squashed with extreme prejudice. It was related to the new house screening functions.

Given how flaky the visibility calculations are at present (ie cars should not be despawned if you are looking at them), I have added an extra distance condition, so they won't ever be despawned if closer than 100m to the player. I had a fun time shooting up civ cars and didn't get any disappearing, so it seems to work.

Lastly, if you can tell me what sort of civ counter functionality you'd like, I can certainly try to work it in.

Share this post


Link to post
Share on other sites

That's very kind of you, Thanks!

Something very basic, that simply counts how many civs have been killed by the good guys. And allows us to end mission with a mission failure when X number of civs have died. Preferably not counting civs who have died by walking in buildings, as does happen with certain long-time Arma bug(s), or stuff like that. Just civs killed by the player or players team. With a config setting that allows player to select how many before setting is reached. I almost always play as west, but if you want to add a config option for that, ya know, that might be cool.

And of course the wheel was invented already, in various forms. For example the great and mighty Shuko did a version in A2, but it I guess depended on civs being either editor placed, or spawned by ALICE, I forget which. But I could not get that wheel to fit on the rim of your mod, so to speak sorta.

http://forums.bistudio.com/showthread.php?109166-Civilian-kill-Counter&p=1785626&viewfull=1#post1785626

Headed off to visit my dear old Mom for the weekend, will report back with more play test results in day or two. Thanks again for being so generous in sharing your time and talent.

Share this post


Link to post
Share on other sites
Good update. If possible I'd like to set the distance to 500m regardless of their visibility status.

No worries, I'll write that distance in as a configurable variable for the next release.

PS Really liking the blood mist addon!

---------- Post added at 18:39 ---------- Previous post was at 18:38 ----------

That's very kind of you, Thanks!

Something very basic, that simply counts how many civs have been killed by the good guys. And allows us to end mission with a mission failure when X number of civs have died. Preferably not counting civs who have died by walking in buildings, as does happen with certain long-time Arma bug(s), or stuff like that. Just civs killed by the player or players team. With a config setting that allows player to select how many before setting is reached. I almost always play as west, but if you want to add a config option for that, ya know, that might be cool.

And of course the wheel was invented already, in various forms. For example the great and mighty Shuko did a version in A2, but it I guess depended on civs being either editor placed, or spawned by ALICE, I forget which. But I could not get that wheel to fit on the rim of your mod, so to speak sorta.

http://forums.bistudio.com/showthread.php?109166-Civilian-kill-Counter&p=1785626&viewfull=1#post1785626

Headed off to visit my dear old Mom for the weekend, will report back with more play test results in day or two. Thanks again for being so generous in sharing your time and talent.

OK Prof Flagg, shall be done.

Share this post


Link to post
Share on other sites

Another great addition tpw, good stuff. I had a play with the script version in the editor. I had to manually set _ishouse = true to get it to work on All In Arma maps. Just a request, could you maybe add randomized hats, glasses and maybe occasional backpacks to the civs? It would help with variety.

Looking forward to your next stroke of genius.

Share this post


Link to post
Share on other sites

Civ vehicles basically floor it everywhere they go and it looks weird. Can the waypoints be made with a limited speed value?

Share this post


Link to post
Share on other sites

Super great! Is there anyway you could include a way to edit the parameters- either in or out of game? I really want to be able to crank up the number of pedestrians.

Share this post


Link to post
Share on other sites
Super great! Is there anyway you could include a way to edit the parameters- either in or out of game? I really want to be able to crank up the number of pedestrians.

You can change the number in the userconfig file.

Share this post


Link to post
Share on other sites
Civ vehicles basically floor it everywhere they go and it looks weird. Can the waypoints be made with a limited speed value?

Good call mate. I've added an additional check so that cars are set to speedmode "limited" when within a defined radius of the player, and it seems to work OK to prevent the worst suicidal behaviour, especially from trucks/vans. I'll release it soon along with some other bugfixes.

Share this post


Link to post
Share on other sites

TPW CIVS v1.07: https://dl.dropboxusercontent.com/u/481663/TPW_CIVS_107.zip

Changes:

  • Cars will now drive with limited speed within 150m of player
  • Total and squad inflicted civilian casualties are counted, and will end a mission if they exceed a defined threshold
  • Bugfixes

Cars should no longer drive like total kamikazes when near the driver! However, they still crash and injure the driver with some regularity. These count towards civilian casualties.

Please note, you will need to update your userconfig\TPW_CIVS\TPW_CIVS.hpp to include the new variables for civilian casualty handling.

Share this post


Link to post
Share on other sites

What i noticed when playing with your script is that if i destroy a car and turn around and turn back it gets removed even when still in range (but above 100 meters min distance). This had to do with the speed check which i had to remove to not have cars dissapear that quick.

Share this post


Link to post
Share on other sites

Would it be possible to incorporate something like stopping those civilians (if you have to contain the area with your troops, you obviously stop all civilian cars and personnel from moving in)?

Thanks

Share this post


Link to post
Share on other sites

^^ then there is no point in using this addon at all then. The idea here is that it keeps the island alive.

Share this post


Link to post
Share on other sites

tpw_animals.jpg

Hi guys. As promised, here is my attempt at an ambient animals system. It's script only for the time being:

/* 
AMBIENT ANIMALS
Author: tpw 
Date: 20130908
Version: 1.00

   - This script will gradually spawn animals, up to a maximum specified, within a specified radius of the player.
- Animals will not spawn into water, onto roads or too near buildings.
   - Animals will exhibit their default behaviours (moving, eating etc).
- Animals will be removed if beyond a specified distance from the player.
   - If an animal is killed another will spawn.

Disclaimer: Feel free to use and modify this code, on the proviso that you post back changes and improvements so that everyone can benefit from them, and acknowledge the original author (tpw) in any derivative works.     

To use: 
1 - Save this script into your mission directory as eg tpw_animals.sqf
2 - Call it with 0 = [1,10,15,250,75] execvm "tpw_animals.sqf"; where 1= start hint, 10 = start delay, 15 = maximum animals near player, 250 = animals will be removed beyond this distance, 75 = minimum distance from player to spawn an animal

THIS SCRIPT WON'T RUN ON DEDICATED SERVERS
*/

if (isDedicated) exitWith {};
if (count _this < 5) exitwith {"TPW ANIMALS incorrect/no config, exiting."};
if (_this select 3 == 0) exitwith {};

// READ IN VARIABLES
tpw_animal_hint = _this select 0; // Start hint. 0 = no hint
tpw_animal_sleep = _this select 1; // Delay until animals start spawning
tpw_animal_max = _this select 2; // maximum animals near player
tpw_animal_maxradius = _this select 3; // distance beyond which animals wil lbe removed
tpw_animal_minradius = _this select 4; // minimum distance from player to spawn animals

// HINT
sleep tpw_animal_sleep;
if (tpw_animal_hint == 1) then
{
0 = [] spawn 
	{
	sleep  2;
	hintsilent "TPW ANIMALS 1.00 active";
	sleep 2;
	hintsilent "";
	};	
};

// VARIABLES
tpw_animals = [["Hen_random_F",3],["Hen_random_F",3],["Alsatian_random_F",1],["Fin_random_F",1],["Sheep_random_F",4],["Goat_random_F",4],["Sheep_random_F",4],["Goat_random_F",4]]; // animals and max flock size
tpw_animal_debug = false; // debugging
tpw_animal_array = []; // array of animals near player

// SPAWN ANIMALS INTO APPROPRIATE SPOTS
tpw_animal_fnc_spawn =
{
private ["_group","_pos","_dir","_posx","_posy","_randpos","_type","_animal","_iswater","_roads","_land","_typearray","_type","_num","_cantsee"];
_group = createGroup Civilian;
_pos = getposasl player;

//Check that spawn posistion is not water, house or road
waituntil 
	{
	_dir = random 360;
	_posx = ((_pos select 0) + ((tpw_animal_minradius + (random tpw_animal_minradius)) * sin(_dir)));
	_posy = ((_pos select 1) + ((tpw_animal_minradius + (random tpw_animal_minradius)) * cos(_dir)));
	_randpos = [_posx,_posy,0]; 
	_isWater = surfaceIsWater _randpos;
	_roads = _randpos nearRoads 5;
	_land = nearestObjects [_randpos, ["land"], 5];
	(!(_iswater) && (count _roads == 0) && (count _land == 0));
	};

// Select animal
_typearray = tpw_animals select (floor (random (count tpw_animals)));
_type = _typearray select 0;
_num = ceil (random (_typearray select 1));

// Spawn flock
for "_i" from 1 to _num do 
	{
	sleep random 3;
	_animal = createAgent [_type,_randpos, [], 0, "NONE"];
	_animal setdir random 360;
	tpw_animal_array set [count tpw_animal_array,_animal]; // add to player's animal array
	};
};

// MAIN LOOP
while {true} do
{
if (tpw_animal_debug) then
	{
	hintsilent format ["Animals: %1",count tpw_animal_array];
	};

tpw_animal_removearray = [];

// Spawn animals if not enough
if (count tpw_animal_array < tpw_animal_max) then
	{
	[] spawn tpw_animal_fnc_spawn;
	};

	{
	// Remove distant animals
	if (_x distance player > tpw_animal_maxradius) then 
		{
		tpw_animal_removearray set [count tpw_animal_removearray,_x];
		deletevehicle _x;
		};

	// Remove dead animals from player array, leave carcass		
	if !(alive _x) then 
		{
		tpw_animal_removearray set [count tpw_animal_removearray,_x];
		};	
	} foreach tpw_animal_array; 

// Update player's animal array	
tpw_animal_array = tpw_animal_array - tpw_animal_removearray;	
sleep random 10;
};

Basically this just spawns appropriate sized flocks of the various BIS animals (dogs, chickens, sheep, goats) around the player, and then lets them get on with their default behaviours - moving, eating, running away if you get too close etc. They won't spawn too near the player, into water, onto roads, or too near houses. Animals will be removed once they are more than a specified distance from the player. If you kill one, another animal will soon spawn to keep the numbers up. You might see a distant animal pop into existence occasionally, but in the scheme of texture pop in, LOD switching etc, I think you'll find it bearable.

The effect is pretty subtle (the island isn't a wildlife park), but generally every few minutes you'll see a few animals. I'm going with the Altis storyline that has social breakdown and thus unmaintained farms and animals everywhere, including towns.

Please test it out and if there are no glaring issues, I'll bundle it up into an addon. I'll probably look at adding some sound fx too if I can find some.

Edited by tpw

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×