Random is bugged or something like this - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Random is bugged or something like this (
/showthread.php?tid=630752)
Random is bugged or something like this -
henkas - 18.03.2017
Hi
I know it should work perfect bat for example playing
4 players and selection should be random, bat it doesn't always player 2 will be zombie
Код:
public RandomZombie() return Half();
stock Half()
{
new Humans;
foreach(new i : Player) {
if(Humans < 2 && random(100) < 70 )
{
HumanSetup(i);
printf("Selected humans");
Humans ++;
}
else
{
ZombieSetup2(i);
printf("Selected zombies");
Humans = 0;
}
}
printf("Finished Selecting teams");
return 1;
}
Ideas why?
Re: Random is bugged or something like this -
SyS - 18.03.2017
Humans = 0;
why you resetting it?
Re: Random is bugged or something like this -
henkas - 18.03.2017
Quote:
Originally Posted by Sreyas
Humans = 0;
why you resetting it?
|
So how should it be?
Re: Random is bugged or something like this -
SyS - 18.03.2017
before answering the question I want to clear some things.
Is the order of selection is same always? Not just for player 2 ?
can you show what your debug printed?
You are trying to balance the team right?
Re: Random is bugged or something like this -
henkas - 18.03.2017
For make it more clear i will explain it better. Playing 4 players
Names
Name_Name (Id 0)
Second_Second (Id 1)
Third_Third (Id 2)
Fourth_Fourth (Id 3)
Weird think that always player with id 2 will be selected as zombie. I tested about 20 times and he never was Human
Код:
Printed:
[13:42:29] Selected zombies
[13:42:29] Finished Selecting teams
[13:42:29] Selected humans
[13:42:29] Finished Selecting teams
[13:42:30] Selected zombies
[13:42:30] Finished Selecting teams
[13:42:30] Selected humans
[13:42:30] Finished Selecting teams
[13:42:31] Selected humans
[13:42:31] Finished Selecting teams
[13:42:31] Selected zombies
[13:42:31] Finished Selecting teams
[13:42:32] Selected humans
[13:42:32] Finished Selecting teams
[13:42:49] Selected humans
[13:42:49] Finished Selecting teams
[13:42:50] Selected humans
[13:42:50] Finished Selecting teams
[13:42:50] Selected humans
[13:42:50] Finished Selecting teams
[13:42:51] Selected humans
[13:42:51] Finished Selecting teams
[13:42:52] Selected humans
[13:42:52] Finished Selecting teams
Yes i try balance it.
Re: Random is bugged or something like this -
Pokemon64 - 18.03.2017
I think it was just a accident
Re: Random is bugged or something like this -
henkas - 18.03.2017
Quote:
Originally Posted by Pokemon64
I think it was just a accident
|
I dont think so. I call accident when you got selected 3-4 times bat not 20 times
Re: Random is bugged or something like this -
SyS - 18.03.2017
Your function have no problem i just tested it. Try to call this function in a loop and see it yourself.Also if you want more precise 50/50 odds then change <70 to <50.
Re: Random is bugged or something like this -
Pokemon64 - 18.03.2017
Quote:
Originally Posted by Sreyas
Your function have no problem i just tested it. Try to call this function in a loop and see it yourself.Also if you want more precise 50/50 odds then change <70 to <50.
|
Bump
Re: Random is bugged or something like this -
henkas - 18.03.2017
Quote:
Originally Posted by Sreyas
Your function have no problem i just tested it. Try to call this function in a loop and see it yourself.Also if you want more precise 50/50 odds then change <70 to <50.
|
Well okay.