Jump to content

Recommended Posts

I want to create a random number picker from 1-4. I think I've been able to do this successfully but I don't know how to use these. For instance If the random number picker chose 1 then a unit named "Red" Would die. I just don't know how to implement this. Any help is great, cheers.

Share this post


Link to post
Share on other sites

If u want to kill a random unit then u dont need a random number. You just have to select a random unit and then kill it.

But u gave not much information. I could jusr throw some commands but i doubt this helps

Share this post


Link to post
Share on other sites
3 minutes ago, sarogahtyp said:

If u want to kill a random unit then u dont need a random number. You just have to select a random unit and then kill it.

But u gave not much information. I could jusr throw some commands but i doubt this helps

Right so, I'm making a battle royal, I've been for a while and I've just started again. I've got 4 zones. Each of them have a corresponding human somewhere hidden away from the player zone. Once say "Red" has died then the Red zone will be closed. Ik this is primitive but It's what I'm working with I guess.

Share this post


Link to post
Share on other sites

And who should randomly die? Im onfused.

 

Who ever the units are which you want semect one randomly from ti get killed, put em all together in an array and use selectRandom to get one of them randomly.

Share this post


Link to post
Share on other sites
16 minutes ago, Bingo-66d21d294c551e45 said:

Each of them have a corresponding human somewhere hidden away from the player zone.

 

So, just a non-player unit hidden somewhere that has no purpose but to suddenly die?

 

Why not simply select one of your zones at random?

_zone = selectRandom [zone_1, zone_2, zone_3, zone_4];

 

Share this post


Link to post
Share on other sites
3 minutes ago, Harzach said:

 

So, just a non-player unit hidden somewhere that has no purpose but to suddenly die?

 

Why not simply select one of your zones at random?


_zone = selectRandom [zone_1, zone_2, zone_3, zone_4];

 

Right, I've done this, thank you. But i still don't understand how to activate the zone once one at random has been chosen.

Share this post


Link to post
Share on other sites
1 hour ago, Bingo-66d21d294c551e45 said:

how to activate the zone

 

We can't really help you until you give us more information.

 

Let's start with:

How are you defining these zones?
What are they? (triggers, markers, etc.)

 

Or, just share all of your code.

Share this post


Link to post
Share on other sites
21 minutes ago, Harzach said:

 

We can't really help you until you give us more information.

 

Let's start with:

How are you defining these zones?
What are they? (triggers, markers, etc.)

 

Or, just share all of your code.

There are 4 zones. Each with their own names. These zones are triggers. radzone1, radzone2, radzone3, radzone4. Once these zones are active they will start to hurt any player inside. I'm now trying to make the trigger's condition change from false to true via an SQF file. This file currently looks like this.

private _triggerStatements = triggerStatements _theTrigger;
_triggerStatements set [0, "true"];
_theTrigger setTriggerStatements _triggerStatements;
[]execVM "RandomArray.sqf";

Share this post


Link to post
Share on other sites

Idk if u understand what a triggers condition is or a condition in general is.

A condition to live is breathable air around you.

This condition is true as long u have that air around you. A teleport into space will set that condition to false and you die.

 

No sqf file needed for this just the condition...

Share this post


Link to post
Share on other sites

Anyhow when using random numbers in the game,  it is better to use  0-3  instead of 1-4

 

100 things selected at random, are numbered 0-99

 

.

 

 

 

  • Confused 2

Share this post


Link to post
Share on other sites

4 triggers (edited or scripted) for 4 areas, named: radzone1, radzone2, radzone3, radzone4

 

In init.sqf (or initServer.sqf in MP) , disable their simulation:

{_x enableSimulationGlobal FALSE} forEach [radzone1, radzone2, radzone3, radzone4];

 

choosing an area and activate it:
private _trg = selectRandom [radzone1, radzone2, radzone3, radzone4];

_trg enableSimulationGlobal TRUE;

 

Btw, for BI devs, that could be nice if the simulation option could be added in the attributes of the edited triggers....

 

 

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Joe98 said:

Anyhow when using random numbers in the game,  it is better to use  0-3  instead of 1-4

 

100 things selected at random, are numbered 0-99

 

.

 

 

 

 

Not if those 100 things are the numbers 1 thru 100.

 

Also, the command random is not inclusive of the ceiling value, i.e.:

 

random 99 will return values from 0 to 98.

  • Like 2

Share this post


Link to post
Share on other sites
On 6/23/2022 at 12:58 PM, Harzach said:

 

 

 

random 99 will return values from 0 to 98.

 

 

And  random 100  is 0-99

Many people have left this forum because they were given complex instructions they cannot follow.

 

 

Share this post


Link to post
Share on other sites
1 minute ago, Joe98 said:

 

 

And  random 100  is 0-99

Many people have left this forum because they were given complex instructions they cannot follow.

 

 

 

You are missing the point. When selecting random numbers, there is no reason to not select from the range that is relevant to the desired result. If you need a number from 1-4, then select a number from 1-4. It is not "better" to select from 0-3, as that only introduces the need for another step. You are spreading misinformation.

 

There is nothing we can do about people who are unwilling to apply themselves. If they prefer a half-assed solution from elsewhere, they are welcome to it.

  • Like 2

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

×