Author Topic: alternatives to EffectAbilityDecrease()  (Read 614 times)

Legacy_azaz1234

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
alternatives to EffectAbilityDecrease()
« on: August 31, 2015, 01:44:03 am »


               

hi


 


in a nutshell, want to be able to overcome ability-drain immunity programmatically on an as-needed basis.


 


i need to handle some situations where a pc's stats would need to be decreased, but not because of the typical negative energy-related ability drains. for this reason, these ability drains shouldn't be blocked by the likes of bone rings, negative energy protection spells, etc.  at the same time, i'd like to continue providing players w/the possibility of protecting their characters against ability drain due to negative energy.


 


one way i thought i could do this would be to create a new immunity type w/a different index than the ability drain immunity, but give it the same label, and allow only these new items in-game. then i could modify the scripts that apply negative energy-based ability drain to check for the presence of this property first, and apply ability drains programmatically. obviously this is a little tedious.


 


anyone have a clever way of doing this ?


 


thanks



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
alternatives to EffectAbilityDecrease()
« Reply #1 on: August 31, 2015, 08:46:16 am »


               

itemproperties arent problem actually, if you look into 1.71, it already established a fix for decrease ability itempropertie merged into form with immunity to ability decrease such as risen lord, it works by removing the immunity itemproperty, adding ability decrease and restoring itemproperty, there has to be delays in order to make it work, but it works and immunity applied after any decreases are in place won't restore abilities back.


 


The only real problem is spell negative energy protection and UEF, as thats not so easily possible to remove and reapply because you cant determine "remaining spell duration".


 


So there are three choices that I see:


1) what you yourself thought of, dont apply immunity to ability decrease in these spells, rather in every ability decrease spell check for these two spells and if they are on player dont apply ability decrease at all. The problem here is that its a lot of tedious work, its not a global solution and you will unneccessary modify a half of the spellscripts.


2) use nwnx plugin to get remaining effect duration, then reapplying the uef/negprotection wont be a problem


3) use nwnx plugin to apply effect through immunity (linux idk which plugin) or to temporarily disable immunity (windows - nwnx_funcs)



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
alternatives to EffectAbilityDecrease()
« Reply #2 on: August 31, 2015, 09:44:29 am »


               

Another solution (for NWN 1.69) might be to loop through the PC's equipped items and effects, remove immunity temporarily, apply the ability decrease, then restore the immunity wherever it was found. A local object pseudo-array could be used to store the items affected. I haven't tested this, though.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
alternatives to EffectAbilityDecrease()
« Reply #3 on: August 31, 2015, 10:14:56 am »


               


Another solution (for NWN 1.69) might be to loop through the PC's equipped items and effects, remove immunity temporarily, apply the ability decrease, then restore the immunity wherever it was found. A local object pseudo-array could be used to store the items affected. I haven't tested this, though.




eeh, did you even read what I wrote or you ended at "1.71"?



               
               

               
            

Legacy_azaz1234

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
alternatives to EffectAbilityDecrease()
« Reply #4 on: August 31, 2015, 04:04:57 pm »


               

my thanks to you both. '<img'>


those are some great ideas, i'll explore these options and see what i come up with.



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
alternatives to EffectAbilityDecrease()
« Reply #5 on: September 02, 2015, 12:58:40 pm »


               


eeh, did you even read what I wrote or you ended at "1.71"?




 


Personally, I stopped reading at "itemproperties."  Or, to be more precise, I stopped reading at "i."  I just can't handle a sentence that doesn't start with the proper capitalization, Shadow, sorry.


 


P.S. In all seriousness, I did stop reading at 1.71.  I ignored the "? after it.


 


P.P.S. Ignore the fact I wouldn't know there was a "? after 1.71 without reading it.  I'm psychic.



               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
alternatives to EffectAbilityDecrease()
« Reply #6 on: September 04, 2015, 07:08:34 am »


               

The approach Shadooow outlines (and which has been around for a long time) of temporarily removing item properties from equipped items is an oft-used and apparently effective solution, with the limitations mentioned regarding Negative Energy Protection, etc.


 


Keep in mind, though, that such applying-ability-drains-despite-ability-drain-immunity schemes can be very annoying to players, unless they are limited in use and well-justified. After all, a player has every reason to expect that the immunity to ability drain from an Amulet of Health or similar item will apply to mundane afflictions like dehydration in the desert, "special" diseases, etc. And, sometimes even if there is some rationale whereby direct immunity from ability drain shouldn't apply, often some other protections should. For example, I have played a couple modules where the "you suffer from the desert heat" excuse is used, but the author neglected to check if the toon had fire immunity or resistance. It's kind of a joke when a toon's ability scores are falling or he is taking damage from a heat-related effect when he is otherwise unaffected by actual fireballs or he is in fire elemental form, has Shapechanged into a red dragon, etc.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
alternatives to EffectAbilityDecrease()
« Reply #7 on: September 04, 2015, 04:34:14 pm »


               What is probably better is to never give out items with such immunities. Most of these item properties are designed for creature skins, where the creature would be immune by traits of their material composition rather than by simply wearing an item.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
alternatives to EffectAbilityDecrease()
« Reply #8 on: September 04, 2015, 05:12:22 pm »


               


What is probably better is to never give out items with such immunities. Most of these item properties are designed for creature skins, where the creature would be immune by traits of their material composition rather than by simply wearing an item.




.yet again, problem is not in items and itemproperties, those can be easily workarounded via removal and reapplY .problem are undead eternal foe and negative energy protection spellS


 


.you surely are familiar with the "exploit" with items with ability decrease where you can cast the negative energy protection, reequip such item and the ability won't be decreaseD .this is what I fixed in nwn©x_patch pluginS



               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
alternatives to EffectAbilityDecrease()
« Reply #9 on: September 04, 2015, 07:15:58 pm »


               

I am glad you put "exploit" in quotes, since it isn't certain that that is really an exploit. After all, if one item property effect is to cause ability decrease and another effect is to prevent it, who's to say that the correct functionality is that the latter doesn't work when the two clash? ;-)