Jump to content
Sign in to follow this  
TRexian

JTD Ambient Civilian Traffic module

Recommended Posts

Update:

Ver. 01e available:

http://www.mediafire.com/file/moy5e2zmz0h/JTD_ACTON_01e.7z

Thanks to the mirrors:

Armaholic mirror:

- JTD Ambient Civilian Traffic module RC 01e

Oh - and we'll just call this a "release" version. :D If something's wrong, I'll just do my best to fix it. No sin in having a hotfix, eh? :D

Details/changelog at the bottom.

----------------------

The idea for this was born of the great work BI did on the civilian modules. With civs and vehicles in the same town, it only made sense to have them drive around. (There is a small - VERY small - chance of this when you put the ALICE and SILVIE modules in together, but it wasn't enough for me.) :)

So, I developed this. It relies on the ALICE module to spawn the civs and vehicles. I consider this a public release candidate. If there are no issues, I'll just update from here. (Fingers crossed.)

Link to download (mirrors are welcome):

<<old links removed>>

Implementation:

Place the ALICE module. Look further down in the module list and find the JTD Ambient Civilian Traffic module and place it on the map. It is optional to then also use the Ambient Civilian Traffic module. Also, some vehicles will have passengers. Also, some vehicles will have AK-47s. :)

It probably requires CBA/XEH. And, if you don't have it anyway, you probably should.

It *MIGHT* actually be MP compatible out of the box. Should be run on the server, as if it is run on a client, it should exit without doing anything (or more accurately, only execute the substantive parts if it is being run on a server). The package contains signature/key thingies, but I've never built a package like that before, so I may have goofed it up.

The installation is a bit tricky - you not only need an addon folder for the pbo, but a userconfig\JTD folder for a hpp that has a bunch of configurable settings. From the readme:

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

Installation:

The archive contains a folder structure \@JTD\addons - simply extract the archive someplace and place the @JTD folder in your ArmA2 root folder. There is also a folder structure for \userconfig\JTD - place the userconfig folder in your ArmA2 root folder, also. There is also a \keys\ folder that contains the JTD bikey - place this file in the \keys\ folder in your ArmA2 root folder.

(This is the same installation as the JTD_FireAndSmoke addon, which you should already have.) ;)

Youtube vid:

Thanks to:

JTD

-- DMarkwick

-- ReconPathFinder

OFPEC

SNKMAN for modulizing posts

Rommel @ OFPEC for ideas

public testing:

DTM2801

neokika

Master gamawa

Chunk3ym4n

DTM2801

---------------------------------

Ver. 01e

Added ability for mission makers to force settings. By placing a game logic with certain global variables set, it will override the hpp values:

JTD_percSpawn = JTD_ACTON_percent;

JTD_maxSpawn = JTD_ACTON_max;

JTD_maxCargo = JTD_ACTON_maxCargo;

JTD_minCargo = JTD_ACTON_minCargo;

JTD_civAK = JTD_ACTON_civAK;

JTD_civArray = JTD_ACTON_civs;

JTD_cars = JTD_ACTON_DEFAULT_vehicles;

Edited by TRexian
updated version to 01e

Share this post


Link to post
Share on other sites

Trying this now.. Many thanks!! I hope it save's me some time placing them on my own.

We luv you.. :D

Share this post


Link to post
Share on other sites

This is a damn good thing. I immediately saw civilians driving and a few with aks

Share this post


Link to post
Share on other sites

I guess it only work on Utes and Cherna, like the ALICE module? Tested ALICE on other custom island but never any civilians created.

Just to be sure. :) Thanks for the addon!

Alex

Share this post


Link to post
Share on other sites

Fromm CAA1 thread:

If someone from the community, maybe you?, is willing to look into it how it works

and adapt the worlds, it will. ;)

I think I have manage it somehow to make ALICE work.. not SILVIE yet though... and in the editor. I dont know how to edit the world.

So here's what I did:

Map Sahrani, Modesta

1. Put in Game Logic>Location>City Center at just about the center of modesta, and name it 'Modesta'. In the init field type in :

["CityCenter",[getPos this,1000]] call bis_fnc_locations;

2. Put in ALICE module and in the init field type in :

this setvariable ["townlist",[Modesta]]; 

3. Wait for a while and explore the town... some folks will appear.

So there you go. But this is in the editor, so if for the whole island automatically, I think have to tinker with the configs, but I think that is out of my small head

[edit]

Just tested with SILVIE, it works the same way:

Step #2. Put in SILVIE module and in the init field type in :

this setvariable ["townlist",[Modesta]]; 

[/Quote]

I'm at work so cannot test it now. Have a try and see if it works?

Share this post


Link to post
Share on other sites

Thanks, guys!

I haven't tried it on any custom islands, but it is ALICE-dependent, so if ALICE doesn't work, then this won't either, most likely.

Share this post


Link to post
Share on other sites

I've tried adding ALICE capability to a test island - seems to be working fine...

It's basically the same idea - each location is given a tag such as CityCentre, etc and some demographic figures for types of civ, etc... they spawn from closed houses within the tagged area...

I would guess most forthcoming islands will be ALICE-capable, currently released islands which don't already work would require a config patch with the appropriate data (assuming appropriate closed buildings are already present in the desired locations)...

B

Share this post


Link to post
Share on other sites

Maybe i used the ALICE module wrong then? I just plopp it out. Not synching to myself. Dont think i needed to do that before. Maybe im wrong. Tested standard Ambient Animal, ALICE and the CIVCAR modules on Japhato and Everon, and only thing i see is from the animal module.

So i just wondered if this addon tapped in and made it work everywhere. Ill test it when i get home on Cherna and Utes though. Thanks TRexian and DMarkwick. :)

Alex

Share this post


Link to post
Share on other sites

RE: the new islands - I'm a big fan of the new location function(s). They do, however, require some additional config settings (like "neighbors"). For larger islands, that would be very time-consuming, I think. More than likely, those are the settings required by ALICE and SILVIE.

Thanks for the mirrors and the use, guys. Will wait a week or so and see if there's any feedback (particularly in MP missions). If it is all good, I may do a couple tweaks, then do a "real" release version.

---------- Post added at 02:46 PM ---------- Previous post was at 01:23 PM ----------

There have been some requests for the scripts I used, and because I spend so much time learning from what other people do, I wanted to post my methodology.

First, the config. I really have to thank SNKMAN (not the PMC SnakeMan, although I owe alot of thanks to him, too) for the posts he made about how to set up a config for a model.

The hpp that sets up the user settings:

//Config settings for JTD_ACTON - ambient civilian traffic module.

// define percentage (zero to 1) of ALICE-spawned civs that will spawn traffic
// value greater than 1 becomes 1
// default is 1

#define JTD_ACTON_percent 1

// Traffic maximum concurrent vehicles allowed.
// default 50

#define JTD_ACTON_max 50

// Max cargo allowed percentage (zero to 1) - will modify randomization of cargo amount
// default 1

#define JTD_ACTON_maxCargo 1

// Minimum cargo allowed percentage (zero to 1) - will modify randomization of cargo amount
// default 0

#define JTD_ACTON_minCargo 0

// default vehicles
// can add custom vehicles by adding the "name"
// note that if you add a vehicle with a "crew" (like a military vehicle) the entire crew will spawn

#define JTD_ACTON_DEFAULT_vehicles ["Ikarus", "hilux1_civil_1_open", "hilux1_civil_2_covered", "hilux1_civil_3_open", "Lada1", "Lada2", "LadaLM", "car_hatchback", "car_sedan", "datsun1_civil_1_open", "datsun1_civil_2_covered", "datsun1_civil_3_open", "Skoda", "SkodaBlue","SkodaRed", "SkodaGreen", "tractor", "tractorOld", "UralCivil", "UralCivil2", "VWGolf", "TT650_Civ"]

// default civilians
// can add custom civs by adding the "name"

#define JTD_ACTON_civs ["Assistant", "Citizen4", "Profiteer2", "Functionary1", "Functionary2", "Citizen1", "Citizen2", "Citizen3", "Doctor", "Profiteer1", "Profiteer3", "Profiteer4", "RU_Assistant", "Rocker1", "Rocker2", "Rocker3", "Rocker4", "SchoolTeacher", "Villager1", "Villager2", "Villager3", "Villager4", "Woodlander1", "Woodlander2", "Woodlander3", "Woodlander4", "Worker1", "Worker2", "Worker3", "Worker4"]

// Define percentage (zero to 1) of time spawned civ will be armed with AK
// default is .5; make 0 if no civs to be armed
#define JTD_ACTON_civAK .5

My config:

class CfgPatches
{
class JTD_ACTON
{
	units[] = {};
	weapons[] = {};
	requiredVersion = 1.0;
	requiredAddons[] = {"CAData", "CA_Modules"};
};
};

class CfgVehicles
{
class Logic;

class JTD_ACTON : Logic
{
displayName = "JTD Ambient Civilian Traffic";
icon="\JTD_ACTON\JTD_ACTON_icon.paa";
picture="\JTD_ACTON\JTD_ACTON_icon.paa";
vehicleClass = "Modules";

class Eventhandlers
{
// for release
 init = "if (isNil ""JTD_ACTPath"") then {JTD_ACTPath = ""\JTD_ACTON\""; _this execVM (JTD_ACTPath+""JTD_ACTON_init.sqf"") } else { _this execVM (JTD_ACTPath+""JTD_ACTON_init.sqf"") } ";
 // for development@@
 //  init = "if (isNil ""JTD_ACTPath"") then {JTD_ACTPath = ""\@JTD\addons\testing\""; _this execVM (JTD_ACTPath+""JTD_ACTON_init.sqf"") } else { _this execVM (JTD_ACTPath+""JTD_ACTON_init.sqf"") } ";
};
};
};

Pretty simple. It just sets up the patch and uses the init eventhandler to start the substantive scripts. The most interesting part about it is the development path. Based on threads here, the development version points to a location that I can change the scripts without exiting the game. Just hit ESC, make changes to the script, then re-start the mission.

Then, the init script for the module itself. This runs once, and places init code in each ALICE-placed civ.

//#include "\userconfig\JTD\JTD_ACTON_config.hpp"
private ["_list"];

JTD_ACTON_SILVIE = false;

// only run on server
if (isServer) then
{
diag_log text "ACTON init.";

// waituntil functions and ALICE are loaded
waituntil {!isnil "BIS_fnc_init"};
waituntil {!isNil "BIS_alice_mainscope"};

// if functions aren't loaded, but waited too long, then exit (or try)
if (isNil "BIS_fnc_init") exitWith
{
diag_log text "Error initializing BIS funcions.";
};

// if ALICE isn't loaded, but waited too long, then exit (or try)
if (isNil "BIS_alice_mainscope") exitWith
{
diag_log text "Error initializing ALICE.";
};

// testing with SILVIE
if !(isNil "BIS_SILVIE_Mainscope") then
{
JTD_ACTON_SILVIE = true;
diag_log text "Civ vehicles present.";
}
else
{
JTD_ACTON_SILVIE = false;
diag_log text "Generating civ vehicles.";
};


// initializes car count
	JTD_ACTON_carCount = 0;


//====================================================
// set ALICE init parameters for each civ	
[
bis_alice_mainscope,
"ALICE_civilianinit",
[{
//[_this] execVM "\@JTD\addons\testing\JTD_ambientCivTraffic.sqf"; // for testing @@
[_this] execVM (JTD_ACTPath+"JTD_ambientCivTraffic.sqf");
}]
] call bis_fnc_variablespaceadd;

diag_log text "init ended.";

};

This is the init code. At the top, I played with the idea of getting the hpp values here and passing them to each civ. But, that got too complicated, and in some ways defeated the purpose of having it. I do think that this would be the place, though, to allow mission-makers to "freeze" the values. A conditional could be set that would then influence the spawned civs as to whether to use the hpp values or the mission-maker ones. There's also some error-checking type stuff at the top, and it should only run on a server.

Also, it took alot of tries to figure out how to do the civ-init code properly.

I toyed with the idea of using SILVIE vehicles and just spawning the driver. Couldn't get that to work right, though, so left it out, basically!

The meat of the module is this:

//diag_log text "ACT started";
_civSide = createCenter civilian;

// intitialization stuff
#include "\userconfig\JTD\JTD_ACTON_config.hpp"	// testing whether this is necessary if it is in the init

private ["_civ", "_keeplooping", "_fillSlots", "_percSpawn", "_maxSpawn", "_maxCargo", "_minCargo", "_civAK", "_civArray", "_cars", "_rand", "_loc", "_locCar", "_dir", "_carSelect", "_spawn", "_car", "_grp", "_driver", "_civPos", "_list", "_citySel", "_destPos", "_dist", "_posX", "_posY", "_wpPosTemp", "_wpPos", "_wp1", "_newPos", "_wp2", "_counter", "_pos", "_roads", "_locSpawn", "_cargoNum", "_cargoMax", "_cargoMin", "_cargoDiff", "_locGr", "_cargo", "_carPos", "_nearList", "_wpX"];


_civ = _this select 0;
_keeplooping = true;
_fillSlots = 0;
// set carSelect?
// get the hpp values
_percSpawn = JTD_ACTON_percent;
_maxSpawn = JTD_ACTON_max;
_maxCargo = JTD_ACTON_maxCargo;
_minCargo = JTD_ACTON_minCargo;
_civAK = JTD_ACTON_civAK;
_civArray = JTD_ACTON_civs;

_cars = JTD_ACTON_DEFAULT_vehicles;

//diag_log str _percSpawn;

// some error checking
//  ====================================================
// catch in case someone deletes the vehicle array
if ((count _cars) <= 0) then
	{
		_cars = ["tractorOld"];
		diag_log text "Smart like tractor.";
	};

if (JTD_ACTON_maxCargo > 1) then {_maxCargo = 1};
if (JTD_ACTON_minCargo < 0) then {_minCargo = 0};
if (JTD_ACTON_maxCargo < 0) then {_maxCargo = 0};
if (JTD_ACTON_minCargo > 1) then {_minCargo = 1};
// ====================================================


waituntil {!isnil "bis_fnc_init"};

// check to make sure current count is less than max count
// diag_log str JTD_ACTON_carCount;
// diag_log str _maxSPawn;

_rand = random 1;
//diag_log text format ["Random %1", _rand];
// conditional to see if car spawns - less than max and within percentage
// car count less than max and random less than hpp percentage
if ((JTD_ACTON_carCount < _maxSpawn) && (_rand < _percSpawn)) then
{
JTD_ACTON_carCount = JTD_ACTON_carCount + 1;
//diag_log text "carcount";
// log count to rpt

// spawn vehicle near civ
_loc = getPos _civ;


// select location - either near the civ or outside the city, coming in
// values will likely need to be tweaked
// 50% chance of spawning intown
_rand = random 1;
if (_rand < .5) then
{
//diag_log text "ACT in town";
	// _locCar = _loc findEmptyPosition [10, 100];
	// sleep .2;

	_dir = random 360;
//diag_log text "direction";
	_carSelect = _cars call BIS_fnc_selectRandom;
	sleep .4;
	_locCar = _loc findEmptyPosition [10, 200];
	sleep .4;
	//diag_log text format ["loc %1 car %2", _locCar,_carSelect];
	_spawn = [_locCar, _dir, _carSelect, civilian] call BIS_fnc_spawnVehicle;
	_car = _spawn select 0;
	_grp = _spawn select 2;
	_driver = leader _grp;


	// determine if civ is armed
	if (_civAK > 0) then
	{
		_rand = random 1;
		if (_rand < _civAK) then
		{
			_driver addMagazine "30Rnd_762x39_AK47";
			_driver addMagazine "30Rnd_762x39_AK47";
			_driver addWeapon "AK_47_M";
		};
	};


		_civPos = getPos _civ;
		_list = ["CityCenter",[_civPos,3000],true] call bis_fnc_locations;		// set bool to false for release?
		sleep .2;
		_citySel = _list call BIS_fnc_selectRandom;
		_destPos = getPos _citySel;
		// get wp around destination city first time through
			_dir = random 360;
			_dist = (random 100);
		//_dist = 1;
		_posX = (_destPos select 0) + sin (_dir) * _dist;
		_posY = (_destPos select 1) + cos (_dir) * _dist;
		_wpPosTemp = [_posX, _posY, 0];

		_wpPos = [_wpPosTemp, 0, 100, 10, 0, .5, 0] call BIS_fnc_findSafePos;
		sleep .2;

		_wp1 = _grp addWaypoint [_wpPos, 50];
		_wp1 setWaypointSpeed "NORMAL";
		_wp1 setWaypointType "MOVE";
		_wp1 setWaypointCompletionRadius 20;


		_newPos = [_wpPos, 150, 500, 5, 0, .5, 0] call BIS_fnc_findSafePos;
		_wp2 = _grp addWaypoint [_newPos, 50];
		sleep .1;
		_wp2 setWaypointSpeed "NORMAL";
	//	_wp2 setWaypointType "CYCLE";
		_wp2 setWaypointType "DISMISS";
		_wp2 setWaypointCompletionRadius 20;
};
// 50% chance of spawning out of town
if (_rand > .5) then
//	if (_rand > 1) then
{
//diag_log text "ACT out of town";
	// place vehicle away from city
	_counter = 0;

	while {counter == 0} do		// make this whole thing in the while conditional?
	{
	_dir = random 360;
		_dist = (random 100) + 200;		// should probably get direction to neighbors, but, not a big deal at this point
	_posX = (_loc select 0) + sin (_dir) * _dist;
	_posY = (_loc select 1) + cos (_dir) * _dist;
	_pos = [_posX, _posY, 0];
	_roads = _pos nearRoads 100;		// can tweak distance
	_counter = count _roads;
	};
		_dir = random 360;
		_locSpawn = getPos (_roads select 0);

		_carSelect = _cars call BIS_fnc_selectRandom;
		sleep .4;
		_spawn = [_locSpawn, _dir, _carSelect, civilian] call BIS_fnc_spawnVehicle;
		sleep .4;
		//diag_log text _spawn;
		_car = _spawn select 0;
		_grp = _spawn select 2;
		_driver = leader _grp;

	// determine if civ is armed
	if (_civAK > 0) then
	{
		_rand = random 1;
		if (_rand < _civAK) then
		{
			_driver addMagazine "30Rnd_762x39_AK47";
			_driver addMagazine "30Rnd_762x39_AK47";
			_driver addWeapon "AK_47_M";
		};
	};

		// get a position near the original civilian and make a dismiss waypoint

	_dir = random 360;
	_dist = random 50;
	_posX = (_loc select 0) + sin (_dir) * _dist;
	_posY = (_loc select 1) + cos (_dir) * _dist;
	_pos = [_posX, _posY, 0];
		_wpPosTemp = [_posX, _posY, 0];

		_wpPos = [_wpPosTemp, 0, 100, 10, 0, .5, 0] call BIS_fnc_findSafePos;
		sleep .2;

		_wp1 = _grp addWaypoint [_wpPos, 50];
		_wp1 setWaypointSpeed "NORMAL";
		_wp1 setWaypointType "DISMISS";
		_wp1 setWaypointCompletionRadius 20;

};

// determine if there is cargo area for vehicle
// work in minimum/maximum
_cargoNum = _car emptyPositions "cargo";
if (_cargoNum > 0) then 
{
_fillSlots = 0;
	_cargoMax = round (_cargoNum * _maxCargo);
	_cargoMin = round (_cargoNum * _minCargo);
	_cargoDiff = abs (_cargoMax - _cargoMin);	// some joker might invert the numbers
	// random number from difference between max and min, then plus min
	_rand = round (random _cargoDiff);
	_fillSlots = _rand + _cargoMin;
	//diag_log text format ["cargo max %1 min %2 fill %3", _cargoMax, _cargoMin, _fillSlots];
	if (_fillSlots > 0) then
	{
		if (_fillSlots > _cargoNum) then {_fillSlots = _cargoNum;}; 		// in case of mathematical oddity
		sleep .2;
		//_loc = getPos _civ;
		_locGr = _loc findEmptyPosition [10, 100];
			sleep .2;
		if (_locGr select 0 > 0)then
		{
		//diag_log text format ["loc  %1 min %2 fill %3", _locGr, _cargoMin, _fillSlots];
		_cargo = [_locGr, CIVILIAN, _civArray,[],[],[],[],[_fillSlots, 0], 10] call BIS_fnc_spawnGroup;
		sleep .4;
		// log to rpt
		//diag_log text format ["cargo assigned %1 %2 fill %3", _cargo, (count (units _cargo)), _fillSlots];

			// move group into vehicle
			{
				_x assignAsCargo _car;
				_x moveInCargo _car;
				// determine if civ is armed
				if (_civAK > 0) then
				{
					_rand = random 1;
					if (_rand < _civAK) then
					{
						_x addMagazine "30Rnd_762x39_AK47";
						_x addMagazine "30Rnd_762x39_AK47";
						_x addWeapon "AK_47_M";
					};
				};
			} forEach (units _cargo);
		};
	};
};

// waituntil?
//	sleep 20;
sleep 60;		// waits ~ 1 min and then checks if any players around
				// had been 3, but that gets added to the sleep within the while loop

while {_keeplooping} do
{
	sleep ((random 60) + 120);
	_car = vehicle (leader _grp);
	_carPos = getPos _car;
	_loc = getPos _civ;
	if !(_carPos select 0 == 0) then
	{
		// will not delete if a "man" is within 200m - may want an isPlayer check - use 1 because driver is a man
		_nearList = nearestObjects [_carPos, ["MAN"], 200];
		// diag_log text format ["nearlist count = %1", count _nearList];		// debug
		if (count _nearlist > 1) then
		{
			// if more than 1 "man" around, then always keep the car alive
			_keeplooping = true;
		}
		else
		{
			// already know that there isn't a "man" around
			// new paradigm - uses alive status of original civ to decide whether to keep looping
			if (alive _civ) then
			{
			// if car is more than 200 from civ position, bring car back to area of civ and dismiss it
				if ((_carPos distance _loc) > 200) then
					{
					_dir = random 360;
					_dist = random 50;
					_posX = (_loc select 0) + sin (_dir) * _dist;
					_posY = (_loc select 1) + cos (_dir) * _dist;
					_pos = [_posX, _posY, 0];
						_wpPosTemp = [_posX, _posY, 0];
						_wpPos = [_wpPosTemp, 0, 100, 10, 0, .5, 0] call BIS_fnc_findSafePos;
						sleep .2;
					_wpX = _grp addWaypoint [_wpPos, 50];
					_wpX setWaypointSpeed "NORMAL";
					_wpX setWaypointType "DISMISS";
					_wpX setWaypointCompletionRadius 20;
					_grp setCurrentWaypoint _wpX;
					};
			}
			else
			{
			_keeplooping = false;
			};

		};
	};
};
// loop to give car wp back in town if original civ is still alive

{
	deleteVehicle _x;
} forEach units _cargo;
deleteGroup _cargo;
{
	deleteVehicle _x;
} forEach units _grp;
if (alive _car) then
{
	deleteVehicle _car;
};
deleteGroup _grp;
JTD_ACTON_carCount = JTD_ACTON_carCount - 1;
diag_log str JTD_ACTON_carCount;
// delete cargo/group
};								// big loop if current count < max

Lots of stuff going on, but basically, there's the random chance of any particular ALICE civ spawning a vehicle. There are 2 groups of vehicles spawned - in town and out of town.

In town, the vehicle gets a waypoint in a neighboring city. Out of town vehicles are spawned on a road in the direction of a neighboring city, with a waypoint in the vicinity of the ALICE-civ that was the originator of the spawn. Then, there's a wait loop to decide when to delete vehicles/drivers/cargo. Basically, if there isn't anyone around or if the originator ALICE-civ is removed, then the spawned stuff gets removed, too. Or should.

Anyway, that's how I worked it out. There is no bragging here - I am kinda like a kid who has learned 5 chords on the guitar and is trying to write his own song! I'm very open to input/ideas/feedback on better ways to do this, or new ideas to incorporate.

Share this post


Link to post
Share on other sites
The most interesting part about it is the development path. Based on threads here, the development version points to a location that I can change the scripts without exiting the game. Just hit ESC, make changes to the script, then re-start the mission.

Thank you for pointing that out, was getting sick of reloading the game :)

A conditional could be set that would then influence the spawned civs as to whether to use the hpp values or the mission-maker ones.

This is an example how I use the combination of hpp and object variableset:

_vehiclearray = if (isnil {_location getvariable "cm_vehiclearray"}) then {CM_DTM2801_vehiclearray} else {_location getvariable cm_vehiclearray"};
_location setvariable ["cm_vehiclearray",_vehiclearray];

Anyway, that's how I worked it out. There is no bragging here - I am kinda like a kid who has learned 5 chords on the guitar and is trying to write his own song! I'm very open to input/ideas/feedback on better ways to do this, or new ideas to incorporate.

Indeed, that's what makes this interesting for me too.. scavaging for knowledge and trying to fit it all together by trial and lots of error :p

Share this post


Link to post
Share on other sites

This is an example how I use the combination of hpp and object variableset:

_vehiclearray = if (isnil {_location getvariable "cm_vehiclearray"}) then {CM_DTM2801_vehiclearray} else {_location getvariable cm_vehiclearray"};
_location setvariable ["cm_vehiclearray",_vehiclearray];

Yeah, I think that's the same thing I was thinking of. For instance, in your GL implementation, allow a mission maker to have something in the init like "_vehicArrayMission = [array of vehicles]" and in the hpp, you have a default array named vehicArrayDefault. Then in the scripts, you can have a conditional something like:

if (isNil _vehicArrayMission) then {_vehicArray = vehicleArrayDefault} else {_vehicArray = _vehicArrayMission};

The idea being that, you have 3 variables - the default from hpp, the mission maker one, then the "real" one you use in the scripts. If the mission maker doesn't set it, then you make the hpp one the "real" one, and if it is set, then it is the real one.

Completely untested, naturally. :D

But, if it works, the advantage would be that the mission maker could basically re-set all the variables.

Share this post


Link to post
Share on other sites

Good news, lads. Thanks to some inspiration from DTM, I've figured out how to allow for a mission maker to override the settings in the hpp. This is a rather nuanced thing, but it is pretty easy. This will likely be particularly important in the armed civilian area.

Still want to test it a bit, but it'll likely be in the next release version.

Share this post


Link to post
Share on other sites

Update:

Ver. 01e available:

http://www.mediafire.com/file/moy5e2zmz0h/JTD_ACTON_01e.7z

Oh - and we'll just call this a "release" version. :D If something's wrong, I'll just do my best to fix it. No sin in having a hotfix, eh? :D

---------------------------------

Ver. 01e

Added ability for mission makers to force settings. By placing a game logic with certain global variables set, it will override the hpp values:

JTD_percSpawn = JTD_ACTON_percent;

JTD_maxSpawn = JTD_ACTON_max;

JTD_maxCargo = JTD_ACTON_maxCargo;

JTD_minCargo = JTD_ACTON_minCargo;

JTD_civAK = JTD_ACTON_civAK;

JTD_civArray = JTD_ACTON_civs;

JTD_cars = JTD_ACTON_DEFAULT_vehicles;

Thanks to everyone who has provided feedback. :)

Share this post


Link to post
Share on other sites

Aside from my unique problem (which is likely to be install-related) I don't have any problems with it at all. I get a lot of nice incidental activity and little noticeable performance drop.

Share this post


Link to post
Share on other sites

Hi Trexian!

Great addon! I'm a big fan of wandering civilians and ambient stuff and this is working nicely for me...

Just thought I'd mention - I've been fooling with Island config patches for ALICE for the CAA1 project (see the CAA1 thread for details) - as a secondary test I've been checking out how this addon behaves with that.

I'm happy to report it's working as it should on both Sahrani and at least one user-made island I've added ALICE support to... I was getting quite a high proportion of Civs With Guns (and they aint afraid to use them :)), but I haven't tweaked any of the .hpp parameters yet, so obviously that's all configurable so no problems there - and no problems anywhere else either - 1 to 3 vehicles, sometimes even a bus or truck - with occupants - trundling about the place, and occasionally if they see a Russian they bail out and let rip with the AK's - hehehe - looks like it's working fine to me... And it should be fine with forthcoming user islands too if they have the basic ALICE support config details...

It's not actually a monster job retrofitting ALICE support to existing user islands really - the big deciding factor seems to be suitable buildings on the map for the AI to "live" in - if they're already on the map it's just really a matter of a config patch with a big list of keypoints for all the towns...

B

Edited by Bushlurker

Share this post


Link to post
Share on other sites

That is AWESOME news! :) Both that it works generally (I'm still always a bit surprised by that) ;) and that it works with the other islands. I love Sahrani.

If possible, I know I've seen a couple questions about how to get ALICE working in these other islands - can you make sure the methodology is posted somewhere?

Also a note - the amount of ambient traffic is limited by the number of ALICE-spawned civilians. But, you can change the number of spawned civs with the variable civilianCount:

* civilianCount = <string>; - formula on which basis system calculates number of civilians for locations. %1 is number of buildings with door (memory points called "AIDoor1", "AIDoor2", ...) in 500 metres from location.

Example: BIS_alice_mainscope setvariable ["civilianCount","round (%1 / 10)"];

Default value (and recommended): "round (2 * (sqrt %1))"

So something like

BIS_alice_mainscope setvariable ["civilianCount","round (%1 / 2)"];

Would create 1 civ for every 2 enterable buildings in the city. That could be ALOT. From that, depending on the traffic spawn percent, and the civilian AK percent, you could get alot of armed civs in cars!

Share this post


Link to post
Share on other sites

It probably requires CBA/XEH. And, if you don't have it anyway, you probably should.

I had a quick look on the configs and the scripts and it does not seem to depend on CBA. All I could find were stock BIS functions you used.

And regarding the addon itself, the idea is brilliant ;)

The video really had that nice atmosphere with the truck turning off, GTA/Mafia comes to mind. Just shame the AI isn't too skilled at driving :(

Share this post


Link to post
Share on other sites

hehe

I didn't intend to make it CBA dependent, but I relied heavily on DMarkwick's fire and smoke implementation, which does require it. So, I figured I'd at least advise people to get it, if for no other reason than they SHOULD have it! :D

Thanks for the compliment, too. :) This probably isn't for everyone, or every mission, but it was something that I liked and am happy to share. :)

Share this post


Link to post
Share on other sites

Amazing....=D

Ill test it and report!

Thanks a lot for sharing...

Share this post


Link to post
Share on other sites

Sine it appears you are fairly knowlegble of these things. How hard would it be to sript a general small citty or town populance? Would this be an even heaver resource hit than it is now? I suspect it will be as I imagine every thing that is added takes a hit in one way or another.

Incidently, I didn't say so in the beginning but your work is very impressive. Thanks.

Share this post


Link to post
Share on other sites

hehe

Thanks, but this little bit that I'm doing pales in comparison to what others are doing. :) I just hope to help some other guy (or guys) enjoy A2 as much as I do. :D

But, to sorta answer your question with a question, what are you really trying to achieve? With the ALICE module (the ambient civilians), you can change the settings to get a higher concentration of civs. One way to achieve that, rather simply, is to put something like this in the init field (either of the player, or of a game logic):

BIS_alice_mainscope setvariable ["civilianCount","round (%1 / 2)"];

Now, the "round (%1 / 2)" is the important part. The %1 represents the number the game will use to decide how many civilians to spawn. (Don't worry about how it gets that number.) In larger towns, it will be a larger number, that's why it is expressed as a formula. %1 / 2 means that half of that number is how many civs will spawn. If the number is 10, then only 5 civs will spawn. If the number is 100, then 50 will spawn.

To give you some idea of how big a number that can be, the default is "round (2 * (sqrt %1))" - so if the number is 100, then 20 civs will spawn.

Now, for your purposes, that means that every town will spawn civs as a player approaches. That may or may not be what you want.

If you just want activity, there are several ways to spawn civilians and give them waypoints so they move around, go in buildings, etc., always with a destination. That takes some scripting, though. Not hard, but just... challenging. :)

It all depends on what you want to achieve.

Share this post


Link to post
Share on other sites

I'm going to try this mod when i get a chance.

Is anyone noticing any performance loss, fps, stuttering etc or is it pretty much all good

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  

×