Jump to content


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

  • Please log in to reply
No replies to this topic

#1 johncdp



  • Citizen
  • 2 posts

Posted 09 November 2020 - 02:30 PM

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;
    race, DamageResist, newDR: integer;
    sig: String;
    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);



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


Thank you.


  • 0

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users