im soon done with this just need one more bit of help

Started by jeux2119 on

Topic category: Advanced modding

Last seen on 19:38, 22. Apr 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
im soon done with this just need one more bit of help

here is the procedure
https://imgur.com/a/eC1oOWvso  this is supposed to be an on button clicked summon that costs some brains and it works fully in that part but if the player has more than one stack in their inventory it will summon two of the zombie not just one
 

Last seen on 22:24, 17. Sep 2023
Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Some ideas:- if you can exit…
Wed, 09/13/2023 - 16:38

Some ideas:
- if you can exit the loop "for each slot of inventory of" in the 2nd "do" then that's the true solution. Hope MCreator allows it

- if not, maybe you can add a new boolean variable called hasSpawnedZombie and set it to false at first. In the 2nd "do", set it to true. And then make it so all the code in that "do" block only executes if the variable is false. This is also a true solution

- otherwise, maybe allowing this behavior or doing some clean-up i.e. if there are 2 giga zombies in the same spawning area, remove them until there's only 1. Problem is, you'll still be consuming the inventory items this way and if you try spawning one while one is already near you, you'll have only 1 when you're done