I’m trying to make AI entities fight others AI entities by using a set damage of animation system so everytime an animation-type is played, collided entity will recieve x amount of damage. This also includes the player. I searched and reached the video tutorials and the extension “health” and analize it carefully seeing that, it was created with the intention of “recieve damage”, instead of “giving damage” something that is not what I was expecting. will take a long time doing it that way.
So, I need your help. I reached the Json files of minecraft mob entities. How they attack giving damage? How is it coded? I just need that (on javascript) so I can do the rest of the coding and non-coding. Thank you.
I want it that damage value of this entity affect all entities. So if I decide to update new creatures…, all that long work can be done in minutes if it is with a attack variable. Even if it isn’t to give damage trought animations, if it can aply to all enemies at once it would be of big help.
Let’s say you have Zombie
You want all Zombies to attack with 10 damage
You give zombie object variable ATK and set it to 10
Now event
Condition
Zombie in collision with Vampire
Animation of Zombie is Attack
Action
Change variable HP of Vampire Subtract Zombie.Variable(ATK)
Now you can update your ATK variable on Zombie to deal whatever damage value you want
IDK if it would be more sense to call it DMG instead of ATK but whatever
And a BAD tip (THX to MrMen for clarification)
Add all enemies to group called Enemies
And instead of making above event for each enemy type you only need one
Condition
Enemies in collision with Enemies
Animation of Enemies is Attack
Action
Change variable HP of Enemies Subtract Enemies.Variable(ATK)
In scene editor you have in upper right some icons one of them will show you groups section (hover over each icon with cursor to display their names)
And there you simply just add new group rename it and add crap to it
I see. Zombie, who is an object, collision with Vampires, who is a group of objects; Pick all objects (of the mentioned group) and change the var HP (health) of mentioned group. One thing I’m confused. Is the substract a variable that I have to create? I guess I have to attach it to the entity.
Wait, does Zombie (first line) can be a group too? So “group one make collision with group two”?
It’s up to you how you set the amount to be deducted. I just followed @ZeroX4 example - it’s a way it could be implemented, but not the only way. You can hard code the value in, you can have it in variable (object, scene or global) or put in some formulae.
In this example, yes, it’s checking if a member of one group collides with a member of another group. But you could make it object vs object, or object vs group.
My example was only intended to show that you need to use the Pick all instances condition to affect all of the other objects.
BTW, keep in mind this is not a complete solution - if a zombie collides with a vampire then you’ll also want to separate the two colliding objects. Otherwise the collision will be actions every game frame, and lead to a sudden health depletion on the vampires.