Aller au contenu

Photo

Scripted Irresistable Damage?


  • Veuillez vous connecter pour répondre
16 réponses à ce sujet

#1
MagicalMaster

MagicalMaster
  • Members
  • 2 003 messages

So we all know you could do something along these lines to apply 100 magic damage to a creature:

 

ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(100), oTarget);

 

However, if oTarget has 50% magic immunity and 50 magic resist he won't take any damage.  Is there a way to get around this?

 

If you're wondering why I ask, it's due to my HP display script that I'm improving at the moment.  Specifically I'm trying to make it play nicely with heals by default -- which means if a creature has 10 max HP, 100k total scripted HP (so 90k hidden initially), and 15k effective HP they'd be sitting at 2499 actual HP and 12501 hidden HP (so they appear Near Death).  However, if they get healed for 5k HP then they'll shoot up to 7499 HP and appear Injured instead.

 

Now, my script will update their health percentage correctly (since it considers both actual and hidden HP) -- but ideally I'd like to be able to detect that they're above 2499 HP while being below 25% effective HP (easy to do), knock their HP back down to 2499 (the point of this thread), and then bump their hidden HP up by 5000 (easy to do) which gets everything back on track as the player has 2499 actual HP and 127501 hidden HP at the end (20% health and thus stays at "Near Death").

 

If the target doesn't have resistances, vulnerabilities, or immunities that's simple (just apply 5000 damage of some type in this case) -- but I'm not sure what to do if they do possess one or more of those.  Ideally I want a "pure/true" damage value like the DamageEffectIncrease for non-physical damage but applied via scripting instead of a creature having to swing a weapon.

 

Another example where this would be a problem is if a creature has a lot of regeneration -- they might be brought down to, say, 36% HP (and thus slip into Badly Wounded) and then start regenerating.  But since they're "held" at 49.9% of HP the regeneration will nudge them back into "Injured" status.

 

Obviously this is mainly a visual display issue and the builder can always get around this by adding hidden HP rather than an actual heal effect...but it would be nice to be able to fix this problem.



#2
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages

Take a look at ApplyDirectDamage in the module I gave you.

 

Another, slightly more hacktastic way, is similar to the way we coded effects that ignore itemprop immunities (other than Death, which is easy with Ex or Su). Just strip and reapply the props, applying the damage in between. It actually works quite flawlessly. For that, look at the includes for the endcombats in that module, the functions beginning ApplyEffectIgnoring... . Of course, that leaves the problem of effects, but you can strip and reapply those as well, with the proper duration, if you're running nwnx_structs.

 

Funky


  • Squatting Monk aime ceci

#3
MagicalMaster

MagicalMaster
  • Members
  • 2 003 messages

Unfortunately, this is being updated in general (though mainly due to the needs of a particular person) and thus I have no guarantee nwnx_structs will be running.  So not sure what to do about effects -- was hoping I wouldn't have to try to strip item properties and reapply them constantly (potentially once per second).

 

Where are ApplyDirectDamage and ApplyEffectIgnoring... located?  I opened the OnCombatEnd script which had access to AEI (but not ADD) but the only include was nw_i0_generic -- so I opened that (modified in the module) to find that it didn't have either of the functions.  So I checked that ;ibrary's includes (x0_i0_behavior and x0_i0_anims) but neither of those appear on the modified module specific resource list.

 

What libraries would hold those functions?



#4
Proleric

Proleric
  • Members
  • 2 356 messages
Evidently, these are custom functions.

To find them, open the module with NWNExplorer. Right-click on the Scripts heading, then export to a folder of your choice. Search the folder using any tool that allows you to find content (e.g. FreeCommander).

#5
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages

There's an easier way to find them. Just open the mod script editor, and do a Find for the function name, making sure to search all scripts. Is how I find em myself, since we're north of 5000 scripts in the mod. In the search pane that opens below, you'll see the function declarations and implementations, if you scroll through. Most likely they're in a script ending in _inc, though I can't guarantee that.

 

Funky


  • Squatting Monk aime ceci

#6
Proleric

Proleric
  • Members
  • 2 356 messages
lol I forgot it was just one module - started out describing how to pool Bioware / hak scripts, but lost my way...

#7
MagicalMaster

MagicalMaster
  • Members
  • 2 003 messages

Found it, looking through it, thanks.



#8
SKIPPNUTTZ

SKIPPNUTTZ
  • Members
  • 80 messages

Take a look at ApplyDirectDamage in the module I gave you.

 

Another, slightly more hacktastic way, is similar to the way we coded effects that ignore itemprop immunities (other than Death, which is easy with Ex or Su). Just strip and reapply the props, applying the damage in between. It actually works quite flawlessly. For that, look at the includes for the endcombats in that module, the functions beginning ApplyEffectIgnoring... . Of course, that leaves the problem of effects, but you can strip and reapply those as well, with the proper duration, if you're running nwnx_structs.

 

Funky

 

Lol really?  I would like to see your code you use to do that, ive been thinking of trying this for some boss abilities. Quite sick of players and  monsters running around with Immunity to X,X,X,X,X,X,X,X,X,X,X,X, and  YZ :P   So I'm guessing:

 

Boss casts custom Mass Hold Person at location.

Checks target for all effects, Remove temporary freedom of movement, and then it would get a little more difficult if you had to remove the itemstat i assume. Get item with freedom on it, remove the prop, Apply paralyze

 

 

And then apply the item prop back to the item?? Yes I need this please <3

 

And if you could take a second, how the hell could I apply something like this to Knockdown, Stunning Fist, Called Shot, etc events? We use a windows nwnx last i knew I seem to recall a plugin that would let u hook into these events but not sure how customizable it is.



#9
SKIPPNUTTZ

SKIPPNUTTZ
  • Members
  • 80 messages

Unfortunately, this is being updated in general (though mainly due to the needs of a particular person) and thus I have no guarantee nwnx_structs will be running. 

 

Is  nwnx_structs still Linux only? I'll ask the admin tonight, but im pretty sure out current server runs on windows.



#10
MagicalMaster

MagicalMaster
  • Members
  • 2 003 messages

Skipp, keep in mind you can use Cutscene Paralyze to get around some of that -- can use it as a stun/knockdown/paralyze and players can't resist it even with immunity to paralysis/freedom.

 

And if you could take a second, how the hell could I apply something like this to Knockdown, Stunning Fist, Called Shot, etc events? We use a windows nwnx last i knew I seem to recall a plugin that would let u hook into these events but not sure how customizable it is.

 

One option would be to give either a new feat or use a player tool feat that only works if you possess the feat, can only be used every so often, and simulates the main feat.  Higher Ground does something similar with Knockdown/Disarm as I recall.



#11
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages

Lol really?  I would like to see your code you use to do that, ive been thinking of trying this for some boss abilities. Quite sick of players and  monsters running around with Immunity to X,X,X,X,X,X,X,X,X,X,X,X, and  YZ :P   So I'm guessing:

 

Boss casts custom Mass Hold Person at location.

Checks target for all effects, Remove temporary freedom of movement, and then it would get a little more difficult if you had to remove the itemstat i assume. Get item with freedom on it, remove the prop, Apply paralyze

 

 

And then apply the item prop back to the item?? Yes I need this please <3

 

And if you could take a second, how the hell could I apply something like this to Knockdown, Stunning Fist, Called Shot, etc events? We use a windows nwnx last i knew I seem to recall a plugin that would let u hook into these events but not sure how customizable it is.

Here are our basic ignoring functions, taken from hg_inc and hg_attack_inc. The latter functions don't have declarations with them in the paste I made:

 

http://pastebin.com/4c92pPmR

 

Here are some sample implementations:

 

http://pastebin.com/Fq5wjQ67

 

Lastly, some KD functions:

 

http://pastebin.com/GxYcKHxR

 

Note that the vanilla compiler won't let you do for loops like this, you have to do whiles instead:
 

    for (oTarget = GetFirstObjectInShape(SHAPE_SPHERE, fRadius, lSelf, TRUE, nTargetMask);
         GetIsObjectValid(oTarget);
         oTarget = GetNextObjectInShape(SHAPE_SPHERE, fRadius, lSelf, TRUE, nTargetMask)) {...}

 

I'm not going to attempt to include every single subfunction, or else I'd be posting for hours, but that should be enough to give you the general gist of it. As you can see, we don't bother with getting duration and reapplying, as these functions predate that capability, and we simply haven't made it a priority yet, as our players were already accustomed to the current setup.

 

Funky



#12
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages

Is  nwnx_structs still Linux only? I'll ask the admin tonight, but im pretty sure out current server runs on windows.

Don't know anymore, but as I note in the reply I just posted, you don't really need it unless you feel compelled to reapply.

 

Funky



#13
SKIPPNUTTZ

SKIPPNUTTZ
  • Members
  • 80 messages

You guys are great, thanks a bunch.

 

And yes MagicalMaster, thank god for Cutscene Paralyze, I use it a lot.



#14
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages

By the way, here's a paste of ApplyDirectDamage, mentioned above, from a while back on these boards:

 

http://pastebin.com/vpaLtxAj

 

Funky



#15
MagicalMaster

MagicalMaster
  • Members
  • 2 003 messages

Yes, was looking at it a bit yesterday and was confused by some things.  For example, what are GetTrueDamageImmunity and GetEffectDamageResistance?

 

Looks like those might be NWNX functions?

 

Would have to do some testing to see if it's possible to get the integer value of an effect's damage immunity.  If it was a property on an item then presumably one could get the associated cost of the property but if it's simply an applied effect I don't know if that'll work.



#16
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages

Look in nwnx_defenses for GetEffectDamageResistance. It can be done via nwscript as well, though the nwnx function is faster. It also, I believe, allows for stacking damage resistances and debuffs of them, though I don't recall offhand if our ability to do that comes from that plugin or elsewhere, and you don't need that to do what you want.

 

GetTrueDamageImmunity, also in nwnx_defenses, essentially gets their total immunity to the specified element. It handles stacking errors in nwscript, or did - I don't remember if they were all fixed in 1.69 or not, and they're pretty uncommon scenarios either way (iirc bugged when stacking past 255, though I could be misremembering). The main thing it does that you can't easily do otherwise in nwscript is to check for absolute damage immunity ala RDD. Again, not something mission-critical for most applications. We rely on it mainly because we like to do partial absolute immunity for some situations - immunity that can be dubuffed by stacking vulns, but down to a minimum value greater than 0 (like 50%).

 

Funky



#17
Shadooow

Shadooow
  • Members
  • 4 470 messages

So we all know you could do something along these lines to apply 100 magic damage to a creature:

 

ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(100), oTarget);

 

However, if oTarget has 50% magic immunity and 50 magic resist he won't take any damage.  Is there a way to get around this?

 

If you're wondering why I ask, it's due to my HP display script that I'm improving at the moment.  Specifically I'm trying to make it play nicely with heals by default -- which means if a creature has 10 max HP, 100k total scripted HP (so 90k hidden initially), and 15k effective HP they'd be sitting at 2499 actual HP and 12501 hidden HP (so they appear Near Death).  However, if they get healed for 5k HP then they'll shoot up to 7499 HP and appear Injured instead.

 

Now, my script will update their health percentage correctly (since it considers both actual and hidden HP) -- but ideally I'd like to be able to detect that they're above 2499 HP while being below 25% effective HP (easy to do), knock their HP back down to 2499 (the point of this thread), and then bump their hidden HP up by 5000 (easy to do) which gets everything back on track as the player has 2499 actual HP and 127501 hidden HP at the end (20% health and thus stays at "Near Death").

 

If the target doesn't have resistances, vulnerabilities, or immunities that's simple (just apply 5000 damage of some type in this case) -- but I'm not sure what to do if they do possess one or more of those.  Ideally I want a "pure/true" damage value like the DamageEffectIncrease for non-physical damage but applied via scripting instead of a creature having to swing a weapon.

 

Another example where this would be a problem is if a creature has a lot of regeneration -- they might be brought down to, say, 36% HP (and thus slip into Badly Wounded) and then start regenerating.  But since they're "held" at 49.9% of HP the regeneration will nudge them back into "Injured" status.

 

Obviously this is mainly a visual display issue and the builder can always get around this by adding hidden HP rather than an actual heal effect...but it would be nice to be able to fix this problem.

long story short, this is not possible to do properly without heavily usage of linux nwnx plugins