Aller au contenu

Photo

Doors Hardness (Damage Resistance)


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

#1
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,

In recent testing, I discovered a door with a hardness setting of 5 was allowing an unarmed PC to do normal damage, even though it said the damage was being "absorbed" (by the hardness level one assumes). I also tried with a weapon and still the door was damaged as if there was no absorption actually taking place.

I also tried to place a Damage Resistance value on the door to the value of the hardness, but this also did not work.

Is there something I am missing, or are these settings/functions broken with respect to doors?

Thanks in advance,

Lance.

#2
kamalpoe

kamalpoe
  • Members
  • 711 messages
I don't know but the easy workaround is giving your door a lot more hp.

Modifié par kamalpoe, 27 juillet 2010 - 04:21 .


#3
rjshae

rjshae
  • Members
  • 4 491 messages
The hardness rating seemed to work okay when I tested it on a placeable (a barricade). Perhaps you could put a script in the Door's "On Damaged" slot and do some data gathering?

#4
MasterChanger

MasterChanger
  • Members
  • 686 messages

Lance Botelle wrote...

Hi All,

In recent testing, I discovered a door with a hardness setting of 5 was allowing an unarmed PC to do normal damage, even though it said the damage was being "absorbed" (by the hardness level one assumes). I also tried with a weapon and still the door was damaged as if there was no absorption actually taking place.

I also tried to place a Damage Resistance value on the door to the value of the hardness, but this also did not work.

Is there something I am missing, or are these settings/functions broken with respect to doors?

Thanks in advance,

Lance.


Well, if door/chest hardness works by Damage Resistance (and I seem to recall it does) that would explain it not working, as Damage Resistance does not work. If Damage Reduction is an option, try that.

#5
diophant

diophant
  • Members
  • 116 messages
AFAIK, hardness is broken since the beginning, and it has never been fixed (I tried it with placeables).

#6
Shaun the Crazy One

Shaun the Crazy One
  • Members
  • 183 messages

Lance Botelle wrote...

Hi All,

In recent testing, I discovered a door with a hardness setting of 5 was allowing an unarmed PC to do normal damage, even though it said the damage was being "absorbed" (by the hardness level one assumes). I also tried with a weapon and still the door was damaged as if there was no absorption actually taking place.

I also tried to place a Damage Resistance value on the door to the value of the hardness, but this also did not work.

Is there something I am missing, or are these settings/functions broken with respect to doors?

Thanks in advance,

Lance.


It's not just you the hardenss function does not work.  I spent a considerable amount of time trying to figure this out myself.  Damage reduction doesn't work on placables, so you basicly have to make a script that heals the door after each attack.  I posted a script here (it's pretty massive so I'd rather not re-post it), that does hardness according to the D&D 3.5 rules.

#7
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,

Thanks for all the responses everybody.  Posted Image  (Shaun: I am looking at your script now.)

Yesterday, I spent a little time going through some scripting options and did come up with a solution. Like Shaun, I ended up healing the object (placeable or door) after an unsuccessful breach of the hardness level. In my workings, I confirmed the problem exists for both doors and placeables. Also, adding the Damage Resistance effect does not work.

My own workaround is more generic than Shaun's and works slightly differently in that it provides a "buffer" value of HPs before the initial damage (just in case the damage done is more than the initial HPs). I will add my own scripts to the list Shaun links to so that others can have a look as well.

See my scripts here: Click Here.

Once again, thanks to everybody's input here.

Lance.

Modifié par Lance Botelle, 28 juillet 2010 - 04:32 .


#8
rjshae

rjshae
  • Members
  • 4 491 messages
Nice script combination. Might I suggest though that all you really need to do is give a one-time bonus of extra hit points equal to the hardness in the On Attacked script (which could be flagged by a local boolean), then just heal an amount equal to the hardness each time through the On Damaged script. If the door receives damage at least equal to its remaining hit points plus the hardness, it should just go down, with no need to process the damage. Thanks.

#9
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi rjshae,

I realised this myself after posting them. I have edited them to reflect this now.  Posted Image

Check out new scripts: LINK REMOVED

PLEASE REFER TO THE NEW FIXED SCRIPTS BELOW ..... 06/10/10 Lance Botelle

Let me know what you think. Posted Image

Thanks. Posted Image

Lance.

Modifié par Lance Botelle, 06 octobre 2010 - 03:51 .


#10
rjshae

rjshae
  • Members
  • 4 491 messages
It looks good to me. Thank you.

#11
Shaun the Crazy One

Shaun the Crazy One
  • Members
  • 183 messages
Wow, nice script Lance. I like how make the PC speak the weapon ineffective line when they can't hurt the object. The bonus hit points was a good idea too. I think I might try combining the two scripts in my own mod.

#12
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
rjshae: Glad you like them. :) They did need updating from the first version, as it was inefficient before. Thanks for encouraging me to tidy them up. :)

Shaun: Glad you like them too. :) I thought you might insert your bit of code. ;) It's ideal if you want to stick to the 3.5 rules. I did consider that myself, but decided to keep it simple in the end. :)

Lance.

Modifié par Lance Botelle, 30 juillet 2010 - 10:16 .


#13
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,

*** FINALLY FIXED - I HOPE - LET ME KNOW IF NOT ***

After some play testing, I discovered the scripts I wrote for hardness checking do not work when a PC has the ability to do multiple attacks. A PC would have two of their attacks combined as one attack to bypass the hardness level. After prolonged testing, I have now managed to update the scripts to work as they should. That is, each attack has to bypass the hardness independantly:

Please note:-
==========

1) Hardness level can be less than the HP value of the object. (E.g. Object can have 1 HP and Hardness 5.) NB: Current HP value and Maximum HP value must be set to the same value in the toolset when setting.

2) This script does not test for object material as it is expected the builder will take this into account when setting the Hardness value in the first place. (E.g. A door made of iron should be given a higher Hardness level than one made of wood.)

3) It gives the player feedback on the remaining integrity value (in percentage score) of the object being damaged. This gives the player an idea of how much longer the item may take to be destroyed without giving direct HP feedback.

The thinking behind this approach is that it is easier for a builder to work on a single Hardness figure as a guide of how much damage a PC must be able to do to bypass any Hardness factor. If the PC can deliver damage above this figure, then they will break down the object eventually anyway.

There are two scripts involved: The alb_object_damaged and the alb_object_attacked scripts. The first script must always go on the object's "on damaged" hook (or be added to the script already there), but the latter script can go onto both the object's "on attacked" and "on spell cast at" hooks (or added to the scripts already there) ... OR can be put on (or added to) the object's "heartbeat" hook alone. (Some builder's prefer to limit the amount of heartbeat scripts they use, but if their objects already use a heartbeat script, then this small bit of code may as well be added there as well.)

Please offer feedback at my blog (in signature) if required.

Many Thanks.

Lance.

alb_object_damaged: Place on the object's "On Damaged".

/* HARDNESS DAMAGE RESISTANCE *********** BY LANCE BOTELLE (28/07/10) *******************
 FIXED FOR MULTIPLE ATTACKS 06/10/10
 FIXED HP ZERO CHECK BY SELF DEATH 08/10/10
This script is the first of two to allow the Hardness value to work on placeables and doors.
The system works around a "Buffer" system to allow objects with fewer HPs than their Hardness level.
AT BUILD TIME: Set the object's HP Values & set the Hardness value to represent the Damage Resistance as normal.
Example guides:
- GLASS has a hardness of 1.
- WOOD has a hardness of 5.
- STONE has a hardness of 8.
- IRON has a hardness of 10.
- MITHRAL has a hardness of 15.
- ADAMANTINE has a hardness of 20.
Place this script on the door or placeable "On Damaged" hook.
Be sure to set the alb_object_attacked script on the correct hook as well. (See script)*/
void ApplyResults(object oPC)
{
 // ALWAYS RESET THE WORKING BUFFER FIRST
 SetLocalInt(OBJECT_SELF, "MAXBufferHPS", GetMaxHitPoints()); 
 
 // GIVE FEEDBACK REQUIRED
 if(GetLocalInt(OBJECT_SELF, "PreventDouble") == 0)
 {
 SetLocalInt(OBJECT_SELF, "PreventDouble", 1);
 DelayCommand(0.1, DeleteLocalInt(OBJECT_SELF, "PreventDouble"));
 
 int FirstAttack = GetLocalInt(OBJECT_SELF, "FirstAttack");
 int SecondAttack = GetLocalInt(OBJECT_SELF, "SecondAttack");
 
 DeleteLocalInt(OBJECT_SELF, "FirstAttack");
 DeleteLocalInt(OBJECT_SELF, "SecondAttack");
 
 //SendMessageToPC(oPC, "FIRST >>> " + IntToString(FirstAttack)); // DEBUG    
 //SendMessageToPC(oPC, "SECOND >>> " + IntToString(SecondAttack)); // DEBUG 
 // NOW DO THE DAMAGE FOR BOTH ATTACKS
 int iHardness = GetHardness(OBJECT_SELF); 
 
 int TempDamage = FirstAttack + SecondAttack;
 int ActualFirstDamage = FirstAttack - iHardness; if(ActualFirstDamage < 0){ActualFirstDamage = 0;}
 int ActualSecondDamage = SecondAttack - iHardness; if(ActualSecondDamage < 0){ActualSecondDamage = 0;}
 int iRealDam = ActualFirstDamage + ActualSecondDamage;
 int Absorbed = TempDamage - iRealDam;
 
 // SendMessageToPC(oPC, "REALDAM >>> " + IntToString(iRealDam));    // DEBUG
 
 int iCURHPS = GetLocalInt(OBJECT_SELF, "CURRENTHPS") - (iHardness * 2);
 if(iCURHPS < 0){iCURHPS = GetMaxHitPoints() - (iHardness * 2);} 
 
 //SendMessageToPC(oPC, "REAL HPS PRIOR DAMAGE >>> " + IntToString(iCURHPS)); // DEBUG
 // NO DAMAGE (ALL ABSORBED)
 if (iRealDam < 1)
 {
 //SendMessageToPC(oPC, "TEMPDAMFIXED >>> " + IntToString(TempDamage));   // DEBUG
 ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(TempDamage),OBJECT_SELF); 
 AssignCommand(oPC, SpeakString("The target resisted my attack!"));
 AssignCommand(oPC, PlayVoiceChat(VOICE_CHAT_CUSS, oPC));
 }
   
 // DAMAGE DONE 
 else
 {  
  // CHECK DESTROYED
  if((GetCurrentHitPoints() - (iHardness * 2) + Absorbed) <= 0)
  {
  ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), OBJECT_SELF);
  AssignCommand(oPC, PlayVoiceChat(VOICE_CHAT_LAUGH, oPC));
  }
  
  // ELSE ONLY DAMAGED    
  else
  {
  ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(TempDamage - iRealDam),OBJECT_SELF);       
  }  
 }
 
 // REPORT INTEGRITY  
 SetLocalInt(OBJECT_SELF, "CURRENTHPS", GetCurrentHitPoints());
 //SendMessageToPC(oPC, "REAL HPS AFTER DAMAGE >>> " + IntToString(GetCurrentHitPoints() - (iHardness * 2)));  // DEBUG
 int iREALHPS = GetCurrentHitPoints() - (iHardness * 2); int iMAXHPS = GetMaxHitPoints() - (iHardness * 2);  
 float fPercent = (IntToFloat(iREALHPS)/IntToFloat(iMAXHPS)) * 100.00; int iPercent = FloatToInt(fPercent);
 string sReport = "DESTROYED!"; if (iPercent > 0){sReport =  IntToString(iPercent) + "%";} 
 SendMessageToPC(oPC, "TARGET INTEGRITY: " + sReport);
 if(sReport == "DESTROYED!"){AssignCommand(oPC, ClearAllActions(TRUE));} 
 }
}
void main()
{     
 // GATHER VARIABLES
 object oPC = GetLastDamager();      
 int iDamDealt = GetTotalDamageDealt(); // ALWAYS RETURNS THE SECOND DAMAGE
  
 int FirstAttack = 0;
 int SecondAttack = 0;
  
 // RETRIEVE THE WORKING BUFFER (USED TO HELP CALCULATE THE INDIVIDUAL ATTACKS)
 int iCURHPS = GetLocalInt(OBJECT_SELF, "MAXBufferHPS"); 
  
 // FIRST ATTACK OF A MULTI-ATTACK HIT
 if(iCURHPS == GetMaxHitPoints()) 
 { 
 SetLocalInt(OBJECT_SELF, "MAXBufferHPS", iCURHPS - iDamDealt);  
 SetLocalInt(OBJECT_SELF, "FirstAttack", iDamDealt); 
 }
 
 // SECOND ATTACK OF A MULTI-ATTACK HIT (CORRECT THE FIRST ATTACK VALUE)
 else
 { 
 int CURRENTHPS = GetLocalInt(OBJECT_SELF, "CURRENTHPS");
 if(CURRENTHPS == 0){CURRENTHPS = GetMaxHitPoints();}  
 int FullDam = CURRENTHPS - GetCurrentHitPoints();
 FirstAttack = FullDam - iDamDealt;   
 
 SetLocalInt(OBJECT_SELF, "SecondAttack", iDamDealt);    
 SetLocalInt(OBJECT_SELF, "FirstAttack", FirstAttack);    
 
 // SendMessageToPC(oPC, "CURRENTHPS: " + IntToString(CURRENTHPS)); // DEBUG
 // SendMessageToPC(oPC, "FULLDAM: " + IntToString(FullDam));  // DEBUG
 }   
 
 // APPLY THE RESULTS (REGARDLESS OF NUMBER OF ATTACKS)   
 DelayCommand(0.1, ApplyResults(oPC)); 
}


alb_object_attacked: Place on the object's "On Attacked" and "On Spell Cast" ... OR ... just the "On Heartbeat".

/*HARDNESS DAMAGE RESISTANCE *********** BY LANCE BOTELLE (28/07/10) *******************
 FIXED FOR MULTIPLE ATTACKS 06/10/10
This script is the second of two to allow the Hardness value to work on placeables and doors.
The system works around a "Buffer" system to allow objects with fewer HPs than their Hardness level.
This script ensures an object has a buffer amount of HPs to absorb HP damage above its Hardness amount.
It should be placed on an object's "On Attacked" and "On Spell Cast At" ... OR ... "On Heartbeat" only.
Be sure to set the alb_object_damaged script on the correct hook as well. (See script)
The alb_object_damaged script also has more details. */

void main()
{
// SET A BUFFER HP VALUE FOR ALL OBJECTS (DOUBLE HARDNESS FOR MULTIPLE ATTACKS)
 if(GetLocalInt(OBJECT_SELF, "MAXBufferHPS") == 0)
 {int HPS = GetCurrentHitPoints(); int Hardness = GetHardness(OBJECT_SELF) * 2;
  ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectBonus_Hitpoints(Hardness), OBJECT_SELF); // (*)
  ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(Hardness), OBJECT_SELF);
 SetLocalInt(OBJECT_SELF, "MAXBufferHPS", HPS + Hardness);}
}



(*) IMPORTANT: EffectBonus_Hitpoints should be all one word (without the underscore). Unfortunately, the swear filter is messing the format up and replacing some of the letters with ****. You can guess what that is now. Posted Image

SCRIPTS UPDATED FOR PCS CAPABLE OF MULTIPLE ATTACKS

Modifié par Lance Botelle, 08 octobre 2010 - 05:01 .