First time join effects with certain tags

Started by brothers_trouble on

Topic category: Help with modding (Java Edition)

Last seen on 00:53, 19. Jan 2023
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
First time join effects with certain tags

Hello! I’m attempting to make a mod that: 

1: adds new food items, and

2: players have a chance to be allergic (using poison 1) when eating food with certain tags. They would also have a chance to be allergic to more than one food type if they are unlucky.

I was able to do the food part easily enough,  it I was struggling trying to figure out how to get the allergy part to work being someone new to this whole coding business. As an example, I want one person to be able to eat bread, but another person to be allergic to it.

Can you send me a picture and explanation on how I can do this?

Last seen on 06:28, 29. Mar 2024
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This might not be the best…
Wed, 01/11/2023 - 17:41

This might not be the best solution but:

1. I would make a Player Persistent String Variable and give it the value "none" or something similar. 

2. I would then make a check that checks if the variable is the default value we assigned the "none" or something similar. (I'd put the check on "player joins world")

3. If the Variable has the default value we assigned, use a randomizer to assign a value to the Variable which will determine if they are allergic to it or not. 

4. Make a few Item forge tags that define what a food item is, like: Gluten, Meat etc.

5. Then make a procedure that checks when a "player finishes using item" and check the Variable of the player and checks it against the provided item / item stack specific food variable that we assigned to them in stage 4.

Hope this helps, the String variable could also be replaced with an Int variable which would make the process more smooth as you could simply just randomize the variable directly in stage 3 but it would be harder to read as you would have to remember what each number stands for. 

Last seen on 00:53, 19. Jan 2023
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@woodcraft is it possible…
Thu, 01/12/2023 - 00:28

@woodcraft is it possible you could send me a picture of what that would look like? sorry im new and i dont understand how to do much of that.