Artificial Damage Formula, finding Damage Threshold

Post » Thu May 03, 2012 5:38 pm

I'm working on a replacement script for various weapons that apply Fatigue damage the has proper dynamic damage affected by things like skill and the target's armor, but I'm having some issues.
Most importantly, I can't figure out how to find the target's Damage Threshold, only Armor Rating.
Secondly, I'm curious if this line method will work to avoid a large number of unnecessary references (it does allow the script to save):
Set FatigueDamage to ((Player.GetEquippedObject).GetDamage)*2

This is an OnHit script, and alternatively if I could just find some way to register the actual damage done by the attack and simply double that, this would be much simpler.
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Thu May 03, 2012 11:23 pm

You're going to have to use an additional ref variable. I too try as hard as I can to keep variable count low and reuse them when possible, but the scripting just can't handle what you have there.

Personally, I declare temp variables in most of my scripts, like:
float fffint iiiref rrr
and just reuse fff, iii and rrr for any intermediates or values that I get every pass of the script, so for your above code, I'd do:
set rrr to Player.GetEquippedObjectif rrrset FatigueDamage to rrr.GetDamage * 2endif
and I'd most likely dump the FatigueDamage named variable and just use fff in place of it and any other one-use floats in the script. Notice I also added a safety to make sure rrr was valid.

As for your other questions, I don't recall off the top of my head. I'm sure there's a get DT function somewhere...

Queue
User avatar
Daddy Cool!
 
Posts: 3381
Joined: Tue Aug 21, 2007 5:34 pm

Post » Thu May 03, 2012 1:53 pm

I can't find a function relating in any way to Damage Threshold anywhere, either as a base function or from FOSE.
User avatar
Beast Attire
 
Posts: 3456
Joined: Tue Oct 09, 2007 5:33 am

Post » Thu May 03, 2012 12:12 pm

GetArmorDT / GetArmorDamageThreshold

Not sure if you can check an NPC's DT directly though... hm...

Edit: NPC.GetAV DamageThreshold

Queue
User avatar
Jessica Thomson
 
Posts: 3337
Joined: Fri Jul 21, 2006 5:10 am

Post » Thu May 03, 2012 1:29 pm

Does the GECK not give error messages when a script fails to save? I could have sworn the Oblivion CS did, but maybe I'm mistaken.
I'm trying to save this script, but it's not working:
scn MeleeFatigueOnHitScript

; Inflicts Fatigue damage on the target to temporarily knock it out.

Begin OnHit

Ref WeaponTarget
Ref WeaponOwner
Int FatDamage
Set WeaponTarget to GetOwnerLastTarget
Set WeaponOwner to GetContainer
Set FatDamage to WeaponOwner.GetAV Strength
Set WeaponOwner to WeaponOwner.GetEquipped 5
Set FatDamage to FatDamage + (WeaponOwner.GetDamage * 1.25) + (20 - WeaponOwner.GetDamage) - (WeaponTarget.GetAV DamageThreshold) * ((100 - (WeaponTarget.GetAV DamageResist)) / 100)
If (FatDamage < 0)
Set FatDamage to 0
EndIf

If (WeaponTarget != PlayerRef) && (WeaponTarget.GetIsCreatureType 6 != 1) && (WeaponTarget.IsAnimPlaying BlockHit != 1)
WeaponTarget.DamageAV Fatigue FatDamage
EndIf

End

If I've made a mistake here, I assume it may be because I need a reference for GetContainer... I just have no idea how I can get either the weapon being used as a reference, or by extension the holder of said weapon.
User avatar
Sarah Kim
 
Posts: 3407
Joined: Tue Aug 29, 2006 2:24 pm

Post » Thu May 03, 2012 5:44 pm

You're passing functions a base object as a reference. GetEquipped returns the base object of the player's weapon.
User avatar
Gemma Flanagan
 
Posts: 3432
Joined: Sun Aug 13, 2006 6:34 pm

Post » Fri May 04, 2012 12:23 am

Wait, so GetContainer would actually work fine here? How can I reference the exact weapon being used by the script?
The script is attached to the weapon directly, so could GetSelf work?

Thanks for all the help so far, it's not easy to get any help in the Fallout forums with so little activity here.
User avatar
Dylan Markese
 
Posts: 3513
Joined: Sat Dec 01, 2007 11:58 am


Return to Fallout: New Vegas