Jump to content
Sign in to follow this  
Spudgunner

Spawning civilians

Recommended Posts

Try Norrins spawn scripts, just replace east groups with civ groups and you could do same with vehicles:

Individually respawning AI that move via doMove commands.

http://www.norrin.org/downloads/ArmA2/AI_respawn/AI_respawn_WP_test.utes.rar

Group respawning AI that move via waypoints

http://www.norrin.org/downloads/ArmA2/AI_respawn/AI_respawn_WP_grp.utes.rar

Group respawning AI that patrol an area using Kronzky's UPS

http://www.norrin.org/downloads/ArmA2/AI_respawn/aiRespawnUPS.Chernarus.rar

Respawning AI vehicles that move via waypoints

http://norrin.org/downloads/ArmA2/AI_respawn/AIvclRespawn_WP.utes.rar

Respawning AI vehicles that patrol an area using Kronzky's UPS

Share this post


Link to post
Share on other sites

I think those are for respawning existing units where as I'm trying to create new ones - but I have a good look. What I have been doing so far is this - But it's not working. Any ideas?

_rand = round (random 5);
_SideCIV = createCenter civilian;
if (_rand > -1) then {   // Debug: always true
_rand = round (random 2); // either 0, 1, 2 //
switch (_rand) do {   
	case 0: {
		_civgrp = createGroup civilian;
		unit = group createUnit ["Damsel1", Position player, [], 10, "NONE"];
		[unit] join _civgrp;
	 };   
	case 1: {
		_civgrp = createGroup civilian;
		unit = group createUnit ["Civilian1", Position player, [], 10, "NONE"];
		[unit] join _civgrp;
	};
	case 2: {
		_civgrp = createGroup civilian; 
		unit = group createUnit ["Damsel2", Position player, [], 10, "NONE"];
		[unit] join _civgrp;
	};
	default {
		hint "ERROR";
	}; 
};
};

The civilians are not being created as they should appear near to me (I think). Eventually I'll create them on markers once I see they appear.

Share this post


Link to post
Share on other sites
Take a look http://community.bistudio.com/wiki/Ambient_Civilians

I think it might be what you are looking for.

EDIT: SOLVED!!!

The ALICE module is just for populating the towns. The randomly generated civilians I'm working on need to board/disembark buses and follow WP's.

I'm not sure whats preventing them being created. I'm not using a trigger like most people using the createUnit. The bus itself calls the sqf file (for now) from it's init field. Also, I use the "createGroup" (side set to civilian) which I hear works for military units. I'm not sure what else I need - I've been playing around with "CreateCenter" but I've no idea if I need to. Atm the stripped down code looks like this:

_rand = round (random 5);

if (_rand > -1) then {
_rand = round (random 2);
switch (_rand) do {   
	case 0: {
		civgrp = createGroup Civilian;
		_unit1 = civgrp createUnit ["Damsel1", [(getMarkerPos "bwp1") select 0, (getMarkerPos "bwp1") select 1, 0, [], 0, "NONE"];
	 };   
	case 1: {
		civgrp = createGroup Civilian;
		_unit2 = civgrp createUnit ["Civilian1", [(getMarkerPos "bwp1") select 0, (getMarkerPos "bwp1") select 1, 0, [], 0, "NONE"];
	};
	case 2: {
		civgrp = createGroup Civilian;
		_unit3 = civgrp createUnit ["Damsel2", [(getMarkerPos "bwp1") select 0, (getMarkerPos "bwp1") select 1, 0, [], 0, "NONE"];
	};
	default {
		hint "ERROR";
	}; 
};
};

EDIT: SOLVED!!!

All that time lost for the want of detecting a missing "]". The above code works when the bracket is added :).

Edited by Spudgunner

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  

×