Jump to content
Sign in to follow this  
polar bear

Probability of presence for a group?

Recommended Posts

Hi all,

Is there any way to set a probability of presence for an entire group, without having to base it on the name of a leader?

I was hoping to create kind of a template for a town that would have a random number of groups in it. It might have an AA unit, or it might not. It might have an infantry squad, or it might not. I was going to create it once with a waypoint for each unit ordering it to guard the town.

Then I was going to wholesale copy the entire thing and drop it on every town on the map. The idea being to quickly populate the entire map with differently defended towns.

However I have noticed that if you set the PoP of the leader of a group the rest of the group still shows up even when the leader doesn't. I understand you can script it by using the name of the leader, but presumably then that would result in duplicate names all over the map and it would fail in some way.

Thoughts?

I guess I could go individually edit each unit each time I stamp it out... but that's going to be painful! I want to populate the whole island with defenders.

Edited by Polar Bear

Share this post


Link to post
Share on other sites

So on the PoP....if you have a group of 4 men....The only PoP that matters is the leader of that group? If say you hve him set to 75% chance.....Is the entire group automatically set to 75%.....or will parts still show up if he doesn't?

Share this post


Link to post
Share on other sites

It doesn't appear that way. I created a sniper team, sniper and spotter, and made the PoP of the leader 50%. Then I previewed a few times and I noticed that the spotter is always there, while the sniper is only there half the time.

So the PoP of the leader applies to the leader only whereas I was hoping to have the entire sniper team or nothing.

Share this post


Link to post
Share on other sites

If you want pop on groups you can try deletevehicle on a random number

ie a trigger:

condition: isServer && random 9 < 5

onact: {deleteVehicle _x} foreach units group man1

That'll delete every unit of the group which man1 is in at 50% chance.

I think that should work?

Share this post


Link to post
Share on other sites

The best way should be to run a script that deletes the group if probability is low.

Example:

Unit init line:

nul = [this, 50] execVM "probability.sqf";

this is the unit.

50 is the chance = 50%.

probability.sqf

if (!isServer) exitWith {};

_grp = group (_this select 0);

_prob = _this select 1;

_chance = (random 100);

if (_chance > _prob) then

{

{ deleteVehicle vehicle _x; deleteVehicle _x; } forEach units _grp;

};

_neo_

Share this post


Link to post
Share on other sites

all u need is a condition in the other units checking if the leader is present..

Something like (Alive Leader1);

Just tested this and it works perfectly :)

Edited by Junker

Share this post


Link to post
Share on other sites

Good idea Junker! Place only the leaderand spawn the rest via trigger and the trigger should check if the leader is present.

trigger

condition box: alive sniperleader

on activation box: "US_Soldier_Sniper_EP1" createUnit [position sniperleader, group sniperleader]; "US_Soldier_Sniper_EP1" createUnit [position sniperleader, group sniperleader]; "US_Soldier_Sniper_EP1" createUnit [position sniperleader, group sniperleader];

Share this post


Link to post
Share on other sites
Good idea Junker! Place only the leaderand spawn the rest via trigger and the trigger should check if the leader is present.

trigger

condition box: alive sniperleader

on activation box: "US_Soldier_Sniper_EP1" createUnit [position sniperleader, group sniperleader]; "US_Soldier_Sniper_EP1" createUnit [position sniperleader, group sniperleader]; "US_Soldier_Sniper_EP1" createUnit [position sniperleader, group sniperleader];

why would u want to spawn the rest of the group ??

You can add (Alive leader1) to each unit in that group, so when the leader isnt there they wont appear.

Simple ;)

Share this post


Link to post
Share on other sites
why would u want to spawn the rest of the group ??

You can add (Alive leader1) to each unit in that group, so when the leader isnt there they wont appear.

Simple ;)

Just like this? :

(Alive leader1)

or

Alive leader1

Share this post


Link to post
Share on other sites

I have got the same problem.

I created a group, named the leader (in the "Name" box) "Leader1", and set his PoP to 10 %.

Then I wrote in all "Condition"-boxes of the soldiers (aliveLeader1);

But it doesnt work. Do I have to create a trigger?

Additionaly the leader of the group which I actually set to a PoP of 10% shows up at each restart.

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  

×