Jump to content
  • 0

Help with a script that change DR of all creatures depending of their race


johncdp

Question

Hello everyone,

 

I'm trying to change the damage resistance of all creatures and NPC. I'm new to scripts, and I tried to tweak an existent xedit script health normalizer to make it change DR instead. The script should change every creature by applying a formula to the existing DR, which is different for each race.

But it seems some creatures are not selected by the script, and I can't really figure out why (as an exemple, most of fog crawlers are not taken by the script).

 

Here is a part of the script:

 

 

function Process(e: IInterface): integer;
var
    race, DamageResist, newDR: integer;
    sig: String;
    
begin
    sig := Signature(e);    
    if (sig <> 'NPC_') then Exit;
    if not IsMaster(e) then Exit;
    //if isLegendary(e) then Exit;
    
    // patch the last overriding record from the current load order
    e := WinningOverride(e);
    
    DamageResist := getDR(e);
    if DamageResist = -9999 then Exit;
    race := GetElementNativeValues(e, 'RNAM');

    //Race - algorithm
 
    
    //Master load order:
    //00 - Fallout4.esm
    //01 - DLCRobot.esm
    //02 - DLCworkshop01.esm
    //03 - DLCCoast.esm
    //04 - DLCworkshop02.esm
    //05 - DLCworkshop03.esm
    //06 - DLCNukaWorld.esm
    
        //AlienRace "" [RACE:00184C4D]
    //
    //
    //
    //
    if race = $00184C4D then begin
        if (DamageResist > 0) then begin
            newDR := 5 + (Sqrt(Abs(DamageResist)*2));
            e := setDR(e, newDR);
        end;
    end;

 

 

Has someone a better way for a script that could do what I'm looking for ?

 

Thank you.

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.