Skip to content

Set current/max hitpoints for a DOOR?


I'd like to be able to dynamically set the hitpoints and hardness for a door. Hardness has a GetHardness/SetHardness function and works prefect. But don't know how to set the MAX hitpoints for a door?

I've tried these:
    int nHP = 999;
    NWNX_Creature_SetMaxHitPointsByLevel(oDoor, 1, nHP);
    SetCurrentHitPoints(oDoor, nHP);
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectTemporaryHitpoints(nHP), oDoor);

Those don't work if I want to adjust the doors hitpoints upwards (ie, more than it currently has).

The only "solution" I found, was to set the door to 10,000 hitpoints and then use SetCurrentHitPoints to adjust it DOWN, but can't adjust it UP.

That is, if door has Max of 10 hitpoints, there is no way to set it to max of 99 hitpoints?







Comments

  • ProlericProleric Member Posts: 1,283
    According to the Lexicon, EffectTemporaryHitpoints only works for creatures.

    I suspect the solution you found is the only one in this case.
  • DazDaz Member Posts: 125
    As you're using NWNX already, you'll want NWNX_Object_SetMaxHitPoints(), NWNX_Creature_SetMaxHitPointsByLevel(), as its name indicates, is for creatures :D
  • ForSeriousForSerious Member Posts: 446
    edited February 2022
    Oh. I thought I would have something for you because I've done that... but it turns out that I just set the object to have the max HP I wanted in the toolset. Then I use SetCurrentHitPoints() to lower it. I didn't even think about going the other way.

    If you want to take the time to learn moneo and letto script, it would be a good fit for what it sounds like you want to do (Increase the base HP for a lot of doors in your module, so that you can lower them with a script). That is if you have already made the doors you want to change, tagged or identifiable in some way.
  • ReachPWReachPW Member Posts: 27
    Daz wrote: »
    As you're using NWNX already, you'll want NWNX_Object_SetMaxHitPoints(), NWNX_Creature_SetMaxHitPointsByLevel(), as its name indicates, is for creatures :D

    thank you! Apparently I can't read documentation. I found the creature one but didn't look in the object plugin.

    this works wonderful:
        NWNX_Object_SetMaxHitPoints(oDoor, nHP);
        SetCurrentHitPoints(oDoor, nHP);
    
Sign In or Register to comment.