Help with assigning a random, custom text NBT tag to the player upon player joining the world.

Started by akrayniak on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with assigning a random, custom text NBT tag to the player upon player joining the world.

So I'm trying to create a mod based off of the Naruto series, and the first feature I'm trying to implement is one that randomly assigns the player to one of four clans. I thought I had the procedure set up correctly, however there seems to be an issue. So the procedure is set to trigger upon the player joining the world. After that it checks to see whether or not the player has already been assigned to a clan. If not, it generates a random number, between 1 and 4, assigns each clan to a value, and then assigns the player to a clan with a corresponding message, notifying the player which clanthey have been assigned to. However when I test this out, I do not see any message in-game upon creating and joining a world. Amy help here would be greatly appreciated. I can post the procedure set up too, I'm just not sure the right way to do that. 

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think the logic you're…
Wed, 04/17/2024 - 13:14

I think the logic you're describing is sound, but make sure the returned value for your randomized clan is being stored to a PLAYER_PERSISTANT string variable that has a distinct initial value that wouldn't be polled on accident/create false positives (i.e., not having the initial value be blank or a space char or something).

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I believe I've done that…
Wed, 04/17/2024 - 23:00

I believe I've done that. Could be wrong though, here's what the procedure actually looks like. https://imgur.com/a/125GoYB 

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi akrayniak, when using the…
Tue, 08/13/2024 - 01:41

Hi akrayniak, when using the "Random number between min and max" block, it is able to choose a random number that is a decimal. On top of that, your 1 to 4 means the highest number it can generate is 3.999999. To fix all of this, you need a "Round down" block in front of your min and max, and you'll also need a multiplication block where the number on the right of it is your max number.