Aller au contenu

Photo

Detecting damage reduction on creature blueprints


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

#1
Dann-J

Dann-J
  • Members
  • 3 161 messages
Is there a way to determine the presence, type and amount of damage reduction that is hardcoded into a creature's blueprint? I've tried looping through both effects and item properties, but it doesn't seem to show up as either.


EffectDamageReductionNegated successfully removes the hardcoded damage reduction for the duration, but I'd like to be able to check whether it *should* be removed in order to allow some scripted damage through.

I'm faking a second attack as part of ammunition OnHit properties (halfling skiprocks, splitting arrows), but currently only the real attack gets past the target's damage reduction from a magical launcher. I tried assigning the damage effect to the launcher instead of the attacker, hoping that the game engine would then recognise the enhancement on the bow or sling, but unfortunately that doesn't work. It still assigns the damage to the attacker though (instead of 'someone'), interestingly enough.

Modifié par DannJ, 08 août 2013 - 05:37 .


#2
Dann-J

Dann-J
  • Members
  • 3 161 messages
[Casting 'animate dead' on topic...]

I never did get this figured out. There may well be no way of checking the presence of DR hardcoded into creature blueprints at all.

I've noticed the following flags in UTC files:

- DmgReduction
- DmgRedctFlags
- DmgRedctAmt
- DmgRedctSubList
- DmgRedctType
- DmgRedctSubType

But they would seem to be of little use without a function that interogates creatures and returns values for them.

#3
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi DannJ,

Determining the presence should be possible with GetHasEffect and testing for EFFECT_TYPE_DAMAGE_REDUCTION.

I was also wondering if DR was actually applied as an "Item Property" instead of an effect, in which case you may be able to retrieve the actual amount via an Item Property function. Worth a try possibly? After all, DR is applied differently on the blueprints, so you never know until tried I guess. EDIT: I say this as there are a lot of IP_CONST_DAMAGEREDUCTION_* values in the toolset.

As a last resort, apply variables to the creatures in question and simply use your own code to address the issue. I imagine you could write a script to check for and make the task of applying these variables easy ... or possibly even incorporate the values to check into the tags or resrefs of the creatures in question.

Lance.

Modifié par Lance Botelle, 10 août 2013 - 11:29 .


#4
FalconTamer

FalconTamer
  • Members
  • 5 messages
As it was with NWN1, there were two different types of damage reduction:
1. applied to any equipment with "AddItemProperty" and the like, and
2. added to the skin of a creature, which - after all we have tested some years ago - can neither be modified nor being addressed through a script.

I guess you need the second solution, but a creature's skin is out of focus, so to speak, once it is connected to a creature. Or at least, we didn't find a way.

FT

#5
MasterChanger

MasterChanger
  • Members
  • 686 messages
FT, I believe you are missing one way of applying DR. The creature instance/blueprint properties has a "damage reduction" field in the main properties area (first tab). Using this field is pretty standard practice for populating your creatures and works reliably.

I suppose it is possible that this DR actually winds up being applied on the creature skin. But since you can add the prop directly to the skin anyway, I think it warrants being considered separately. And Lance, I'm not sure that this kind of DR would actually show up as an Effect (as opposed to something like a spell effect) but you could test it out. Give a creature DR in this way and then have a script spit out the active effects on them.

And Dann, are there perhaps easier ways to get the extra attack behavior you're looking for? You can apply an extra attacks effect that would just give the shooter another chance to hit. I understand that this isn't the same as one hit leading to the second (like skip-rocks) but maybe it's close enough for these purposes.

#6
Dann-J

Dann-J
  • Members
  • 3 161 messages

DannJ wrote...

...I've tried looping through both effects and item properties, but it doesn't seem to show up as either.


Yep - checking for effects or skin item properties was my first port-of-call,

Since this is for ammunition properties that I was hoping could be used in any modules or campaigns with nothing more than tag-based scripts, changing the way DR is applied to creatures is out of the question.  Physical DR as an item property on the skin likely wouldn't work properly anyway.

I wonder if there's some way of doing it via an XML? I've noticed all sorts of interesting XML functions that pull information from creatures. It would only have to be done once for each creature, with local variables then being stored on them to inform subsequent hits about whether or not EffectDamageReductionNegated() is warranted.

#7
FalconTamer

FalconTamer
  • Members
  • 5 messages
MasterChanger,

you're right, of course. Dr is nothing more than an effect applied to the skin. But - a big but here - it is, as far as I remember, not possible to address the skin via script. The program itself can do it: right-click on a creature, select "Examine", and you'll see the effect "Damage Reduction". All I say is that some years ago, we tried to influence this DR via script, but we could not find a way to do this.

We were five people who worked on a crafting system which was supposed to base on enchantments. We tried to create a "Softener Potion" which reduces the damage reduction. A Zombie, for instance, has a DR of 5, and this potion should reduce it by 2 -4 points. We failed, just because we could not address the skin.

But all this was in NWN1. I found NWN2 just 3 weeks ago and I didn't have the time to dig into it. I'll keep track of this thread because it interests me if there is a solution ;-)

FT

#8
I_Raps

I_Raps
  • Members
  • 1 262 messages
Could you equip a stand-in skin to force the real skin off, then check/manipulate it as an item in the inventory?

#9
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

MasterChanger wrote...

.... And Lance, I'm not sure that this kind of DR would actually show up as an Effect (as opposed to something like a spell effect) but you could test it out. Give a creature DR in this way and then have a script spit out the active effects on them.


Hi MC,

Good point about the "effect" type. It is something I would consider checking given more time, but as you know, I am having to use every spare minute trying to get my mod done ... this decade. ;)

That said, if I need to look into this more, then it is something that interests me and I would try the sort of thing you say. Maybe in my next module. :)

Lance.

#10
Dann-J

Dann-J
  • Members
  • 3 161 messages

I_Raps wrote...

Could you equip a stand-in skin to force the real skin off, then check/manipulate it as an item in the inventory?


I'm not convinced that DR hardcoded into the blueprint is transferred to a skin at all. Why would the game designers create such a round-about way of getting DR onto the skin when they could just add item properties to the skin directly? Plus, it's possible to give a creature DR without equipping any sort of skin. The game engine would have to spawn a blank skin in that case (another layer of unnecessary complexity).

It's easy enough to check though. Adding a few lines to one of my tag-based ammunition scripts that destroys a zombie's skin would do the trick. Neither arrows nor bullets should bypass a zombie's DR, so if it starts taking full damage then I'll eat humble pie. I suspect it won't be that easy though, and that some sort of hardcoded action is going on behind the scenes that isn't accessable via script functions.

#11
Dann-J

Dann-J
  • Members
  • 3 161 messages
Nope - the creature hide has nothing to do with DR added via the creature properties tab. Destroying a zombie's hide lets you poison them, critical-hit, sneak-attack etc, but damage reduction remains. It's obviously been hardcoded.

One way to get the second missile attack to override the same DR as the 'real' first attack does would be to create a huge list of creature ResRefs and compare it to the properties of the launcher or the ammunition material type, then use EffectDamageReductionNegated() to make sure the second scripted attack gets through when it should. That's far too much work for too little reward, plus it would miss any custom creature types in other people's modules.

I'll just have to live with the secondary attacks of skip rocks or splitting arrows not overcoming DR, even when the first attack does.

#12
Dann-J

Dann-J
  • Members
  • 3 161 messages
I managed to figure out how to get ammunition OnHit scripts to recognise damage reduction on the target. There is a function called GetIsWeaponEffective() that determines whether the weapon you made the attack with will bypass DR or not. It doesn't tell you what that DR actually is, but at least it works in this instance.

The function works perfectly in ammunition OnHit scripts, but always seems to return TRUE in melee weapon OnHit scripts. I seemed to have lucked out there.

My ammunition property scripts (halfling skiprocks, splitting arrows) have been modified so their second attacks now bypass DR if the first attack also did.