My Enhancement Table is not working properly

Started by Tyoorp on Tue, 04/21/2020 - 20:18

Topic category: Help with MCreator software

Last seen on 01:23, 30. Apr 2020
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
My Enhancement Table is not working properly
Tue, 04/21/2020 - 23:21 (edited)

Hello there.

I am actually working on my mod with MCreator 2020.2 and I'd like to create a crafting table with just 3 slots: 2 input slots and 1 outputslot.

This is my procedure and my enhancement table:

https://imgur.com/a/vBhmgSn

The video that shows the problem:

https://imgur.com/3XMVKBN

 

When you try to enhance your weapon/armor, you'll have a percentage chance of success.

+1 is 50% chance of succes, +2 is 30% and so on...

This procedure is triggered when I click on the button in the enhancement table. The tickrate of the table is 40 (2sec I think).

So, if I success, the item goes +1 and is spawned in my output slot, number 2. Slots 0 and 1 are cleared during the process.

But if I failed, the item does not go +1.

In this case, since it is an IF DO statement, the item STAYS in the input slot number 1, because it has failed to upgrade, so it is not removed from the slot.

 

What I was expecting:

If I success: the output slot is filled with the new +1 item, if not, the item stays in slot 1, only the ingredient is being consumed. It works BUT.

 

The result:

Sometimes, when I failed, the item is removed from slot 1 and the new +1 item spawn in the output slot... and when I click on it, it despawns and the real item spawns in slot 1, as it is supposed to do.

I tried everyway possible (well, I hope not !) to fix the IF DO statement. But I feel like it is buggy atm?

I mean, if the roll failed, why MCreator sometimes run the statement?

 

Do you know if I can make a crafting table only using input slots ?

 

If you have an idea, please let me know!

 

EDIT

I ended up with something like this, now it works as intended, but sometimes you can see that the procedure still spawns an item and then remove it to place the resulting item in the input slot. It's very weird. I added a feature: everytime you failed, your item is downgraded. This way, it is simplier to get what I originally planned to do. I will fit to this for now, but I still think that it's a bug.

https://imgur.com/JT8R0xR

 

Tyoorp

Edited by Tyoorp on Tue, 04/21/2020 - 23:21
Last seen on 01:27, 5. Sep 2020
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Have you tried using "else…
Tue, 04/21/2020 - 23:05

Have you tried using "else ifs" or "else" statements? These are in the "logic and loops" assortment alongside the if statements. If you don't know, "else" is used to do something else when the if statement condition is not met. "Else if" runs another if statement when the condition is not met in the original if statement.

 

If that doesn't work, or you already tried that, maybe use GUI procedure blocks instead of Block procedure blocks as in some cases, the either of them work better than the other.

 

That's all I can think of. If I get any other ideas that could work, I'll try to help out.

Last seen on 01:23, 30. Apr 2020
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I tried all of the…
Tue, 04/21/2020 - 23:33

I tried all of the statements possible to get the result I wanted, but everytime, it failed, saddly :/

The GUI still thought he had to put an item in the output slot, even if I failed the enhancement. But I came out with a better solution, it is shorter. I made an an edit to my post if you want to see.

I will try your idea about using GUI blocks and let you know.

Last seen on 01:27, 5. Sep 2020
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Alright, good luck!
Wed, 04/22/2020 - 20:37

Alright, good luck!

Last seen on 01:27, 5. Sep 2020
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Here's a few more ideas: In…
Thu, 04/23/2020 - 16:31

Here's a few more ideas:

In your procedure, try moving the "remove 1 items from slot" blocks after the "if else" statement block. The procedure I think takes priority in what comes first. In your case, you would want the result to come first before the items get removed in the procedure.

Instead of:

 

remove 1 items from slot 1 of block at x y z if it has inventory      <---- Move

remove 1 items from slot 2 of block at x y z if it has inventory      <---- This

(if random 0,1 < 0.5

execute command... "success"

set item in slot 2...)

(else

execute command... "failed"

set item in slot 2...)

                                                         <---- To here

 

Also, I don't think the procedure will be needing the "check in slot 2 for air". In fact, the GUI already won't allow duplicate items in the same slot if it can't stack. Plus, it may have also added to the problem. Try removing that. The two possible solutions may be   just the thing to fix the issue.

;)

Last seen on 01:23, 30. Apr 2020
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Hello again! So I've tried…
Thu, 04/23/2020 - 18:43

Hello again!

So I've tried with GUIs procedures and it does'nt work at all, so I will keep using Blocks I think.

I had to make several procedures because MCreator becomes very very laggy if you put too much things. The procedure itself won't display at all if you want to edit it afterward ^^ Then, I made a procedure that targets the right procedures to spawn the corresponding item in the output slot. It was very tedious, working on procedures with bad performances (it uses a web environnement I think) but I made it, the right way, I hope...

I've made some changes according to what you advise me to do:

I am no more checking if there is air in the output slot and unable my item to stack.

Now, you get higher chance of success by filling a new slot (slot 3) with a rare item. Since you can use 2 types of these rare items, I still have to check if there is air or at least one of the specific item (and again, they are consumed during the process but you can keep 1 or 2 if you are lucky).

Then there's a IF DO/ELSE IF statement that test if you get the enhancement according to the number of item you put in the slot 3.

So basically, my procedure looks like this now, for level +1: https://imgur.com/a/6AWanVR

 

The whole thing seems to work very well thanks to your help. Minecraft works in a way I begin to understand now ^^

But I still don't now about the IF DO statement... Alone, this statement is very basic and even if the condition wasn't fullfiled (I did not try with other conditions than a simple ROLL), the game sometimes still execute the code ^^

Question:

Do you know if I can delay the result (in slot 2) by let's say 40 ticks with procedures ? I might get into coding here... Because I didn't find how to make it possible.

 

tyoorp

Last seen on 01:27, 5. Sep 2020
Joined Apr 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I'm glad that I was of…
Thu, 04/23/2020 - 19:30

I'm glad that I was of assistance. Now, about your question there...

If you want to delay the result being put in the output, in the same procedure you would use local/global variables (there might be another method or more, but this is how I usually do it). First, create a new variable with the variable type "NUMBER" Lets say that the variable name you picked was called "OutputDelay". In the same if statement that determines the output, insert "Set global/local variable to (get global/local variable) + 1". The way this works is that procedures are ran in a single tick which would mean that every time the procedure is run, the "OutputDelay" variable would increase by one every tick.

Add an "if else" statement within the same if statement that we put the "OutputDelay" mechanism in. The if section would check if the "OutputDelay" variable is = 40. When that condition is met, make it so that it creates the result in the output slot. In the else section, put set global/local variable "OutputDelay" to 0, this is so that the variable resets itself if the player changes their mind and takes back the item from the slot.

And there you would have it! Maybe as a bonus, when the result is created in the output slot, put a magical "BLLIING!" sound if the enhancement succeeds, and if it fails... Well I'm not sure, but maybe a "failure trumpet" sound would play? Or a sound won't play to emphasize the awkward silence that the player experiences afterward when they realize that they just couldn't do it. You can be creative, so you can of course put your own spins into things.

Also, I really like the concept of enhancement, I think that it puts a unique little detail into Minecraft that would really set apart your mod from others! It's a neat little idea.

Good luck from here on out!

Last seen on 01:23, 30. Apr 2020
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Hey there :) Sorry for the…
Sat, 04/25/2020 - 13:06

Hey there :)

Sorry for the late response !

So I've tried to delay my procedure but it doesn't work... I understand how it is supposed to work but I can't find a way to set it up. Because the procedure that chose the corresponding item is just run once, I've even used while loops but it crashes the game, and when it works (when we go out of the loop properly) it seems like Minecraft doesnt count a procedure as 1 tick. I've even tried to run useless procedures like update the block at x y z, 20 times, to get my 20 ticks delay but nope x) I'll come back to it later, 2 days lost. lol.

So now I have this, thanks to you: https://imgur.com/a/u7nF3X5

Eheh I added the sound effects I made on garage band (not the "bing" sound tho, it is a free smithing sound) and yes it is nice! Thank you for the idea.

Yes I saw it in other games and it adds more challenge, I think my mod will be multiplayer compatible later on...

By the way, you can see on the imgur link that I'm adding a new feature, you can display a menu by pressing P, that allows you to make "quick" craft, like the simple cooking or the simple alchemy. I've made my GUIs (only for the menu and the simple alchemy tab) but it doesn't work when I try to craft something. I've tried Blocks and GUIs procedures...

  • Do you know if I need a block that has an output slot configurated and everything ? Like we do for custom crafting tables ? 
  • And do I absolutely need an output slot when doing a crafting GUI ?

Everyone can answer x) Because I'd really like to have this in my mod, the ability to craft simple things without a crafting table, wherever you are.

 

tyoorp