Is there a way to (when runned a certain amount of blocks), decrease a variable?

Started by ILikeMakingMods2103 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is there a way to (when runned a certain amount of blocks), decrease a variable?

Don´t know what to include in this place so yea, maybe answer the question pls?

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[set "Var"] to [get "Var" -…
Sat, 11/27/2021 - 04:44

[set "Var"] to [get "Var" - 1]

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Someone told me to "save the…
Sat, 11/27/2021 - 07:04

Someone told me to "save the current coordinates to a variable, and then check every tick if the x or z coordinates go either up or down by the specific amount of blocks" but I don´t know how to do it.

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The reason I want to do it,…
Sat, 11/27/2021 - 07:06

The reason I want to do it, it´s because I want to make a stamina system with a hud. But I cannot seem to make it so when running (for example) 2 blocks, a variable decreases by 1 and when I´m not running it regenerates again, taking it up all the way to max stamina (max variable number).

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Visual programming does not…
Sat, 11/27/2021 - 17:58

Visual programming does not relieve you of the requirements for knowledge of mathematics and the ability to build algorithms.

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
  If you cannot create such…
Sat, 11/27/2021 - 18:00

 

If you cannot create such a simple algorithm with visual blocks, it only means that you do not understand how the code works. In this case, if all the work is constantly working for you, you will not learn anything.

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello Obscuria, I am going…
Mon, 11/29/2021 - 20:44

Hello Obscuria, I am going to be entirely honest with you: I will say that your manners are not of my liking, and if you wonder why I´m writing so politely, is because I don´t want to insult you in any way, even if you basically said that I´m "low on intelligence" (to say it with different words).

I understand that you think that because I just asked a question about something that I don´t know, you might aswell try to make yourself superior and try to make me look dumb just because I don´t understand something that you probably do.

But let´s be honest here, noone here is superior to anybody, even if you basically just called me dumb. I´m speaking to you as any normal human being and I just had a wonder because I don´t have as much experience. I have already experimented a bit why MCreator, but I don´t think that because I don´t have that much experience with variables, means that I don´t know how to use some types of variables.

I appreciate your time reading this and I hope your manners might change in a future, because I don´t see the reason to respond like that when we´re all trying to help eachother instead of ridicule and denigrate someone else only because they don´t know something.

 

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, I just saw your…
Mon, 11/29/2021 - 21:42

Also, I just saw your profile and you did good mods, though I don´t think that because I uploaded no mods or I have only 40 points means that I´m lower in hierarchy or something like that and should be treated as someone whose intellegence is lower.

I also saw you responded to people nicely instead of talking to them the same way you did to me, so I honestly think you´re being fake about your emotions and your opinions, but that´s your problem, not mine.

I just hope you understand that just because I´m "lower" in points, doesn´t mean I´m a non-intelligent and reasonable person, please, don´t think you´re superior. That´s like, -100% cool.

And even if you say you´re not making yourself look better than me, well, technically you aren´t SAYING it, but you´re indicating so by the way you speak to me.

I actually hope you have a good day and that you think about what I said.

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You misunderstood me. I was…
Mon, 11/29/2021 - 22:11

You misunderstood me.

I was not trying to offend you. I wanted to let you know that you need to look for a solution to the problem in teaching the basics of programming and algorithms.

Knowing how minecraft algorithms work would allow you to understand that you just need to check every tick if the current positions differ from the previous stamina deduction positions.  And if the number of blocks is different for you, then subtract the stamina and set the coordinates of the last stamina deduction to the current ones. Moreover, the variables  of the last deduction of stamina should be the player's NBT value.

But in any case, you need to be able to program yourself, otherwise you will constantly encounter such obstacles.

The fact that I am writing all this in place of just giving a ready-made procedure means that I see that it makes sense to talk to you about this and you will probably understand me. Most other people will endlessly ask for help with their procedures.

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, please note that …
Mon, 11/29/2021 - 22:14

Also, please note that "learning programming" is not "learning programming language" - they are two different things. There is visual programming that does not require programming language.

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I will admit it did seem…
Tue, 11/30/2021 - 06:24

I will admit it did seem like you were trying to offend me, but I had no problem with the "learning programming" thing.

I just felt quite insulted when you said "If you cannot create such a simple algorithm with visual blocks, it only means that you do not understand how the code works" as if you meant that because I couldn´t make "simple" algorithm, it only meant that I wasn´t intelligent enough to make it.

Also, about being able to program myself, I sadly don´t know how to do java programming, so that´s an issue it stops me from making more complex mods.

 

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Not understanding how the…
Tue, 11/30/2021 - 06:42

Not understanding how the code works doesn't make you stupid. It only means that you should watch/read a couple of lessons on it.
Again, you don't need to know Java syntax to do complex procedures. You only need to know how minecraft and Java work. Classes, their hierarchy and how they are processed. In some cases, knowledge of trigonometry is also required.
All this information can be found in the form of a YouTube video, you can handle it.

This knowledge will allow you to come up with different ways to implement what you need.

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well, I appreciate your…
Tue, 11/30/2021 - 06:57

Well, I appreciate your advise and I´m happy we got into an agreement.

About not understanding how code works not making me stupid, I just thought you were saying I was dumb in a "secret" way of sort, but it seems I was wrong.

 

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The only way to learn is to…
Tue, 11/30/2021 - 12:29

The only way to learn is to tinker. Been tinkering since the 90s.

Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
back to the original topic,…
Wed, 01/05/2022 - 02:05

back to the original topic, i dont think that this is possible with mcreator without plugins (if there are plugins, i dont know which ones) because if you check for changes in entity's x and z axis, you will lose stamina while riding in a minecart for instance. (though there could be ways around this like: get entitiy player is riding, if it = null, then execute whatever code)

However, there is a code block in entitiy data called is player sprinting, and that could work. It woulden't be a perfect fix, but that is what i am doing currently for my mod which has a stamina system in it.

Hope this was helpful.