SetDamage method for PlayerHitVegetationEvent

  • Hey


    is there a specific reason why PlayerHitVegetationEvent doesn't have the SetDamage method? All the other hit events provide it for some reason (Check screenshot below). It would be nice to also have it for that event.


    HdAZ8pr.png


    Just in case if someone's asking for a good use case:

    I am currently working on a level system which supposed to give the player more strength (= damage, speed etc.) depending on their level. As you might guessed I need an method like that to alter the damage for vegatations as well.

  • Hi, I think that for other events you can use getHealth and setHealth methods in player, but I'm not sure if they will show you damage animation or not

    Thanks for the fast reply, but I think there's a misunderstanding. What I'm looking for is a method which allows you to manipulate the incoming damage of vegatation entities (such as trees, plants, etc.).

    Basically I wanna multiply the damage by a given factor (which depends on the level) to simulate the strength as I mentioned above.

  • manipulate the incoming damage of vegatation entities

    I think that there is no such damage for plants, most likely that they are not entities and have a separate object type. So you since you can't control thing that doesn't exist you will need to implement your own damage system for vegetation with these methods

  • I think that there is no such damage for plants, most likely that they are not entities and have a separate object type. So you since you can't control thing that doesn't exist you will need to implement your own damage system for vegetation with these methods

    Check the doc site, there's a GetDamage method for plants (check screenshow below). And also I've tested it locally, it tracks the damage as expected, but unfortunately I can't modify the value as I wanted :$

    nlXyCDE.png


    // Edit:

    with plants I meant stuff like bushes which of course have a hitbox.. (sorry for the misunderstanding)

  • Check the doc site, there's a GetDamage method for plants (check screenshow below). And also I've tested it locally, it tracks the damage as expected, but unfortunately I can't modify the value as I wanted :$

    Wait, do you mean situation when player get damage from plant or when plant get damage from player (like tree cutting)? Event in the docs is about the second one

  • Wait, do you mean situation when player get damage from plant or when plant get damage from player (like tree cutting)? Event in the docs is about the second one

    The second one of course when plant get damage from player :D (i.e. to increase the speed of cutting a tree) I mean it wouldn't make much sense for a level system to handle player damage from plant.

  • when plant get damage from player

    In that case it should be simple - you can cancel the event and then damage plant manually, for example you can use getDamage and multiply it on level (or any other system that you will implement). Event itself don't provide you the plant object, but it provides you getGlobalID method, so you can get this object from the world with getObject method and apply custom damage to it with setStrength. That should work fine (probably)

  • In that case it should be simple - you can cancel the event and then damage plant manually, for example you can use getDamage and multiply it on level (or any other system that you will implement). Event itself don't provide you the plant object, but it provides you getGlobalID method, so you can get this object from the world with getObject method and apply custom damage to it with setStrength. That should work fine (probably)

    I will give it a try, thanks!

  • There is no reason there is no setDamage() method, so we'll add it to the PlayerHitConstructionEvent, PlayerHitObjectEvent and PlayerHitVegetationEvent with the upcoming hotfix (probably in 1-2 days) :)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!