RonnieJ 10 Posted February 1, 2010 Hey guys... im trying to use ALICE and SILVIE with default parameters but nothing happens... any idea why? I have a functions module and a game logic... when I preview the mission nothing happens... Share this post Link to post Share on other sites
TRexian 0 Posted February 1, 2010 What city/town are you using it in? If it is an addon theater, it may not be properly set up for ALICE/SILVIE. Share this post Link to post Share on other sites
RonnieJ 10 Posted February 1, 2010 Im using an addon called Quesh Kibrul v2 ... thats the map... ---------- Post added at 05:54 PM ---------- Previous post was at 05:53 PM ---------- and the city on that map is called Quesh-Kibrul ouest (in the editor) Share this post Link to post Share on other sites
TRexian 0 Posted February 1, 2010 Ah - I'm not sure that Q-K has the right config entries for ALICE. Share this post Link to post Share on other sites
RonnieJ 10 Posted February 1, 2010 Can that be handled by entering some parameteres into ALICE? Share this post Link to post Share on other sites
TRexian 0 Posted February 1, 2010 I don't think so. It involves the world config, IIRC. Share this post Link to post Share on other sites
RonnieJ 10 Posted February 1, 2010 Crap - then making a civilian environment suddenly seems like an impossible task :( Share this post Link to post Share on other sites
mugaben 10 Posted February 1, 2010 Old school all the way mate. :) Place alot of different units, copy paste and fine adjust each one the places where you expect the players to move through. Triggers works great, 2 minutes before players will reach the area, you sync the trigger to all civillians waypoints. The waypoint after the sync should be "Dismissed". After that, everyone goes on doing their thing. Sitting, walking around. Like with ALICE. Exept in Quesh kibrul they will go all over the place, out in the sands and what not. Not only in the village itself. Thats the hard-way, and my way. :) Share this post Link to post Share on other sites
TRexian 0 Posted February 1, 2010 Depends on what you want to do. :) For A1, I had a method of generating random civilians at random locations when the player was near a town. It was basically a rough pre-cursor to the ALICE module. This is the foundation, a set of functions that determine where the cities are, and what their radius is: http://www.ofpec.com/forum/index.php?topic=32328.0 With those, you basically set up a trigger in each city that detects a player, and then starts spawning civilians within that radius within the city. Share this post Link to post Share on other sites
RonnieJ 10 Posted February 1, 2010 Ye well thats pretty much what I want... just civilians walking around giving the impression of a city environment... TRexian the download link dosent work in that thread.. Share this post Link to post Share on other sites
TRexian 0 Posted February 1, 2010 Ok - at the risk of overwhelming you :) here are the most recent version I have handy. I think these are up-to-date, though. First, the mission init. This is what sets the whole thing up. You can use this in a test mission you set up. ["DEBUG", "", 1, 1] execVM "JTD_CityInit.sqf"; Then, the CityInit: /* JTD City Initialization script by Trexian Purpose: run the JTD City functions Implementation: executed from init or mission.sqm Future plans will include greater information exchange. ooooooooooooooooooooooooooooooooooooooooooooooooooo Version history 01a - released at OFPEC 01b - fixed pursuant to Spooner's suggestions - included demo mission 01c - civ spawning 01d - global variable for cities that have spawned civs 01e - player in list of trigger - added global command line parameters ooooooooooooooooooooooooooooooooooooooooooooooooooo "JTD_CityPosition.sqf" - passed no parameters - returns an array of all cities in the config, and the config positions "JTD_CityCenter.sqf" - passed a position array (most likely from JTDCityPosition) - determines the approximate center of the city, by density - returns the position of the center "JTD_CityBorder.sqf" - passed a position array (most likely from JTDCityCenter) - determines an approximate geographic size of the city in X (radius A) and Y (radius B) - returns radius A/B for use in marker or trigger The markers are created to show the scenario developer the location and size of the parameters. This particular script loads the centers and borders in additional global arrays that are indexed in the same order as the city list taken from the config. Options: First paramenter (select 0)- "DEBUG" = shows all debug hints and approximate trigger border "MARKERS" = shows approximate trigger border, but not hints Second parameter (select 1)- "PLAYERONLY" = only the player will activate the triggers set Third parameter (select 2) - enter a multiplier for the radius. Default is 1. Parameter will be used to make the trigger size smaller or larger than default. To halve the size, use .5. To double the size, use 2. */ //ooooooooooooooooooooooooooooooooooooooooooooooooooo // start of city stuff _i = 0; JTD_CityTriggers = []; JTD_CityCenters = []; JTD_CityBorders = []; JTD_CityDebug = false; JTD_CityMarkers = false; JTD_CityPlayerOnly = false; JTD_CityRadiusMod = 1; //special civilian spawn globals JTD_CityCivArray = []; JTD_CivSpawnMod = 1; //ooooooooooooooooooooooooooooooooooooooooooooooooooo // get modifiers from command line _temp = count _this; if (_temp > 0) then { _tempType = _this select 0; if ((typeName _tempType) == "STRING") then { if (_this select 0 == "DEBUG") then { JTD_CityDebug = true; JTD_CityMarkers = true; }; if (_this select 0 == "MARKERS") then { JTD_CityMarkers = true; }; }; _tempType = _this select 1; if ((typeName _tempType) == "STRING") then { if (_this select 1 == "PLAYERONLY") then { JTD_CityPlayerOnly = true; }; }; if (_temp > 2) then { // also consider using finite test? _tempType = _this select 2; if (finite _tempType) then { JTD_CityRadiusMod = _this select 2; }; // civilian specific global params _tempType = _this select 3; if (finite _tempType) then { JTD_CivSpawnMod = _this select 3; }; }; //ooooooooooooooooooooooooooooooooooooooooooooooooooo // start the cool stuff if (JTD_CityDebug) then { hint "DEBUG city init"; sleep 1; }; }; JTD_cityPos = compile preprocessFileLineNumbers "JTD_CityPosition.sqf"; JTD_cityCent = compile preprocessFileLineNumbers "JTD_CityCenter.sqf"; JTD_cityBord = compile preprocessFileLineNumbers "JTD_CityBorder.sqf"; JTD_citylist = call JTD_cityPos; _count = (count JTD_citylist) -1; for [{_i = 0}, {_i <= _count}, {_i = _i + 1}] do //for [{_i = 0}, {_i < 5}, {_i = _i + 1}] do // for testing, to limit the iterations { _citypos = ((JTD_citylist select _i) select 1); _citycenter = [_citypos] call JTD_cityCent; _cityborder = [_citycenter] call JTD_cityBord; _posX = _citycenter select 0; _posY = _citycenter select 1; _radA = _cityborder select 0; _radB = _cityborder select 1; // modify radius size based on parameter - absolute value in case someone gets funny with a negative parameter _radA = abs (_radA * JTD_CityRadiusMod); _radB = abs (_radB * JTD_CityRadiusMod); // ensures a minimum radius of 1 if (_radA < 1) then { _radA = 1; }; if (_radB < 1) then { _radB = 1; }; //ooooooooooooooooooooooooooooooooooooooooooooooooooo // set markers if (JTD_CityMarkers) then { _trigName = format ["JTDTrig%1", ((JTD_citylist select _i) select 0)]; _JTDTrigMarker = createMarker [_trigName, [_posX, _posY]]; _JTDTrigMarker setMarkerColor "ColorRedAlpha"; _JTDTrigMarker setMarkerShape "ELLIPSE"; _JTDTrigMarker setMarkerSize [_radA, _radB]; }; //ooooooooooooooooooooooooooooooooooooooooooooooooooo // set trigger _spawnTrig = createTrigger ["EmptyDetector", [_posX, _posY]]; _spawnTrig setTriggerArea [_radA, _radB, 0, true]; _spawnTrig setTriggerActivation ["ANY", "PRESENT", true]; if (JTD_CityPlayerOnly) then { // this version only activates on player in the trigger if (JTD_CityDebug) then { hint "Player Only Trigger"; sleep 1; }; _spawnTrig setTriggerStatements ["player in thislist", format ["nul = [%1] execVM 'JTD_CivSpawnInit.sqf'", _i], ""]; //for JTD Civ script } else { // any unit will set off the civs _spawnTrig setTriggerStatements ["this", format ["nul = [%1] execVM 'JTD_CivSpawnInit.sqf'", _i], ""]; //saves the index to pass to spawn script }; JTD_CityTriggers = JTD_CityTriggers + [_trigger]; // Store these variables into global array, so they are indexed to the city list. JTD_CityCenters = JTD_CityCenters + [_citycenter]; JTD_CityBorders = JTD_CityBorders + [_cityborder]; }; if (JTD_CityDebug) then { hint "City Scripts Initialized"; sleep 1; }; Then, the city position function: /* JTD_CityPosition.sqf function. By Trexian/hoz The purpose of the JTDCityCenter function is to determine the location of a city area. It is almost a direct rip of the FindClosestTown function by hoz, available at OFPEC. All I did was change the elements returned, and tweaked the mechanism for creating the array, as suggested by Spooner. All credit for this function really goes to hoz. ooooooooooooooooooooooooooooooooooooooooooooooooooo No elements passed to it (yet), and it returns the city position from the config. ooooooooooooooooooooooooooooooooooooooooooooooooooo Version history 01a - released at OFPEC 01b - fixed pursuant to Spooner's suggestions - included demo mission */ //hint "position init"; //sleep 1; _towns=[]; _townsTemp = []; _cfgTowns = (configFile >> "cfgWorlds" >> WorldName >> "Names"); _cfgPath = ""; _return = []; for [{_z=0}, {_z < ((count _cfgTowns) - 1)}, {_z = _z +1}] do { _cfgPath = _cfgTowns select _z; _typecity = getText (_cfgPath >> "type"); if ((_typecity == "NAMECITY") || (_typecity == "NAMEVILLAGE") || (_typecity == "NAMECITYCAPITAL")) then { _return = _return + [[getText (_cfgPath >> "name"),getArray (_cfgPath >> "position")]]; }; }; _return Then, the city center function: /* JTD_CityCenter.sqf function. By Trexian ooooooooooooooooooooooooooooooooooooooooooooooooooo Credits: OFPEC DMarkwick, for math Hoz, for the FindNearestTown resource Baddo, for findBuildingPositions sqf reference Raven, for takeBuilding sqs reference ooooooooooooooooooooooooooooooooooooooooooooooooooo The purpose of the JTDCityCenter function is to roughly determine the center of a city area. It starts with the position passed to it (likely the config location of the city), and determines the densities of the areas in each direction. If one of the densities is larger than the inital, that becomes the temporary center. The search is repeated until the script reaches a position that has no higher density in the surrounding area. That position is returned. ooooooooooooooooooooooooooooooooooooooooooooooooooo Version history 01a - released at OFPEC 01b - fixed pursuant to Spooner's suggestions - included demo mission */ //hint "center init"; //sleep 1; _posTown = [0,0]; _cntThis = 0; _initArray = []; _initCnt = 0; _bldgTemp = ""; _bldgPos = 0; _t = 0; _z = 0; _d = 0; _tempArray = []; _centerBool = false; _posCenter = [0,0,0]; _direction = 0; _cntTemp = 0; _posTemp = [0,0,0]; _srchPos = [0,0,0]; _srchBldg = []; _srchArray = []; _srchCnt = 0; _holderCnt = 0; _holderPos = [0,0,0]; _posElem = []; _posX = 0; _posY = 0; _posElem = _this select 0; // position array passed to function _posX = _posElem select 0; _posY = _posElem select 1; _posCenter = [_posX, _posY, 0]; // initial setting of the "center" _initPos = _posCenter; _initCnt = 0; _centerBool = false; _direction = 0; while {! _centerBool} do { _posTemp = _posCenter; _holderCnt = _initCnt; _holderPos = _posCenter; for [{_d = 1},{_d <= 8},{_d = _d + 1}] do { _direction = _direction + 45; // builds an initial array of buildings within the search area // the distance could be tweaked, depending on the results _srchPos = [((_posTemp select 0) + sin (_direction) * 100), ((_posTemp select 1) + cos (_direction) *100), 0]; _tempArray = nearestObjects [_srchPos, ["HOUSE"], 100]; _t = count _tempArray; _t = _t - 1; // this is a quick routine to make sure the buildings found are occupiable for [{_z = 0},{_z <= _t},{_z = _z + 1}] do { _srchBldg = _tempArray select _z; _bldgPos = _srchBldg buildingPos 0; if (((_bldgPos select 0) != 0) && ((_bldgPos select 1) != 0)) then { _srchArray = _srchArray + [_srchBldg]; }; }; _tempArray = []; _t = 0; _srchCnt = count _srchArray; _srchArray = []; // conditional to determine if the search is greater than the original if (_srchCnt > _holderCnt) then { _holderPos = _srchPos; _holderCnt = _srchCnt; }; // conditional to determine if the search yielded a position different than the last center - that no higher densities were found if (((_holderPos select 0) != (_posCenter select 0)) && ((_holderPos select 1) != (_posCenter select 1)) && ((_d == 8))) then { _posCenter = _holderPos; _initCnt = _holderCnt; _d = 0; }; }; _tempArray = nearestObjects [_holderPos, ["HOUSE"], 50]; if ((count _tempArray) < 1) then {_tempArray = nearestObjects [_holderPos, ["HOUSE"], 100];}; // makes the center over a building _posCenter = getPos (_tempArray select 0); _centerBool = true; }; _posCenter Then, the city radius function: /* JTD_CityBorder.sqf function. By Trexian The purpose of the JTDCityBorder function is to roughly determine the size of the city being analyzed. It first determines the baseline density for the center of the city. The analysis is different, depending on whether it is a high-density or low-density city. The script uses a circle of the given radius (_radius) to compare the density within the circle to the initial density in each cardinal direction. When it reaches a certain percentage (_densityCutoff) of the original ratio, it considers that the outer extent of that direction. The script uses the longer of North/South for the B radius, and East/West for the A radius. The _radiusFactor is basically something to increase/decrease the size of the radii by an artificial amount, depending on the needs of the developer. This can also be achieved by altering the returned elements in the calling script. Also, within the script, the areas to tweak are: - the first conditional determines the definition between "big" and "small" cities - the _dist is the increment for the center of the search - the _radius determines the size of the circle the search examines to determine the ratio to compare to the initial ratio ooooooooooooooooooooooooooooooooooooooooooooooooooo Credits: OFPEC DMarkwick, for math Hoz, for the FindNearestTown resource Baddo, for findBuildingPositions sqf reference Raven, for takeBuilding sqs reference ooooooooooooooooooooooooooooooooooooooooooooooooooo Version history 01a - released at OFPEC 01b - fixed pursuant to Spooner's suggestions - included demo mission */ //hint "border init"; //sleep 1; // these are the main tweakable values _densityCutoff = .2; _dist = 0; _radiusFactor = 0; _initCnt = 0; _t = 0; _d = 0; _tempArray = []; _centerBool = false; _posCenter = [0,0,0]; _direction = 0; _cntTemp = 0; _posTemp = [0,0,0]; _srchPos = [0,0,0]; _srchCnt = 0; _radA = 10; _radB = 10; _tmpRatio = .2; _angle = 0; _radius = 50; _posElem = _this select 0; _return = []; _posX = _posElem select 0; _posY = _posElem select 1; _posCenter = [_posX, _posY, 0]; _tempArray = nearestObjects [_posCenter, ["HOUSE"], 100]; _cntTemp = count _tempArray; _posCenter = getPos (_tempArray select 0); _initPos = _posCenter; _initCnt = _cntTemp; _initRatio = _cntTemp / 100; _centerBool = false; _direction = 0; // conditional to determine whether to use the Big City function or not if (_initRatio < .75) then { _radius = 100; _dist = 50; _densityCutoff = .2; _radiusFactor = .75; } else { _radius = 150; _dist = 50; _densityCutoff = .1; _radiusFactor = 1; }; for [{_t = 1},{_t <= 4},{_t = _t + 1}] do { _tmpRatio = .9; while {_tmpRatio > (_initRatio * _densityCutoff)} do { _d = _d + 1; _dist = _d * _radius; _direction = _t * 90; _srchPos = [((_posCenter select 0) + sin (_direction) * (_dist)), ((_posCenter select 1) + cos (_direction) * (_dist)), 0]; _tempArray = nearestObjects [_srchPos, ["HOUSE"], _radius]; _cntTemp = count _tempArray; _tmpRatio = (_cntTemp / _radius); }; _d = 0; // conditional to determine which direction we're looking at if (((_t == 1) || (_t == 3)) && (_dist > _radA)) then { _radA = _dist; }; if (((_t == 2) || (_t == 4)) && (_dist > _radB)) then { _radB = _dist; }; _radA = _radA * _radiusFactor; _radB = _radB * _radiusFactor; _return = [_radA, _radB]; }; _return Then, an init for the civilian spawning: /* JTD Civilian Spawn script by Trexian Purpose: determine how many civs to spawn Implementation: executed from generated trigger. MUST HAVE CIVILIAN ON THE MAP. Will likely include a loop for vehicles eventually. ooooooooooooooooooooooooooooooooooooooooooooooooooo Ver. History 01a - used with the 01b version of released JTD City Functions 01b - added array for cities with spawned civs 01c - added server check 01d - included global parameters ooooooooooooooooooooooooooooooooooooooooooooooooooo */ if (JTD_CityDebug) then { hint "DEBUG civilian spawn init"; sleep 1; hint "VERIFY manual placement of civilian on map."; sleep 2.5; }; // this section sets up the basic parameters _index = _this select 0; _name = (JTD_citylist select _index) select 0; // name of nearest city _cityCenter = JTD_CityCenters select _index; // center of nearest city _cityRadA = (JTD_CityBorders select _index) select 0; _cityRadB = (JTD_CityBorders select _index) select 1; _posSpawn = [_cityCenter select 0, _cityCenter select 1, 0]; // unnecessary? _cntArray = 0; if !(isServer) exitWith {hint "not server"}; if (JTD_CityDebug) then { hint format ["city = %1", _name]; // debug sleep 1; }; //ooooooooooooooooooooooooooooooooooooooooooooooooooo // Global city civ array functions- // want to use index of current city, so we can get distance to any city in array if (_index in JTD_CityCivArray) exitWith { if (JTD_CityDebug) then { hint "exiting because city exists in array"; sleep 2; }; }; JTD_CityCivArray = JTD_CityCivArray + [_index]; //ooooooooooooooooooooooooooooooooooooooooooooooooooo // radius not changed by parameter, value from original calculation; can be changed by different parameter _randCivs = floor (random ((_cityRadA + _cityRadB) / 5)); // modify number of civs by global parameter from the city initialization _randCivs = abs (ceil (_randCivs * JTD_CivSpawnMod)); if (_randCivs < 1) then { _randCivs = 1; }; if (JTD_CityDebug) then { hint format ["civ number %1", _randCivs]; sleep 1; }; // change the _randcivs to whatever number you want for [{_q = 0}, {_q <= _randCivs}, {_q = _q + 1}] do //for [{_q = 0}, {_q <= 1}, {_q = _q + 1}] do { [_index] execVM "JTD_CivSpawn.sqf"; sleep .2; }; if (JTD_CityDebug) then { hint "Civilian Spawn initialized"; sleep 1; }; Then the actual civilian spawning: /* JTD Civilian Spawn script by Trexian Purpose: spawn some civs randomly, behind the player, with random waypoints Implementation: executed from generated trigger ooooooooooooooooooooooooooooooooooooooooooooooooooo Credits: OFPEC Hoz, for the FindNearestTown, doFollowUnit references Baddo, for findBuildingPositions sqf reference Raven, for takeBuilding sqs reference Spooner, for iterative triggers Xeno, for support and testing ooooooooooooooooooooooooooooooooooooooooooooooooooo Version: 01a Taken a bit from JTD CivAmble estabish basics 01b Randomized AI movement Established chance that the AI will follow the player 01c Spawn in buildings Enter buildings 02a Made to work with the JTDCity scripts, release ver. 01b Spawn position is in a 120 deg arc on the oppposite side of the trigger from the player 02b Changed "cycle" to "dismissed" 02c appears to have global array functioning appears to properly delete civs 02d added alive-ness check for deletion changed back to cycle - dismissed resulted in greater number of loiterers further changed the building entry stuff to alleviate loiterers bug - dudes still walk off building tops added debug/global parameter stuff ooooooooooooooooooooooooooooooooooooooooooooooooooo TTD: spawn in or on far side of buildings. - get number of civs to spawn - get number/location of buildings - - problem in that the building array only takes 1 number for radius, and doesn't do ellipse - - maybe take the average of the two radii, or the longer, I guess - randomly pick building - - random binary to decide if spawn in building - if outside, get direction of player to building - - pick position random distance on that vector past building, spawn there vehicles Develop better way of getting vector from player to center of town rather than direction player is going/looking ooooooooooooooooooooooooooooooooooooooooooooooooooo */ if (JTD_CityDebug) then { hint "Civilian Spawn started"; sleep 1; }; //ooooooooooooooooooooooooooooooooooooooooooooooooooo //defines and scopes _civArray = ["Civilian2","Civilian3","Civilian4","Civilian5","Civilian6","Civilian7","Civilian8","Civilian9","Civilian10","Civilian11","Civilian12","Civilian13","Civilian14","Civilian15","Civilian16","Civilian17","Civilian18","Civilian19","Civilian20","Civilian21"]; _speedArray = ["LIMITED", "NORMAL", "LIMITED"]; _behaveArray = ["CARELESS", "AWARE", "AWARE", "CARELESS", "CARELESS"]; _posPl = getPos player; _dirPl = getDir player; // integrate global values _index = _this select 0; _name = (JTD_citylist select _index) select 0; _cityCenter = JTD_CityCenters select _index; _cityRadA = (JTD_CityBorders select _index) select 0; _cityRadB = (JTD_CityBorders select _index) select 1; _posSpawn = [_cityCenter select 0, _cityCenter select 1, 0]; // local values _disSpawn = ((_cityRadA + _cityRadB) / 3); // distance to spawn - started as average of radii, then 1/3 total // may use "max" command to choose the larger of the two _civCnt = count _civArray; // count number in civilian array _civRnd = floor (random _civCnt); // random number 0 to number of civilians, basically _civSel = _civArray select _civRnd; // select random element of civilian array _wpDis = (random 50) + 50; // random number 50-100 for waypoint distance _wpDir = random 360; // random waypoint direction _wpNum = ceil ((random 3) + 3); // random number of waypoints 3-6 _disCheck = 0; // will be the check for distance between spawned civ and player _follower = false; // for follower conditional _followerCnt = 0; // counter for follower conditional _rndBeh = 0; // random behavior select _rndSpd = 0; // random speed mode select _followerCnt = 0; // sets follower iteration counter _bldgArray = []; // array of buildings near spawn point _bldgCnt = 0; // building count _rndBldg = 0; // random building select _bldgSpawn = ""; // building select to spawn into _bldgPos = 0; // building position for spawn _i = 0; // iterator _rndPos = 0; // random building position selector _bldgNear = ""; // nearest building for entry routine _rndTime = random 20; // random number to add to behavior timer at the end _t = 0; // temporary iterator _tempArray = []; // temporary array _bldgDist = 21; // distance of civ to nearest building _distRand = 0; //------------------------------------- // TEST - spawn where player isn't looking // _dirPl = (_dirPl+180)+((random 60) - 30); // if (_dirPl >360) then {_dirPl = (_dirPl - 360)}; //------------------------------------- //ooooooooooooooooooooooooooooooooooooooooooooooooooo // spawn on side of city opposite player _dirPl = (_dirPl)+((random 120) - 60); if (_dirPl >360) then {_dirPl = (_dirPl - 360)}; //_dirPl = random 360; // test for random direction around player _distRand = random 50; // _distRand = 1; // for testing _disSpawn = (_disSpawn + _distRand) ; // tweakification _xSpawn = (_cityCenter select 0) + sin (_dirPl) * _disSpawn; _ySpawn = (_cityCenter select 1) + cos (_dirPl) * _disSpawn; // checks if surface is water; if it is, spawn just 20m from center if (surfaceIsWater [_xSpawn, _ySpawn]) then { _xSpawn = (_cityCenter select 0) + sin (_dirPl) * 20; _ySpawn = (_cityCenter select 1) + cos (_dirPl) * 20; }; _posSpawn = [_xSpawn, _ySpawn, 0]; // creates civ at a point, might be setpos'd to a building if (JTD_CityDebug) then { hint "civ spawned"; sleep 1; }; _grpSpawn = createGroup civilian; sleep .4; _civSpawn = _grpSpawn createUnit [_civSel, _posSpawn, [], 5, "NONE"]; _rndBeh = floor (random 5); _rndSpd = floor (random 3); _civSpawn setBehaviour (_behArray select _rndBeh); _civSpawn setSpeedMode (_speedArray select _rndSpd); //ooooooooooooooooooooooooooooooooooooooooooooooooooo // building checks to see if the AI spawns in a building _tempArray = nearestObjects [_posSpawn, ["HOUSE"], 100]; // radius 100, can be tweaked _t = count _tempArray; // count number of buildings in array //for each building, find at least one building position //this should serially select each building in the array, then remove it if position 0 (1) is 0,0,0 _t = _t - 1; for [{_x = 0},{_x <= _t},{_x = _x+1}] do { _bldgSpawn = _tempArray select _x; _bldgPos = _bldgSpawn buildingPos 0; if (((_bldgPos select 0) != 0) && ((_bldgPos select 1) != 0)) then { _bldgArray = _bldgArray + [_bldgSpawn]; }; }; _tempArray = []; // resets the temparray // need to create array of those to be removed, then remove them _bldgCnt = count _bldgArray; // count number of buildings in array // at this point, _bldgArray should only contain buildings within 100 of the civ that have at least one buildingPos if (_bldgCnt > 0) then //building spawn conditional start // at least 1 inhabitable building exists within the radius of the position { _rndBldg = floor (random _bldgCnt); _bldgSpawn = _bldgArray select _rndBldg; _i = 0; // building position iterator while { format ["%1", _bldgSpawn buildingPos _i] != "[0,0,0]" } do // counts number of building positions { _bldgPos = _bldgSpawn buildingPos _i; _i = _i + 1; }; _rndPos = floor (random _i); _civSpawn setPos (_bldgSpawn buildingPos _rndPos); if (JTD_CityDebug) then { hint "civ in bldg"; sleep 1; }; }; //building spawn conditional end // this ends the building spawning; after this, the unit gets regular waypoints //ooooooooooooooooooooooooooooooooooooooooooooooooooo // set waypoints for [{_i = 0}, {_i <= _wpNum}, {_i = _i + 1}] do { // start wp index iterative loop _wpDis = (random 50) + 20; // random number 20-70 for waypoint distance _wpDir = random 360; // random waypoint direction _xWp = (_posSpawn select 0) + sin (_wpDir) * _wpDis; _yWp = (_posSpawn select 1) + cos (_wpDir) * _wpDis; _wpPos = [_xWp, _yWp, 0]; _wp = _grpSpawn addWaypoint [_wpPos, _i]; // adds waypoint selected at index _i // conditional to decide which kind of waypoint to make it if (_i == _wpNum) then { [_grpSpawn, _i] setWaypointType "CYCLE"; // had better performance than "DISMISSED" } else { [_grpSpawn, _i] setWaypointType "MOVE"; }; _rndRad = ceil random 15; // creates random radius for the wp [_grpSpawn, _i] setWaypointPosition [_wpPos, _rndRad] }; // end wp index iterative loop //ooooooooooooooooooooooooooooooooooooooooooooooooooo // while distance < 300 loop? Tweaked to 500 for JTDCity implementation _disCheck = _civSpawn distance player; _follower = false; _followerCnt = 0; while {(_disCheck <= 400) && (alive _civSpawn)} do // sets distance to delete AI { // distance loop start if (JTD_CityDebug) then { hint format ["distance %1", _disCheck]; sleep 1; }; sleep _rndTime + 10; // random sleep from 10-30 second _rand100 = random 100; // if follower move toward player if (_follower) then // follower conditional start { // civ is player follower group _civSpawn move getPos player; _followerCnt = _followerCnt + 1; sleep 20; } else { // civ is non-follower _rndBeh = floor (random 5); _rndSpd = floor (random 3); _civSpawn setBehaviour (_behArray select _rndBeh); _civSpawn setSpeedMode (_speedArray select _rndSpd); if (JTD_CityDebug) then { hint format ["Beh %1 speed %2", _rndBeh, _rndSpd]; sleep 1; }; // enter building routine _bldgNear = position _civSpawn nearestObject "HOUSE"; // get building nearest civ _bldgDist = _civSpawn distance _bldgNear; if (_bldgDist < 50) then // building near conditional start { _i = 0; // building position iterator while { format ["%1", _bldgNear buildingPos _i] != "[0,0,0]" } do // counts number of building positions { _i = _i + 1; }; _rndPos = floor (random _i); //group _civSpawn move (_bldgNear buildingPos _rndPos); // doesn't work well _civSpawn moveTo (_bldgNear buildingPos _rndPos); waitUntil {(_civSpawn distance (_bldgNear buildingPos _rndPos)) < 5}; hint "entering building"; sleep 1; group _civSpawn setCurrentWaypoint [group _civSpawn, 1]; }; // building near conditional end // random chance to follow - 20%; tweaked to 10%; tweaked to 1 to make it almost impossible if (_rand100 < 1) then // set follower conditional start { _follower = true; }; // set follower conditional end }; // main conditional end // reset follower status - 50% chance + iterations greater than 20 if ((_rand100 < 1) && (_followerCnt > 5)) then // reset follower conditional start { _follower = false; _followerCnt = 0; }; // reset follower conditional end }; // distance loop end //ooooooooooooooooooooooooooooooooooooooooooooooooooo sleep (random 10); deleteVehicle _civSpawn; if (JTD_CityDebug) then { hint "civ deleted"; sleep 1; }; sleep 1; // 10 percent chance that city is removed from array if ((random 1) < .1) then { if (JTD_CityDebug) then { hint "removing city from array"; sleep 1; }; JTD_CityCivArray = JTD_CityCivArray - [_index]; }; Now, no guarantees with this stuff.... I haven't tested it in A2. Specifically, I'm not sure of the array for civilians. Those classes may have changed. I think it worked with A2 just in terms of finding the cities, but I don't know. This is at least the framework I settled on - there's probably a dozen ways to improve it. In fact, it might be easier to figure out what needs to be added to get ALICE to work in Q-K. :D Share this post Link to post Share on other sites
RonnieJ 10 Posted February 1, 2010 Looks like a bit to big a task for me... I guess I will have to make the civilians by hand :S ---------- Post added at 07:49 PM ---------- Previous post was at 07:41 PM ---------- Reading about http://community.bistudio.com/wiki/Ambient_Civilians I cant see why another island shouldnt work? Default it will use the whole island... Share this post Link to post Share on other sites
TRexian 0 Posted February 1, 2010 ALICE relies on special config entries, the BIS Location functions are related, too. There are some threads here on it, including one that suggests how to fix it. Can't seem to find it quickly, though.... Share this post Link to post Share on other sites
manzilla 1 Posted February 20, 2010 (edited) Hey thanks for this thread and thanks TRexian for this script. But one question for TRexian, what are the last to things named. I'm pretty sure the last script is named "JTD_CivSpawn.sqf", got that from the 5th script, but what's that 5th one's name? And where do I execute it? Does it go directly in my init.sqf or is it named "JTD_CivInit.sqf" and is executed on the map some where? I tried using a trigger with a civilian in it but I'm not sure I set the trigger up right. I'm gonna use this on QK in my current WIP mission. Thanks for making this, I just wish all the map makers would update all there maps ASAP so mission on them actually have some ambiance. Edited February 20, 2010 by Manzilla Share this post Link to post Share on other sites
TRexian 0 Posted February 21, 2010 Ah, right - I think I ran that last script from the init of the mission. :) If I don't get back to this, remind me. :) Share this post Link to post Share on other sites
manzilla 1 Posted February 21, 2010 Alright now I'm a bit confused. Could you just throw this in a quick example mission so I can look at it that way? I can't seem to get the civies to spawn on Q-K. I've changed the class names for them as well. Great script though to supplement the lack of some map makers not making it ALICE compatible. ;) Share this post Link to post Share on other sites
manzilla 1 Posted March 2, 2010 I'm still having a bitch of a time setting this up. Could you whip together a quick example mission showing the set up. I've tried on and off for about a week but I just can't make it work. Share this post Link to post Share on other sites
TRexian 0 Posted March 2, 2010 (edited) Hey mate, sorry I haven't come back to this. :( Here's a quick upload of a mission in A1. Believe it or not, it'll probably work if you just drop the files (other than the briefing stuff) into A2. I recall specifically trying to make it so that it was "portable." http://www.mediafire.com/file/zujznoyo0we/OperRandomFury_02f.zip But, it is really freaking complicated - at least by my standards. :) I'll try to distill down the civ-spawn parts for an A2 mission. (Also, beware, there's some boring dev text files in there that show how truly erratic my thought patterns are.) Edit: Just realized that zip didn't have the actual script-functions in it. Here is a zip that has those. They should be the same as what I posted earlier, though. http://www.mediafire.com/file/zzmmntn3k35/JTD_CityScripts.zip Edited March 2, 2010 by TRexian Share this post Link to post Share on other sites
manzilla 1 Posted March 2, 2010 Thanks. I'll try it. But how can I get this mission to work in A2 with out Sahrani and the other AddOns in the mission.sqm? Share this post Link to post Share on other sites
TRexian 0 Posted March 3, 2010 I think using CAA1 would work, but I feel really bad about having forgotten your issue. :( Here's a quick mission that uses the files. I tried it and it looks like it works. Amazingly, no rpt errors either. :) http://www.mediafire.com/file/rjkinlymmm5/MZillaMission.zip The mission is both a pbo'd mission and the mission folder. When you play the mission, open the map, and the city borders should have red markers over them that show roughly the boundary of the city. It will be centered on the perceived center of the town. When you cross the boundary into the city, there'll be a hint showing the name of the town. At that point, start looking for civs. (I find the JTD_Camera a useful addon for that task.) Like I said, when I just tested it, it amazingly seemed to work fine. :) Share this post Link to post Share on other sites
manzilla 1 Posted March 3, 2010 I think using CAA1 would work, but I feel really bad about having forgotten your issue. :(Here's a quick mission that uses the files. I tried it and it looks like it works. Amazingly, no rpt errors either. :) http://www.mediafire.com/file/rjkinlymmm5/MZillaMission.zip The mission is both a pbo'd mission and the mission folder. When you play the mission, open the map, and the city borders should have red markers over them that show roughly the boundary of the city. It will be centered on the perceived center of the town. When you cross the boundary into the city, there'll be a hint showing the name of the town. At that point, start looking for civs. (I find the JTD_Camera a useful addon for that task.) Like I said, when I just tested it, it amazingly seemed to work fine. :) No worries bud. I'm in no rush. Thank you bud! I don't have CAA so it would've been difficult to try. I appreciate it. Share this post Link to post Share on other sites
TRexian 0 Posted March 3, 2010 Let me know if you have any questions or problems with it. It may still have some application for various dynamic missions in A2. Share this post Link to post Share on other sites
Jack_Ryan_ 10 Posted April 6, 2010 Another way would be to use a patrol script on civilians, and assign "neighbourhoods" for them to 'patrol'. Share this post Link to post Share on other sites
bushlurker 46 Posted April 6, 2010 (edited) Just happened to come across this thread while searching for something else... ALICE relies on special config entries, the BIS Location functions are related, too.There are some threads here on it, including one that suggests how to fix it. Can't seem to find it quickly, though.... I think I might have written that post... I'll summarise briefly, just in case it's of any help... (also - THIS post on the old CAA1 thread and the next few pages are worth a read)... ALICE relies basically on two things - location info in the island config, and suitable houses included in the island... you can patch in the location info easily - not so the actual houses... I did a patch for CAA1 for Sahrani to add ALICE support... (get that HERE and tear it apart to see how its done)... amazingly, it worked, more or less... I can only therefore assume certain A1 houses have the appropriate memory points... though I didn't get many civs - so possibly only a few houses have them... not sure about that issue... However, it also enabled TRexians Ambient Civ Traffic, so it's a start... tho I dunno which houses Quesh Kibrul uses... If Floosy decides to update QK then you'll be sorted since he'll add new config entries plus appropriate houses... Since you can't currently do anything about the houses - a config patch is worth a quick try I guess... Here's all you need to do... UnPBO the island - look for the config.cpp... (I'll use examples from Sahrani below since I don't have QK handy - but the principle is the same)... In the config.cpp you'll find entries for every town... they'll look something like this... class Rashidah { name="Rashidah"; position[]={9585.79,11109.2}; type="NameVillage"; radiusA=100; radiusB=100; }; That gives you names and location coordinates, so fire up notepad and, for every one of these, you have to create a matching "citycenter" - like this... class Sara_Rashidah_CC { name = ""; position[] ={9585.79,11109.2}; type = "CityCenter"; radiusA = 100; radiusB = 100; neighbors[]="Sara_Paraiso_CC","Sara_Balmopan_CC"}; demography[] = {"CIV",1,"CIV_RU",0}; }; ... then add a CfgPatches header, a bit like this... class CfgPatches { class caa1_c_town_names { units[] = {}; weapons[] = {}; requiredVersion = 1.04; requiredAddons[] = {""}; }; }; class CfgWorlds { class Intro; class Sara: Intro { class Names { class Sara_Rashidah_CC { name = ""; position[] = { 9585.79, 11109.2 }; type = "CityCenter"; radiusA = 100; radiusB = 100; neighbors[] = {"Sara_Paraiso_CC","Sara_Balmopan_CC"}; demography[] = {"CIV",1,"CIV_RU",0}; }; class Sara_Balmopan_CC { name = ""; position[] = { 8035.76, 9456.25 }; type = "CityCenter"; radiusA = 100; radiusB = 100; neighbors[] = {"Sara_Chantico_CC","Sara_Ambergris_CC"}; demography[] = {"CIV",1,"CIV_RU",0}; }; *snip..... etc, etc, etc ... save it as "config.cpp" - put it in a folder called eg: "ALICE_Support_QK" and PBO it up... You'll then need to make that microaddon a "required addon" for your mission and include it in the download... No guarantees - since it's all so very dependant on "suitable house models", but that should get Ambient Civ Traffic kicking in, at the very least... B Edited April 6, 2010 by Bushlurker Share this post Link to post Share on other sites
Clayman 20 Posted May 10, 2010 Don't know if this is obvious, but I couldn't find anything so I'll just post it here. I've spent quite some time trying to get the ALICE and SILVIE modules working on a custom island (FDF Podagorsk in this case) without any config editing. (The advantage being that mission makers don't have to create a config-fix-pbo to get the modules working.) Tried various suggestions I found on these and other forums, read through the wiki and looked over the location functions. And finally I think I have it working - to a certain degree at least. Vehicles will spawn, civilians will walk around and do stuff, chimneys smoke etc. In fact, while testing this, I actually noticed for the first time civilians driving from one town to the other. So, what to do: 1) Place a logic of type "City Center" in each town on the map and give it a name (e.g. the name of the town). 2) Place ALICE and SILVIE modules. In each init line put this setVariable ["townlist", [logicName1, logicName2, logicName3]] (replace logicName1 etc with the names of your logic you created in step 1) 3) In player's init line put: [[logicName1, logicName2, logicName3], [getpos player, 100000], true] call BIS_fnc_locations; nul = [] execVM "setNeighbors.sqf" (again replace logicName with the corresponding logic names) 4) In your mission folder, create a setNeighbors.sqf file. Now this is the tricky part. We have to define the neighbor connections for each town. The BIS_fnc_locations creates location names like BIS_loc_custom_0, BIS_loc_custom_1 etc. When previewing the mission, these location names will be displayed on the map. Use these names to create the neighbor connections in the setNeighbors.sqf: BIS_loc_custom_0 setVariable ["neighbors", [bIS_loc_custom_1, BIS_loc_custom_2, BIS_loc_custom_3, BIS_loc_custom_4, BIS_loc_custom_5]]; BIS_loc_custom_1 setVariable ["neighbors", [bIS_loc_custom_0, BIS_loc_custom_2, BIS_loc_custom_3, BIS_loc_custom_4, BIS_loc_custom_5]]; BIS_loc_custom_2 setVariable ["neighbors", [bIS_loc_custom_0, BIS_loc_custom_1, BIS_loc_custom_3, BIS_loc_custom_4, BIS_loc_custom_5]]; BIS_loc_custom_3 setVariable ["neighbors", [bIS_loc_custom_0, BIS_loc_custom_1, BIS_loc_custom_2, BIS_loc_custom_4, BIS_loc_custom_5]]; BIS_loc_custom_4 setVariable ["neighbors", [bIS_loc_custom_0, BIS_loc_custom_1, BIS_loc_custom_2, BIS_loc_custom_3, BIS_loc_custom_5]]; BIS_loc_custom_5 setVariable ["neighbors", [bIS_loc_custom_0, BIS_loc_custom_1, BIS_loc_custom_2, BIS_loc_custom_3, BIS_loc_custom_4]]; Here we have 5 locations, all connected to each other. It's totally up to you which locations you connect to each other. That's it. Preview the mission, wait a minute or two and civilians and vehicles should be spawned. To remove the location markers on the map, simply remove the true at the end of the function call in player's init line (step 3): [[logicName1, logicName2, logicName3], [getpos player, 100000]] call BIS_fnc_locations; nul = [] execVM "setNeighbors.sqf" I've made a small demo mission showing you how to set it up correctly: locationTest.FDF_Isle1_a.rar Apparently FDF Podagorsk is required for this. ;) Share this post Link to post Share on other sites