Aller au contenu

Photo

EffectDamageResistance problem


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

#26
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hehe, thanks for the edit kevL... you missed that i screwed up the spear type.


Weapon      (Type)  | DR Type   | Bypass Y/N
--------------------------------------------
Longsword   (S)     | BSP       | N
Longsword   (S)     | B         | N
Longsword   (S)     | S         | Y
Longsword   (S)     | P         | Y
Longsword   (S)     | BP        | N
Longsword   (S)     | BS        | N
Longsword   (S)     | SP        | Y

Club        (B)     | BSP       | N 
Club        (B)     | B         | Y
Club        (B)     | S         | N
Club        (B)     | P         | N
Club        (B)     | BP        | N
Club        (B)     | BS        | N
Club        (B)     | SP        | N

Spear       (P)     | BSP       | N 
Spear       (P)     | B         | N
Spear       (P)     | S         | N
Spear       (P)     | P         | Y
Spear       (P)     | BP        | N
Spear       (P)     | BS        | N
Spear       (P)     | SP        | N

Halberd     (PS)    | BSP       | N 
Halberd     (PS)    | B         | N
Halberd     (PS)    | S         | Y
Halberd     (PS)    | P         | Y
Halberd     (PS)    | BP        | N
Halberd     (PS)    | BS        | N
Halberd     (PS)    | SP        | Y

Morningstar (BP)    | BSP       | N
Morningstar (BP)    | B         | Y
Morningstar (BP)    | S         | N
Morningstar (BP)    | P         | N
Morningstar (BP)    | BP        | N
Morningstar (BP)    | BS        | N
Morningstar (PS)    | SP        | N
And fixed.
 
I've edited the wiki page as well. I'll just add a reference to this thread as well.

 


Hi Loki_999/KevL,

Great work ... Just a few questions for my slow and tired mind this afternoon ... ;)

1) Are you saying these results are the *actual* results without altering any code in the OC?
2) Applying DR to creatures or armours work in the same way? (i.e. A creature with DR 5/Bludgeoning is the same as armour with DR 5/Bludgeoning.)
3) If we want to add DR to an item we should use the EffectDamageReduction() with the IP_CONST _* definitions?
4) As an example from above, a club would NOT bypass something with Bludgeoning/Piercing "piercings"?
5) So the Morningstar would need the "piercing" damage descriptor removed from its description (for better consistency)? (i.e. TLK 5412 for Custom.)
6) I also guess the last Morningstar (PS) was meant to be Morningstar (BP) in your list above?

FINALLY

From a quick glance, it looks as though the "logic" reverses if the creature/item has two or more "piercings" attached to them. i.e. If there is more than one "piercing" listed, then these become what the item/creature's is actually DR against! I use "piercing" in the same sense as the toolset uses it when setting DR. EDIT: Except on closer inspection, a BP armour/creature cannot be bypassed anything from the looks of it. If my theory was correct, a slashing weapon (like a longsword) would have bypassed a BP DR setting and not the SP as your results say. :( Although, MAYBE the long sword descriptor is wrong and it is actually a SP weapon! :) That *may* resolve the logic involved.

TEST: What happens if you use a *different* slashing weapon rather than the longsword (which may have the wrong descriptor regarding its P - which may actually be PS)?
 
In theory, a normal "S" weapon should bypass a "BP" DR setting if my theories are correct about the longsword and revered logic.
 
NB: I was just about to do the test myself, when I also noticed a "Uses_OR_Logic" parameter (FALSE by default), which suggests something about the logic usage here too. Perhaps changing to TRUE will give the expected results with respect to "piercings"?
 
RESULTS: I only did a quick test with respect to the "Uses_OR_Logic" and that does appear to set the logic to the correct state on a very quick test. i.e. I had a goblin with DR 5/BP, which has protection against bludgeoning when using the default FALSE for this logic, but has their DR "pierced" when this logic is set to TRUE.
 
RESULTS 2: A sickle (S damage) against a BP goblin seems to break this theory, as the goblin does have DR against it. :( So, unless there is a fault with just one aspect of one part of DR (BP stands out to me), or some weapons are not what they say they deliver (or both), then it needs further testing. I would suggest the following:-
 
1) CONFIRM the damage types of *every* weapon. (i.e. Some may be delivering more than they say, and others not.) DONE - SEE BELOW!
2) TEST the application of the "Uses_OR_Logic" for every combination possible.
 
EDIT: Something else just occurred to me. Maybe there is a percentage chance (hard coded) applied to the type of damage done when a weapon does more than one type of damage. e.g. If a weapon does piercing/slashing damage and does one point of damage, then maybe it can only be 1 point of damage which is defined as piercing or slashing. There may even be instances when a weapon does more damage (E.g. 6 damage) and the system may still randomly determine it to be all of one type in this particular instance of attack! Therefore, a weapon with two types of damage *may* only be doing one type at any one time due to chance. This would appear to give random results with respect to DR against certain weapon types.
 
OBSERVATIONS
==============
1) In testing, a placeable will return -1 (i.e. damage type undetected) when trying to ascertain the type of last damage by weapon type.
OK, I forgot this function was broken with respect to this type of damage being dealt! Doh!
 
2) I note there is no "BLUDGEONING AND PIERCING" CONSTANT for GetWeaponType function. (i.e. Confirms Morningstar descriptor as wrong?)
 
3) I can CONFIRM the Morningstar is BLUDGEONING only (TLK 5412 NEEDS CORRECTING) and that the Longsword is both SLASHING AND PIERCING! (See below) Also SLASHING & PIERCING: Bastard Sword, Halberd, Katana, Scythe. (Total five weapons.) Therefore, Longsword (TLK 5417), Bastard Sword (TLK 5434) and Katana (TLK 5423) need descriptor correction.

 

LATEST TEST REQUIRED

=====================

 

Use confirmed damage by weapon type to test DR with "Uses_OR_Logic" set to both TRUE and FALSE for various combinations. Suggested weapons to test: Club (Bludgeoning only); Spear (Piercing only); Scimitar (Slashing only); Halberd (Piercing and Slashing). Avoid using Morningstar or Longsword to avoid confusion due to their incorrect descriptors (to fix with updating 2da and tlk refs.) Note, there is no other type of damage type available. (i.e. There is no Bludgeoning/Piercing as the Morningstar descriptor suggests.)


Loki_999 ... Any further updates or discoveries your end?
 
Cheers,
Lance.
 
Feedback.jpg


  • 4760 aime ceci

#27
Loki_999

Loki_999
  • Members
  • 430 messages

Woah! Good testing Lance.

 

Well, that explains at least why i'm getting inconsistent results with some weapons. I would have thought longsword would be one weapon they actually got right (in terms of description matching actual properties).

 

Can't believe this was never noted on the wiki.

 

I haven't got anything new to add, but what i can say is that when adding effects via the function you have no option to OR the piercings.  I thought maybe you could do a bitwise combiation, but thats not going to work i think since the constants are something like 0, 1 , 3, etc, they would have to be 1,2,4..etc to be able to work like that.

 

This leads to an interesting question... whether to update descriptions or change weapon types to match the descriptions.



#28
Loki_999

Loki_999
  • Members
  • 430 messages

And... so this means DR is not as broken as it first appeared!



#29
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi Loki_999,

You're welcome. It's something I have been meaning to get to grips with myself and you triggered me into it. ;)
 

This leads to an interesting question... whether to update descriptions or change weapon types to match the descriptions.


I don't think you can change the weapon types (hard coded I believe - correct me if I am wrong, as I would prefer to do it this way), therefore, it is best to change the weapon descriptions for the longsword, bastard sword, katana and morningstar.
 
Anyway, I am back with some more testing myself .... :) I became aware that you are trying to add DR dynamically rather than at toolset creation time!
 
UPDATE: EffectDamageResistance does NOT work. It reports the DR in place, but does not correct the damage taken. This has been confirmed after I enabled combat debugging at the console. (I will do the same test for EffectDamageReduction and update this comment in a moment ....
EffectDamageReduction DOES work!
 
SUCCESSFUL RESULTS: I believe EffectDamageReduction *DOES WORK* when I checked the combat debugging results and compared the damage rolled to the damage applied, the DR figure HAD been taken into account!

NB: This is JUST the bludgeoning DR test at this point in time.

UPDATE: Having tried using my script below to change the DR on the creature during testing, it seems that the DR type either does NOT update or it is NOT set correctly. I am going to try another test, setting the "PIERCING" as the immediate test and see what happens with a club against that!

RESULT: Even when I set the DR to be against PIERCING and use a CLUB (Bludgeon damage), the DR still protects against the creature! :angry: Unfortunately, that would suggest my script may be OK, but that the function does NOT apply the DR effect as I thought it did. :(

DR%20RESULTS.jpg

Below is a copy of the script I am using to help apply an effect to a creature. Edit as required.

The script below that is just some additional feedback on monster damaged to help give some more info.

Please, use them yourself if they help to get to the bottom of this. :)

Cheers,
Lance.

It goes on a useable lever with name "ALTERDR" and the nearby creature has TAG "alb_testgoblin". BTW, I gave the goblin 1000 Hps and made them immobile too.
 
EDIT: THIS SCRIPT DOES APPEAR TO WORK ... BUT DR FUNCTION DOES NOT WORK AS EXPECTED!

The problem is to do with the fact that an applied DR effect does NOT simply protect verses the single type is says it does!
 
///////////////////////////////////////////////////////////////////////////////////////////////////
// LBREMOVEALLEFFECTS - SIMPLY REMOVES ALL EFFECTS (NOT INSTANT ONES THOUGH)
///////////////////////////////////////////////////////////////////////////////////////////////////
void LBRemoveAllEffects(object oPC)
{
	effect eLoop=GetFirstEffect(oPC);

	while (GetIsEffectValid(eLoop))
   	{
	RemoveEffect(oPC, eLoop);
   	eLoop=GetNextEffect(oPC);
   	}
}

void main()
{
	object oPlayer = GetLastUsedBy(); 	
	object oArea = GetArea(oPlayer);	
	
	if(GetName(OBJECT_SELF) == "ALTERDR")
	{
		object oDummy = GetNearestObjectByTag("alb_testgoblin");	
		
		int iTYPE = GetLocalInt(oDummy, "DRTYPE") + 1;
                if(iTYPE > 7){iTYPE = 1;}					
		SetLocalInt(oDummy, "DRTYPE", iTYPE);
		
		// ALTERNATIVES
		string sREPORT = "NONE"; effect eDR; effect eDR2; effect eDR3;
		
		if(iTYPE == 1)
		{
			sREPORT = "BLUDGEON DR";
			eDR = EffectDamageReduction(5, DAMAGE_TYPE_BLUDGEONING, 0, DR_TYPE_DMGTYPE);
			//eDR = EffectDamageResistance(DAMAGE_TYPE_BLUDGEONING, 5, 0);
		}		
		
		if(iTYPE == 2)
		{
			sREPORT = "PIERCING DR";
			eDR = EffectDamageReduction(5, DAMAGE_TYPE_PIERCING, 0, DR_TYPE_DMGTYPE);
			//eDR = EffectDamageResistance(DAMAGE_TYPE_PIERCING, 5, 0);
		}
		
		if(iTYPE == 3)
		{
			sREPORT = "SLASHING DR";
			eDR = EffectDamageReduction(5, DAMAGE_TYPE_SLASHING, 0, DR_TYPE_DMGTYPE);
			//eDR = EffectDamageResistance(DAMAGE_TYPE_SLASHING, 5, 0);
		}
		
		if(iTYPE == 4)
		{
			sREPORT = "SLASHING & PIERCING DR";
			eDR = EffectDamageReduction(5, DAMAGE_TYPE_SLASHING, 0, DR_TYPE_DMGTYPE);
			eDR2 = EffectDamageReduction(5, DAMAGE_TYPE_PIERCING, 0, DR_TYPE_DMGTYPE);
			
			//eDR = EffectDamageResistance(DAMAGE_TYPE_SLASHING, 5, 0);
			//eDR2 = EffectDamageResistance(DAMAGE_TYPE_PIERCING, 5, 0);
			
			eDR = EffectLinkEffects(eDR, eDR2);
		}
		
		if(iTYPE == 5)
		{
			sREPORT = "SLASHING & BLUDGEONING DR";
			eDR = EffectDamageReduction(5, DAMAGE_TYPE_SLASHING, 0, DR_TYPE_DMGTYPE);
			eDR2 = EffectDamageReduction(5, DAMAGE_TYPE_BLUDGEONING, 0, DR_TYPE_DMGTYPE);
			
			//eDR = EffectDamageResistance(DAMAGE_TYPE_SLASHING, 5, 0);
			//eDR2 = EffectDamageResistance(DAMAGE_TYPE_BLUDGEONING, 5, 0);
			
			eDR = EffectLinkEffects(eDR, eDR2);
		}
		
		if(iTYPE == 6)
		{
			sREPORT = "BLUDGEONING & PIERCING DR";
			eDR = EffectDamageReduction(5, DAMAGE_TYPE_BLUDGEONING, 0, DR_TYPE_DMGTYPE);
			eDR2 = EffectDamageReduction(5, DAMAGE_TYPE_PIERCING, 0, DR_TYPE_DMGTYPE);
			
			//eDR = EffectDamageResistance(DAMAGE_TYPE_PIERCING, 5, 0);
			//eDR2 = EffectDamageResistance(DAMAGE_TYPE_BLUDGEONING, 5, 0);
			
			eDR = EffectLinkEffects(eDR, eDR2);
		}
		
		if(iTYPE == 7)
		{
			sREPORT = "BLUDGEONING, PIERCING & SLASHING DR";
			eDR = EffectDamageReduction(5, DAMAGE_TYPE_BLUDGEONING, 0, DR_TYPE_DMGTYPE);
			eDR2 = EffectDamageReduction(5, DAMAGE_TYPE_PIERCING, 0, DR_TYPE_DMGTYPE);
			eDR3 = EffectDamageReduction(5, DAMAGE_TYPE_SLASHING, 0, DR_TYPE_DMGTYPE);
			
			//eDR = EffectDamageResistance(DAMAGE_TYPE_PIERCING, 5, 0);
			//eDR2 = EffectDamageResistance(DAMAGE_TYPE_BLUDGEONING, 5, 0);
			//eDR3 = EffectDamageResistance(DAMAGE_TYPE_SLASHING, 5, 0);
			
			eDR = EffectLinkEffects(eDR, eDR2);
			eDR = EffectLinkEffects(eDR, eDR3);
		}	
		
		LBRemoveAllEffects(oDummy); // HOME BREW FUNCTION THAT SIMPLY REMOVES ALL EFFECTS FIRST
		SendMessageToPC(oPlayer, "SETTING>>> " + sREPORT);
		DelayCommand(0.1, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDR, oDummy));
		
		return;
	}
}
On a creature damaged ...
 
// DAMAGE TYPE DEBUG
	if(GetGlobalInt("TESTMODE") == 1)
	{
		int iMAX = GetMaxHitPoints(OBJECT_SELF);
		int iLASTREC = GetLocalInt(OBJECT_SELF, "RECORDED");
		if(iLASTREC == 0){iLASTREC = iMAX;}	
		
		int iHPS = GetCurrentHitPoints(OBJECT_SELF);
		SetLocalInt(OBJECT_SELF, "RECORDED", iHPS);
		
		int iTOTDamage = GetTotalDamageDealt();
		int iDamage = iLASTREC - iHPS;	
		
		SendMessageToPC(oDamager, "PREVIOUS>>> " + IntToString(iLASTREC) + " DAMAGED>>> " + IntToString(iDamage)
		 + " REMAIN HPS>>> " + IntToString(iHPS));	
	}


#30
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,
 
OK, new post for clarity ....
 
This needs some extensive testing. Having just tested a creature (using my test scripts above) I have discovered that if you apply the "BLUDGEONING" DR to a creature, then it protects against "BLUDGEONING" (CLUB TESTED) & "SLASHING" (SCIMITAR TESTED), but NOT "PIERCING" (SPEAR TESTED)!
 
I think I noticed a similar weirdness when I had the "PIERCING" DR added to a creature, in that it works against "PIERCING" (SPEAR) and "BLUDGEONING" (CLUB), but NOT "SLASHING" (scimitar).
 
Therefore, the whole combination of DR applications needs to be tested against the various weapons to determine where and how the DR applications apply when added by this effect.
 
NB: I have not even got onto the combination of DR effects yet!
 
I am taking a break ... If anybody else wants to copy and use those scripts above, then they are welcome. Full results of testing would be good to see. (I may try another day if nobody picks up the gauntlet!) ;)
 
EDIT: LOKI_999 we need another one of your tables with all the tests done. :)
 
Cheers,
Lance.
 
EDIT: Did one quick set of tests trying to apply various EffectDamageReduction effects. Here are the results:-
 
B = Bludgeon. S = Slash. P = Pierce.
 
JUST B-DR - Protects v B & S. (Pierce gets through.)
JUST P-DR - Protects v P & B. (Slash gets through.)
JUST S-DR - Protects v S, P & B. (Nothing gets though!)
 
And so consequently, any multiple combination of B, P or S DR means the DR works against EVERYTHING! In fact there is no need to apply multiple effects as applying the SLASHING DR does them all in one go!
 
I have NOT checked applying DR via toolset (or the various LOGIC states available). However, I would say that is the more reliable method to work with, as it is *impossible* (as far as I can see) to minimise a DR effect to a single type when using the EffectDamageReduction function. E.g. You try giving JUST the SLASHING DR and it effectively stops all damage types from getting through. :(
 
Can anybody find a way (using dynamic functions only) to make it so only a SINGLE form of DR is applied to a creature?
 
The answer may be to apply an "item property" version of DR to an item (like the creatures skin) instead.

E.g. itemproperty IP_DRED = ItemPropertyDamageReduction(5, DAMAGE_TYPE_BLUDGEONING, 0, DR_TYPE_DMGTYPE);

RESULTS: Testing has shown I am unable to apply this DR to an item. :( i.e. ItemPropertyDamageReduction does NOT appear to work at all. :(
 
Cheers,
Lance.

#31
Loki_999

Loki_999
  • Members
  • 430 messages

Ugh! Sounds like you are having a wild time.

 

To be honest, thanks to your investigation on weapon types it now seems to make more sense.  

 

What you appear to be doing wrong is using DAMAGE_TYPE_* instead of IP_CONST_DAMAGE_TYPE_* - as i discovered early in my testing, you must use the IP_CONST properties for this to work. ;)



#32
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Ugh! Sounds like you are having a wild time.
 
To be honest, thanks to your investigation on weapon types it now seems to make more sense.  
 
What you appear to be doing wrong is using DAMAGE_TYPE_* instead of IP_CONST_DAMAGE_TYPE_* - as i discovered early in my testing, you must use the IP_CONST properties for this to work. ;)


Ah! That's what happens when one keeps switching between functions and gets tired ... and forget things. Doh!

Thanks for that ... I will try again with a fresh head on my shoulders.

EDIT: Although ... initial testing using IP_CONST_DAMAGETYPE_BLUDGEONING is still failing. :( Maybe I have the format wrong, as I was following the function description, but that is wrong if we should be using the IP_CONST types.

EDIT 2: I am using a test script that shows if any item property is found on the item. When I use the ItemPropertyDamageReduction function to add a property to the item, it fails to detect it when used in the format I am trying to use. If it works in other formats, I am yet to discover. NOTE: My test script detected a light property added as a test OK.

EDIT 3: In the X2_s0_persblde, it has the following line:-

AddItemProperty(DURATION_TYPE_TEMPORARY, ItemPropertyDamageReduction(5,IP_CONST_DAMAGEREDUCTION_1),oWeapon,fDuration);

What is the IP_CONST_DAMAGEREDUCTION_1 part doing?
 
For instance, I thought the first figure "5" represented how much to reduce, so what is this parameter doing?

Anything wrong with this?:

ItemPropertyDamageReduction(5, IP_CONST_DAMAGETYPE_BLUDGEONING, 0, DR_TYPE_DMGTYPE);

I am still unable to apply a DR to an item using the above format. :(

Even this fails: ItemPropertyDamageReduction(5, IP_CONST_DAMAGETYPE_BLUDGEONING);

Lance.

#33
Loki_999

Loki_999
  • Members
  • 430 messages

Ah, now on items might be a different kettle of fish.

 

I've only attempted DR directly on a character as an effect, so it may be that ItemPropertyDamageReduction has its own quirks.

 

The only thing i can suggest at this point is trying a variety of values and see if something sticks. For example, the IP_CONST properties work for the non-itemproperty DR types... tried using base DAMAGE_TYPE_* values for the IP function?  Could be Obsidian got them backwards.



#34
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Ah, now on items might be a different kettle of fish.
 
I've only attempted DR directly on a character as an effect, so it may be that ItemPropertyDamageReduction has its own quirks.
 
The only thing i can suggest at this point is trying a variety of values and see if something sticks. For example, the IP_CONST properties work for the non-itemproperty DR types... tried using base DAMAGE_TYPE_* values for the IP function?  Could be Obsidian got them backwards.


EDIT: If you think about it, that was what I did by mistake the first time around. ;)

Hi Loki_999,

Can you give me a line example of code you have used when using IP_CONST that works.

I am a little surprised what is happening, as surely CONSTANTS are simply integers anyway, whether expressed as numbers or these WORDED_CONSTANTS. i.e. IP_CONST_DAMAGETYPE_PIERCING == 1 == DAMAGE_TYPE_BLUDGEONING ... My point being, I thought I was trying with various weapon types regardless of the "apparent DR" I had attached, but I was not receiving any confirmed attachment of an IP on a skin no matter what.

So, if I understand you correctly, you have been applying item property DR as an effect to a creature! This sounds weird, and seeing what actual line of code you used with what function may help to explain what you achieved ... and help determine how/if the OC is borked.
 
Cheers,
Lance.

#35
Loki_999

Loki_999
  • Members
  • 430 messages

Well, you are right in that constants are just substitutes for integers (or floats, or strings or whatever).  So yeah, you can use any constant with the right value if you like... although thats one way to make obfuscated code :P

 

So no, i'm not applying itemp property DRs to creatures, i'm using EffectDamageReduction(....) with IP_CONST.... values, but that's it.

 

What you seem to be doing with the itemproperty though to apply as an item property seems to be right though... although, let me ask, you are trying to apply it to something that can have this property attached? I'm not certain, but i think it only works on armour.... possibly shields.

 

As for my script, here it is (as you can see, for the physical damage types i actually used integer values instead of their consts:

/* Feat created by Agony_Aunt/Loki_999 for SCoD PW
adds DR effect to target */


//#include "nw_i0_spells"
#include "x2_inc_spellhook"

const int FEAT_DR_CI10 = 2290;
const int FEAT_DR_EVIL10 = 2291;
const int FEAT_DR_MAGIC10 = 2292;
const int FEAT_DR_MAGIC15 = 2293;
const int FEAT_DR_BLUDG15 = 2294;
const int FEAT_DR_LAW15 = 2295;
const int FEAT_DR_AS5 = 2296;
const int FEAT_DR_AS10 = 2297;
const int FEAT_DR_BLUDG5 = 2298;
const int FEAT_DR_SLASH5 = 2299;
const int FEAT_DR_PIERCE5 = 2321;


void main()
{
    object oTarget = GetSpellTargetObject();

    if (!GetHasSpellEffect(GetSpellId(), oTarget))
	{
		int iFeat = GetSpellFeatId();
		int iAmount;
		int iType;
		int iSpecific;

		switch(iFeat)
		{
			case FEAT_DR_CI10: iAmount=10; iType=DR_TYPE_GMATERIAL; iSpecific = GMATERIAL_METAL_COLD_IRON; break;
			case FEAT_DR_EVIL10: iAmount=10; iType=DR_TYPE_ALIGNMENT; iSpecific = ALIGNMENT_EVIL; break;
			case FEAT_DR_MAGIC10: iAmount=10; iType=DR_TYPE_DMGTYPE; iSpecific = DAMAGE_TYPE_MAGICAL; break;
			case FEAT_DR_MAGIC15: iAmount=15; iType=DR_TYPE_DMGTYPE; iSpecific = DAMAGE_TYPE_MAGICAL; break; // check this to be used and not IP_CONST
			case FEAT_DR_BLUDG15: iAmount=15; iType=DR_TYPE_DMGTYPE; iSpecific = 0; break; // Bludgeoning
			case FEAT_DR_LAW15: iAmount=15; iType=DR_TYPE_ALIGNMENT; iSpecific = ALIGNMENT_LAWFUL; break;
			case FEAT_DR_AS5: iAmount=5; iType=DR_TYPE_GMATERIAL; iSpecific = GMATERIAL_METAL_ALCHEMICAL_SILVER; break;
			case FEAT_DR_AS10: iAmount=10; iType=DR_TYPE_GMATERIAL; iSpecific = GMATERIAL_METAL_ALCHEMICAL_SILVER; break;
			case FEAT_DR_BLUDG5: iAmount=5; iType=DR_TYPE_DMGTYPE; iSpecific = 0; break; // Bludgeoning
			case FEAT_DR_SLASH5: iAmount=5; iType=DR_TYPE_DMGTYPE; iSpecific = 2; break; // Slashing
			case FEAT_DR_PIERCE5: iAmount=5; iType=DR_TYPE_DMGTYPE; iSpecific = 1; break; // Piercing
			default: 		SendMessageToPC(GetFirstPC(), "Problem! Feat ID is " + IntToString(iFeat)); break;

		}
		
		effect eRes = EffectDamageReduction(iAmount, iSpecific, 0, iType);
		eRes = SupernaturalEffect(eRes);
		ApplyEffectToObject(DURATION_TYPE_PERMANENT, eRes, oTarget);
	}	
}


#36
Loki_999

Loki_999
  • Members
  • 430 messages

Oh wait! I remember!

 

Damage Reduction cannot be applied as an item property vs physical damage types. Only elemental DR works.  Damage Resistance is either full (all types) DR or elemental.

 

The only way to apply weapon property DR to an item is actually directly on it (as part of the Damage Reductions section of the properties), not as an item property!



#37
kevL

kevL
  • Members
  • 4 052 messages

oh bother Lol

 

am getting itchy to jump into this mysterie



#38
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Oh wait! I remember!
 
Damage Reduction cannot be applied as an item property vs physical damage types. Only elemental DR works.  Damage Resistance is either full (all types) DR or elemental.
 
The only way to apply weapon property DR to an item is actually directly on it (as part of the Damage Reductions section of the properties), not as an item property!


Hi Loki_999,

So, it seems that applying a single DR damage type (bludgeoning, slashing or piercing) via scripting, is impossible? :(
 

oh bother Lol
 
am getting itchy to jump into this mysterie


Please do. :) If you are able to figure out if applying a single DR type via scripting is achievable via any of the functions we have available to us, I would like to know how. ;) NB: After applying the type, test to make sure it does not "protect" (i.e. offer DR) against another type of weapon.

I have tried adding old "effect" style and "itemproperty" with no success yet. However, a fresh head by somebody else may be what it needs. ;)

Many Thanks,
Lance.



#39
Loki_999

Loki_999
  • Members
  • 430 messages

Oh, here is an idea.  Since applying the effect directly to the character does work, then use tag based scripting and attach that effect to an on_equip script (make it a supernatural effect as well), and remove the effect when in the on_unequip  script.

 

eg:

object oPC   = GetPCItemLastEquippedBy();

ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernatualEffect(EffectDamageReduction, val1, subtype, val2, type)), oPC);

On unequip is a little tricker.  One quick hack way would be to pick a blank entry in spells.2da and use SetSpellId(int iBlankEntry) in the on_equip script so that when it comes time to remove the effect you can loop through the effects on the PC and use GetSpellEffectId() to make sure you are removing the right one and not any DR applied from a different source (eg: Stoneskin).

 

Where there is a will there is a way :)



#40
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Oh, here is an idea.  Since applying the effect directly to the character does work, then use tag based scripting and attach that effect to an on_equip script (make it a supernatural effect as well), and remove the effect when in the on_unequip  script.
 
eg:

object oPC   = GetPCItemLastEquippedBy();

ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernatualEffect(EffectDamageReduction, val1, subtype, val2, type)), oPC);
On unequip is a little tricker.  One quick hack way would be to pick a blank entry in spells.2da and use SetSpellId(int iBlankEntry) in the on_equip script so that when it comes time to remove the effect you can loop through the effects on the PC and use GetSpellEffectId() to make sure you are removing the right one and not any DR applied from a different source (eg: Stoneskin).
 
Where there is a will there is a way :)


Hi Loki_999,

I am not sure I understand what you are getting at here ... :(

However, if by whatever means you can apply a single DR effect (E.g. just DR against bludgeoning and not any others) then please let me know how you do it. :)

I believe THAT PROBLEM is our only hurdle! Because we know already that the following results currently stand:-

B = Bludgeon. S = Slash. P = Pierce.

JUST B-DR - Protects v B & S. (Pierce gets through.)
JUST P-DR - Protects v P & B. (Slash gets through.)
JUST S-DR - Protects v S, P & B. (Nothing gets though!)

We need to find a way of applying a *single* DR effect that works against its own type *alone*.

That is the problem as far as I see it.

Have you (or KevL? ... or anybody else?) managed to achieve this yet? NB: I mean "dynamically" (via scripting) and NOT via the toolset prior to the game being played.

The gauntlet has been thrown down! ;)

EDIT: Maybe a complete rewrite of the functions are required, which simply checks for variables and apply the single "SLASHING" DR (which protects against all damage types) at the time of combat *after* detecting the weapon type *attacking* the PC ... and then quickly removing it prior to the next potential attack/hit. E.g. PC has a "Belt of 5 Bludgeoning DR": A variable would be on the same item (which has the SLASHING DR type - which protects versus all types) says to "activate" when it detects a Bludgeoning weapon attacking the PC. How this would work when being attacked by multiple creatures with different weapon types, I do not know. But, hopefully, the code works quick enough to switch the states of the DR quicker than the PC gets hit! i.e. The DR quickly turns on or off according to the weapon type attacking the PC.

I will wait for feedback before I attempt to write this bit of code though.

Cheers,
Lance.

#41
kevL

kevL
  • Members
  • 4 052 messages

Please do. :)

Lance.

unfortunately i am currently being bludgeoned by blast propagation / LoS calculations re. other code. (who'd have thought they're so related... explosions + LoS, that is)

if I got into *this* atm, my synapses could melt,


so, All in good time

#42
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

unfortunately i am currently being bludgeoned by blast propagation / LoS calculations re. other code. (who'd have thought they're so related... explosions + LoS, that is)

if I got into *this* atm, my synapses could melt,
so, All in good time


Hi KevL,

You are too kind to your players .... ;) I say, if within range, they get it! Considering shrapnel, ricochets and all! ;)

When you're ready ... and if you feel like taking a look. It's really just to confirm results and check to see if I missed anything really. That can easily be the case when working with different functions (that are similar) at the same time.

EDIT: I *might* look at that idea I had in the meantime, as long as it does not get too involved. ;)

Cheers,
Lance.

#43
kevL

kevL
  • Members
  • 4 052 messages

Lance, as a bit of an aside,
and if I'm wrong i hope to get cleared up on this,

But when assigning an effect or IP damage reduction, is not the type specified actually the type that goes through the DR?


because i'm getting the impression you might be looking at it the other way, where the type applied is what gets reduced ...


yes/no/possibly ?



#44
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Lance, as a bit of an aside,
and if I'm wrong i hope to get cleared up on this,

But when assigning an effect or IP damage reduction, is not the type specified actually the type that goes through the DR?


because i'm getting the impression you might be looking at it the other way, where the type applied is what gets reduced ...


yes/no/possibly ?


Hi KevL,

I tested a simple BLUDGEON 5 DR on a suit of armour the goblin was wearing and it did not protect them against *any* weapon type damage, bludgeon, slashing or piercing. :(

Not only that, but my test to confirm if a IP had been added, did not even detect *any* DR IP being added anyway!

Therefore, unless I have made a mistake (which is quite possible), I have not yet been able to apply any DR IP on an item to date. (Only creature skin and suit of leather armour tested to date.)

EDIT: The only OC code I have found that uses this function (within X2_S0_PersBlde) has this line (which I do not understand what the IP_CONST_DAMAGEREDUCTION_1 does):-

AddItemProperty(DURATION_TYPE_TEMPORARY, ItemPropertyDamageReduction(5,IP_CONST_DAMAGEREDUCTION_1),oWeapon,fDuration);

Any ideas?

Cheers,
Lance.

The above is a "cut" spell 534, with following description:-

<<<CUT>>>
Caster Level(s): Wizard / Sorcerer 1
Innate Level: 1
School: Evocation
Descriptor(s): Summoned Item
Component(s): Verbal, Somatic
Range: Short
Area of Effect / Target: Point
Duration: 1 Minute / 2 Levels
Additional Counter Spells:
Save: None
Spell Resistance: No

The caster summons a dagger that acts as a faithful and loyal servant.

#45
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Great work kevL.  Your script helped me spot an issue i had in spells.2da with two of my feats referencing the wrong feats, which is why one sometimes appeared to work depending on what state my script was in.
 
And i can confirm, for EffectDamageResistance to work with physical types, you have to use the IP_CONST values!
 
Ill be updating the wiki momentarily to confirm this.
 
Its also why people thought DAMAGE_TYPE_ALL was actually DAMAGE_TYPE_BLUDGEONING - because DAMAGE_TYPE_ALL = 0 and IP_CONST_DAMAGETYPE_BLUDGEONING = 0.
 
Everything now works as expected! Cheers for the help.


Hi Loki_999,

Please can you double-check this for me ... (emphasis added and underlined in your quote).

For I have the following applied to a goblin in my test and it does *NOT* give them 5 DR against *anything*.
 
eDR = EffectDamageResistance(IP_CONST_DAMAGETYPE_BLUDGEONING, 5, 0);

Many Thanks,
Lance.



#46
kevL

kevL
  • Members
  • 4 052 messages

well, simple logic says that this:

ItemPropertyDamageReduction(5, IP_CONST_DAMAGEREDUCTION_1);


ought translate to this:

ItemPropertyDamageReduction(5, DAMAGE_POWER_NORMAL, 0, DR_TYPE_MAGICBONUS);


But *why* it's there on a summoned dagger don't know .... maybe it does cause universal DR 5/-  (ironically)

have you tried that via scripting and/or preset ItemProps at all?



#47
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi KevL,
 
Yes, I agree with how you interpret the line if we consider just plain numbers. :)
 
And actually, I did this for a simple  test as well (i.e. ignore the wording and used just plain numbers) and got the following results:-

eDR = EffectDamageReduction(5, 0, 0, DR_TYPE_DMGTYPE); // Applies DR for P and S (B Gets Through)
eDR = EffectDamageReduction(5, 1, 0, DR_TYPE_DMGTYPE); // Applies DR for B and S (P Gets Through)
eDR = EffectDamageReduction(5, 2, 0, DR_TYPE_DMGTYPE); // Applies DR for B and P (S Gets Through)

NOTE the values can mean:-

0: IP_CONST_DAMAGETYPE_BLUDGEONING ... or ... DAMAGE_TYPE_ALL
1: IP_CONST_DAMAGETYPE_PIERCING ...... or ... DAMAGE_TYPE_BLUDGEONING
2: IP_CONST_DAMAGETYPE_SLASHING ...... or ... DAMAGE_TYPE_PIERCING

So, if we make the assumption that we *do* use the incorrectly documented IP_CONST_XXX instead of the documented DAMAGE_TYPE_XXX, we get a "correct" reverse logic result (as you implied). i.e. Applying a DR 5 versus Bludgeoning means it protects against all types *except* bludgeoning!

This still begs the question: Is it possible to have a single DR applied to a creature via scripting?

Cheers,
Lance.



#48
kevL

kevL
  • Members
  • 4 052 messages

ah Look what i just rummaged up  :)


// 'testip'

//
void Tell(string sTell) { SendMessageToPC(GetFirstPC(FALSE), sTell); }


void main()
{
    Tell("\nrun ( testip ) " + GetName(OBJECT_SELF));

    object oItem = GetPlayerCurrentTarget(OBJECT_SELF);
    if (!GetIsObjectValid(oItem)
        || GetObjectType(oItem) != OBJECT_TYPE_ITEM)
    {
        Tell(". error : An item must be targetted.");
        return;
    }

    itemproperty ipTest = GetFirstItemProperty(oItem);
    while (GetIsItemPropertyValid(ipTest))
    {
        int iType           = GetItemPropertyType(ipTest);
        int iDurType        = GetItemPropertyDurationType(ipTest);
        int iSubType        = GetItemPropertySubType(ipTest);
        int iCostTable      = GetItemPropertyCostTable(ipTest);
        int iCostTableValue = GetItemPropertyCostTableValue(ipTest);
        int iParam1         = GetItemPropertyParam1(ipTest);
        int iParam1Value    = GetItemPropertyParam1Value(ipTest);

        Tell(". Type = " + IntToString(iType));
        Tell(". DurType = " + IntToString(iDurType));
        Tell(". SubType = " + IntToString(iSubType));
        Tell(". CostTable = " + IntToString(iCostTable));
        Tell(". CostTableValue = " + IntToString(iCostTableValue));
        Tell(". Param1 = " + IntToString(iParam1));
        Tell(". Param1Value = " + IntToString(iParam1Value));
        
        Tell("\n");

        ipTest = GetNextItemProperty(oItem);
    }
}


#49
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi KevL,
 
EDIT: FINDINGS TO DATE:

EffectDamageResistance: Cannot use this function to add *ANY* DR reduction.
ItemPropertyDamageReduction: Have not been successful in adding DR to skin or armour items.
EffectDamageReduction: Have only be successful in adding a *pair* of DR and not one by itself. (Use IP_CONST_XXX and reverse logic.)
SET VIA TOOLSET PRIOR PLAY - CREATURES ONLY (NOT ITEMS) Appears to work if you bear weapon corrections into account (See next).

 

UPDATE: I got DR to work on both a creature skin (for monster) and a set of armour (for the PC).

The Morningstar is BLUDGEONING only (TLK 5412 NEEDS CORRECTING) and that the Longsword is both SLASHING AND PIERCING! Also SLASHING & PIERCING: Bastard Sword, Halberd, Katana, Scythe. (Total five weapons.) Therefore, Longsword (TLK 5417), Bastard Sword (TLK 5434) and Katana (TLK 5423) need descriptor correction.

BOTTOM LINE: Perhaps the real question is "How often will we need to script DR dynamically"? i.e. If setting DR values on items and creatures works at toolset creation time, then perhaps we do not need to worry about this much ... at all?
 
0 ====== 0

My actual response to you starts here ... :)

Great, I will be interested if you manage to get any results on items that are supposed to have the DR itemproperty attached to them. :)

EDIT: Try a very simple test by trying to "script add" a single DR (OR ANY AMOUNT) to an item and then see if it does actually have it. I have failed to date. A double DR state, no problem. A single, not yet done. :( Ignore that last sentence, that relates to the EffectDamageReduction *ONLY*. i.e. I am unable to add a "SINGLE" (i.e. lone) DR as an effect using EffectDamageReduction.
 
Here is what I was using ... which tested that the loop was working by making sure the item had a light property attached .. and then continued to check for other IP.
 

void QLBRemoveAllIPs(object oSkin)
{
	itemproperty eLoop=GetFirstItemProperty(oSkin);
	
	SendMessageToPC(GetFirstPC(), "<<< LOOP STARTING >>>");

	while (GetIsItemPropertyValid(eLoop))
   	{
		SendMessageToPC(GetFirstPC(), "<<< AN IP FOUND >>>");
		
		if (GetItemHasItemProperty(oSkin, ITEM_PROPERTY_DAMAGE_REDUCTION))
		{
			RemoveItemProperty(oSkin, eLoop);
			SendMessageToPC(GetFirstPC(), "<<< REMOVING DR PROPERTY >>>");
		}		
		
		if (GetItemHasItemProperty(oSkin, ITEM_PROPERTY_LIGHT))
		{
			RemoveItemProperty(oSkin, eLoop);
			SendMessageToPC(GetFirstPC(), "<<< REMOVING LIGHT >>>");
		}	
		
   		eLoop=GetNextItemProperty(oSkin);
   	}
}

Cheers,
Lance.



#50
kevL

kevL
  • Members
  • 4 052 messages

you shouldn't have to loop GetItemHasItemProperty()

the loop for that is likely in the hard-code. Just call it on an item outright.


i got my finger caught in a debugger hehe. Still, your script there should show the IPs ... although, removing the found-IPs will muck the iterator -- not so much as to give false returns AFAICT, but the call should be straight, no loops i believe.


ok i got my finger out long enough to open the TS.