how do i get a randomizer to select a random player

how do i get a randomizer to select a random player

Postby wolf653 » 14 April 2020, 04:27

in short words i have tried to make a infection where each round a player gets well chosen as patient zero but i am experiencing difficulties yes i have tried naming them 0, 1, 2, 3, 4, 5, 6, 7
you know i began to realize why youtubers beg for likes and shit its cause people forget to rate otherwise like come on how many people can have under 100 kills!
User avatar
wolf653
Civil Security Lite [100]
 
Posts: 123
Joined: 15 March 2020, 03:02

Re: how do i get a randomizer to select a random player

Postby Girl_Power » 14 April 2020, 09:08

Try removing the spaces to see if that fixes the problem (e.g; 1,2,3,4,5,6...)

I've never worked with randomizers so I'm not too sure myself.
Forever young, ever strong, ever brave.
User avatar
Girl_Power
Noir Lime [600]
 
Posts: 666
Joined: 12 February 2017, 00:45
Location: Earth | Close To The Sun

Re: how do i get a randomizer to select a random player

Postby jeje52 » 14 April 2020, 09:08

Random values are different for every player, so you have to sync it so it's the same for everyone.

First, you need to pick a slot that will send the value to the other players. To make sure you don't get an empty slot, check if the player's hp is over 0. If the player isn't alive, pick another.
Then you randomize the value only for that slot. Again, to make sure the slot of the value isn't empty, check if the player's hp is over 0. If it's an empty slot, randomize again. Sync the value once you get a good one. After some time (1 second or so), everyone should have the same value.
Still, there may be issues if the selected player leaves before sending the value.

This is probably way too complicated to make just like that. An easier solution would be to use a simple single-use button that takes the initiator slot and uses that, but that's not really random. If you want real random value, I can make something for you to copy to your map.
User avatar
jeje52
Civil Security Lite [100]
 
Posts: 146
Joined: 13 April 2018, 19:52

Re: how do i get a randomizer to select a random player

Postby wolf653 » 15 April 2020, 02:25

jeje52 wrote:Random values are different for every player, so you have to sync it so it's the same for everyone.

First, you need to pick a slot that will send the value to the other players. To make sure you don't get an empty slot, check if the player's hp is over 0. If the player isn't alive, pick another.
Then you randomize the value only for that slot. Again, to make sure the slot of the value isn't empty, check if the player's hp is over 0. If it's an empty slot, randomize again. Sync the value once you get a good one. After some time (1 second or so), everyone should have the same value.
Still, there may be issues if the selected player leaves before sending the value.

This is probably way too complicated to make just like that. An easier solution would be to use a simple single-use button that takes the initiator slot and uses that, but that's not really random. If you want real random value, I can make something for you to copy to your map.

yes a copy and pasta would be preferred thank you
you know i began to realize why youtubers beg for likes and shit its cause people forget to rate otherwise like come on how many people can have under 100 kills!
User avatar
wolf653
Civil Security Lite [100]
 
Posts: 123
Joined: 15 March 2020, 03:02

Re: how do i get a randomizer to select a random player

Postby daft punk 777 » 15 April 2020, 02:46

Here Is Map With Very Simple To Do Randomiser.
daft punk 777-easyrandomiser
User avatar
daft punk 777
Falkok [250]
 
Posts: 295
Joined: 22 December 2016, 11:15

Re: how do i get a randomizer to select a random player

Postby jeje52 » 15 April 2020, 04:02

daft punk 777 wrote:Here Is Map With Very Simple To Do Randomiser.
daft punk 777-easyrandomiser

I looked at the map source. I saw a couple problems with it.

1. If the randomizer gets an empty slot, you're out of luck, since it only runs once.

2. Variables like player health and the random value don't have to be set to 0 at game start, as they will change anyway. It's not a big deal, but you can remove some triggers if you take this into consideration.

3. Those single-use instant timers are quite useless. Use the trigger action "Execute trigger 'A'" in #trigger*6. Again, not a big deal but you can make it more compact and less complicated.

4. It may be better to check if hp is over 0, rather than if it's not 0. Health values can go below 0, even though you never see it in-game. If empty slots always have 0 hp then it would work even better, but it would take more testing to confirm that.

5. This would work in singleplayer, as long as you fix the issues mentioned above. It wouldn't work so well in multiplayer, as nothing is synced and random values are different for every player.
User avatar
jeje52
Civil Security Lite [100]
 
Posts: 146
Joined: 13 April 2018, 19:52

Re: how do i get a randomizer to select a random player

Postby daft punk 777 » 15 April 2020, 04:49

1 - its need to be one call randomiser, cause he wants to do infection with patient zero, it needs one call per round i think.
2 - maybe
3 - not important
4 - maybe
5 - really? I never checked this in MP , but i dont think what variable will be different for every players, only if one will join after randomiser was used.... And If this really wont sync - just put another timer (or trigger exec) what disable other timers(triggers) after player selection. I think this will solve problem, if it will be
User avatar
daft punk 777
Falkok [250]
 
Posts: 295
Joined: 22 December 2016, 11:15

Re: how do i get a randomizer to select a random player

Postby jeje52 » 15 April 2020, 06:13

daft punk 777 wrote:1 - its need to be one call randomizer, cause he wants to do infection with patient zero, it needs one call per round I think.
...
5 - really? I never checked this in MP, but I don't think what variable will be different for every player, only if one will join after randomizer was used... And If this really won't sync - just put another timer (or trigger exec) what disable other timers(triggers) after player selection. I think this will solve the problem, if it will be

1. Not really, as we're supposed to get a slot value that has a player in it. If the randomizer gets a value that doesn't contain a player, it should randomize again until it gets one with a player in it. It still randomizes one slot per round, but we have to make sure it's a good one before using it.

5. Random values in multiplayer are always different for every player. Your fix wouldn't solve the problem, you have to use sync trigger actions.
User avatar
jeje52
Civil Security Lite [100]
 
Posts: 146
Joined: 13 April 2018, 19:52

Re: how do i get a randomizer to select a random player

Postby jeje52 » 16 April 2020, 17:51

wolf653 wrote:yes a copy and pasta would be preferred thank you

I made the not-so-simple player randomizer.
I tested it in multiplayer and it worked fine, though let me know if you face any problems with it.
Here's the link to the map page: https://www.plazmaburst2.com/?s=9&a=&m= ... &id=976997

I used a different method than I described previously. Three main differences are:

1. Player health isn't used to check if player is online. Instead, a more reliable method is used where every player sends a value using sync trigger actions. If the value is sent and then received by other players, the player is online.

2. Every player randomizes a player slot. The slot that has the most "votes" will be chosen. This way of doing it should make it more reliable, as failing to send one value doesn't topple the entire system. It also answers the question "who randomizes and sends the value" by avoiding the problem altogether.

3. It doesn't work in singleplayer. This probably won't bother you too much.
User avatar
jeje52
Civil Security Lite [100]
 
Posts: 146
Joined: 13 April 2018, 19:52

Re: how do i get a randomizer to select a random player

Postby wolf653 » 18 April 2020, 00:16

jeje52 wrote:
wolf653 wrote:yes a copy and pasta would be preferred thank you

I made the not-so-simple player randomizer.
I tested it in multiplayer and it worked fine, though let me know if you face any problems with it.
Here's the link to the map page: https://www.plazmaburst2.com/?s=9&a=&m= ... &id=976997

I used a different method than I described previously. Three main differences are:

1. Player health isn't used to check if player is online. Instead, a more reliable method is used where every player sends a value using sync trigger actions. If the value is sent and then received by other players, the player is online.

2. Every player randomizes a player slot. The slot that has the most "votes" will be chosen. This way of doing it should make it more reliable, as failing to send one value doesn't topple the entire system. It also answers the question "who randomizes and sends the value" by avoiding the problem altogether.

3. It doesn't work in singleplayer. This probably won't bother you too much.

so unfortunately issues with error 1010 occur with color pattern cmds and even moving decors to guns after the stuff was copy and pasted over the issue doesn't appear on custom guns that were added pre copy
you know i began to realize why youtubers beg for likes and shit its cause people forget to rate otherwise like come on how many people can have under 100 kills!
User avatar
wolf653
Civil Security Lite [100]
 
Posts: 123
Joined: 15 March 2020, 03:02

Re: how do i get a randomizer to select a random player

Postby jeje52 » 18 April 2020, 04:05

wolf653 wrote:so unfortunately issues with error 1010 occur with color pattern cmds and even moving decors to guns after the stuff was copy and pasted over the issue doesn't appear on custom guns that were added pre copy

The randomizer shouldn't affect any of those. Can you make the map open source?
User avatar
jeje52
Civil Security Lite [100]
 
Posts: 146
Joined: 13 April 2018, 19:52


Return to Bug Reporting Archive

Who is online

Users browsing this forum: No registered users