View Full Version : JTD Ambient Civilian Traffic module
TRexian
Nov 17 2009, 17:38
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 (http://www.armaholic.com/page.php?id=8214)
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 \@<hidden>\addons - simply extract the archive someplace and place the @<hidden> 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:
http://www.youtube.com/watch?v=V8QcMYqmwBo
Thanks to:
JTD
-- DMarkwick
-- ReconPathFinder
OFPEC
SNKMAN for modulizing posts
Rommel @<hidden> 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;
Foxhound
Nov 17 2009, 19:26
New version frontpaged on the Armaholic homepage (http://www.armaholic.com/page.php?id=8195).
http://www.armaholic.com/datas/users/3-animation.png (http://www.armaholic.com/page.php?id=8214)
JTD Ambient Civilian Traffic module RC 01d (http://www.armaholic.com/page.php?id=8214)
http://www.armaholic.com/skins/Blaster07/img/required_addons.png
Community Base addons (http://www.armaholic.com/page.php?id=6231) (possibly required)
redrumNL
Nov 17 2009, 21:46
Trying this now.. Many thanks!! I hope it save's me some time placing them on my own.
We luv you.. :D
Manzilla
Nov 17 2009, 21:56
This is a damn good thing. I immediately saw civilians driving and a few with aks
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
Mr_Centipede
Nov 18 2009, 01:46
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]];
I'm at work so cannot test it now. Have a try and see if it works?
TRexian
Nov 18 2009, 02:46
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.
Bushlurker
Nov 18 2009, 05:57
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
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
Old Bear
Nov 18 2009, 10:25
Mirror on Armed Assault.info (http://www.armedassault.info/)
Link to mirror :
JTD Ambient Civilian Traffic module (v RC 01d) (http://www.armedassault.info/index.php?game=1&cat=addons&id=1143)
TRexian
Nov 18 2009, 13:46
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@<hidden>@<hidden>
// init = "if (isNil ""JTD_ACTPath"") then {JTD_ACTPath = ""\@<hidden>\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 "\@<hidden>\addons\testing\JTD_ambientCivTraffic.sqf"; // for testing @<hidden>@<hidden>
[_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.
DTM2801
Nov 18 2009, 14:29
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
TRexian
Nov 18 2009, 15:10
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.
TRexian
Nov 20 2009, 03:23
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.
TRexian
Nov 23 2009, 13:34
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. :)
DMarkwick
Nov 23 2009, 13:54
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.
Bushlurker
Nov 23 2009, 15:35
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
TRexian
Nov 23 2009, 15:48
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!
Deadfast
Nov 23 2009, 16:01
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 :(
TRexian
Nov 23 2009, 16:13
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. :)
neokika
Nov 23 2009, 17:42
Amazing....=D
Ill test it and report!
Thanks a lot for sharing...
That guy Over there
Nov 23 2009, 20:50
this is awesome
adds more life to Chernarus (Haven't tested it in Utes)
ChiefRedCloud
Nov 23 2009, 21:40
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.
TRexian
Nov 24 2009, 02:08
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.
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
TRexian
Nov 24 2009, 03:41
I have a relatively low end system, and can kinda tell when I cross the boundary into an area where the ambient civs spawn (both BI and mine). A slight stutter - not even a pause - is how I would describe it. Sometimes, though, I don't notice it at all.
Ahh cool i'll try and report back soon, it should be ok in that case but i'll test it soon.
My system runs ARMA2 very smooth and with AA on medium. other settings are on medium and high and i usually play self made editor missions with big battles.
cheers
lol and shame on me:unable to understand how to install it and why it requires jtd fire and smoke....
TRexian
Nov 24 2009, 22:12
hehe
It probably doesn't require FireAndSmoke. :)
In terms of installation, unzip it someplace, then copy all the folders in your ArmA2 root folder (with all contents). That should work. :)
Manzilla
Nov 24 2009, 22:32
Ahh cool i'll try and report back soon, it should be ok in that case but i'll test it soon.
My system runs ARMA2 very smooth and with AA on medium. other settings are on medium and high and i usually play self made editor missions with big battles.
cheers
I really haven't noticed any performance hit when using this. Mind you that I have a fairly good system but I still don't notice any FPS drop with this Mod active in a mission or not.
TRexian,
I haven't said thanks yet. My apologies, this is a wonderful Mod that really adds immensely to the game. I love seeing all the traffic. Well done sir and thank you!
TRexian
Nov 24 2009, 23:15
Glad you like it. :)
After you play it awhile, let me know how it can be improved. :D
Mod is cool
Didn't notice any performance hit :)
Master gamawa
Dec 7 2009, 18:09
Dude I spent the last hour hitchhicking around Chernarus. Those bastards can't drive for shit.
I also found a truck full of civilians carrying guns (armed civilians addon). Even the doctor had an AK. It was surreal. As if I stumbled upon some secret underground organization. Teacher by day, guerilla by night.
Good stuff!
Now if I find that script for the combat module I'll just get on a bicycle and become a war reporter.
hehe
Glad you are enjoying it.
The ACE2 release* (while I don't actually have it yet) has inspired me to revisit an idea I had for this. Rather than having a user-selectable set of cars, just derive it from the config, selecting any vehicle that belongs to the "civ" faction.
I'm open to ideas from everyone as to whether this would be a good idea or not. I guess another avenue (pardon the pun) would be to have it as another user-selectable option in the hpp.
* Regarding ACE2, I have no idea if there will be issues or not. I suspect not, but you never know. :)
Mr_Centipede
Dec 7 2009, 23:22
About the civ with guns, I noticed the civ will engage the side that are unfriendly to them, but the enemy wont engage the civ... or that was a fluke on my end?
Bushlurker
Dec 7 2009, 23:37
I noticed that too... The armed civs have no hesitation setting about Russian forces for example, but the Russians will ignore them every time as they're mown down, no matter how many casualties they take, they don't react to the armed civs as "enemy"...
B
Master gamawa
Dec 8 2009, 00:00
How come armed civs spawn in groups? I never see them alone.
WRT the civs being enemies of Russians, check the general settings of the mission (the thing where you click on the date). I believe if it is set to being the enemy of East, then they will attack Russian forces no matter what, but the Russians won't be their enemy until a certain number of civs have killed a certain number of Russians. I don't know for sure what the ratio is, though. I have seen Russians, or maybe Guerillas, shoot civs before, though.
@<hidden> Master G - what you may be seeing, at least with my mod, that if a group forms, there's a greater chance that there will be several with weapons. If a car has only a driver, he may or may not have a gun.
Hey, I do not understand how to get to the JTD and work on other islands :confused:
TRexian
Jan 12 2010, 14:51
It requires that the island have certain information in the config that the Ambient Civilian module uses. The Ambient Traffic module requires the Ambient Civilian module.
There are some threads in the Visitor (the island development app) area that talk about how to add the important parts to the config. I've never done that, though.
I read that it can not because it is not the same buildings as the Uthas? but I get the animals out!
Isla duala I will have civilian :j:
Harlow[16AA]
Mar 24 2010, 11:42
Apologies for dredging up an old topic, but I had a question I'm hoping you could help me with.
First off - Really nice work with this!! The difference this has made is really incredible - it's amazing how tense people can get when they see a few cars driving towards them, knowing that they could have hostiles inside -- or maybe just civilians :)
I do have a question or two however-
We're putting together a campaign for our unit and a big part of that will be civilians presence. Ordinarily it would be fairly straight forward - place ALICE+this addon + a few manually placed civilians with animations to make it all feel more real.
But -- we want to use a specific set of civilians (the FAA Arab civilians to be precise). I know what they're called so all set on that front.
My first question, is more a request for clarification:
- Does this addon only affect the civilians in cars, or does it also affect civilians walking around normally?
My second question is dependant on the first's answer I guess:
- I was able to get the arab civilians to spawn alongside the default Chernarus ones, but how do I get ONLY the Arab civilian ones to spawn? I've modified the custom civilian line and removed the ones that were in there by default, replacing them with the arab ones, but it still is spawning all civilians.
Is this even doable?
Thanks a lot, and again - great work with this!
TRexian
Mar 24 2010, 12:02
No problem bringing this up again! :) I've actually revisited it for another project, so it is useful for both of us!
In looking at this, I see the problem. In the spawning script, I use the BI functions spawnVehicle and spawnGroup, which I suspect rely on the default config groups for the drivers and groups....
Off the top of my head, the only way to change it would be to write my own function, that uses the civ array in the hpp to choose from. I could probably use the BI function as a template to do it, so it may not be that hard.
I could also add in a couple other tweaks. :) What kind of time frame would you need a new version by?
You are doing MP testing? And it works? :)
Harlow[16AA]
Mar 24 2010, 13:45
Heya mate,
I have no idea how complicated this would be (and salute you for having wrapped your head around this :)), so not sure what type of timeframe would be realistic in all honesty.
That said, we are aiming to kick the campaign off in 2 to (more likely) 3 weeks time.
Multiplayer wise, it seemed to work okay in MP, but only did some limited testing last night. We'll be doing another mission this Sunday which I want to use ALICE+your addon. Will let you know how that reacts :)
Thanks for the help offer Trexian! Really appreciate it!
TRexian
Mar 24 2010, 14:03
I'll do this on the condition that you give me some feedback about the MP-ness of it. :D
Something else I just thought of - part of the "problem" may be ALICE. You may need to look at civilianRarity and adjust all the default BI civs to be VERY rare, and create rarity values for the new civs. Have you tried it with just the ALICE module and checked what kind of civs are generated?
Otherwise, I'm working out how to spawn from the custom array. Having not looked at the basic script for several months, I'm also seeing how I need to clean it up! :D
Harlow[16AA]
Mar 24 2010, 15:23
Nice one Trexian!
I'll definitely let you know how the multiplayer-ness works out. Anything else you think a group of 20 to 30 can run through on this for you, let me know!! :)
I haven't tried adjusting the rarity bits yet actually. Must look into that tonight! Will let you know how that goes.
IceBreakr
Mar 24 2010, 15:59
TRexian: I'm soon to release civilians for Duala, but I would like to keep white women from "CIV" class. Is there a way to pick them out for the module or only mixed groups will appear (CIV=chernarus civs,DUA=my african ppl)?
TRexian
Mar 24 2010, 16:52
That's a good question... ultimately, I'm not sure.... :)
Well, with regard to my module, I'm re-organizing it so that all of the civs it spawns will be generated from the user/mission-maker array.
With regard to ALICE, I've looked at the resources for it, and I *think* it will take from whatever the cfgGroups entries are for civs. If you are creating a different faction for your Duala civs, it might really confuse ALICE. The only way I can think of to fix it would be to maybe make a config change to ALICE itself? I have no idea how that would work....
In digging deeper, and this may help you, too Harlow, ALICE has a function - BIS_ALICE_fnc_civilianSet - that is vaguely documented. It looks like the config support for it is:
class cfgFunctions
{
class BIS_ALICE
{
class Default
{
class civilianSet
{
description = "Adds civilian unit to ALICE system.";
file = "\ca\modules\alice\data\scripts\fnc_civilianSet.sqf";
};
};
};
};
I looked in d-h at that script, and it doesn't look like it supports an array of civs to be passed to it. So, that may be a dead-end, too. :/
From the ALICE main script, this looks like it might show where ALICE derives the civs from:
///////////////////////////////////////////////////////////////////////////////////
///// Civilian Classes
///////////////////////////////////////////////////////////////////////////////////
_unitrarity = if (format ["%1",_logic getvariable "civilianRarity"] == "<null>") then {[]} else {_logic getvariable "civilianRarity";};
_logic setvariable ["civilianRarity",_unitrarity];
_classlist = [];
_totobj = count (configfile >> "cfgVehicles");
for [{_i = 0}, {_i < _totobj}, {_i = _i + 1}] do {
_actual = (configfile >> "cfgVehicles") select _i;
if (isclass _actual) then {
_class = configname _actual;
_vehicleclass = gettext (configfile >> "cfgvehicles" >> _class >> "vehicleClass");
if !(_vehicleclass in ["Sounds","Mines"]) then {
_scope = getnumber (_actual >> "scope");
if (_class iskindof "civilian" && _scope == 2) then {
_rarity = if (_class in _unitrarity) then {
_vehiclerarity select ((_vehiclerarity find _class)+1);
} else {
getnumber (_actual >> "rarityUrban");
};
_faction = gettext (_actual >> "faction");
_classlist = _classlist + [[_class,_rarity,_faction]];
};
};
};
};
And at the end of that, it looks like there is SOME way to establish new civs, but it looks like it hasn't been implemented (it is all a block comment):
///////////////////////////////////////////////////////////////////////////////////
///// Custom Civlians
///////////////////////////////////////////////////////////////////////////////////
/*
{
if (!isnull leader _x && side _x != "sidelogic") then {
};
} foreach (synchronizedobjects _logic);
*/
Ice - were you going to release the Duala civs as a separate addon, or integrated into the next release of the island? (Which looks awesome, BTW.) :) Not sure if it makes a difference, I was just curious. :)
Edit: Also, with all the great custom islands, if there is enough interest (and no easy work-around), I can probably come up with a way to make it non-dependent on ALICE.
Harlow[16AA]
Mar 24 2010, 17:07
Hm, shame its looking like a dead-end :(
I wonder if _classlist = []; would allow anything to be entered (e.g. dualacivs). I'm probably being completely naiive here and showing my complete lack of knowledge on the scripting side :)
I'll still let you know how the rarity thing goes.
Ice - that's great news indeed! Looking forward to it! Our unit campaign we're working on will be set on Isla Duala so using your civs would be absolutely brilliant :) Great work on that island as well, by the way and the other 'unit' addons you've made for it.
Probably cheeky for asking, but do you have an estimate on when the civs will be released?
IceBreakr
Mar 24 2010, 18:07
Harlow & TRexian: no ETA yet, I'm still drawing their shirts, models are done by IceWindo (big kudos to him!). They feature long pants+tshirts and shortpants+tshirts.
My priority is to release Panthera 2.5 now (too bad none of the houses are closed, so Alice doesn't work!), but vehicles spawn normally on streets.
Then I'm off to finish new Duala update, civs will be included. Next stop: two new islands (1. desert & 2. jungle/urban warfare)
TRexian
Mar 24 2010, 18:14
Hey Ice - in case it matters, I don't know that the houses actually have to be "closed", they just need the right memory points. If you can add them to existing models, great. Also, I've kinda thought of just creating generic models with those memory points to allow them to be placed more manually, if that makes sense.
Anyway, from the ALICE Biki:
number of buildings with door (memory points called "AIDoor1", "AIDoor2", ...)
IceBreakr
Mar 24 2010, 20:22
I know how it works, we added the "doors" to A1 buildings we use on Duala. All houses are open on Panthera, therefor civilians cannot "hide" inside?
Harlow[16AA]
Mar 24 2010, 20:52
Sounds exciting! Can't wait for both next Duala and especially the Desert one (I like sand :)).
Unfortunately I haven't had much luck with the rarity thing TRexian.
I placed the ALICE Module alone and in its init line put:
BIS_alice_mainscope setvariable ["vehicleRarity", ["ffaa_civil_agf_4",0.1,"Assistant",0.9,"Citizen1",10,"Citizen2",10,"Citizen3",10,"Citizen4",10,"Doctor",10,"Functionary1",10,"Functionary2",10,"Pilot",10,"Policeman",10,"Priest",10,"Profiteer1",10,"Profiteer2",10,"Profiteer3",10,"Profiteer4",10,"RU_Assistant",10,"RU_Citizen1",10,"RU_Citizen2",10,"RU_Citizen3",10,"RU_Citizen4",10,"RU_Doctor",10,"RU_Functionary1",10,"RU_Functionary2",10,"RU_Pilot",10,"RU_Policeman",10,"RU_Priest",10,"RU_Profiteer1",10,"RU_Profiteer2",10,"RU_Profiteer3",10,"RU_Profiteer4",10,"RU_Rocker",10,"RU_Rocker2",10,"RU_Rocker3",10,"RU_Rocker4",10,"RU_SchoolTeacher",10,"RU_Villager1",10,"RU_Villager2",10,"RU_Villager3",10,"RU_Villager4",10,"RU_Woodlander1",10,"RU_Woodlander2",10,"RU_Woodlander3",10,"RU_Woodlander4",10,"RU_Worker1",10,"RU_Worker2",10,"RU_Worker3",10,"RU_Worker4",10,"Rocker1",10 ,"Rocker2",10,"Rocker3",10,"Rocker4",10,"SchoolTeacher",10,"Villager1",10,"Villager2",10,"Villager3",10,"Villager4",10,"Woodlander1",10,"Woodlander2",10,"Woodlander3",10,"Woodlander4",10,"Worker1",10,"Worker2",10,"Worker3",10,"Worker4",10,"Worker4",10,"Worker4",10]]; BIS_alice_mainscope setvariable ["civilianCount","50"];
Which, according to the biki should have disabled everything (number 10) apart from the women, the arab guy and the assistant. When I tried it out, everyone was spawning like normal. I then tried switching the extremes, same result.
Of course its possible that I misunderstood how the rarity thing works.
TRexian
Mar 26 2010, 14:20
Ok, lads, wee update.
I have re-structured the spawning of civs, to divorce it from the BI functions spawnGroups and spawnVehicle, so it will strictly look at the civilian array when spawning. I've also *seriously* cleaned up the scripting so it is more efficient, or at least looks more efficient. :) Just ironing out a wrinkle with a new function that gives the civs guns, but I think I have it sorted.
@<hidden> Harlow - probably won't have anything ready by Sunday, though. :( On the vehicleRarity issue, maybe try calling it civilianRarity instead? It almost looks like there's a typo with what the variable is called? Indeed, in the ALICE main sqf, it referst to the variable "civilianRarity":
_unitrarity = if (format ["%1",_logic getvariable "civilianRarity"] == "<null>") then {[]} else {_logic getvariable "civilianRarity";};
Haven't tracked down how the number works, though, so your guess is as good as mine on that issue. :)
Will take a bit longer (probably a couple weeks) for me to completely wean this from ALICE. In fact, I may make it a boolean, so that people can choose whether to use ALICE or not. I'm not sure how easy that will be, yet, though, in terms of setting up my own trigger, etc.
Loyalguard
Mar 26 2010, 15:05
This is outstanding and pioneering work Trex. Your work on this has given me a lot of insights on some interfacing with ALICE that I am looking at...so, thanks for this module and the work going into it!
TRexian
Mar 26 2010, 15:23
Thanks. :) Ironically, I remember reading your Sahrani electrical grids stuff, and found that amazing and immersive! Funny how inspiration/motivation can come full circle.
But, now you've piqued my curiosity about what other interfacing with ALICE you're working on! ;) Perhaps a PM or link to your work?
On a related note, I think I've figured out a potentially simpler addon to achieve a similar effect with this. I'll mention it here, in case some other developer wants to follow up on it.
In the ALICE config, there is a certain action:
class CfgCivilianActions
{
class BIS
{
class drive
{
condition = "_twnthreat <= 1 && _twnthreat >= 0 && !isnil 'bis_silvie_mainscope' && {_x getvariable 'ALICE_threat' <= 1} count _nearbyTowns > 0 && getnumber(configfile >> 'cfgvehicles' >> typeof (_this select 0) >> 'woman') == 0;";
fsm = "ca\modules\alice\data\actions\safe_drive.fsm";
rarity = 0.01;
locked = 1;
canRepeat = 0;
};
};
};
It seems like someone could rig a config to change the rarity and probably the conditional to see if ALICE could spawn more drivers indigenously. That's pushing the edge of my ability to config and test, though.
Loyalguard
Mar 26 2010, 18:40
Thanks. Ironically, I remember reading your Sahrani electrical grids stuff, and found that amazing and immersive! Funny how inspiration/motivation can come full circle.
But, now you've piqued my curiosity about what other interfacing with ALICE you're working on! Perhaps a PM or link to your work?
Funny indeed! Thanks for the kind word in turn!
As far as what I am working on...I am actually working on the succesor to SEG for A2/Chernarus (still very early in development as I have only been back scripting for a few weeks after a two year hiatus and the electrical "infrastructure" on Chernarus is a lot more complex than Sahrani).
As you may recall SEG only controlled the street lamps on Sahrani because there was no good/easy/practical way to deal with other light sources. However, with the addition of ALICE in A2 there are house lights to consider (part of the house effects component of ALICE along with chimney smoke). I got the idea from reading a post by Andy455 where he brilliantly (pardon the pun) included the ALICE houselights in his code (http://forums.bistudio.com/showpost.php?p=1549717&postcount=2).
I think Andy's idea is great because it would be lacking to turn off street lamps but not house lights when power to an area is cut off. However, I need to expand on it because like in SEG, my current project will also allow the mission maker to have players manually shut down power without having to damage the substations. In order to do this, I need to be able to turn off the house lights and then later turn them on again if power is restored without interfering with how ALICE handles each house. This is where your work has been extremely helpful in helping me navigate through ALICE.
On a related note, JTD city functions has inspired me to look at using the principles you established within it to see if I can later implement a universal electrical grid addon that will work on any island as long as crucial location information (city centers, neigbors, etc.) are properly defined for the island (this project is still a ways off though...)
So, again thanks, and I may hit you up for some advice if you don't mind!
Harlow[16AA]
Mar 27 2010, 19:13
Aah.. I'll try renaming it to CivilianRarity and see what that does. But awesome news on your update though :)
About tomorrow -- no problem at all at all. The game on Sunday will be on Chernarus anyway, using standard civilians (we'll be using the arab civilians in a few weeks still), but I will be using your addon on there and and will let you know how things get on with the full house there! Looking forward to it actually.
TRexian
Mar 27 2010, 19:30
@<hidden> - sounds good! :)
@<hidden> - that solution by Andy is, indeed, brilliant! And, it would actually meld well with the city functions, that can get the location of urban areas! On that note, I'm also planning on re-vitalizing the city functions to get the Ambient Traffic apart from ALICE. I'll let you know how that goes. I don't think there'll be a major overhaul - but those were some of the first serious scripts I wrote, so maybe there will be! If you have any ideas or see areas for additional functionality, let me know.
I'd love to dissect DAC and be able to have non-rectangle/oval shapes, but... I think I'd need a brain cell infusion for that... ;)
TRexian
Apr 14 2010, 13:57
Update:
Well, I'm working through a 75-90% rewrite of the whole system. In the last 24 hours, I've kinda reached a decent alpha stage. :)
Goals:
- spawn civs only from civ array (if specified) - done
---- (this effectively makes it non-dependent on ALICE, also)
- allow mission designer to use markers to specify where to spawn civs - done
- spawn traffic in a similar way to the original module - done
- if no markers specified, use city functions - still testing
- modifier for how many civs to spawn within designated area - not implemented
- change spawning methodology to better reflect whether the marker is a circle or rectangle - not implemented
No timeline for the new version - at least a couple weeks. (3-4 weeks is the old joke.) ;)
IceBreakr
Apr 14 2010, 14:06
TRexian: please also test on Panthera 2.6, cities should be connected to at least 2-3 neighbours for AI to travel to.
TRexian
Apr 14 2010, 14:32
Sure. :) Getting tired of testing on Utes, anyway. ;)
Does it have theater-specific civs, or can I just use the BI default?
Harlow[16AA]
Apr 14 2010, 15:01
Heya TRexian,
great to see your progress! Sounds awesome :)
If you need any extra multiplayer testing done, let me know and we'll give it a go!!
TRexian
Apr 14 2010, 15:04
No doubt I will. :)
I'm hoping that this addresses the waypoint issue for vehicles in MP, too.
I'll also probably include that trash module as an option, too.
Harlow[16AA]
Apr 14 2010, 15:37
Cool :) Looking forward man!! Will definitely save from having to manually place the upcoming Isla Duala civvies (or currently the FFAA Arabes).
TRexian
Apr 22 2010, 17:59
I wonder what ALICE 2 will have in Operation Arrowhead.... traffic maybe? :D (Look at the top of the dropdown list.)
http://i26.photobucket.com/albums/c114/TRexian/JTD/testing/ALICE2.jpg
Would be kinda cool if (another) one of my projects is made redundant by actual in-game features. :)
Manzilla
Apr 22 2010, 20:43
I was reading those earlier and I'm pumped to see it. The whole town spawn feature is pretty wicked in and of itself. And 3 maps!(I hope)
---------- Post added at 03:43 PM ---------- Previous post was at 03:42 PM ----------
TRexian: please also test on Panthera 2.6, cities should be connected to at least 2-3 neighbours for AI to travel to.
How are you setting this up on your maps?
I see some stuff but it's just a few cars in a few places.
TRexian
Apr 23 2010, 03:00
Hey 'zilla - was that question to me or Ice? :)
One thing I'm implementing is a way to use markers to set the areas where the civs will spawn, not just cities/towns.
TRexian
Apr 28 2010, 03:11
Heya IceBreakr-
This spot might look familiar:
http://i26.photobucket.com/albums/c114/TRexian/JTD/testing/ACT_02a_Panthera01s.jpg
;)
That's an early test on 2.6, with just ALICE. Basically, the same implementation as the first version of my module, which means that the old version should work. I think. :)
It also looks like the city functions... function.
http://i26.photobucket.com/albums/c114/TRexian/JTD/testing/ACT_02a_Panthera02s.jpg
That's a good sign. :)
IceBreakr
Apr 28 2010, 05:56
Woo, lookin' good!
Manzilla
Apr 28 2010, 12:40
Hey 'zilla - was that question to me or Ice? :)
One thing I'm implementing is a way to use markers to set the areas where the civs will spawn, not just cities/towns.
Sorry missed it.
It's directed at either of you. The marker thing sounds like a great idea.
Are those pictures from a new version of this Module? That looks awesome.
TRexian
Apr 28 2010, 13:23
Yeah, sorta. :)
I'm afraid that, as it is evolving, it is becoming more complicated (I guess that's part of what "evolution" means). I'll probably need to make a pdf to document how to fully use it. However, the basic functionality will remain - I'm just layering additional options over it.
One of my "design standards" is that stuff should work without any input from the user. That is, there should be some nominal, default gameplay by just placing the module. (Ideally, it won't even *need* the hpp - so that should reduce the emails/PMs I get, too.) After that, the hpp, or the variable settings are tweaking/personalizing.
So, the layers I'm planning on adding:
- No need for ALICE: there will be a CPU cost to spawning my own civs, but if someone doesn't want to use ALICE, they don't have to.
- To allow for no ALICE: the city functions will spawn civs and traffic.
- So as not to spawn everywhere: the ability to use markers to specify what areas will spawn civs and traffic. So, if a mission only takes place in one city, there's no reason to spend the CPU cycles spawning civs elsewhere. This will require the mission maker, though, to list the marker names in a variable in the init line of the module. Not a big deal, but it will require the pdf manual. ;)
I also recently came across a script that generates "gaussian" random numbers. That is, the randoms should generate in a bell curve. For me, that is cool because I can generate spawn points that tend to be towards the center of an area. In cities/towns, that tends to be where people congregate, so it should provide a more organic feel to the spawning.
Otherwise, the "feel" of the module should be about the same.
TRexian
May 16 2010, 02:22
Ok ladies, alpha version (really more like beta, but close enough) of version 2 is here:
http://www.mediafire.com/file/nuzr2d1zozg/JTD_ACTON_2a.zip
I'm reluctant to have the wonderful community mirrors host it yet, only because it has only been tested by me, and it isn't signed. If you guys decide you want to, no problem, but if this goes well, I'll probably have a signed version within a week or so.
(Famous last words, those.) ;)
Anyway, there is a readme, but it could probably stand to have a fuller pdf to really detail how it works. There is quite a bit changed in the mechanics of it, but here is the portion of the readme that covers the major changes:
ADDITIONAL FUNCTIONALITY IN VERSION 2
Implementation:
ALICE -
This is the same implementation as in version 1. Place an ALICE module, and the traffic will spawn any time an ALICE civ spawns.
Config cities/towns -
By default, civs will spawn in all cities/towns identified in the config for the island. However, this is time-consuming at the start of a mission if there are many such cities/towns. Plus, on a map with many cities/towns, it is possible to quickly run out of available groups to spawn civs in. Something is different from ArmA1, and the trigger formulation I used before now results in civs being spawned immediately. So, the first ~100 groups of civs will be assigned to the first cities/towns in the config.
Markers -
By placing markers in areas where you want civs, they will only spawn in those locations. To accomplish this, you MUST set the JTD_civMarkerArray variable.
JTD_civMarkerArray - array - default = nil;
** This is required to designate which markers will spawn civs. In the init line of the module, write:
this setVariable ["JTD_civMarkerArray", ["nameofmarker1", "nameofmarker2"]];
In that example, you have named the markers nameofmarker1, nameofmarker2. You can have as many markers as you need. Also, you can overlap or "nest" markers in various areas. Have a big marker over an entire city, then smaller markers in neighborhoods where you want more dense concentrations of civs.
Feedback is not only requested, but required. :)
I've tested all 3 implementations in Utes, Pantera and Chernarus (and elsewhere). The marker way is really best from a designer perspective, and while the city function method is easiest, it really isn't workable for maps like Chernarus, and even Pantera, where there are many defined cities in the config. (I'm going to have to build in some error-catching or limit the city functionality somehow.) ALICE is the best balance between easy and effective in that instance.
Anyway, apologies for mistakes that are sure to be in there. I am (again) pushing the edge of my scriptological skeels with this. You all are just along for the bumpy ride! And thanks for the support.
Uziyahu--IDF
May 16 2010, 03:01
Can a certain percentage of civs be made to WALK from one town to another?
And if they can be made to walk, can they be made to hitchhike if you stop to pick them up?
Foxhound
May 16 2010, 11:28
Not mirrored, but announced to help spread the word :D
Release frontpaged on the Armaholic homepage (http://www.armaholic.com/page.php?id=8195).
http://www.armaholic.com/datas/users/3-animation.png (http://www.armaholic.com/page.php?id=8214)
JTD Ambient Civilian Traffic module v02a (http://www.armaholic.com/page.php?id=8214)
http://www.armaholic.com/skins/Blaster07/img/required_addons.png
Community Base addons (http://www.armaholic.com/page.php?id=6231)
TRexian
May 16 2010, 14:45
@<hidden> Uzi - well, they can be given a waypoint to a nearby town (or several), but the hitchhiking thing is beyond me. :) Probably can be done, though.
@<hidden> Foxhound - thanks! :D
TRexian
Jul 14 2010, 19:45
Well, ladies, with the release of OA, I see this addon as a bit superfluous - which is not really a bad thing. They say that imitation is the sincerest form of flattery :) and, while I do not harbor the illusion that BI imitated my work, I think it is fantastically cool that we both identified the same area where A2 could be improved.
Having said that, I think I'll wait a bit before further developing this, if at all. First, I need to familiarize myself more with how OA works. But, I can see a sliver of development to explore in the area of user-controlled areas of greater traffic or civilian density. I may shift this to a mechanism where the mission maker can identify areas with greater civilian population/traffic (or at least the chance for it) and use my module in a way that complements the OA implementation.
Thanks to all for feedback and ideas. This module has been a HUGE learning experience for me! And thanks to BI for advancing the concept!
Fox '09
Jul 14 2010, 21:09
was about to say, more traffic would be great to have, especially in the cities. Or, how about convoys?
Wolffy.au
Jul 26 2010, 20:43
I recently contacted TRexian as the OA Amb Civs doesn't work in dedicated MP server. The civs spawn and then delete themselves every few seconds.
Can some confirm this, in case its just me?
esco7800
Aug 13 2010, 20:18
im haveing a problem turning off SILVIE for JTD Ambient Civilian Traffic module this is what I typed. this setVariable ["JTD_traffic - boolean - default = false;"]]; I placed it in the Ambient Civilian Traffic module init line of the module. And SILVIE is still on can someone tell me what im doing wrong.
TRexian
Aug 14 2010, 15:14
Oh, sorry, that probably wasn't clear in the readme.
First, remove the SILVIE module. That should remove the extra vehicles.
Then in the init, just have:
this setVariable ["JTD_traffic", false];
Haven't tried that in awhile, but that's the way it is supposed to work.
Also, I've been getting some feedback that the ambient civs in OA may not be MP-friendly. If that's the case, I can probably continue work on this. :)
Wolffy.au
Sep 28 2010, 14:15
So I'm led to believe that Ambient Civilian module in OA 1.54 is MP friendly, although I haven't tried it.
At a minimum, I still believe the traffic code would be required even if it was fixed. TRexian, are you still working on JTD ACT module?
TRexian
Sep 28 2010, 14:25
Funny you should ask! :) I am.
It won't be much of an improvement over the beta, but a slight paradigm shift. I'm going to get away from the city-based generating of civs. The actual location of the modules will be the default way to define where to spawn civs. I'm thinking each module will represent a 50x50 area. Of course, the better way would be to use markers to define the areas you want civs to spawn.
Also, a colleague (SNKMAN) has provided me with a custom FSM for the civs that I'll be testing.
There will be a greater emphasis on MP functionality. :)
In terms of a timeline, I'd guess 3-4 weeks.... if all goes well.
Harlow[16AA]
Sep 28 2010, 15:59
And you strike again :)
As before - looking forward to your next edition and will definitely be using it!
GregRUS
Oct 20 2010, 21:24
Is there any way to run this module serverside only? Without client-side JTD addon?
TRexian
Oct 21 2010, 12:36
Is there any way to run this module serverside only? Without client-side JTD addon?
Hmm.... that is a good question.
I think with the new implementation (not ALICE-dependent) there may be. Something that just spawns civs in areas, gives them waypoints, and then leaves them alone?
I guess the trick would be to make sure that if a client DID have the addon, that it didn't run on the client. I could probably make a variable (something like JTD_ACTON_serverOnly) that, when true, only runs on the server?
Not too late to try to do something with that for the next release.
Ok, contrary to my post above, I didn't add that kind of check, yet. :)
Here is a dev version. Please, no mirrors at this time. If I get some positive feedback, I'll make this an 'official' version.
Download:
http://www.mediafire.com/file/u3szfamiw3wrm2n/JTD_ACTON_02dev.7z
This DOES NOT include the hpp. It should work with the one from earlier. (Actually, it may even work without one, but I haven't really tested that yet.)
Readme stuff:
Readme for the JTD Ambient Civilian Traffic module for ArmA2
Ver. 02b-dev Nov. 5, 2010
JTD:
-- DMarkwick
-- ReconPathFinder
-- TRexian
Thanks to:
OFPEC
SNKMAN for modulizing posts
Rommel @<hidden> OFPEC for ideas
=====================================================
***IMPORTANT INFO***
The JTD_ACTON_config.hpp file now must go into a new folder, <ArmA2 root>\userconfig\JTD\. If you do not have this path/folder, make one. The archive is set up to make it automatically, if necessary.
=====================================================
Description:
This module, when placed in a mission, will generate civilians and civilian vehicles which will travel around the area.
Caveat:
This addon is very near to being obsolete, based on the improvements by BI of their ALICE implementation. I, for one, am happy to see my own work being superceded! I do still believe, though, that this addon can fill a narrow niche within the community. This addon does not rely on certain models, so it can be used on any map (as far as I know). It also allows the incorporation of custom civilians and vehicles, in case Chernorussian or Takistani civilians would be out of place. Plus, it just gives more flexibility for mission makers as to where civs spawn.
Requirements:
None
Optional:
- ALICE - the BIS Ambient Civilian module
- SILVIE - the BIS Ambient Vehicle module
Issues:
Framerate hits when a bunch of things spawn. Civs are generally persistent, once they spawn, they will continue to exist until killed, unlike BI modules
=====================================================
Installation:
The archive contains a folder structure \@<hidden>\addons - simply extract the archive someplace and place the @<hidden> 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.) ;)
********************
LICENSE:
This package, as a whole and separately, is released under the terms and restrictions of the Creative Commons License - Attribution Non-Commercial Share Alike (cc by-nc-sa), which is hereby incorporated by reference into this document.
The contents of this package can be modified and built upon, as long as the resulting product is non-commercial, and includes attribution to JTD and/or Trexian. Such resulting products ("derivative works") must be licensed in the same manner as this package.
The author of this product may be interested in additional uses and/or licenses upon request.
In the spirit of community sharing, without which this addon wouldn't exist in the first place, all scripts can be viewed and purloined for further use, with credits, as long as the addon itself remains intact as per the official release.
=====================================================
Usage:
The module itself is found in the Modules portion of the editor, under JTD Ambient Civilian Traffic.
Module settings:
The first place the module 'looks' for variables is to itself, for certain setVariables. In the init field, use the following variables to over-ride the user hpp variables:
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;
JTD_weapons = JTD_ACTON_wepArray;
For example, if you wanted to make a mission that had no civilians with AKs, then, in the init field of the game logic you would put:
this setVariable ["JTD_civAK", 0];
This would replace the local user's hpp value. You can also use this to substitute your own vehicles or civilians in the arrays, etc.
The second place the module will 'look' is the user's hpp settings.
Finally, there are default values for each of the settings.
JTD_percSpawn - number 0-1 - default .5;
Percentage chance that a civ will spawn.
JTD_maxSpawn - number - default 50;
Max number of civs that spawn.
JTD_maxCargo - number 0-1 - default 1;
Max percentage of available cargo slots that will be filled with civs.
JTD_minCargo - number 0-1 - default 0;
Min percentage of available cargo slots that will be filled with civs.
JTD_civAK - number 0-1 - default .25;
Percentage chance that civilians get weapons. (Set to 0 to disable.)
JTD_civArray - array;
Array of civilians that will be spawned. There is a default for Chernorussians:
["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"]
JTD_cars - array;
Array of cars that will be spawned. There is a default that is Chernorussian:
["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"]
JTD_weapons - array - default is stock A2:
Array of weapon choices for civs.
["Colt1911", "Makarov", "Huntingrifle", "AK_47_M", "AK_47_M"]
JTD_traffic - boolean - default = true;
Option to not spawn any traffic, just civilians. Set to false to disable the spawning of traffic - only pedestrians will spawn.
How to Spawn:*
1) Markers - you can designate areas to spawn civilians by placing and naming markers on the map. In the init line of the JTD ambient civilian module, place the array of those markers as a setvariable. For example:
this setVariable ["JTD_civMarkerArray", ["civmarker1", "civmarker2",
"civmarker3"]];
The module would then spawn civilians in those markers. The module settings would only apply to the markers listed in that module. So, you could have several modules handling different areas of civs.
2) Module-location (default) - in the absence of ALICE or an array of markers, the location of the module on the map will be the center of a 50x50 marker in which civs will spawn. In this case, there is an additional variable JTD_moduleRad that can chance the radius (an array [RadA, RadB]) for the spawning. To make the civs spawn in a 100x50 area, in the init line of the module:
this setVariable [JTD_moduleRad", [100,50]];
(The direction of the module, and the spawn zone, will always be North.)
You can place multiple modules, with different settings, on the map. You can also combine this method with the marker-array method, if you want.
*
This version removes the ability to use in conjunction with ALICE. BI has developed ALICE to the point where it was no longer necessary. Thank you BI! :)
=====================================================
***What's the downside?***
There may a performance hit for a mod of this nature. Also, the presence of civilians (some armed) and traffic can cause missions to play differently than expected.
***What should I watch out for?***
If you use JTD_ACTON in the ArmA2 editor, and you preview the mission, then you will get an addon dependancy written into the mission.sqm file. Exactly the same as if you'd used any other addon in your mission. If you wish to have your mission JTD_ACTON independent you should manually remove this entry with a text editor.
***What's next?***
I believe this addon is very near to being obsolete, which does not sadden me one bit. BI is doing an excellent job of upgrading their ambient civilian implementation with each release. As I said above, this is an addon for a narrow niche. I am not sure how much more to add to this, frankly!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.