Started by
rozaly
on
Topic category: Help with Minecraft modding (Java Edition)
I have three things I need help with, so if anyone can answer at least one of them could you please?
1. How do I make an effect that gives damage reduction, exactly like resistance except I can customize the amount?
2. How can I make a procedure that makes it so while you have a specific effect, every time you are hit the level of that effect decreases by 1 (when it reaches 1 and you get it, it is removed)
3. How can I use fully 3d modeled animations in procedures? For example, say I wanted to make an ability where it makes a custom 3d sweep in front of you. Or an ability that causes a 3d model to orbit around you.
You would need to make a procedure on the global trigger event: entity takes damage, you then check if the entity that took damage is a player and that they have your effect active. If so you cancel the event that caused the trigger ie cancel the damage. You can then get the damage that should have been applied and reduce it by whatever and then finally use that as the value to damage the entity.
You can do the same thing as above, use the same trigger and then get time left for the effect and level of effect as local variables. Remove current effect. Apply effect with same time and level-1. Else if level=1, dont apply anything.
For using animations through procedures, you would need to do this through multiples procedures. You use the active condition for the animation within the elements animation tab to turn the animation on and off through variables/nbt/custom data whatever. Then on your main procedure where you want to call the animation you do that by using the variable/nbt/custom data that you specified within the animations on/off condition either through true/false or numbers and at the end of the procedure you do the opposite to stop the animation. For the sweep it depends on when it's activated, on attacking/swinging is easy and requires only that to be checked within the animation condition. The orbit can be animated when holding the item that is orbiting, otherwise you would use particles maybe.
Sorry, I haven't been able to work on this for a few days.
I'm trying now to do the damage reduction, but I can't find out how to get the original damage value of the attack. Can you tell me how or show me how?
I also can't quite figure the effect thing out. Can you show me a procedure?
On any trigger, look in the bottom left and mcreator will give you all of the provided dependencies based on the trigger selected. In that list should be [amount] that is the amount of damage. Click it to get it as a procedure block in the window.
Here's the procedure: https://imgbox.com/gtPaGSpL
Final health should be a minus. Also I don't think this will work if the entity dies from the damage done to it. You could potentially make another procedure on entity death acting like a totem of undying to stop the player from dieing if they have the potion effect. If the damage would kill them even with the damage reduction it would be fine as it would still kill them after the potion effect procedure above goes through.
I managed to get those things to work, I used "set number global trigger parameter" in order to change the incoming damage rather than cancelling it. I also got the effect reduction to work.
I would now like some more elaboration on the animation thing though, could you please? And thank you
Oh yeah that's good.
For animation. If not a walking or idle animation but a specific action. It would depend on why/how the entity is performing the action. Use a synced data logic to turn the animation on/off. You then need a procedure to activate the logic data which would be the condition for when the action is performed.
E.g. you right click the entity, on right clicked logic set to true, in the animation condition return value of logic data, then the entity will perform the animation on being right clicked.
If you want custom effects you can make them with entities using no ai and spawn them in locationally or use particles and projectiles. If you want actual player animations then you would need to use the plugin for it.
You can make a model orbit you by making a model with the center of the model being where the player would be, when importing the model override the animation to be constant y axis rotation. Then on spawning the entity you apply yourself as a data value. You then set the entities location to the location of the entity data value (eg yourself) on tick update.