Need help with a randomizer

Recently I’ve decided to start making a new game. One of the functions I need to include is a task randomizer, where I have a choice of set tasks but it randomizes which ones you do. The intention is to have enough available that the players won’t be able to complete them all before the game ends, so each time they play it, it will be different. I’m not too bothered about this bit, but I have a problem - I don’t want the same job to be assigned twice, and I can’t for the life of me work out how to do that. I’m not the best at block code formatting, so I really need help. Does anyone have any ideas on how I could do this?

2 Likes

When you say “Play again”, do you mean go out of the game and back in?

Yes. The intention is that no two games will be the same, so if they play it again another time, it won’t be exactly the same, since the way the game works means that it would get pretty boring.

1 Like

So how about every time a job is picked, set a variable for that job to false, and make it so when the job is randomly picked it has to go through an if block checking if that variable is true, and if not it picks another job and that originally picked job won’t run. So an if else block, my bad.

3 Likes

That sounds like it might work! I haven’t actually started it yet, but I’ll tell you if it worked and mark a solution accordingly when I’ve tested it.

3 Likes

Okay, let me know if you need pictures. I’ll test it myself as well and see if I can find a possibly more efficient solution.

2 Likes

I might be a while, since I have a whole load of other stuff to make before I can actually get to that bit, but thanks for the help!

1 Like
Picture of Block Code

This will work but I fixed it later so now it’s better- no need for the restart functionality as of course all the jobs aren’t picked at once, that would make no sense.

3 Likes

That looks good! I was thinking that I’d use properties instead of variables for the true/false part, since properties can be set to true/false and it would remember that. Do you think that would work?

Yeah, sounds good. That should work and it would have the benefit of working across multiple systems later. I suppose I can blame it on my learning to never use global variables, but Gimkit is slightly different so properties make a lot of sense.

Revised Block Code

Here, I added that into the code. It’s all good now since I realized we don’t need to rechoose a job every time, because the player does that. So here it is, fully revised. This should work.

3 Likes

I think you might have made a mistake in the outer ‘if else’ block - that’s saying to set it as false if it’s not true, but I need it to transmit on the task channel and set it as false it it is true, and do it again if it’s false so that I can pick another task that hasn’t been done yet. Apart from that, this looks great! Thanks so much! I’ll put that in when I get to it.

Off-topic

About Gimkit Documentation, I think you might be able to get permission to have forum members write bits for you so long as you don’t share any links. Also, is there anything to do with it I could help with?

Oh yeah, another stupid mistake I made lol. So yeah, I’ll fix that. We’ll just pick another number, I think that’ll work better. Give me a minute, sorry about that.

For a duck

Yeah, so I’m actually going to email Team Gimkit about it because it isn’t really modding- well, it is- but I think they might be willing to make an exception for having it on the forum because we need more documentation. I’ll let you know when this happens, obviously. The full list of modules is in my bio, so you can just pick one on there and do it if you’d like. Thanks so much!

1 Like