Open main menu

UESPWiki β

Morrowind Mod:XGetMaxCondition

< Mod / Morrowind: Morrowind Mod: MWSE

A function added by MWSE.

XGetMaxCondition returns the maxium condition for armor and weapons and maximum uses for lockpicks, probes, and repair tools.

SyntaxEdit

condition (long): ref->xGetMaxCondition

ExampleEdit

begin MWSE_TargetMaxCondition
        ; This script displays the maximum condition of the player's current target.
        ; It demonstrates the use of the following MWSE functions:
        ; xGetPCTarget
        ; xRefType
        ; xGetMaxCondition

        long pcTarget
        long lastTarget
        long refType
        long maxCond

        setx pcTarget to xGetPCTarget

        ; Continue only if the target has changed.
        if ( pcTarget == lastTarget )
                return
        endif

        set lastTarget to pcTarget      

        ; Continue only if the player has a target.
        if ( pctarget == 0 )
                return
        endif

        setx refType to pcTarget->xRefType

        ; Continue only if the target is a weapon, armor, repair item, probe, or lockpick.
        if ( reftype != 1346454871 ) ; not weapon
                if ( reftype != 1330467393 ) ; not armor
                        if ( reftype != 1095779666 ) ; not repair
                                if ( reftype != 1112494672 ) ; not probe
                                        if ( reftype != 1262702412 ) ; not lockpick
                                                return
                                        endif
                                endif
                        endif
                endif
        endif

        setx maxCond to pcTarget->xGetMaxCondition
        
        MessageBox, "Max Condition: %g", maxCond

end MWSE_TargetMaxCondition

See AlsoEdit