# Group Probability of Presence

## Recommended Posts

Is it possible to apply the probability of presence to an entire group? I've tried just making the group leader have 0%, but then it just promotes someone else in the group to leader. Is this even possible? I'm figuring this would save a ton of time on mission making.

##### Share on other sites

You could give one guy a probability of presence, then put this in the init of a guy with 100%

`if (count units group this < 4) then { {deletevehicle _x} foreach units group this}`

4 being the maximum number of guys in the group.

##### Share on other sites

You sir, just won the internet.

##### Share on other sites

place a unit on the map and in the init line of that unit run the script that will spawn a group. Set the POP for the unit to whatever you want the groups POP to be. ie, 50%

unit init

`mygroup = [] exevm "groupcreateexample.sqf";`

groupcreateexample.sqf

`[getPos hpad1, EAST, 5] call BIS_fnc_spawnGroup;`

if the unit is present he will run the script wich spawns the group. if he isnt present then the script that creates the group will not get executed.

##### Share on other sites

Give the groupleader a name, for example:

`myguy`

Make his "probability of presence" 0% for testing:

Then into the "condition of presence" field of all other groupmembers:

`alive myguy`

Now the groupmembers will only be alive if the leader is there too.

This checks only at mission start, if the leader dies later the groupmembers will still be there.

##### Share on other sites

yeah I do what wiggum did, very easy, also allows for a whole base or something to be dependent on one probability of presence.

##### Share on other sites

As far as I remember you can only use wiggum's method for a single group.

To continue wiggum's example, if you put

```alive myguy
```

into the condition of presence line of a unit which is not in the same group as myguy it will have no effect on this unit.

Please correct me if I'm wrong because I can't test it myself right now, but it was like that in Ofp.

##### Share on other sites

If you want a probability of presence for multiple groups, just name the next groupleader "myguy2" or something.

This way you can have a endless number of groups, all with a differend probability of presence. ;)

##### Share on other sites

Yeah, I know this wiggum. I meant it is not possible to have different groups depend on the same unit's probability of presence.

##### Share on other sites

Glorious, this is much better than spawning groups, this way I can actually put people in buildings and what not, and simply disableAI "move" so they can't collapse back into formation, and I've got myself dynamic ambushes. This is probably going to be my first user-made release, a simple convoy op through the heart of the Sangin river valley to resupply an outpost and rotate one squad back to the main FOB. 10 possible ambush points, each with a 10-15% of having men there so it could be an all out brawl to get to the outpost, or it could go without incident.

##### Share on other sites

how can i make this work for objects?

for ex.: ammo box1 is only there if ammo box 2 is there. this method here doesnt work, not even when i synchronise the 2 objects :confused:

##### Share on other sites

Name one box, eg RBox, give it a random probability of presence, then in the Condition of Presence field of the other, put

`!(isnull RBox)`

##### Share on other sites
Yeah, I know this wiggum. I meant it is not possible to have different groups depend on the same unit's probability of presence.

This is incorrect. I have several scenarios that call for precisely this, and it works perfectly. A soldier called ABC, with a condition of presence of 50%, will dictate whether or not any soldier with an "alive ABC" in it's condition of presence field will be there. This includes any and all units in any and all groups with this in their condition of presence field, even enemy units!

Here's another trick for the OP. If one wants a 50% chance of either one group appearing or another, then give the first group's leader, who we will call "ABC", a 50% chance of appearing, and put the "alive ABC" thing in all of it's group member's condition of presence field (the group leaders' remains "true"). Then, in the other group, put "if (alive ABC) then { deleteVehicle this };" in the initialization field of every member of the group. Give the next group a chance of not appearing as well, and you can have a whole chain of possible units appearing or not.

Of course, one can also fiddle with the probability of presence fields within all of the groups, thus ensuring a wide variety of possible units in a scenario. It is a great way to ensure variety and unpredictable scenarios for the determined single player gaming aficionado!