Jump to content
Sign in to follow this  
esco7800

civilian spawn

Recommended Posts

I'm trying to get 20 civilians to only spawn in the city of Arnoldstein on Panthera how would I do that? Tried somethings but they did not work any help would be appreciated?

Edited by esco7800

Share this post


Link to post
Share on other sites

Do you want them to spawn at the beginning of the mission, or from a trigger when a player is in the area (or some other event)? :)

Oh, and do you want civilian traffic? ;)

Share this post


Link to post
Share on other sites

at the beginning of the mission no need for civilian traffic I hate how the AI drives

Edited by esco7800

Share this post


Link to post
Share on other sites

Are you familiar with placing an init.sqf in the mission folder? Also, do you have a preference for what kind of civs get spawned, or is it ok if they are random? Also, are you using Icebreakr's civ addon (I think it has been released?) or the default civs?

First, place a marker (either rectangular or ellipse) centered on the area you want to spawn, that is big enough to cover the area (ideally, use the same value for each axis, otherwise it gets a bit trickier) - name it something. Here is a snippet that I would start with as an init.sqf (for purposes of this snippet, I'll pretend like you named the marker civSpawnArea):

private ["_civArray", "_civMarker", "_size", "_radA", "_radB", "_dist", "_dir", "_rDist", "_posX", "_posY", "_posSpawn", "_grp", "_unit", "_member", "_newWP"];

// establishes the array of civilians to choose from randomly - these are default classes
_civArray = ["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"]

// get location of marker
_civMarker = getMarkerPos "civSpawnArea";
// get size of marker, which will give the radius measurements
_size = getMarkerSize "civSpawnArea";
  _radA = _size select 0;
  _radB = _size select 1;
  // distance = average of the two
  _dist = (_radA + _radB) /2;

// start loop for number of civilians
for [{_l = 0}, {_l < 20}, {_l = _l + 1}] do
{
// random direction
_dir = random 360;
_rDist = random _dist;

// get rough spawn point - for better results, worth looking at BIS_fnc_findSafePos
_posX = (_civMarker select 0) + sin (_dir) * _rDist;
_posY = (_civMarker select 1) + cos (_dir) * _rDist;
_posSpawn = [_posX, _posY, 0];

// spawn a random civs
_grp = createGroup civilian;
// create unit
_unit = _civArray call BIS_fnc_selectRandom;
_member = _grp createUnit [_unit, _posSpawn, [], 5, "NONE"];

// set dismissed waypoint so they wander around aimlessly
_newWP = _grp addWaypoint [_civMarker, 1];
_newWP setWaypointCombatMode "GREEN";
_newWP setWaypointType "DISMISS";
_grp setBehaviour "CARELESS";
_grp setSpeedMode "LIMITED";
_grp setCurrentWaypoint _newWP;
};

Untested, but I've done this a few times ;) and that should approximate what you're hoping to get.

Share this post


Link to post
Share on other sites

default civs no preference on what kind civs thanks you

Edited by esco7800

Share this post


Link to post
Share on other sites
civGruppen = [getpos myLocationLogicForWhereIwantTheseUnits, civilian, 20] call BIS_fnc_spawnGroup;

[civGruppen,getpos myLocationLogicForWhereIwantTheseUnits] call CBA_fnc_taskPatrol; //optional :P

Hope that helps.

Share this post


Link to post
Share on other sites
Are you familiar with placing an init.sqf in the mission folder? Also, do you have a preference for what kind of civs get spawned, or is it ok if they are random? Also, are you using Icebreakr's civ addon (I think it has been released?) or the default civs?

First, place a marker (either rectangular or ellipse) centered on the area you want to spawn, that is big enough to cover the area (ideally, use the same value for each axis, otherwise it gets a bit trickier) - name it something. Here is a snippet that I would start with as an init.sqf (for purposes of this snippet, I'll pretend like you named the marker civSpawnArea):

Why do you suggest putting this in the init.sqf? Wouldn't you want to call it from inside the mission so you could use it only when needed? (I'm right in thinking that the above puts them in the mission from the start, right?)

----

Ooops, just noticed esco7800 asked it be in the mission from the start. *Face Palm* Duh!

Edited by mcvittees

Share this post


Link to post
Share on other sites

hehe

Exactly right, mcvittees. :) It was important to know how he wanted the mission structured. If you have a mission that will (or could) wander from one town to another, you would want to set up a trigger or some other way of knowing when to place the civs.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×