Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Categories

Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Need script line for base ability decrease for on_death or on_respawn

ESXESX Member Posts: 23
edited June 2020 in Builders - Scripting
I have modded the respawn script to start me back at the starting location of the mod. The last thing I need to do is add a line that will PERMANENTLY take away 1 base constitution point FOREVER. Not an effect that a character can sleep of or get healed by magic. But make it so every time the character dies they lose 1 con point, forever.

Grymlorde

Comments

  • FreshLemonBunFreshLemonBun Member Posts: 907
    To implement the 1 point optional con loss or the AD&D style con loss on raise properly you'll need to edit the character file. You do this using NWNXEE otherwise you can fake it or soft code it and then reapply it on all events that would remove it.

  • ESXESX Member Posts: 23
    edited June 2020
    To implement the 1 point optional con loss or the AD&D style con loss on raise properly you'll need to edit the character file. You do this using NWNXEE otherwise you can fake it or soft code it and then reapply it on all events that would remove it.

    I was able to do this a few years ago successfully, and now forgot what I did. There must be a way to script a line to do this and make it permanent. Maybe supernatural debuff with a permanent script line? Looking for a professional solution, not a gimik. Thanks

  • ProlericProleric Member Posts: 871
    Supernatural effect is probably the answer because it can only be removed by scripting.

  • ESXESX Member Posts: 23
    Proleric wrote: »
    Supernatural effect is probably the answer because it can only be removed by scripting.

    Perfect, now this is the line I found:

    effect eBad=EffectAbilityDecrease(ABILITY_STRENGTH, 1);
    eBad=SupernaturalEffect(eBad);
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eBad, oPC);

    The last line gets an error, I am trying to put this in the standard nw_o0_respawn script.

  • DJ_WoWDJ_WoW Member Posts: 34
    Gooday to ya,

    That should compile. The only thing I can think of is to change oPC to oRespawner.

    DJ-WoW

  • ESXESX Member Posts: 23
    Will try that, thank you

  • AtrophiedericAtrophiederic Member, Mobile Tester Posts: 147
    Friend @ESX ,
    Would you be willing to share that script once it's finalized? Please and thank you!

  • ESXESX Member Posts: 23
    Friend @ESX ,
    Would you be willing to share that script once it's finalized? Please and thank you!

    Yes, I will test it first in a few days and post it here. I am only an amateur, so you may want to test it yourself also.

  • AncarionAncarion Member Posts: 155
    Proleric wrote: »
    Supernatural effect is probably the answer because it can only be removed by scripting.

    I'm not sure about that... This is part of the code I currently use for my players:
    void ghApplyDeathPenalty(object oPC)
    {
    int nDeathCount=GetLocalInt(oPC,"PC_DEATH_COUNT");
    effect ePenalty=SupernaturalEffect(EffectCurse(nDeathCount,nDeathCount,nDeathCount,nDeathCount,nDeathCount,nDeathCount));
    
    ApplyEffectToObject(DURATION_TYPE_PERMANENT,ePenalty,oPC);
    if (GetIsPC(oPC))
     {
      SendMessageToPC(oPC,"Your return from death has weakened your Essence. All of your attributes have been permanently decreased by one point. This effect is cumulative, and can be removed only by magical means.");
     }
    
    void main()
    {
    object oPC=GetLastRespawnButtonPresser();
    ghApplyDeathPenalty(oPC);
    }
    

    The effect is removable by scripting or by use of a Greater Restoration or Remove Curse spell. EffectAbilityDecrease() is removable with a Greater Restoration spell, even if made a supernatural effect. I think the only true permanent ability decrease would be to apply a curse as DURATION_TYPE_INSTANT, instead of DURATION_TYPE_PERMANENT. Then only special scripting would remove it. This is just based off my own observations though, so I could be wrong.

  • SyrusGreycloakSyrusGreycloak Member Posts: 10
    iirc, EffectCurse cannot be applied as DURATION_TYPE_INSTANT, only as _TEMPORARY or _PERMANENT.

    From the code pasted above, you're missing a closing curly brace for your ghApplyDeathPenalty function. Also, if ghApplyDeathPenaly is only being called from the respawn script (i.e. you're not going to use this file as an include to get to the function from other scripts), GetLastRespawnButtonPresser in your main function only returns PC objects (monsters won't be clicking a respawn button), so the check for GetIsPC is unnecessary.

  • AncarionAncarion Member Posts: 155
    I suppose I should have been clearer that this is just a snippet of code, not a fully functioning script, and is in fact part of a larger include script. The function was just included here for the sake of illustration. For example, the effect is also applied to rezzed henchmen, hence the check for PC.

    EffectCurse can indeed be applied as instant, however it's not recommended for the reasons mentioned above.

    My apologies if this was interpreted as being intended to be used as a stand-alone script, or that it was in need of debugging...

Sign In or Register to comment.