Invincibility Frames

Started by Joshualtd on Mon, 03/14/2022 - 14:52

Topic category: Help with modding (Java Edition)

Last seen on 11:09, 24. Nov 2022
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Invincibility Frames
Mon, 03/14/2022 - 18:15 (edited)

is there a possibility to remove iframes (after player/entity got hit it gets 10 ticks invincibility that i absolutely hate sometimes) or somehow change how it works like decrease the iframes or remove it for certain items?

Edited by Joshualtd on Mon, 03/14/2022 - 18:15
Last seen on 15:55, 26. Jul 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Can someone answer this? I…
Wed, 04/06/2022 - 18:58

Can someone answer this? I've been trying to do the same.

Last seen on 12:35, 26. Jun 2022
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Yeaah its Prob not possible…
Mon, 05/30/2022 - 14:31

Yeaah its Prob not possible in MCreator but you can Just "Set Entity's health = Entity's Current Health - Damage Amount" and it does bypass Hurttime but it also bypasses defenses and everything so idk you prob can with codes but its quite a challenge without it
I'm not a programmer though. I only do C# for coding

Last seen on 12:35, 26. Jun 2022
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Maaybe good for Magic…
Mon, 05/30/2022 - 14:32

Maaybe good for Magic Damages? 

Last seen on 13:34, 25. Sep 2022
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
these frames that you want…
Mon, 05/30/2022 - 17:08

these frames that you want to remove balance the games combat to deny exccessive damage in a short period of time this should be used very lightly in your mod if you want to use it at all.

Last seen on 07:52, 21. Nov 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Do what MAKC said but for…
Tue, 05/31/2022 - 20:57

Do what MAKC said but for the damage amount, but go to minecraft's wiki and figure out the damage/armor/armor toughness calculus for damage done and do that then apply the damage amount.

Last seen on 12:09, 3. Dec 2022
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I don't know if you still…
Thu, 11/24/2022 - 10:28

I don't know if you still need help but I came up with a solution for anyone who needs it. @MAKC Suggested "Just "Set Entity's health = Entity's Current Health - Damage Amount" and it does bypass Hurttime but it also bypasses defenses and everything" which is good advice, BUT this method (sorta) doesn't bypass defenses.

 

Two procedures.

 

First procedure:

Set a Global Variable as Global Session/number

Use the global trigger "Before Entity is Hurt"

If: [Source Entity] is subtype Player

Do: Set Global Variable "Name of your variable" to [Current health of Target Entity]

 

 

Second Procedure:

Set another Global Variable as Global Session/Number

Use the Global Trigger "Entity Attacked" or whatever trigger you are using.

Set Global Variable "Name of your first Variable" to [ (Itself) Minus (Current health of Target Entity) ]

This will set it to the amount of damage that was dealt.

Then set your new Global Variable to [ (1st Variable) multiplied by (The % of original damage dealt formatted as 0.##) ]

This will set the second variable to your desired percentage of damage originally dealt.

 

Then you can use this variable how @MAKC suggested, by subtracting it from the entity's current health.

 

Doing it this way will take defenses into account. Hope this helps someone and isn't too confusing!

Last seen on 12:09, 3. Dec 2022
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I forgot to include: On the…
Thu, 11/24/2022 - 10:36

I forgot to include: On the second procedure, you also need to include the same If/Do block with the player subtype when setting the two Global Variables.

Last seen on 12:09, 3. Dec 2022
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Ok forget everything I just…
Thu, 11/24/2022 - 13:00

Ok forget everything I just mentioned. I apologize. After testing, it wasn't working consistently and I found a much more consistent and in fact easier method.

 

So, when you attack an entity, the very first tick registers the entity at health prior to damage. So, by utilizing this, I came up with a simpler solution.

 

 

One procedure.

Two Global Variables set to Global Session/Number.

 

Upon the entity being attacked, immediately set the first global variable to the entity's current health and set the second variable to zero to reset it each time.

Then set a server wait for 1 tick, then set the second variable to [ (The first Variable) minus (The current health of the entity) ]

 

Now you have your damage amount and can do what I mentioned earlier by multiplying by the % formatted as 0.## to get a percent of the damage dealt. This is simpler and it still accounts for defenses. And it actually works consistently.

Last seen on 20:51, 2. Dec 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
In a custom code snippet put…
Thu, 11/24/2022 - 15:23

In a custom code snippet put:

entity.invulnerableTime = 0;