Cuberite Forum
Mobs attacking Players - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Mobs attacking Players (/thread-1766.html)



Mobs attacking Players - wudles - 02-09-2015

Is there anyway (in Lua) to make a mob attack a player besides having a player take damage from the mob?

I'd like to be able to make skeletons attack players and miss on occasion, or zombies strike players and not do any damage too. Part of the fun is the animation. Wink

Any direction on this?


RE: Mobs attacking Players - xoft - 02-09-2015

I'm afraid this is not possible yet. It would require some form of collaboration with the AI (set the target player to attack / follow), which is missing at this point.
Missing the attack on occasion should be doable - simply have the OnTakeDamage hook lower the damage, or for skeletons, when an arrow is spawned, modify its speed a bit.


RE: Mobs attacking Players - wudles - 02-09-2015

(02-09-2015, 08:36 AM)xoft Wrote: I'm afraid this is not possible yet. It would require some form of collaboration with the AI (set the target player to attack / follow), which is missing at this point.
Missing the attack on occasion should be doable - simply have the OnTakeDamage hook lower the damage, or for skeletons, when an arrow is spawned, modify its speed a bit.

How would you propose doing this?

The AI could easily send a cMonster:FollowPlayer(cPlayer) to have it move towards the player.

Depending on ranged/melee attacks a cMonster:AttackPlayer(cPlayer, int) where the int would be the percentage of success (0-100) or something like that.


RE: Mobs attacking Players - coding.solo - 08-30-2017

Is this still unsupported by the API? I couldn't readily find reference to it in the API doc.


RE: Mobs attacking Players - LogicParrot - 09-02-2017

It is still unsupported, but a major AI rewrite is in progress, and that may change.