OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Knight Trane on 16 Jul 2008, 17:54:00

Title: Civilians behave normal
Post by: Knight Trane on 16 Jul 2008, 17:54:00
  I'm looking for a way to have unarmed Civilians in a mission that will: 

        1.  Not run everywhere, but more or less just mill around an area.

        2.  React to circumstances.  i.e. flee from gunfire regaurdless of which side fires.

  I've used Col Sanders "Populate Sharani", and Sola's "DAC 2.0" to place groups and populate my areas, but neither produces the effect I describe. 

  I've looked everywhere I can think of.  If anyone could help, or confirm that its not possible, good karma would come your way.
Title: Re: Civilians behave normal
Post by: Mandoble on 16 Jul 2008, 22:19:24
As far as I remember they'll keep running here and there unless you give them a weapon, doesnt matter if careless, never fire, etc.
Title: Re: Civilians behave normal
Post by: Luke on 17 Jul 2008, 00:30:30
Knight Trane,

maybe use
Code: [Select]
"_x allowfleeing 0.95" ForEach civvygroup

and use Kronzky's Urban Patrol Script (http://kronzky.info/ups/)

Here's YOUR reply, as always.

Luke
Title: Re: Civilians behave normal
Post by: Knight Trane on 17 Jul 2008, 20:05:38
  Thanks Ill try that too.  Haven't had time to try anything yet. hopefully tonight.

Edit***18 June 5:09
  Tried replacing Civies with RACs.  Combat: Blue ,  Speed: limited, AllowFleeing: .50
Results the same.  Still run intermittently.

I really only want them to run when theres something to run from.
Title: Re: Civilians behave normal
Post by: danturn on 19 Jul 2008, 00:58:24
As far as I'm aware you need to set them to careless in their way point as well, this will get them walking, works for me at least :)
Title: Re: Civilians behave normal
Post by: schuler on 19 Jul 2008, 01:35:59
I have found civi's about as easy to control in Arma as heli's are in OFP.
   I have a situation was a civi is set to run away before a carbomb is set off. There is gunfire about 50m on the other side of a building, this confuses him. he still (after using many different setting) sometime decides to lay on the ground. Sometimes he will run away. He is set to full, move, careless and skill set 0.
UPS I don't think is made for civilians. the dont act to natural with that either. good script though for soldiers.
 I am going to start working on some different stuff like giving one of the civi's a weapon and set the armed civ to 0 probability of presents then see what happens. As Mandoble said.
Hours of fun sometimes just to get one cutsence to look real!!!!!
It would be nice if someone made a script just to keep them off the road  >:(
Cheers schuler
Title: Re: Civilians behave normal
Post by: Knight Trane on 19 Jul 2008, 21:32:50
As far as I'm aware you need to set them to careless in their way point as well, this will get them walking, works for me at least :)

Yes, sorry.  I st waypoints to Carless and still they walk about ten paces and the jog the rest of the way.

I have a few more things to try, so I'll keep at it.  At least for a while. LOL!

edit*****

Found this in the BIKI,

Paul-Hewson
    In Multiplayer, this command is overwritten by itself to NORMAL or FULLSPEED (i don't know which one, but it's fast move) when you ask the unit to move via script (ex : _unit doMove (getMarkerPos "destination"); ) The solution to solve this problem is to initialize the setSpeedMode after your order the unit to move.


    So basically it gives you :

    _unit doMove (getMarkerPos "destination");

    _unit setSpeedMode "LIMITED";


    If you plan to move the unit again after it reaches its destination, you will have to set the speed mode to LIMITED again like i did just above.

Does anybody think this could be implement this with DAC 2.0?
Title: Re: Civilians behave normal
Post by: Jocko Flocko on 23 Jul 2008, 21:22:19
_unit SetUnitPos "UP"

Will stop him from lying down...
Title: Re: Civilians behave normal
Post by: Knight Trane on 25 Jul 2008, 14:02:55
W? ???
Title: Re: Civilians behave normal
Post by: Trexian on 14 Aug 2008, 15:34:48
Here's what I came up with to solve this for something I'm working on, too.   :yes:

It works, mostly.

The idea is to make a pretty good sized trigger, with a bunch of civilians inside it, and waypoints (6 in my case, labeled "CivDest#" with # = 1 to 6).  For each civilian in the trigger (well, I think it would also do it for soldiers, so be careful), it will create a set of 2-5 move waypoints, with an additional last cycle waypoint, for a total of 3-6 wps.  Each unit will have the waypoints in a random order.  The end result SHOULD be a bunch of civilians wandering around randomly.  Also, they will occasionally run a few steps, but they mostly walk.

I can post a screenshot of an earlier version of this, if it'll help picture what the trigger looks like.

Codeness:
Code: (JTDCivAmble.sqf) [Select]
/* JTD Civilian Ambling script
by Trexian

Purpose: have civilians wander between six markers

Implementation: executed from activation of trigger

*/

// defines and establishes scopes
// generate list of units in trigger
_civs = thislist;
_pop = count _civs;
_rndNum = 3;    // minimum of 3 waypoints
_rndMarker = 1; // default to first marker
_markPos = getMarkerPos "CivDest1"; // default to first marker

// if no civs within trigger, then exit
if (_pop == 0) exitWith {};

// for each unit, remove from group
{              // start foreach loop
[_x] join grpNull; // makes each unit individual
sleep .5;
_x setBehaviour "SAFE";
_x setSpeedMode "LIMITED";

_rndNum = _rndNum + floor random 3; // results in random number between 3 and 6


for [{_i = 0}, {_i <= _rndNum}, {_i = _i + 1}] do
{            // start wp index iterative loop
_rndMarker = ceil random 6;    // picks one of 6 markers 1 to 6
switch (_rndMarker) do
{            // start switch loop
case 1:
{
_markPos = getMarkerPos "CivDest1";
sleep 1;
};
 
case 2:
{
_markPos = getMarkerPos "CivDest2";
sleep 1;
};

case 3:
{
_markPos = getMarkerPos "CivDest3";
sleep 1;
};

case 4:
{
_markPos = getMarkerPos "CivDest4";
sleep 1;
};

case 5:
{
_markPos = getMarkerPos "CivDest5";
sleep 1;
};

case 6:
{
_markPos = getMarkerPos "CivDest6";
sleep 1;
};
};   // end switch loop

_priGrp = group _x;      // really just a group of 1, but addwaypoint needs a group
_wp = _priGrp addWaypoint [_markPos, _i]; // adds waypoint selected at index _i
// conditional to decide which kind of waypoint to make it
if (_i == _rndNum) then
{
[_priGrp, _i] setWaypointType "CYCLE";
} else
{
[_priGrp, _i] setWaypointType "MOVE";
};

};            // end wp index iterative loop
}             // end foreach loop

foreach _civs;
//done

Now, the biggest issue is that when I've run this, there are usually a few AI that don't seem to get the marching orders.  They just stand around.  Now, depending on where they're placed, it can add to the ambiance, since some guys just aren't going anywhere. :D  But, when they're standing in the middle of the road, it is a bit awkward. ;)  This may be related to a minor issue, in that this script builds each unit's waypoint group in a series, so it must wait until the first dude's wp set is established before moving on to the second dude.  This can be mitigated in a couple ways.

1) reduce the time in each case down a bit, to maybe .4 or so.  For some reason, it seemed to run more smoothly with a brief delay, but YMMV.

2) have an initial foreach that gets all of them moving to a specific (or random) position, then proceeds to break them into individuals.  This should cover the fact that each is getting individual waypoints.

But really, any ideas as to what my cause some dudes not to get the waypoints?

Thanks!
T
Title: Re: Civilians behave normal
Post by: Crowey on 14 Aug 2008, 23:38:20
Hi, when im setting civvys in missions i just put them on "safe" and "limited" speed works a treat....