cooldown and combat system procedure

Started by zorualeloupsolitaire on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
cooldown and combat system procedure

Hello !

 

I have a problem with the combat system of my mod. Specifically, I've created a variable (see photos) to act as a cooldown.

 

I made several tests and yes, my entity is affected by the variable, what bothers me is that this variable “attackcool” is set to “false” by default.

And when I ask it to set it to “true”, I get the impression that it doesn't do so.

 

This procedure is based on the fact that the entity is hit, so every time it has less than 30 hp, it throws a projectile at me. When it shouldn't do so, it should have a 5-second delay before throwing another one at me.

 

Can someone explain where I'm going wrong?

 

Thanks in advance!


Procedure

another procedure

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Are you absolutely certain…
Thu, 06/26/2025 - 13:22

Are you absolutely certain that the entity is affected by the variable?

I would recommend trying with synced entity data or nbt tags in case it is the variable causing the problem. Because I don't think that a player variable can work for non-player entities, and that might be why it isn't being updated.

Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, I'm sure it's affected…
Sat, 06/28/2025 - 19:08

Yes, I'm sure it's affected by the variable, since I had tried setting the variable to true, to see if it was affected.

As a result, I faced him several times and he didn't throw a single projectile at me, no matter how many times I tried.

And thanks for the idea, I must confess I really don't know how to use it. Is it complicated to make? Do you have any tutorial videos?

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't have any tutorial…
Sun, 06/29/2025 - 13:05

I don't have any tutorial videos, although there are likely some somewhere.

NBT tags are really easy to use, you can basically use them like variables, except you need to manually type out the name rather than using a dropdown menu. However, they do sometimes have client-server desynchronization issues if you reference them from both client and server side, and use randomization.

Synced entity data doesn't have that same problem, but you need to define it in a tab of the entity creator, and then you need to specify what entity type you are referencing, as well as what data you are referencing, from dropdown menus.