lollol Posted October 2, 2014 Author Posted October 2, 2014 Stuck right now, so I instead updated the OP. I need to get this script to work.Going to try to find a mod that uses Pluggy HUD functions to check out their scripts, know of any that are very similar to this idea? The best is if they actually made a custom surface image hud element.Thankfully, Haama has made a list of some mods that require pluggy. Going to go through all of them to look at them in the CS. Trying to check out Kyoma's Journal Mod first then trying others. I'm looking for NewHudS being used, to see how it should be set up. Will be exciting to actually be able to make this mod work.At least, it seems a lot easier to make this system then making a fully custom made armor. Trying to manually draw and add detail to a texture in Photoshop seems unbelievable. It seems like most of the work has to be done MS Paint style. Seems almost impossible to make a new texture that will look at all realistic. I may be able to do it someday if I ever get a PC with a multi-monitor setup, one with a zoomed out view of the texture, one that's close up for actual editing.http://forums.bethsoft.com/topic/1038730-relzewip-pluggy-8/ ================ Mods that Require Pluggy================Alchemical FormulasCustomisable HUD ComponentsExit Oblivion with No Crash GuaranteedFast Hotkey ShortcutsJournal Mod (Does this still require Pluggy, or just use it?)Map Markers Be DoneName that HorsePoison EquipperProper EnchantmentsQ-CoreRedecorationSeducer RaceSpeedy HorsesSpell BooksSpell ComponentsStatus Bars (German download)Time ManagerUnarmored Skill for EveryoneVacuityWillpower-Based Magic ResistanceWrye Morph==============Mods that Use Pluggy==============Alternatives to Death and ReloadAuto-save and timeBattle Fatigue and InjuriesClean SpellbookCOBLDrag N' Drop UIEat and SleepMap Marker OverhaulPlayer's DiaryRefSkopeUnnecessary ViolenceEconomy Enhanced=============Previous Threads Found one, Battle Fatigue and Injuries. Copied this part out, going to try to match it to mine and use my PNG Part of Kuertee's script. Let x := kRIQuest.hudGameXLet y := kRIQuest.hudGameYLet scale := kRIQuest.hudGameScaleLet opacity := kRIQuest.hudGameOpacityLet menuX := kRIQuest.hudMenuXLet menuY := kRIQuest.hudMenuYLet menuScale := kRIQuest.hudMenuScaleLet menuOpacity := kRIQuest.hudMenuOpacityLet showMode := 0If pTempString == 0;(StringID:long) CreateString EspID:short Text:string Protected:short RefuseZero:shortLet pTempString := CreateString -1 "pluggy" 0 1EndIfIf pHUDMan == 0SetString pTempString "Textures\kuerteeBattleFatigueAndInjuries\daVinci.png";(HudID:long) NewHudS Filename:stringID RootID:short Show:short X:float Y:float Layer:long Scale:float Opacity:long Align:short AutoScale:bool Protected:bool EspID:longLet pHUDMan := NewHudS pTempString 1 11 x yEndifEnd Tried it but it's not working.My script: scn zzzOneHeartOnlyMode short x short y float scale short opacity short menuX short menuY float menuScale short menuOpacity long pTempString long pHUDHeart begin gamemode ;createString 123:Data\menus\OneHeartOnlyRiskyMode ;NewHudS -1:"menus\OneHeartOnlyRiskyMode.png",1, 1, -60, -60 Let x := 0 Let y := 0 Let scale := .25 Let opacity := 100 ;Let showMode := a If pTempString == 0 ;(StringID:long) CreateString EspID:short Text:string Protected:short RefuseZero:short Let pTempString := CreateString -1 "pluggy" 0 1 EndIf If pHUDHeart == 0 SetString pTempString "Menus\OneHeartOnlyRiskyMode.png" ;(HudID:long) NewHudS Filename:stringID RootID:short Show:short X:float Y:float Layer:long Scale:float Opacity:long Align:short AutoScale:bool Protected:bool EspID:long Let pHUDHeart := NewHudS pTempString 1 1 x y endif end This is just an attempt to get this working at a basic levelStuck right now, so I instead updated the OP. I need to get this script to work.
Vaelorian Posted October 2, 2014 Posted October 2, 2014 Suggestion: try to use the other mod with your image. See if it works. If it does, you eliminate any possibility of a faulty image. If it doesn't, check the differences between the pictures. Other than that, try this script: scn zzzOneHeartOnlyMode short x short y float scale short opacity short menuX short menuY float menuScale short menuOpacity short showMode long pTempString long pHUDHeart begin gamemode Let x := 0 Let y := 0 Let scale := .25 Let opacity := 100 Let showMode := 0 Let menuX := 0 Let menuY := 0 Let menuScale := .25 Let menuOpacity := 100 If pTempString == 0 Let pTempString := CreateString -1 "pluggy" 0 1 EndIf If pHUDHeart == 0 SetString pTempString "Textures\Menus\OneHeartOnlyRiskyMode.png" Let pHUDHeart := NewHudS pTempString 1 11 x y 500 1 90 9 Endif end If that doesn't work, try changing this line: SetString pTempString "Textures\Menus\OneHeartOnlyRiskyMode.png" To this: SetString pTempString 1:"Textures\Menus\OneHeartOnlyRiskyMode.png" And see if it works. I haven't messed with UI elements in over a year and a half, so I don't really remember everything. My internet has some... "Issues" lately. Could't use it at all yesterday, and having issues now. I'm not sure what's going on. Tech guy was here today and couldn't figure out what was going on. So if I don't answer as quickly as you'd like, that's why.
kingkong Posted October 2, 2014 Posted October 2, 2014 just my 2 cents !!! you have a life bar can be represented as a heart but what would you do with the magic bar (a sorcerrer hat ?) and what about the fatigue bar ? you have an other mod the hudstatut bar you can find different exemples in it (can not help more if i even did help).
lollol Posted October 2, 2014 Author Posted October 2, 2014 Did not work. I'm going to install Battle Fatigue to see if it'll work. Also do we rename just the OBSE_Elys_Pluggy.dll to OBSE_Elys_Pluggy_Hud.dll, or do we also rename OBSE_Elys_Pluggy.dlx to OBSE_Elys_Pluggy_Hud.dlx? Installed Battle Fatigue and can confirm it works. [/url] Tried it with my image overwriting theirs: Now it works. Strange As best as I can tell, probably some tiny error(that doesn't even show up when you save in CS) in our script is making it not run. I'm basically mimicing his script, so it shouldn't be something like it appearing off screen just my 2 cents !!! you have a life bar can be represented as a heart but what would you do with the magic bar (a sorcerrer hat ?) and what about the fatigue bar ? you have an other mod the hudstatut bar you can find different exemples in it (can not help more if i even did help). I showed the heart system by using photoshop to quickly add it to screenshots. The Magicka and Fatigue bar will be in the same place, the hearts will be just above them. Magicka and Fatigue will be unchanged. Some spells will be rebalanced, they will cost more magicka. I'm using Darnified UI, so the bars are smaller, and easily fit under the hearts
Vaelorian Posted October 2, 2014 Posted October 2, 2014 Frankly, I'm not entirely sure what's wrong at this point... The scripts are pretty much identical. I have to assume both are quest scripts, being called on game start, yes? Does the battle fatigue mod have any other script that might be related, or perhaps is there any other part to the battle fatigue mod script?
lollol Posted October 3, 2014 Author Posted October 3, 2014 As best as I can tell, probably some tiny error(that doesn't even show up when you save in CS) in our script is making it not run in-game. Thank you for helping! I'm going to just put all his scripts in this spoiler The KRIHUDQuest's Quest Script ScriptName kRIHUDQuestScriptfloat fQuestDelayTime short xshort yfloat scaleshort opacityshort menuXshort menuYfloat menuScaleshort menuOpacity float armfloat lastArmfloat bodyfloat lastBodyfloat legfloat lastLegfloat headfloat lastHead short armRshort armLshort legRshort legL long pHUDManlong pHUDHeadlong pHUDArmRlong pHUDArmLlong pHUDBodylong pHUDLegRlong pHUDLegLlong pTempString short pluggyshort tempShortshort tempShort2float tempFloat short showMode;0 = player;1 = debug target short fromMenuMode short lastHeadOpacityshort lastArmROpacityshort lastArmLOpacityshort lastBodyOpacityshort lastLegROpacityshort lastLegLOpacity short lastManOpacityshort totalInjuriesshort lastTotalInjuries Short started Begin GameModeIf IsPlayerMovingIntoNewSpaceReturnEndIf If fQuestDelayTime != 1Let fQuestDelayTime := 1EndIf If GetGameLoaded || started == 0Let started := 1 Let pluggy := 0If IsPluginInstalled "OBSE_Elys_Pluggy"Let pluggy := (GetPluginVersion "OBSE_Elys_Pluggy") >= 124 && IsHUDEnabledEndIf If pluggyDelAllHudSsEndIf Let pHUDMan := 0Let pHUDHead := 0Let pHUDArmR := 0Let pHUDArmL := 0Let pHUDBody := 0Let pHUDLegR := 0Let pHUDLegL := 0EndIf If pluggy == 0 || kRIQuest.showHUDInGameMode == 0ReturnEndIf Let x := kRIQuest.hudGameXLet y := kRIQuest.hudGameYLet scale := kRIQuest.hudGameScaleLet opacity := kRIQuest.hudGameOpacityLet menuX := kRIQuest.hudMenuXLet menuY := kRIQuest.hudMenuYLet menuScale := kRIQuest.hudMenuScaleLet menuOpacity := kRIQuest.hudMenuOpacityLet showMode := 0 If pTempString == 0;(StringID:long) CreateString EspID:short Text:string Protected:short RefuseZero:shortLet pTempString := CreateString -1 "pluggy" 0 1EndIfIf pHUDMan == 0SetString pTempString "Textures\kuerteeBattleFatigueAndInjuries\daVinci.png";(HudID:long) NewHudS Filename:stringID RootID:short Show:short X:float Y:float Layer:long Scale:float Opacity:long Align:short AutoScale:bool Protected:bool EspID:longLet pHUDMan := NewHudS pTempString 1 11 x yHudS_SclX pHUDMan scaleHudS_SclY pHUDMan scaleHudS_Opac pHUDMan opacityEndIfIf pHUDHead == 0SetString pTempString "Textures\kuerteeBattleFatigueAndInjuries\head.png"Let pHUDHead := NewHudS pTempString 1 11 x yHudS_SclX pHUDHead scaleHudS_SclY pHUDHead scaleHudS_Opac pHUDHead 0EndIfIf pHUDArmR == 0SetString pTempString "Textures\kuerteeBattleFatigueAndInjuries\arm_right.png"Let pHUDArmR := NewHudS pTempString 1 11 x yHudS_SclX pHUDArmR scaleHudS_SclY pHUDArmR scaleHudS_Opac pHUDHead 0EndIfIf pHUDArmL == 0SetString pTempString "Textures\kuerteeBattleFatigueAndInjuries\arm_left.png"Let pHUDArmL := NewHudS pTempString 1 11 x yHudS_SclX pHUDArmL scaleHudS_SclY pHUDArmL scaleHudS_Opac pHUDArmL 0EndIfIf pHUDBody == 0SetString pTempString "Textures\kuerteeBattleFatigueAndInjuries\torso.png"Let pHUDBody := NewHudS pTempString 1 11 x yHudS_SclX pHUDBody scaleHudS_SclY pHUDBody scaleHudS_Opac pHUDBody 0EndIfIf pHUDLegR == 0SetString pTempString "Textures\kuerteeBattleFatigueAndInjuries\leg_right.png"Let pHUDLegR := NewHudS pTempString 1 11 x yHudS_SclX pHUDLegR scaleHudS_SclY pHUDLegR scaleHudS_Opac pHUDLegR 0EndIfIf pHUDLegL == 0SetString pTempString "Textures\kuerteeBattleFatigueAndInjuries\leg_left.png"Let pHUDLegL := NewHudS pTempString 1 11 x yHudS_SclX pHUDLegL scaleHudS_SclY pHUDLegL scaleHudS_Opac pHUDLegL 0EndIf Let totalInjuries := arm + body + leg + headIf totalInjuries != lastTotalInjuries || fromMenuModeIf totalInjuries == 0Let lastManOpacity := 10ElseLet lastManOpacity := opacityEndIfHudS_X pHUDMan xHudS_Y pHUDMan yHudS_Opac pHUDMan lastManOpacityLet lastTotalInjuries := totalInjuriesEndIf If arm != lastArm || fromMenuModeIf arm != lastArmLet tempShort := arm - lastArmLet tempFloat := Rand 0 1If tempFloat > 0.5;rightLet armR := armR + tempShortIf armR < 0Let armL := armL + armRIf armL < 0Let armL := 0EndIfLet armR := 0EndIfElseLet armL := armL + tempShortIf armL < 0Let armR := armR + armLIf armR < 0Let armR := 0EndIfLet armL := 0EndIfEndIfLet tempFloat := armR / 5 * opacityLet tempShort := Ceil tempFloatIf tempShort > 100Let tempShort := 100EndIfElseLet tempShort := lastArmROpacityEndIfHudS_X pHUDArmR xHudS_Y pHUDArmR yHudS_Opac pHUDArmR tempShortLet lastArmROpacity := tempShortIf kRIQuest.debugPrintToConsole "kRIHUD: arm %0.2f armR %0.2f opacity %0.2f" arm armR tempShortEndIfIf arm != lastArmLet tempFloat := armL / 5 * opacityLet tempShort := Ceil tempFloatIf tempShort > 100Let tempShort := 100EndIfElseLet tempShort := lastArmLOpacityEndIfHudS_X pHUDArmL xHudS_Y pHUDArmL yHudS_Opac pHUDArmL tempShortLet lastArmLOpacity := tempShortIf kRIQuest.debugPrintToConsole "kRIHUD: arm %0.2f lastArm %0.2f armL %0.2f opacity %0.2f" arm lastArm armL tempShortEndIfLet lastArm := armEndIf If body != lastBody || fromMenuModeIf body != lastBodyLet tempShort := bodyIf tempShort < 0Let tempShort := 0ElseIf tempShort > 5Let tempShort := 5EndIfLet tempFloat := body / 5 * opacityLet tempShort := Ceil tempFloatIf tempShort > 100Let tempShort := 100EndIfElseLet tempShort := lastBodyOpacityEndIfHudS_X pHUDBody xHudS_Y pHUDBody yHudS_Opac pHUDBody tempShortLet lastBodyOpacity := tempShortIf kRIQuest.debugPrintToConsole "kRIHUD: body %0.2f lastBody %0.2f opacity %0.2f" body lastBody tempShortEndIfLet lastBody := bodyEndIf If leg != lastLeg || fromMenuModeIf leg != lastLegLet tempShort := leg - lastLegLet tempFloat := Rand 0 1If tempFloat > 0.5;rightLet legR := legR + tempShortIf legR < 0Let legL := legL + legRIf legL < 0Let legL := 0EndIfLet legR := 0EndIfElseLet legL := legL + tempShortIf legL < 0Let legR := legR + legLIf legR < 0Let legR := 0EndIfLet legL := 0EndIfEndIfLet tempFloat := legR / 5 * opacityLet tempShort := Ceil tempFloatIf tempShort > 100Let tempShort := 100EndIfElseLet tempShort := lastLegROpacityEndIfHudS_X pHUDLegR xHudS_Y pHUDLegR yHudS_Opac pHUDLegR tempShortLet lastLegROpacity := tempShortIf kRIQuest.debugPrintToConsole "kRIHUD: leg %0.2f legR %0.2f opacity %0.2f" leg legR tempShortEndIfIf leg != lastLegLet tempFloat := legL / 5 * opacityLet tempShort := Ceil tempFloatIf tempShort > 100Let tempShort := 100EndIfElseLet tempShort := lastLegLOpacityEndIfHudS_X pHUDLegL xHudS_Y pHUDLegL yHudS_Opac pHUDLegL tempShortLet lastLegLOpacity := tempShortIf kRIQuest.debugPrintToConsole "kRIHUD: leg %0.2f lastLeg %0.2f legL %0.2f opacity %0.2f" leg lastLeg legL tempShortEndIfLet lastLeg := legEndIf If head != lastHead || fromMenuModeIf head != lastHeadIf tempShort < 0Let tempShort := 0ElseIf tempShort > 5Let tempShort := 5EndIfLet tempFloat := head / 5 * opacityLet tempShort := Ceil tempFloatIf tempShort > 100Let tempShort := 100EndIfElseLet tempShort := lastHeadOpacityEndIfHudS_X pHUDHead xHudS_Y pHUDHead yHudS_Opac pHUDHead tempShortLet lastHeadOpacity := tempShortIf kRIQuest.debugPrintToConsole "kRIHUD: head %0.2f lastHead %0.2f opacity %0.2f" head lastHead tempShortEndIfLet lastHead := headEndIf Let fromMenuMode := 0end Begin MenuModeIf fQuestDelayTime != 1Let fQuestDelayTime := 1EndIf If pluggy == 0 || kRIQuest.showHUDInMenuMode == 0ReturnEndIf If MenuMode 1 && MenuMode 1023 == 0If fromMenuMode != 1Let fromMenuMode := 1HudS_X pHUDMan menuXHudS_Y pHUDMan menuYHudS_X pHUDHead menuXHudS_Y pHUDHead menuYHudS_X pHUDArmR menuXHudS_Y pHUDArmR menuYHudS_X pHUDArmL menuXHudS_Y pHUDArmL menuYHudS_X pHUDBody menuXHudS_Y pHUDBody menuYHudS_X pHUDLegR menuXHudS_Y pHUDLegR menuYHudS_X pHUDLegL menuXHudS_Y pHUDLegL menuY HudS_Opac pHUDMan menuOpacityHudS_Opac pHUDHead lastHeadOpacityHudS_Opac pHUDArmR lastArmROpacityHudS_Opac pHUDArmL lastArmLOpacityHudS_Opac pHUDBody lastBodyOpacityHudS_Opac pHUDLegR lastLegROpacityHudS_Opac pHUDLegL lastLegLOpacityEndIfElseIf fromMenuMode != 2Let fromMenuMode := 2HudS_Opac pHUDMan 0HudS_Opac pHUDHead 0HudS_Opac pHUDArmR 0HudS_Opac pHUDArmL 0HudS_Opac pHUDBody 0HudS_Opac pHUDLegR 0HudS_Opac pHUDLegL 0EndIfEndIfEnd The KRIQuest's Quest Script ScriptName kRIQuestScriptfloat fQuestDelayTimefloat hoursToFullHealth ;number of hours to restore full healthfloat healthLeftToAcquireBattleFatigue ;battle fatigue increases when health decreases below thisfloat battleFatigueDamage ;amount of battle fatigue per increasefloat battleFatigueHealAwake ;amount of battle fatigue per decrease when awakefloat battleFatigueHealAsleep ;amount of battle fatigue per decrease when asleepshort combatRestartsBattleFatigueHealTimerfloat healthLossToAcquireInjury ;injury is acquired when this much health is loss in one iterationfloat chanceOfInjury ;small chance of injury regardless of damagefloat chanceOfInjuryIncrease ;increase chance of injury per secondfloat injuryDamage ;amount of injury per increasefloat injuryHealAwake ;amount of injury per decrease when awakefloat injuryHealAsleep ;amount of injury per decerase when asleepshort combatRestartsInjuryHealTimershort healInCombatshort debugref getRefshort itemCountfloat randomBodyInjuryRangefloat randomArmInjuryRangefloat randomLegInjuryRangefloat randomHeadInjuryRangeref lastApparelRefref newApparelRefref enchantmentRefref fortifyHealthReffloat battleFatigueDamageMultiplierfloat injuryDamageMultipliershort armInjuriesAffectStrengthshort bodyInjuriesAffectStrengthshort legInjuriesAffectStrengtharray_var healthInjuriesarray_var agilityInjuriesarray_var enduranceInjuriesarray_var intelligenceInjuriesarray_var personalityInjuriesarray_var speedInjuriesarray_var strengthInjuriesarray_var willpowerInjuriesarray_var agilityReliefsarray_var enduranceReliefsarray_var intelligenceReliefsarray_var personalityReliefsarray_var speedReliefsarray_var strengthReliefsarray_var willpowerReliefsshort maxReliefTimefloat ArraySizeshort functionModeshort applyToNPCsshort healthAffectsHoursToFullHealthfloat secondsToCaptureDamageForInjuryfloat healingMagicReliefFactorfloat healingMagicReliefDurationfloat tempFloatfloat tempFloat2float tempFloat3short movingIntoNewSpaceref debugReffloat versionfloat lastVersionshort newVersionshort hudGameXshort hudGameYfloat hudGameScaleshort hudGameOpacityshort hudMenuXshort hudMenuYfloat hudMenuScaleshort hudMenuOpacityshort showHUDInGameModeshort showHUDInMenuModeshort updateHUDfloat distancefloat tempFloat4float tempFloat5array_var healthReliefsShort startedRef applyMagicalReliefToRefFloat applyMagicalReliefFromMagnitudebegin GameModeif IsPlayerMovingIntoNewSpaceLet movingIntoNewSpace := 5ReturnElseIf movingIntoNewSpace > 0Let movingIntoNewSpace := movingIntoNewSpace - 1ReturnendifLet movingIntoNewSpace := 0If Player.GetDeadLet fQuestDelayTime := 0.001Elseif fQuestDelayTime != 1set fQuestDelayTime to 1endifIf version != 0.62Let version := 0.62EndIfIf version != lastVersionLet lastVersion := versionLet newVersion := 1ElseIf newVersion != 0Let newVersion := 0EndIfIf GetGameRestarted;If IsModLoaded "Nehrim.esm" == 0SetEventHandler "OnDrinkPotion" FunctionCheckForMagicOnHealthSetEventHandler "OnScrollCast" FunctionCheckForMagicOnHealthSetEventHandler "OnSpellCast" FunctionCheckForMagicOnHealth;EndIfEndIfif GetGameLoaded || started == 0Let started := 1set hoursToFullHealth to 1set healthLeftToAcquireBattleFatigue to 25set battleFatigueDamage to 1set battleFatigueHealAwake to 1/24set battleFatigueHealAsleep to 1/8set combatRestartsBattleFatigueHealTimer to 0Let secondsToCaptureDamageForInjury := 3set healthLossToAcquireInjury to 30set chanceOfInjury to 1set chanceOfInjuryIncrease to 1/60set armInjuriesAffectStrength to 1set bodyInjuriesAffectStrength to 1set legInjuriesAffectStrength to 1set injuryDamage to 1set injuryHealAwake to 1/24set injuryHealAsleep to 1/8set combatRestartsInjuryHealTimer to 0set randomBodyInjuryRange to 40set randomArmInjuryRange to 70set randomLegInjuryRange to 90set randomHeadInjuryRange to 100set healInCombat to 0set maxReliefTime to 4Let healthAffectsHoursToFullHealth := 1Let healingMagicReliefFactor := 1Let healingMagicReliefDuration := 12set debug to 0set battleFatigueDamageMultiplier to 5set injuryDamageMultiplier to 5Let applyToNPCs := 1Let showHUDInGameMode := 1Let hudGameX := 10Let hudGameY := 625Let hudGameScale := 0.25Let hudGameOpacity := 100Let showHUDInMenuMode := 1Let hudMenuX := 660Let hudMenuY := 95Let hudMenuScale := 0.25Let hudMenuOpacity := 100RunBatchScript "Data\ini\kuerteeBattleFatigueAndInjuries.ini"Let updateHUD := 1Let ArraySize := ar_Size agilityInjuriesIf debugPrintToConsole "kRI: agilityInjuries size %0.2f" ArraySizeEndIfIf ArraySize == -1If debugPrintToConsole "kRI: initialising injury arrays"EndIfLet healthInjuries := ar_Construct ArrayLet agilityInjuries := ar_Construct ArrayLet enduranceInjuries := ar_Construct ArrayLet intelligenceInjuries := ar_Construct ArrayLet personalityInjuries := ar_Construct ArrayLet speedInjuries := ar_Construct ArrayLet strengthInjuries := ar_Construct ArrayLet willpowerInjuries := ar_Construct ArrayLet agilityInjuries [0] := kRICAgility1Let agilityInjuries [1] := kRICAgility2Let agilityInjuries [2] := kRICAgility3Let agilityInjuries [3] := kRICAgility4Let agilityInjuries [4] := kRICAgility5Let agilityInjuries [5] := kRICAgility6Let agilityInjuries [6] := kRICAgility7Let agilityInjuries [7] := kRICAgility8Let agilityInjuries [8] := kRICAgility9Let agilityInjuries [9] := kRICAgility10Let agilityInjuries [10] := kRICAgility11Let agilityInjuries [11] := kRICAgility12Let agilityInjuries [12] := kRICAgility13Let agilityInjuries [13] := kRICAgility14Let agilityInjuries [14] := kRICAgility15Let agilityInjuries [15] := kRICAgility16Let agilityInjuries [16] := kRICAgility17Let agilityInjuries [17] := kRICAgility18Let agilityInjuries [18] := kRICAgility19Let agilityInjuries [19] := kRICAgility20Let agilityInjuries [20] := kRICAgility21Let agilityInjuries [21] := kRICAgility22Let agilityInjuries [22] := kRICAgility23Let agilityInjuries [23] := kRICAgility24Let agilityInjuries [24] := kRICAgility25Let enduranceInjuries [0] := kRICEndurance1Let enduranceInjuries [1] := kRICEndurance2Let enduranceInjuries [2] := kRICEndurance3Let enduranceInjuries [3] := kRICEndurance4Let enduranceInjuries [4] := kRICEndurance5Let enduranceInjuries [5] := kRICEndurance6Let enduranceInjuries [6] := kRICEndurance7Let enduranceInjuries [7] := kRICEndurance8Let enduranceInjuries [8] := kRICEndurance9Let enduranceInjuries [9] := kRICEndurance10Let enduranceInjuries [10] := kRICEndurance11Let enduranceInjuries [11] := kRICEndurance12Let enduranceInjuries [12] := kRICEndurance13Let enduranceInjuries [13] := kRICEndurance14Let enduranceInjuries [14] := kRICEndurance15Let enduranceInjuries [15] := kRICEndurance16Let enduranceInjuries [16] := kRICEndurance17Let enduranceInjuries [17] := kRICEndurance18Let enduranceInjuries [18] := kRICEndurance19Let enduranceInjuries [19] := kRICEndurance20Let enduranceInjuries [20] := kRICEndurance21Let enduranceInjuries [21] := kRICEndurance22Let enduranceInjuries [22] := kRICEndurance23Let enduranceInjuries [23] := kRICEndurance24Let enduranceInjuries [24] := kRICEndurance25Let healthInjuries [0] := kRICHealth1Let healthInjuries [1] := kRICHealth2Let healthInjuries [2] := kRICHealth3Let healthInjuries [3] := kRICHealth4Let healthInjuries [4] := kRICHealth5Let healthInjuries [5] := kRICHealth6Let healthInjuries [6] := kRICHealth7Let healthInjuries [7] := kRICHealth8Let healthInjuries [8] := kRICHealth9Let healthInjuries [9] := kRICHealth10Let healthInjuries [10] := kRICHealth11Let healthInjuries [11] := kRICHealth12Let healthInjuries [12] := kRICHealth13Let healthInjuries [13] := kRICHealth14Let healthInjuries [14] := kRICHealth15Let healthInjuries [15] := kRICHealth16Let healthInjuries [16] := kRICHealth17Let healthInjuries [17] := kRICHealth18Let healthInjuries [18] := kRICHealth19Let healthInjuries [19] := kRICHealth20Let healthInjuries [20] := kRICHealth21Let healthInjuries [21] := kRICHealth22Let healthInjuries [22] := kRICHealth23Let healthInjuries [23] := kRICHealth24Let healthInjuries [24] := kRICHealth25Let intelligenceInjuries [0] := kRICIntelligence1Let intelligenceInjuries [1] := kRICIntelligence2Let intelligenceInjuries [2] := kRICIntelligence3Let intelligenceInjuries [3] := kRICIntelligence4Let intelligenceInjuries [4] := kRICIntelligence5Let intelligenceInjuries [5] := kRICIntelligence6Let intelligenceInjuries [6] := kRICIntelligence7Let intelligenceInjuries [7] := kRICIntelligence8Let intelligenceInjuries [8] := kRICIntelligence9Let intelligenceInjuries [9] := kRICIntelligence10Let intelligenceInjuries [10] := kRICIntelligence11Let intelligenceInjuries [11] := kRICIntelligence12Let intelligenceInjuries [12] := kRICIntelligence13Let intelligenceInjuries [13] := kRICIntelligence14Let intelligenceInjuries [14] := kRICIntelligence15Let intelligenceInjuries [15] := kRICIntelligence16Let intelligenceInjuries [16] := kRICIntelligence17Let intelligenceInjuries [17] := kRICIntelligence18Let intelligenceInjuries [18] := kRICIntelligence19Let intelligenceInjuries [19] := kRICIntelligence20Let intelligenceInjuries [20] := kRICIntelligence21Let intelligenceInjuries [21] := kRICIntelligence22Let intelligenceInjuries [22] := kRICIntelligence23Let intelligenceInjuries [23] := kRICIntelligence24Let intelligenceInjuries [24] := kRICIntelligence25Let personalityInjuries [0] := kRICPersonality1Let personalityInjuries [1] := kRICPersonality2Let personalityInjuries [2] := kRICPersonality3Let personalityInjuries [3] := kRICPersonality4Let personalityInjuries [4] := kRICPersonality5Let personalityInjuries [5] := kRICPersonality6Let personalityInjuries [6] := kRICPersonality7Let personalityInjuries [7] := kRICPersonality8Let personalityInjuries [8] := kRICPersonality9Let personalityInjuries [9] := kRICPersonality10Let personalityInjuries [10] := kRICPersonality11Let personalityInjuries [11] := kRICPersonality12Let personalityInjuries [12] := kRICPersonality13Let personalityInjuries [13] := kRICPersonality14Let personalityInjuries [14] := kRICPersonality15Let personalityInjuries [15] := kRICPersonality16Let personalityInjuries [16] := kRICPersonality17Let personalityInjuries [17] := kRICPersonality18Let personalityInjuries [18] := kRICPersonality19Let personalityInjuries [19] := kRICPersonality20Let personalityInjuries [20] := kRICPersonality21Let personalityInjuries [21] := kRICPersonality22Let personalityInjuries [22] := kRICPersonality23Let personalityInjuries [23] := kRICPersonality24Let personalityInjuries [24] := kRICPersonality25Let speedInjuries [0] := kRICSpeed1Let speedInjuries [1] := kRICSpeed2Let speedInjuries [2] := kRICSpeed3Let speedInjuries [3] := kRICSpeed4Let speedInjuries [4] := kRICSpeed5Let speedInjuries [5] := kRICSpeed6Let speedInjuries [6] := kRICSpeed7Let speedInjuries [7] := kRICSpeed8Let speedInjuries [8] := kRICSpeed9Let speedInjuries [9] := kRICSpeed10Let speedInjuries [10] := kRICSpeed11Let speedInjuries [11] := kRICSpeed12Let speedInjuries [12] := kRICSpeed13Let speedInjuries [13] := kRICSpeed14Let speedInjuries [14] := kRICSpeed15Let speedInjuries [15] := kRICSpeed16Let speedInjuries [16] := kRICSpeed17Let speedInjuries [17] := kRICSpeed18Let speedInjuries [18] := kRICSpeed19Let speedInjuries [19] := kRICSpeed20Let speedInjuries [20] := kRICSpeed21Let speedInjuries [21] := kRICSpeed22Let speedInjuries [22] := kRICSpeed23Let speedInjuries [23] := kRICSpeed24Let speedInjuries [24] := kRICSpeed25Let strengthInjuries [0] := kRICStrength1Let strengthInjuries [1] := kRICStrength2Let strengthInjuries [2] := kRICStrength3Let strengthInjuries [3] := kRICStrength4Let strengthInjuries [4] := kRICStrength5Let strengthInjuries [5] := kRICStrength6Let strengthInjuries [6] := kRICStrength7Let strengthInjuries [7] := kRICStrength8Let strengthInjuries [8] := kRICStrength9Let strengthInjuries [9] := kRICStrength10Let strengthInjuries [10] := kRICStrength11Let strengthInjuries [11] := kRICStrength12Let strengthInjuries [12] := kRICStrength13Let strengthInjuries [13] := kRICStrength14Let strengthInjuries [14] := kRICStrength15Let strengthInjuries [15] := kRICStrength16Let strengthInjuries [16] := kRICStrength17Let strengthInjuries [17] := kRICStrength18Let strengthInjuries [18] := kRICStrength19Let strengthInjuries [19] := kRICStrength20Let strengthInjuries [20] := kRICStrength21Let strengthInjuries [21] := kRICStrength22Let strengthInjuries [22] := kRICStrength23Let strengthInjuries [23] := kRICStrength24Let strengthInjuries [24] := kRICStrength25Let willpowerInjuries [0] := kRICWillpower1Let willpowerInjuries [1] := kRICWillpower2Let willpowerInjuries [2] := kRICWillpower3Let willpowerInjuries [3] := kRICWillpower4Let willpowerInjuries [4] := kRICWillpower5Let willpowerInjuries [5] := kRICWillpower6Let willpowerInjuries [6] := kRICWillpower7Let willpowerInjuries [7] := kRICWillpower8Let willpowerInjuries [8] := kRICWillpower9Let willpowerInjuries [9] := kRICWillpower10Let willpowerInjuries [10] := kRICWillpower11Let willpowerInjuries [11] := kRICWillpower12Let willpowerInjuries [12] := kRICWillpower13Let willpowerInjuries [13] := kRICWillpower14Let willpowerInjuries [14] := kRICWillpower15Let willpowerInjuries [15] := kRICWillpower16Let willpowerInjuries [16] := kRICWillpower17Let willpowerInjuries [17] := kRICWillpower18Let willpowerInjuries [18] := kRICWillpower19Let willpowerInjuries [19] := kRICWillpower20Let willpowerInjuries [20] := kRICWillpower21Let willpowerInjuries [21] := kRICWillpower22Let willpowerInjuries [22] := kRICWillpower23Let willpowerInjuries [23] := kRICWillpower24Let willpowerInjuries [24] := kRICWillpower25EndIfLet ArraySize := ar_Size agilityReliefsIf debugPrintToConsole "kRI: agilityReliefs size %0.2f" ArraySizeEndIfIf ArraySize == -1If debugPrintToConsole "kRI: initialising relief arrays"EndIfLet agilityReliefs := ar_Construct ArrayLet enduranceReliefs := ar_Construct ArrayLet intelligenceReliefs := ar_Construct ArrayLet personalityReliefs := ar_Construct ArrayLet speedReliefs := ar_Construct ArrayLet strengthReliefs := ar_Construct ArrayLet willpowerReliefs := ar_Construct ArrayLet agilityReliefs [0] := kRICAgilityFortify1Let agilityReliefs [1] := kRICAgilityFortify2Let agilityReliefs [2] := kRICAgilityFortify3Let agilityReliefs [3] := kRICAgilityFortify4Let agilityReliefs [4] := kRICAgilityFortify5Let agilityReliefs [5] := kRICAgilityFortify6Let agilityReliefs [6] := kRICAgilityFortify7Let agilityReliefs [7] := kRICAgilityFortify8Let agilityReliefs [8] := kRICAgilityFortify9Let agilityReliefs [9] := kRICAgilityFortify10Let agilityReliefs [10] := kRICAgilityFortify11Let agilityReliefs [11] := kRICAgilityFortify12Let agilityReliefs [12] := kRICAgilityFortify13Let agilityReliefs [13] := kRICAgilityFortify14Let agilityReliefs [14] := kRICAgilityFortify15Let agilityReliefs [15] := kRICAgilityFortify16Let agilityReliefs [16] := kRICAgilityFortify17Let agilityReliefs [17] := kRICAgilityFortify18Let agilityReliefs [18] := kRICAgilityFortify19Let agilityReliefs [19] := kRICAgilityFortify20Let agilityReliefs [20] := kRICAgilityFortify21Let agilityReliefs [21] := kRICAgilityFortify22Let agilityReliefs [22] := kRICAgilityFortify23Let agilityReliefs [23] := kRICAgilityFortify24Let agilityReliefs [24] := kRICAgilityFortify25Let enduranceReliefs [0] := kRICEnduranceFortify1Let enduranceReliefs [1] := kRICEnduranceFortify2Let enduranceReliefs [2] := kRICEnduranceFortify3Let enduranceReliefs [3] := kRICEnduranceFortify4Let enduranceReliefs [4] := kRICEnduranceFortify5Let enduranceReliefs [5] := kRICEnduranceFortify6Let enduranceReliefs [6] := kRICEnduranceFortify7Let enduranceReliefs [7] := kRICEnduranceFortify8Let enduranceReliefs [8] := kRICEnduranceFortify9Let enduranceReliefs [9] := kRICEnduranceFortify10Let enduranceReliefs [10] := kRICEnduranceFortify11Let enduranceReliefs [11] := kRICEnduranceFortify12Let enduranceReliefs [12] := kRICEnduranceFortify13Let enduranceReliefs [13] := kRICEnduranceFortify14Let enduranceReliefs [14] := kRICEnduranceFortify15Let enduranceReliefs [15] := kRICEnduranceFortify16Let enduranceReliefs [16] := kRICEnduranceFortify17Let enduranceReliefs [17] := kRICEnduranceFortify18Let enduranceReliefs [18] := kRICEnduranceFortify19Let enduranceReliefs [19] := kRICEnduranceFortify20Let enduranceReliefs [20] := kRICEnduranceFortify21Let enduranceReliefs [21] := kRICEnduranceFortify22Let enduranceReliefs [22] := kRICEnduranceFortify23Let enduranceReliefs [23] := kRICEnduranceFortify24Let enduranceReliefs [24] := kRICEnduranceFortify25Let intelligenceReliefs [0] := kRICIntelligenceFortify1Let intelligenceReliefs [1] := kRICIntelligenceFortify2Let intelligenceReliefs [2] := kRICIntelligenceFortify3Let intelligenceReliefs [3] := kRICIntelligenceFortify4Let intelligenceReliefs [4] := kRICIntelligenceFortify5Let intelligenceReliefs [5] := kRICIntelligenceFortify6Let intelligenceReliefs [6] := kRICIntelligenceFortify7Let intelligenceReliefs [7] := kRICIntelligenceFortify8Let intelligenceReliefs [8] := kRICIntelligenceFortify9Let intelligenceReliefs [9] := kRICIntelligenceFortify10Let intelligenceReliefs [10] := kRICIntelligenceFortify11Let intelligenceReliefs [11] := kRICIntelligenceFortify12Let intelligenceReliefs [12] := kRICIntelligenceFortify13Let intelligenceReliefs [13] := kRICIntelligenceFortify14Let intelligenceReliefs [14] := kRICIntelligenceFortify15Let intelligenceReliefs [15] := kRICIntelligenceFortify16Let intelligenceReliefs [16] := kRICIntelligenceFortify17Let intelligenceReliefs [17] := kRICIntelligenceFortify18Let intelligenceReliefs [18] := kRICIntelligenceFortify19Let intelligenceReliefs [19] := kRICIntelligenceFortify20Let intelligenceReliefs [20] := kRICIntelligenceFortify21Let intelligenceReliefs [21] := kRICIntelligenceFortify22Let intelligenceReliefs [22] := kRICIntelligenceFortify23Let intelligenceReliefs [23] := kRICIntelligenceFortify24Let intelligenceReliefs [24] := kRICIntelligenceFortify25Let personalityReliefs [0] := kRICPersonalityFortify1Let personalityReliefs [1] := kRICPersonalityFortify2Let personalityReliefs [2] := kRICPersonalityFortify3Let personalityReliefs [3] := kRICPersonalityFortify4Let personalityReliefs [4] := kRICPersonalityFortify5Let personalityReliefs [5] := kRICPersonalityFortify6Let personalityReliefs [6] := kRICPersonalityFortify7Let personalityReliefs [7] := kRICPersonalityFortify8Let personalityReliefs [8] := kRICPersonalityFortify9Let personalityReliefs [9] := kRICPersonalityFortify10Let personalityReliefs [10] := kRICPersonalityFortify11Let personalityReliefs [11] := kRICPersonalityFortify12Let personalityReliefs [12] := kRICPersonalityFortify13Let personalityReliefs [13] := kRICPersonalityFortify14Let personalityReliefs [14] := kRICPersonalityFortify15Let personalityReliefs [15] := kRICPersonalityFortify16Let personalityReliefs [16] := kRICPersonalityFortify17Let personalityReliefs [17] := kRICPersonalityFortify18Let personalityReliefs [18] := kRICPersonalityFortify19Let personalityReliefs [19] := kRICPersonalityFortify20Let personalityReliefs [20] := kRICPersonalityFortify21Let personalityReliefs [21] := kRICPersonalityFortify22Let personalityReliefs [22] := kRICPersonalityFortify23Let personalityReliefs [23] := kRICPersonalityFortify24Let personalityReliefs [24] := kRICPersonalityFortify25Let speedReliefs [0] := kRICSpeedFortify1Let speedReliefs [1] := kRICSpeedFortify2Let speedReliefs [2] := kRICSpeedFortify3Let speedReliefs [3] := kRICSpeedFortify4Let speedReliefs [4] := kRICSpeedFortify5Let speedReliefs [5] := kRICSpeedFortify6Let speedReliefs [6] := kRICSpeedFortify7Let speedReliefs [7] := kRICSpeedFortify8Let speedReliefs [8] := kRICSpeedFortify9Let speedReliefs [9] := kRICSpeedFortify10Let speedReliefs [10] := kRICSpeedFortify11Let speedReliefs [11] := kRICSpeedFortify12Let speedReliefs [12] := kRICSpeedFortify13Let speedReliefs [13] := kRICSpeedFortify14Let speedReliefs [14] := kRICSpeedFortify15Let speedReliefs [15] := kRICSpeedFortify16Let speedReliefs [16] := kRICSpeedFortify17Let speedReliefs [17] := kRICSpeedFortify18Let speedReliefs [18] := kRICSpeedFortify19Let speedReliefs [19] := kRICSpeedFortify20Let speedReliefs [20] := kRICSpeedFortify21Let speedReliefs [21] := kRICSpeedFortify22Let speedReliefs [22] := kRICSpeedFortify23Let speedReliefs [23] := kRICSpeedFortify24Let speedReliefs [24] := kRICSpeedFortify25Let strengthReliefs [0] := kRICStrengthFortify1Let strengthReliefs [1] := kRICStrengthFortify2Let strengthReliefs [2] := kRICStrengthFortify3Let strengthReliefs [3] := kRICStrengthFortify4Let strengthReliefs [4] := kRICStrengthFortify5Let strengthReliefs [5] := kRICStrengthFortify6Let strengthReliefs [6] := kRICStrengthFortify7Let strengthReliefs [7] := kRICStrengthFortify8Let strengthReliefs [8] := kRICStrengthFortify9Let strengthReliefs [9] := kRICStrengthFortify10Let strengthReliefs [10] := kRICStrengthFortify11Let strengthReliefs [11] := kRICStrengthFortify12Let strengthReliefs [12] := kRICStrengthFortify13Let strengthReliefs [13] := kRICStrengthFortify14Let strengthReliefs [14] := kRICStrengthFortify15Let strengthReliefs [15] := kRICStrengthFortify16Let strengthReliefs [16] := kRICStrengthFortify17Let strengthReliefs [17] := kRICStrengthFortify18Let strengthReliefs [18] := kRICStrengthFortify19Let strengthReliefs [19] := kRICStrengthFortify20Let strengthReliefs [20] := kRICStrengthFortify21Let strengthReliefs [21] := kRICStrengthFortify22Let strengthReliefs [22] := kRICStrengthFortify23Let strengthReliefs [23] := kRICStrengthFortify24Let strengthReliefs [24] := kRICStrengthFortify25Let willpowerReliefs [0] := kRICWillpowerFortify1Let willpowerReliefs [1] := kRICWillpowerFortify2Let willpowerReliefs [2] := kRICWillpowerFortify3Let willpowerReliefs [3] := kRICWillpowerFortify4Let willpowerReliefs [4] := kRICWillpowerFortify5Let willpowerReliefs [5] := kRICWillpowerFortify6Let willpowerReliefs [6] := kRICWillpowerFortify7Let willpowerReliefs [7] := kRICWillpowerFortify8Let willpowerReliefs [8] := kRICWillpowerFortify9Let willpowerReliefs [9] := kRICWillpowerFortify10Let willpowerReliefs [10] := kRICWillpowerFortify11Let willpowerReliefs [11] := kRICWillpowerFortify12Let willpowerReliefs [12] := kRICWillpowerFortify13Let willpowerReliefs [13] := kRICWillpowerFortify14Let willpowerReliefs [14] := kRICWillpowerFortify15Let willpowerReliefs [15] := kRICWillpowerFortify16Let willpowerReliefs [16] := kRICWillpowerFortify17Let willpowerReliefs [17] := kRICWillpowerFortify18Let willpowerReliefs [18] := kRICWillpowerFortify19Let willpowerReliefs [19] := kRICWillpowerFortify20Let willpowerReliefs [20] := kRICWillpowerFortify21Let willpowerReliefs [21] := kRICWillpowerFortify22Let willpowerReliefs [22] := kRICWillpowerFortify23Let willpowerReliefs [23] := kRICWillpowerFortify24Let willpowerReliefs [24] := kRICWillpowerFortify25EndIfLet ArraySize := ar_Size healthReliefsIf debugPrintToConsole "kRI: healthReliefs size %0.2f" ArraySizeEndIfIf ArraySize == -1If debugPrintToConsole "kRI: initialising health relief array"EndIfLet healthReliefs := ar_Construct ArrayLet healthReliefs [0] := kRIHealthFortify1Let healthReliefs [1] := kRIHealthFortify2Let healthReliefs [2] := kRIHealthFortify3Let healthReliefs [3] := kRIHealthFortify4Let healthReliefs [4] := kRIHealthFortify5Let healthReliefs [5] := kRIHealthFortify6Let healthReliefs [6] := kRIHealthFortify7Let healthReliefs [7] := kRIHealthFortify8Let healthReliefs [8] := kRIHealthFortify9Let healthReliefs [9] := kRIHealthFortify10Let healthReliefs [10] := kRIHealthFortify11Let healthReliefs [11] := kRIHealthFortify12Let healthReliefs [12] := kRIHealthFortify13Let healthReliefs [13] := kRIHealthFortify14Let healthReliefs [14] := kRIHealthFortify15Let healthReliefs [15] := kRIHealthFortify16Let healthReliefs [16] := kRIHealthFortify17Let healthReliefs [17] := kRIHealthFortify18Let healthReliefs [18] := kRIHealthFortify19Let healthReliefs [19] := kRIHealthFortify20Let healthReliefs [20] := kRIHealthFortify21Let healthReliefs [21] := kRIHealthFortify22Let healthReliefs [22] := kRIHealthFortify23Let healthReliefs [23] := kRIHealthFortify24Let healthReliefs [24] := kRIHealthFortify25EndIfendifIf Player.GetDead == 0set getRef to Playerset itemCount to getRef.GetItemCount kRITokenif itemCount < 1 && Player.GetDead == 0set itemCount to 1 - itemCountgetRef.AddItemNS kRIToken itemCountif debugPrintToConsole "kRI: adding (%0.2f) token to %n %i" itemCount getRef getRefendifelseif itemCount > 1set itemCount to itemCount - 1getRef.RemoveItemNS kRIToken itemCountif debugPrintToConsole "kRI: removing (%0.2f) token from %n %i" itemCount getRef getRefendifendifIf applyToNPCsset getRef to Gold001set getRef to GetFirstRef 69 1Label 0if getRefLet distance := getRef.GetDistance Playerif applyToNPCs && getRef.IsCreature == 0 && getRef.GetDead == 0 && getRef.GetDisabled == 0 && getRef.GetIsGhost == 0 && distance < 5000set itemCount to getRef.GetItemCount kRITokenif itemCount < 1 && getRef.IsInCombatset tempFloat to 1 - itemCountgetRef.AddItemNS kRIToken tempFloatif debugPrintToConsole "kRI: adding %0.0f token (%0.0f) to %n %i" tempFloat itemCount getRef getRefendifelseif itemCount > 1set tempFloat to itemCount - 1getRef.RemoveItemNS kRIToken tempFloatif debugPrintToConsole "kRI: removing %0.0f tokens (%0.0f) from %n %i" tempFloat itemCount getRef getRefendifendifendifset getRef to Gold001set getRef to GetNextRefGoTo 0endifEndIfEndIfIf functionMode == 254set functionMode to 0ElseIf functionMode == 255set functionMode to 0EndIfendShort quitToMainMenuBegin MenuMode;If Player.GetDead && quitToMainMenu == 0; Let quitToMainMenu := 1; Let fQuestDelayTime := 0.001; Return;ElseIf quitToMainMenu == 2; Let quitToMainMenu := 3; MessageBox "With Battle Fatigue and Injuries, you need to quit to the Main Menu to load a game.";EndIf;If quitToMainMenu; If MenuMode 1038; ;load menu; Let quitToMainMenu := 2; ClickMenuButton "load_background\load_return_button" 1038; Return; EndIf; if MenuMode 1013; ;escape menu; Let quitToMainMenu := 0; ClickMenuButton "pause_background\pause_quit_button" 1013; Return; endif; ;if MenuMode 1001; ; Let quitToMainMenu := 0; ; ClickMenuButton "background\button_2" 1001; ; Return; ;endif;EndIfIf quitToMainMenuLet quitToMainMenu := 0MessageBox "With Battle Fatigue and Injuries, you need to quit to the Main Menu to load a game."EndIfIf MenuMode 1038;load menuIf Player.GetDeadLet quitToMainMenu := 1ClickMenuButton "load_background\load_return_button" 1038ReturnEndIfEndIfEnd KRIToken Object Script attached to KRIToken ScriptName kRITokenScriptshort functionMode;0 = idle, detect injuries, heal and relief;1,4 = apply injuries and relief, add apparel;2 = equip apparel;3 = reset injuries and relief;5 = remove tokenfloat thisSecondsPassedfloat battleFatiguefloat lastBattleFatiguefloat armInjuriesfloat lastArmInjuriesfloat bodyInjuriesfloat lastBodyInjuriesfloat legInjuriesfloat lastLegInjuriesfloat headInjuriesfloat lastHeadInjuriesfloat armInjuriesRelieffloat lastArmInjuriesRelieffloat bodyInjuriesRelieffloat lastBodyInjuriesRelieffloat legInjuriesRelieffloat lastLegInjuriesRelieffloat headInjuriesRelieffloat lastHeadInjuriesReliefref thisReffloat maxHealthfloat healthfloat lastHealthfloat healthChangefloat healthLossfloat healthMarkfloat healthPercentagefloat randomfloat timeNowfloat timeLastHealedHealthfloat healRatefloat healAmountNowfloat timeElapsedfloat timeLastHealedBattleFatiguefloat timeLastHealedInjuryshort justSleptshort inCombatshort lastInCombatfloat timeLastInCombatshort battleFatigueAppliedThisCombat;injuriesshort strshort lastStrshort endshort lastEndshort agishort lastAgishort spdshort lastSpdshort intshort lastIntshort wilshort lastWilshort pershort lastPer;reliefsshort strRshort lastStrRshort endRshort lastEndRshort agiRshort lastAgiRshort spdRshort lastSpdRshort intRshort lastIntRshort wilRshort lastWilRshort perRshort lastPerRfloat toApplyshort resetfloat combatTimeref apparelRefref apparelHealthRefref apparelAgiRefref apparelEndRefref apparelIntRefref apparelPerRefref apparelSpdRefref apparelStrRefref apparelWilRefref apparelAgiRRefref apparelEndRRefref apparelIntRRefref apparelPerRRefref apparelSpdRRefref apparelStrRRefref apparelWilRRefshort itemCountshort indexshort healthDrainshort lastHealthDrainfloat tempFloatfloat restoreHealthMagfloat adjustedHoursToFullHealthfloat captureDamageTimeshort checkForInjuryfloat bankedDamagesshort formValidfloat valuefloat lastValuearray_var apparelArrayfloat startReliefTimeshort initDonefloat lastRestoreHealthMagshort okshort debug255float versionfloat endReliefTimefloat lastTimeNowfloat elapsedTimeNowbegin GameModeIf kRIQuest.movingIntoNewSpaceReturnEndIfIf OnKeyDown 54;right-shiftLet kRIQuest.debugRef := GetCrosshairRefEndIfset thisSecondsPassed to thisSecondsPassed + GetSecondsPassedif thisSecondsPassed > 1If thisRef != PlayerLet formValid := IsFormValid thisRefIf kRIQuest.debugPrintC "kRI: %n %i formValid %0.0f initDone %0.0f" thisRef thisRef formValid initDoneEndIfLet tempFloat := 0If formValid;GetDistance fails on invalid formsLet tempFloat := thisRef.GetDistance PlayerEndIfIf formValid == 0 || tempFloat > 5000 || (kRIQuest.applyToNPCs == 0 && thisRef != Player)If initDone == 0Let initDone := 1Let thisRef := GetContainerReturnElseIf functionMode < 3Let functionMode := 3EndIfEndIfEndIfEndIf;If thisRef.IsActor == 0; Return;EndIfif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i functionMode %0.2f" thisRef thisRef functionModeendifif reset == 1set reset to 0endifif functionMode < 3 && (thisRef.GetDead || thisRef.GetDisabled)set functionMode to 3endifLet checkForInjury := 0Let captureDamageTime := captureDamageTime + thisSecondsPassedIf functionMode == 0 && captureDamageTime > kRIQuest.secondsToCaptureDamageForInjuryLet checkForInjury := captureDamageTimeLet captureDamageTime := 0EndIfset thisSecondsPassed to 0if functionMode == 3set functionMode to 4Let battleFatigue := 0set armInjuries to 0set bodyInjuries to 0set headInjuries to 0set legInjuries to 0set armInjuriesRelief to 0set bodyInjuriesRelief to 0set headInjuriesRelief to 0set legInjuriesRelief to 0EndIf;detect changes to injuriesif functionMode == 0if kRIQuest.updateHUD || lastBattleFatigue != battleFatigue || lastArmInjuries != armInjuries || lastBodyInjuries != bodyInjuries || lastLegInjuries != legInjuries || lastHeadInjuries != headInjuries || lastArmInjuriesRelief != armInjuriesRelief || lastBodyInjuriesRelief != bodyInjuriesRelief || lastLegInjuriesRelief != legInjuriesRelief || lastHeadInjuriesRelief != headInjuriesReliefLet functionMode := 1Returnendif;fix for stuck battle fatigue;If battleFatigue == 0 && lastBattleFatigue == 0 && healthDrain > 0 && lastHealthDrain > 0; Let functionMode := 1;EndIfIf version != kRIQuest.versionLet version := kRIQuest.versionLet functionMode := 1If kRIQuest.debugPrintC "kRI: %n %i fixing" thisRef thisRefEndIfEndIf;end fixset timeNow to GameDaysPassed * 24 + GameHourLet elapsedTimeNow := timeNow - lastTimeNowLet lastTimeNow := timeNow;if kRIQuest.debug == 1 && thisRef == Player; PrintC "kRI: %n %i elapsedTimeNow %0.2f" thisRef thisRef elapsedTimeNow;EndIfLet health := thisRef.GetActorValue HealthIf health < 1ReturnEndIfLet maxHealth := thisRef.GetBaseActorValue HealthLet tempFloat := thisRef.GetAVMod Health MaxLet maxHealth := maxHealth + tempFloatIf lastHealth == 0Let lastHealth := maxHealthEndIfset healthChange to health - lastHealthif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i health %0.2f maxHealth %0.2f lastHealth %0.2f healthChange %0.2f" thisRef thisRef health maxHealth lastHealth healthChangeEndIfLet inCombat := thisRef.IsInCombatif inCombat != lastInCombatset lastInCombat to inCombatif inCombat == 0set battleFatigueAppliedThisCombat to 0ElseLet timeLastInCombat := timeNowendifendifif timeLastHealedHealth == 0set timeLastHealedHealth to timeNowendifif inCombatset combatTime to combatTime + GetSecondsPassedelseIf inCombat == 0 && combatTimeset combatTime to 0Let bankedDamages := 0endif;relief====================================If kRIQuest.applyMagicalReliefToRef == thisRefLet kRIQuest.applyMagicalReliefToRef := 0Let restoreHealthMag := kRIQuest.applyMagicalReliefFromMagnitudeif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i restoreHealthMag %0.2f lastRestoreHealthMag %0.2f" thisRef thisRef restoreHealthMag lastRestoreHealthMagendifIf restoreHealthMag > lastRestoreHealthMagLet lastRestoreHealthMag := kRIQuest.applyMagicalReliefFromMagnitudeIf kRIQuest.healingMagicReliefFactor && kRIQuest.healingMagicReliefDurationIf armInjuriesLet armInjuriesRelief := armInjuries * restoreHealthMag / 100 * kRIQuest.healingMagicReliefFactorIf armInjuriesRelief > armInjuriesLet armInjuriesRelief := armInjuriesEndIfLet armInjuriesRelief := Ceil armInjuriesReliefElseLet armInjuriesRelief := 0EndIfIf bodyInjuriesLet bodyInjuriesRelief := bodyInjuries * restoreHealthMag / 100 * kRIQuest.healingMagicReliefFactorIf bodyInjuriesRelief > bodyInjuriesLet bodyInjuriesRelief := bodyInjuriesEndIfLet bodyInjuriesRelief := Ceil bodyInjuriesReliefElseLet bodyInjuriesRelief := 0EndIfIf legInjuriesLet legInjuriesRelief := legInjuries * restoreHealthMag / 100 * kRIQuest.healingMagicReliefFactorIf legInjuriesRelief > legInjuriesLet legInjuriesRelief := legInjuriesEndIfLet legInjuriesRelief := Ceil legInjuriesReliefElseLet legInjuriesRelief := 0EndIfIf headInjuriesLet headInjuriesRelief := headInjuries * restoreHealthMag / 100 * kRIQuest.healingMagicReliefFactorIf headInjuriesRelief > headInjuriesLet headInjuriesRelief := headInjuriesEndIfLet headInjuriesRelief := Ceil headInjuriesReliefElseLet headInjuriesRelief := 0EndIfif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i bodyR %0.2f armR %0.2f headR %0.2f legR %0.2f" thisRef thisRef bodyInjuriesRelief armInjuriesRelief headInjuriesRelief legInjuriesReliefendifIf armInjuriesRelief || bodyInjuriesRelief || legInjuriesRelief || headInjuriesReliefLet startReliefTime := timeNowLet tempFloat := thisRef.GetActorValue WillpowerLet tempFloat := tempFloat / 100 * kRIQuest.healingMagicReliefDurationLet endReliefTime := timeNow + tempFloatEndIfEndIfEndIfEndIfIf armInjuriesRelief || bodyInjuriesRelief || legInjuriesRelief || headInjuriesReliefIf startReliefTime && endReliefTimeIf timeNow > endReliefTimeLet startReliefTime := 0Let lastRestoreHealthMag := 0Let armInjuriesRelief := 0Let bodyInjuriesRelief := 0Let legInjuriesRelief := 0Let headInjuriesRelief := 0EndIfif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)Let value := timeNow - startReliefTimePrintC "kRI: %n %i timeNow %0.2f elapsed %0.2f endTime %0.2f" thisRef thisRef timeNow value endReliefTimePrintC "kRI: %n %i armRelief %0.2f bodyRelief %0.2f legRelief %0.2f headRelief %0.2f" thisRef thisRef armInjuriesRelief bodyInjuriesRelief legInjuriesRelief headInjuriesReliefEndIfElseIf startReliefTime == 0 || endReliefTime == 0Let startReliefTime := 0Let lastRestoreHealthMag := 0EndIfElseLet startReliefTime := 0Let lastRestoreHealthMag := 0EndIf;battle fatigue and injury==================if lastHealth != healthif healthChange < 0 && inCombatset healthLoss to Abs healthChangeif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i health %0.2f max %0.2f" thisRef thisRef health maxHealthEndIf;battle fatigueif battleFatigueAppliedThisCombat == 0 && thisRef == Playerset healthMark to kRIQuest.healthLeftToAcquireBattleFatigueset healthPercentage to health / maxHealth * 100if (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i healthPercentage left %0.2f < battleFatigueHealth %0.2f" thisRef thisRef healthPercentage kRIQuest.healthLeftToAcquireBattleFatigueendifif healthPercentage < healthMarkif battleFatigue == 0 || timeLastHealedBattleFatigue == 0 || kRIQuest.combatRestartsBattleFatigueHealTimerset timeLastHealedBattleFatigue to timeNowendifLet battleFatigue := battleFatigue + kRIQuest.battleFatigueDamageset battleFatigueAppliedThisCombat to 1if (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i battleFatigue %0.2f" thisRef thisRef battleFatigueendifendifendif;injuryIf checkForInjury == 0;bank damages until checkForInjuryLet bankedDamages := bankedDamages + healthLossif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i bankedDamages %0.2f" thisRef thisRef bankedDamagesEndIfElseIf checkForInjuryset healthMark to kRIQuest.healthLossToAcquireInjuryLet healthLoss := healthLoss + bankedDamagesset healthPercentage to healthLoss / maxHealth * 100Let bankedDamages := 0set random to GetRandomPercentset tempFloat to kRIQuest.chanceOfInjury + kRIQuest.chanceOfInjuryIncrease * combatTimeif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i healthPercentage loss %0.2f > healthLossToAcquireInjury %0.2f" thisRef thisRef healthPercentage kRIQuest.healthLossToAcquireInjuryPrintC "kRI: %n %i random %0.2f < chanceOfInjury %0.2f + chanceOfInjuryIncrease %0.2f * combatTime %0.2f = (%0.2f)" thisRef thisRef random kRIQuest.chanceOfInjury kRIQuest.chanceOfInjuryIncrease combatTime tempFloatendifif healthPercentage > healthMark || random < tempFloatif (armInjuries == 0 && bodyInjuries == 0 && headInjuries == 0 && legInjuries == 0) || timeLastHealedInjury == 0 || kRIQuest.combatRestartsInjuryHealTimerset timeLastHealedInjury to timeNowendifset random to GetRandomPercentif random < kRIQuest.randomBodyInjuryRangeset bodyInjuries to bodyInjuries + kRIQuest.injuryDamageelseif random < kRIQuest.randomArmInjuryRangeset armInjuries to armInjuries + kRIQuest.injuryDamageelseif random < kRIQuest.randomLegInjuryRangeset legInjuries to legInjuries + kRIQuest.injuryDamageelseif random < kRIQuest.randomHeadInjuryRangeset headInjuries to headInjuries + kRIQuest.injuryDamageendifif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i body %0.2f arm %0.2f head %0.2f leg %0.2f" thisRef thisRef bodyInjuries armInjuries headInjuries legInjuriesendifendifset timeLastHealedHealth to timeNow;reset health healing timeEndIfendifendif;heal health====================================================================Let adjustedHoursToFullHealth := kRIQuest.hoursToFullHealthLet ok := 0If adjustedHoursToFullHealthLet ok := 1If kRIQuest.healthAffectsHoursToFullHealthLet tempFloat := maxHealth / healthLet adjustedHoursToFullHealth := adjustedHoursToFullHealth * tempFloatEndIfIf adjustedHoursToFullHealth == 0Let ok := 0EndIfIf ok && health >= maxHealthLet ok := 0EndIfIf ok && kRIQuest.healInCombat == 0If thisRef == Player && inCombatLet ok := 0ElseIf thisRef != Player && (inCombat || timeNow - timeLastInCombat < 0.5)Let ok := 0EndIfEndIfEndIfif okset timeElapsed to timeNow - timeLastHealedHealthset healRate to maxHealth / adjustedHoursToFullHealthset healAmountNow to healRate * timeElapsedIf thisRef.GetSitting == 3Let healAmountNow := healAmountNow * 2if (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i healAmountNow * 2 = %0.2f" thisRef thisRef healAmountNowEndIfElseIf thisRef.GetSitting == 13Let healAmountNow := healAmountNow * 1.5if (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i healAmountNow * 1.5 = %0.2f" thisRef thisRef healAmountNowEndIfEndIfIf health + healAmountNow > maxHealthLet healAmountNow := maxHealth - healthIf healAmountNow < 1Let healAmountNow := 1EndIfEndIfif healAmountNow >= 1set timeLastHealedHealth to timeNowthisRef.ModActorValue2 Health healAmountNowLet health := health + healAmountNowif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i health %0.2f == maxHealth %0.2f?" thisRef thisRef health maxHealthPrintC "kRI: %n %i mod healing %0.2f" thisRef thisRef healAmountNowendifendif;remove extra healthelseif health > maxHealthLet tempFloat := health - maxHealththisRef.ModActorValue2 Health tempFloatif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i health %0.2f == maxHealth %0.2f?" thisRef thisRef health maxHealthPrintC "kRI: %n %i remove extra Health %0.2f" thisRef thisRef healAmountNowendifLet health := maxHealthset timeLastHealedHealth to 0;no health heal or removal of extra healthElseset timeLastHealedHealth to 0endifIf health != lastHealthLet lastHealth := healthEndIfif (kRIQuest.healInCombat == 0 && inCombat) || functionMode == 1Returnendif;heal battle fatigue======================================If thisRef != Player && battleFatigueLet battleFatigue := 0if (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i removing battle fatigue" thisRef thisRefendifElseif battleFatigueset timeElapsed to timeNow - timeLastHealedBattleFatigueif justSleptset healRate to kRIQuest.battleFatigueHealAsleepelseset healRate to kRIQuest.battleFatigueHealAwakeendifset healAmountNow to healRate * timeElapsedif healAmountNow >= 1Let healAmountNow := Ceil healAmountNowset timeLastHealedBattleFatigue to timeNowLet battleFatigue := battleFatigue - healAmountNowif battleFatigue < 0Let battleFatigue := 0endifif (kRIQuest.debug == 1 && thisRef == Player)PrintC "kRI: %n %i battleFatigue healed by %0.2f" thisRef thisRef healAmountNowendifendifendif;heal injury======================================================================if armInjuries || bodyInjuries || headInjuries || legInjuriesset timeElapsed to timeNow - timeLastHealedInjuryif justSleptset healRate to kRIQuest.injuryHealAsleepelseset healRate to kRIQuest.injuryHealAwakeendifset healAmountNow to healRate * timeElapsedif healAmountNow >= 1Let healAmountNow := Ceil healAmountNowset timeLastHealedInjury to timeNowif armInjuries > 0set armInjuries to armInjuries - healAmountNowif armInjuries < 0set armInjuries to 0Let armInjuriesRelief := 0endifif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i arm healed by %0.2f" thisRef thisRef healAmountNowendifendifif bodyInjuries > 0set bodyInjuries to bodyInjuries - healAmountNowif bodyInjuries < 0set bodyInjuries to 0Let bodyInjuriesRelief := 0endifif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i body healed by %0.2f" thisRef thisRef healAmountNowendifendifif headInjuries > 0set headInjuries to headInjuries - healAmountNowif headInjuries < 0set headInjuries to 0Let headInjuriesRelief := 0endifif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i head healed by %0.2f" thisRef thisRef healAmountNowendifendifif legInjuries > 0set legInjuries to legInjuries - healAmountNowif legInjuries < 0set legInjuries to 0Let legInjuriesRelief := 0endifif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i leg healed by %0.2f" thisRef thisRef healAmountNowendifendifendifendifif justSleptset justSlept to 0endifelseif functionMode == 1 || functionMode == 4if functionMode == 1set functionMode to 0elseif functionMode == 4set functionMode to 5endifset str to 0set agi to 0set end to 0set int to 0set wil to 0set per to 0set spd to 0Let healthDrain := 0Let strR := 0Let agiR := 0Let endR := 0Let intR := 0Let wilR := 0Let perR := 0Let spdR := 0set lastBattleFatigue to battleFatigueIf battleFatigueset toApply to battleFatigue * kRIQuest.battleFatigueDamageMultiplierLet healthDrain := Ceil toApplyEndIfset lastArmInjuries to armInjuriesif armInjuriesset toApply to armInjuries * kRIQuest.injuryDamageMultiplierif kRIQuest.bodyInjuriesAffectStrength == 0set agi to Ceil toApplyelseset tempFloat to toApply / 2set agi to Ceil tempFloatset str to str + toApply - agiendifElseLet armInjuriesRelief := 0endifLet lastArmInjuriesRelief := armInjuriesReliefIf armInjuriesReliefLet toApply := armInjuriesRelief * kRIQuest.injuryDamageMultiplierIf kRIQuest.bodyInjuriesAffectStrength == 0Let agiR := Ceil toApplyElseLet tempFloat := toApply / 2Let agiR := Ceil tempFloatLet strR := strR + toApply - agiREndIfEndIfset lastBodyInjuries to bodyInjuriesif bodyInjuriesset toApply to bodyInjuries * kRIQuest.injuryDamageMultiplierif kRIQuest.bodyInjuriesAffectStrength == 0set end to Ceil toApplyelseset tempFloat to toApply / 2set end to Ceil tempFloatset str to str + toApply - endendifElseLet bodyInjuriesRelief := 0endifLet lastBodyInjuriesRelief := bodyInjuriesReliefIf bodyInjuriesReliefLet toApply := bodyInjuriesRelief * kRIQuest.injuryDamageMultiplierIf kRIQuest.bodyInjuriesAffectStrength == 0Let endR := Ceil toApplyElseLet tempFloat := toApply / 2Let endR := Ceil tempFloatLet strR := strR + toApply - endREndIfEndIfset lastLegInjuries to legInjuriesif legInjuriesset toApply to legInjuries * kRIQuest.injuryDamageMultiplierif kRIQuest.bodyInjuriesAffectStrength == 0set spd to toApplyelseset tempFloat to Ceil toApply / 2set spd to Ceil tempFloatset str to str + toApply - spdendifElseLet legInjuriesRelief := 0endifLet lastLegInjuriesRelief := legInjuriesReliefIf legInjuriesReliefLet toApply := legInjuriesRelief * kRIQuest.injuryDamageMultiplierIf kRIQuest.bodyInjuriesAffectStrength == 0Let spdR := Ceil toApplyElseLet tempFloat := toApply / 2Let spdR := Ceil tempFloatLet strR := strR + toApply - spdREndIfEndIfset lastHeadInjuries to headInjuriesif headInjuriesset toApply to headInjuries * kRIQuest.injuryDamageMultiplierset tempFloat to toApply / 3set per to Ceil tempFloatset wil to Ceil tempFloatset int to toApply - per - wilElseLet headInjuriesRelief := 0endifLet lastHeadInjuriesRelief := headInjuriesReliefIf headInjuriesReliefLet toApply := headInjuriesRelief * kRIQuest.injuryDamageMultiplierLet tempFloat := toApply / 3Let perR := Ceil TempFloatLet wilR := Ceil TempFloatLet intR := toApply - perR - wilREndIf;update the HUDIf (kRIHUDQuest.showMode == 0 && thisRef == Player) || (kRIHUDQuest.showMode == 1 && thisRef == kRIQuest.debugRef);Let kRIQuest.updateHUD := 1Let kRIHUDQuest.arm := armInjuriesLet kRIHUDQuest.body := bodyInjuriesLet kRIHUDQuest.leg := legInjuriesLet kRIHUDQuest.head := headInjuriesEndIfLet kRIQuest.updateHUD := 0;update injuries: add correct apparel to add injuries and reliefs;agi, end, int, per, spd, str, wil, agiR, endR, intR, perR, spdR, strR, wilR, healthLet index := 0while index < 15If index == 0Let lastValue := lastAgiLet value := agiLet apparelArray := kRIQuest.agilityInjuriesElseIf index == 1Let lastValue := lastEndLet value := endLet apparelArray := kRIQuest.enduranceInjuriesElseIf index == 2Let lastValue := lastIntLet value := intLet apparelArray := kRIQuest.intelligenceInjuriesElseIf index == 3Let lastValue := lastPerLet value := perLet apparelArray := kRIQuest.personalityInjuriesElseIf index == 4Let lastValue := lastSpdLet value := spdLet apparelArray := kRIQuest.speedInjuriesElseIf index == 5Let lastValue := lastStrLet value := strLet apparelArray := kRIQuest.strengthInjuriesElseIf index == 6Let lastValue := lastWilLet value := wilLet apparelArray := kRIQuest.willpowerInjuriesElseIf index == 7Let lastValue := lastAgiRLet value := agiRLet apparelArray := kRIQuest.agilityReliefsElseIf index == 8Let lastValue := lastEndRLet value := endRLet apparelArray := kRIQuest.enduranceReliefsElseIf index == 9Let lastValue := lastIntRLet value := intRLet apparelArray := kRIQuest.intelligenceReliefsElseIf index == 10Let lastValue := lastPerRLet value := perRLet apparelArray := kRIQuest.personalityReliefsElseIf index == 11Let lastValue := lastSpdRLet value := spdRLet apparelArray := kRIQuest.speedReliefsElseIf index == 12Let lastValue := lastStrRLet value := strRLet apparelArray := kRIQuest.strengthReliefsElseIf index == 13Let lastValue := lastWilRLet value := wilRLet apparelArray := kRIQuest.willpowerReliefsElseIf index == 14Let lastValue := lastHealthDrainLet value := healthDrainLet apparelArray := kRIQuest.healthInjuriesEndIfIf lastValue < 0Let lastValue := 0ElseIf lastValue > 25Let lastValue := 25EndIfIf value < 0Let value := 0ElseIf value > 25Let value := 25EndIf;If value != lastValueIf value != lastValue && lastValue > 0Let apparelRef := apparelArray [lastvalue - 1]Let itemCount := thisRef.GetItemCount apparelRefIf itemCountthisRef.UnequipItemSilent apparelRefthisRef.RemoveItemNS apparelRef itemCountif (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i removing %n %i" thisRef thisRef apparelRef apparelRefEndIfEndIfEndIfLet apparelRef := 0If value != lastValue && value > 0Let functionMode := 2Let apparelRef := apparelArray [value - 1]Let itemCount := thisRef.GetItemCount apparelRefIf itemCount == 0thisRef.AddItemNS apparelRef 1if (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef)PrintC "kRI: %n %i adding %n %i at value %0.2f of index %0.0f" thisRef thisRef apparelRef apparelRef value indexEndIfEndIfEndIfIf index == 0Let lastAgi := agiLet apparelAgiRef := apparelRefElseIf index == 1Let lastEnd := endLet apparelEndRef := apparelRefElseIf index == 2Let lastInt := intLet apparelIntRef := apparelRefElseIf index == 3Let lastPer := perLet apparelPerRef := apparelRefElseIf index == 4Let lastSpd := spdLet apparelSpdRef := apparelRefElseIf index == 5Let lastStr := strLet apparelStrRef := apparelRefElseIf index == 6Let lastWil := wilLet apparelWilRef := apparelRefElseIf index == 7Let lastAgiR := agiRLet apparelAgiRRef := apparelRefElseIf index == 8Let lastEndR := endRLet apparelEndRRef := apparelRefElseIf index == 9Let lastIntR := intRLet apparelIntRRef := apparelRefElseIf index == 10Let lastPerR := perRLet apparelPerRRef := apparelRefElseIf index == 11Let lastSpdR := spdRLet apparelSpdRRef := apparelRefElseIf index == 12Let lastStrR := strRLet apparelStrRRef := apparelRefElseIf index == 13Let lastWilR := wilRLet apparelWilRRef := apparelRefElseIf index == 14Let lastHealthDrain := healthDrainLet apparelHealthRef := apparelRefEndIf;EndIfLet index := index + 1loopelseif functionMode == 2set functionMode to 0;short itemCountif apparelHealthRefthisRef.EquipItemSilent apparelHealthRefendifif apparelStrRefthisRef.EquipItemSilent apparelStrRefendifif apparelEndRefthisRef.EquipItemSilent apparelEndRefendifif apparelAgiRefthisRef.EquipItemSilent apparelAgiRefendifif apparelSpdRefthisRef.EquipItemSilent apparelSpdRefendifif apparelIntRefthisRef.EquipItemSilent apparelIntRefendifif apparelWilRefthisRef.EquipItemSilent apparelWilRefendifif apparelPerRefthisRef.EquipItemSilent apparelPerRefendifif apparelStrRRefthisRef.EquipItemSilent apparelStrRRefendifif apparelEndRRefthisRef.EquipItemSilent apparelEndRRefendifif apparelAgiRRefthisRef.EquipItemSilent apparelAgiRRefendifif apparelSpdRRefthisRef.EquipItemSilent apparelSpdRRefendifif apparelIntRRefthisRef.EquipItemSilent apparelIntRRefendifif apparelWilRRefthisRef.EquipItemSilent apparelWilRRefendifif apparelPerRRefthisRef.EquipItemSilent apparelPerRRefendifEndIfif functionMode == 5set functionMode to 0If kRIQuest.debugPrintC "kRI: %n %i removing token" thisRef thisRefEndIfset random to thisRef.GetItemCount kRITokenIf random > 0thisRef.RemoveItemNS kRIToken randomElseIf random < 0Let random := -1 * randomthisRef.AddItemNS kRIToken randomEndIfIf kRIQuest.debugPrintC "kRI: %n %i removal successful" thisRef thisRefEndIfReturnendifendifIf kRIQuest.functionMode == 254 && debug255 == 0;add random injuriesLet debug255 := 0if (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef) || kRIQuest.debug == 4Let armInjuries := Rand 0 4Let bodyInjuries := Rand 0 4Let legInjuries := Rand 0 4Let headInjuries := Rand 0 4Let battleFatigue := Rand 0 4Let armInjuries := Floor armInjuriesLet bodyInjuries := Floor bodyInjuriesLet legInjuries := Floor legInjuriesLet headInjuries := Floor headInjuriesLet battleFatigue := Floor battleFatigueLet timeLastHealedInjury := timeNowLet timeLastHealedBattleFatigue := timeNowEndIfElseIf kRIQuest.functionMode == 255 && debug255 == 0Let debug255 := 1if (kRIQuest.debug == 1 && thisRef == Player) || (kRIQuest.debug == 2 && thisRef != Player) || (kRIQuest.debug == 3 && thisRef == kRIQuest.debugRef) || kRIQuest.debug == 4PrintC "kRI: %n %i ------------------------------" thisRef thisRefPrintC "bf %0.2f lastBF %0.2f healthDrain %0.2f lastHealthDrain %0.2f" battleFatigue lastBattleFatigue healthDrain lastHealthDrainPrintC "arm %0.2f agi %0.2f lastAgi %0.2f" armInjuries agi lastAgiPrintC "body %0.2f end %0.2f lastEnd %0.2f" bodyInjuries end lastEndPrintC "leg %0.2f spd %0.2f lastSpd %0.2f" legInjuries spd lastSpdPrintC "head %0.2f int %0.2f per %0.2f wil %0.2f lastInt %0.2f lastPer %0.2f lastWil %0.2f" headInjuries int per wil lastInt lastPer lastWilPrintC "str %0.2f lastStr %0.2f" str lastStrPrintC "relief: arm %0.2f agi %0.2f lastAgi %0.2f" armInjuriesRelief agiR lastAgiRPrintC "relief: body %0.2f end %0.2f lastEnd %0.2f" bodyInjuriesRelief endR lastEndRPrintC "relief: leg %0.2f spd %0.2f lastSpd %0.2f" legInjuriesRelief spdR lastSpdRPrintC "relief: head %0.2f int %0.2f per %0.2f wil %0.2f lastInt %0.2f lastPer %0.2f lastWil %0.2f" headInjuriesRelief intR perR wilR lastIntR lastPerR lastWilRPrintC "relief: str %0.2f lastStr %0.2f" strR lastStrRPrintC "------------------------------"EndIfElseIf kRIQuest.functionMode == 0Let debug255 := 0EndIfendbegin MenuModeIf MenuMode 1012;if thisRef == Player && IsPCSleeping && justSlept == 0If IsPCSleeping && justSlept == 0set justSlept to 1endifendifend An Object Script called FunctionCheckForMagicOnHealththat doesn't seem to be attached to any object, none of the edited(green highlight in CSE) NPCs or items have it. ScriptName FunctionCheckForMagicOnHealthRef actorRefRef itemRefShort magicOnHealthShort magicItemIndexShort magicItemCountShort magicItemNthMagLong magicItemNthCodeBegin Function {actorRef itemRef}If kRIQuest.debugPrintC "kRI FunctionCheckForMagicOnHealth: %n %i %n %i" actorRef actorRef itemRef itemRefEndIfLet magicOnHealth := 0Let magicItemCount := GetMagicItemEffectCount itemRefLet magicItemIndex := 0while magicItemIndex < magicItemCountLet magicItemNthCode := GetNthEffectItemCode itemRef magicItemIndexIf kRIQuest.debugPrintC "kRI FunctionCheckForMagicOnHealth: %n %i index %0.0f code %0.2f" itemRef itemRef magicItemIndex magicItemNthCodeEndIfIf magicItemNthCode == (GetMagicEffectCode REHE) || magicItemNthCode == (GetMagicEffectCode FOHE);magic item has health effectsLet magicItemNthMag := GetNthEffectItemMagnitude itemRef magicItemIndexIf kRIQuest.debugPrintC "kRI FunctionCheckForMagicOnHealth: %n %i index %0.0f Mag %0.0f" itemRef itemRef magicItemIndex magicItemNthMagEndIfIf magicItemNthMag > 0Let magicOnHealth := 1breakEndIfEndIfLet magicItemIndex := magicItemIndex + 1loopIf magicOnHealthLet itemRef := kRIQuest.applyMagicalReliefToRefIf IsFormValid itemRef || IsReference itemRef == 0 || itemRef.GetDead || itemRef.GetDisabledLet kRIQuest.applyMagicalReliefToRef := actorRefLet kRIQuest.applyMagicalReliefFromMagnitude := magicItemNthMagEndIfEndIf;EndIfEnd A blank? object script named kRIFixHealthScript attached to KRIFixHealth(clothing item)All it has is 1 line saying: ScriptName kRIFixHealthScriptHis .ini file here: ;npcs can receive battle fatigue and injuries.;default = 1.set kRIQuest.applyToNPCs to 1 ;=================;health generation;=================;this is the number of in-game hours health will be restored to max.;default = 1.set kRIQuest.hoursToFullHealth to 1;healing can occur in combat.;default = 0. 1 is not recommended.set kRIQuest.healInCombat to 0 ;health affects heal-rate.;the percentage of health left is a factor to the number of in-game hours required for health to be restored fully.;the forumla used to adjust hoursToFullHealth is:;hoursToFullhealth / (health / max health) * healthAffectsHoursToFullHealth.;set this to 0 so that health is always restored after hoursToFullHealth.;default = 1.set kRIQuest.healthAffectsHoursToFullHealth to 1 ;==================;damage multipliers;==================;these are the number of attribute penalties applied for 1 point of battle fatigue or injury.;default = 5.set kRIQuest.battleFatigueDamageMultiplier to 5set kRIQuest.injuryDamageMultiplier to 5 ;==============;battle fatigue;==============;battle fatigue will be applied when health dips below this percentage.;default = 25.set kRIQuest.healthLeftToAcquireBattleFatigue to 0 ;how much battle fatigue is applied for each application of battle fatigue.;default = 1.set kRIQuest.battleFatigueDamage to 1 ;how much battle fatigue is healed per hour awake.;default = 0.042. this translates to 1 battle fatigue damage per day. i.e. 1/24.set kRIQuest.battleFatigueHealAwake to 0.042 ;how much battle fatigue is healed per hour asleep.;default = 0.125. this translates to 1 battle fatigue damage per 8 hours. i.e. 1/8.set kRIQuest.battleFatigueHealAsleep to 0.125 ;healing can be interrupted by combat.;set this to 1 to restart the healing timer for battle fatigue when combat starts.;default = 0.set kRIQuest.combatRestartsBattleFatigueHealTimer to 0 ;========;injuries;========;the length of time the mod will capture damage to convert to injuries.;a longer amount will effectively increase the number of injuries because more damage will be captured over the set time.;the default in ryujiin's Realistic Injury was 2. this, more likely than not, captured damage from more than one hit.;default = 2. when set to 1, the script "almost" captures individual hits.set kRIQuest.secondsToCaptureDamageForInjury to 2 ;injuries will be applied when this percentage of health is lost during combat.;default = 25.set kRIQuest.healthLossToAcquireInjury to 100 ;there is a small chance that even a small amount of damage will cause injury.;default = 1.set kRIQuest.chanceOfInjury to 0 ;this small chance increases every second in combat.;default = 0.017. this translates to 1% per minute. i.e. 1/60.set kRIQuest.chanceOfInjuryIncrease to 0.00 ;how much injury is applied for each application of an injury.;default = 1.set kRIQuest.injuryDamage to 1 ;each injury type affects strength by default.;disable strength penalties on a particular injury by setting its value to 0.;default = 1 to all.set kRIQuest.armInjuriesAffectStrength to 1set kRIQuest.bodyInjuriesAffectStrength to 1set kRIQuest.legInjuriesAffectStrength to 1 ;how much injury is healed per hour awake.;default = 0.042. this translates to 1 injury damage per day. i.e. 1/24.set kRIQuest.injuryHealAwake to 0.042 ;how much injury is healed per hour asleep.;default = 0.125. this translates to 1 injury per 8 hours. i.e. 1/8.set kRIQuest.injuryHealAsleep to 0.125 ;healing can be interrupted by combat.;set this to 1 to restart the healing timer for injuries when combat starts.;default = 0.set kRIQuest.combatRestartsInjuryHealTimer to 0 ;magical heals can temporarily relieve injuries by this factor.;the magnitude of the spell or potion is also a factor to this relief.;the formula is:;relief = injury point * magnitude / 100 * healingMagicReliefFactor;default = 1.set kRIQuest.healingMagicReliefFactor to 1 ;length of in-game hours magic relieves injuries.;the actor's willpower is a factor to this duration.;the formula is:;hours = willpower / 100 * healingMagicReliefDuration;default = 4. an actor with 100 willpower will have relief for 4 hours.set kRIQuest.healingMagicReliefDuration to 4 ;===========;injury type;===========;these are the range of chances an injury will be of a particular type.;body injuries affect endurance and strength.;arm injuries affect agility and strength.;leg injuries affect speed and strength.;head injuries affect personality, willpower and intelligence.;this order cannot be changed.;to disable a particular injury, ensure that its range is 0.;e.g. body = 70 and arm = 70 will disable arm injuries.;leg = 100 and head = 100 will disable head injuries.set kRIQuest.randomBodyInjuryRange to 40 ;0 to 39. 40% chance.set kRIQuest.randomArmInjuryRange to 70 ;40 to 69. 30% chance.set kRIQuest.randomLegInjuryRange to 90 ;70 to 89. 20% chance.set kRIQuest.randomHeadInjuryRange to 100 ;90 to 99. 10% chance. ;===;HUD;===;HUD requires pluggy installed, the pluggy DLL renamed and showHUDInGameMode or showHUDInMenuMode set to 1.;read the Using the HUD section of the read-me.set kRIQuest.showHUDInGameMode to 1 ;default = 1set kRIQuest.hudGameX to 10 ;default = 10set kRIQuest.hudGameY to 625 ;default = 625set kRIQuest.hudGameScale to 0.25 ;default = 0.25set kRIQuest.hudGameOpacity to 100 ;default = 100 set kRIQuest.showHUDInMenuMode to 1 ;default = 1set kRIQuest.hudMenuX to 760 ;default = 760set kRIQuest.hudMenuY to 715 ;default = 715set kRIQuest.hudMenuScale to 0.25 ;default = 0.25set kRIQuest.hudMenuOpacity to 100 ;default = 100 ;=====;debug;=====set kRIQuest.debug to 0 His Readme file: Name: Battle fatigue and injuries Version: 0.70 Date: 4 February 2012 Category: Gameplay Effects and Changes Requirements: Oblivion.ESM or Nehrim.ESM, Oblivion Patch 1.2.0.214, Oblivion Script Extender (OBSE): http://obse.silverlock.org/ Optional: Pluggy: http://tesnexus.com/downloads/file.php?id=23979 Author(s): kuertee Source: http://www.tesnexus.com/downloads/file.php?id=24604 Changes since last updates (0.69) ================================= 0.70, 4 February 2012: Tweak: When loading a game after you die, the game may crash. However, if you quit to the Main Menu and load the game from there, it doesn't. In this version, after you die, you won't be able to load a game except from the Main Menu. You can load the game normally while alive. Gameplay changes ================ Injuries are the debilitating physical cuts and bruises caused by combat when: 25 Damage or more is received in a short time, or from a small chance (1%) that increases over time while in combat. These injuries can be viewed in your Active effects screen. Most injuries are healed after 8 hours of sleep. NPCs and the player gets injuries. Magical relief from injuries when Health is healed magically. E.g. potions, spells, etc. These bonuses can be viewed in your Active effects screen. The Magnitude of magic determines the amount of relief. Willpower determines the length of relief. NPCs and the player. Battle fatigue are psychological/mental conditions that come from almost dying (Health drops below 25%) in combat. These penalties can be viewed in your Active effects screen. Battle fatigue is cleared after 8 hours of sleep. Incurred only once per combat. The player only. Gain full Health over 1 hour. This moves Oblivion's healing when waiting for 1 hour from the Wait screen into the game world. NPCs and the player. Compatibility ============= Requires either Oblivion.ESM or Nehrim.ESM. There is an ESP for Oblivion.ESM and another for Nehrim.ESM. Optional with LAME: "kuertee bgMagicEVShader default drain effects.esp" to reset DFAT Magic effect's shader to "effectDrain". Load after bgMagicEVShader.esp. Optional with MMM: "kuertee MMM OnLoadCS disabled hmf effects.esp" to disable it's Health changes applied with ModActorValue. Load after all of MMM. No scripts, animations, items, etc. were modified so this should be compatible with combat mods - even those with other injuries systems. The injuries will simply "double-up". Details ======= Configure this mod with its INI file in (game folder)\Data\Ini\. Penalties are applied as Drain Attributes effects attached to enchanted and invisible "tokens". Injuries: Body injuries (40% chance): -3 Endurance and -2 Strength Arm injuries (30%): -3 Agility and -2 Strength Leg injuries (20%): -3 Speed and -2 Strength Head injuries (10%): -1 Intelligence, -1 Willpower, -2 Personality Battle fatigue and injuries heal over time: 1 point healed every 24 hours awake, 1 point healed every 8 hours asleep. Magical relief: injury point * magnitude of magic / 100 * healingMagicReliefFactor (default in INI is 1). Duration: Willpower / 100 * healingMagicReliefDuration (default in INI is 12). Healing over time: hoursToFullhealth / (health / max health) * healthAffectsHoursToFullHealth. hoursToFullhealth and healthAffectsHoursToFullHealth are 1 in INI. MMM OnLoadCS scripts with disabled Health, Magicka, Fatigue effects =================================================================== MMM's diversifaction system uses ModActorValue to vary the Health, Magicka, and Fatigue of actors. Unfortunately, this causes I think, some unusual effects to the actors in the game. Two examples are: 1. Health is healed rather than lost when physical damage is inflicted. 2. Actors continously casting healing spells because their AI detects a loss of health due to the modified base Health with ModActorValue. This was confirmed by shadowborn: http://www.bethsoft.com/bgsforums/index.php?showtopic=1049752&view=findpost&p=15272211 "kuertee MMM OnLoadCS disabled hmf effects.esp" disables these effects from MMM's scripts. Note, however, that MMM's diversifcation system on other attributes (e.g. Strength, Intelligence, etc...) are still intact. Using the HUD (optional) ======================== Install Pluggy, rename Data\obse\plugins\OBSE_Elys_Pluggy.dll to Data\obse\plugins\OBSE_Elys_Pluggy_HUD.dll. Ensure that showHUDInGameMode or showHUDInMenuMode in the INI file is set to 1. Upgrade from previous versions ============================== OBMM: Deactivate the previous OMOD then follow the OBMM Install instructions with the new ZIP. OBMM Install ============ 1. Click on "Create" to create a new OMOD. 2. Click on "Add archive" and point to the downloaded ZIP file. 3. Click on "Create omod". 4. Activate the newly created OMOD. OBMM will install the appropriate ESP for Oblivion and Nehrim. OBMM Uninstall ============== 1. Deactivate the OMOD. Manual Install/Uninstall ======================== Unsupported. If you know what to do, go ahead. Otherwise, use OBMM. History ======= 0.69, 23 January 2012: Bug-fix: Magical reliefs (gained from magical spells) may have been disabled in the previous version. Reenabled in this version. Compatibility: With Nehrim: kuerteeNehrimBattleFatigueAndInjuries.esp. Choose one ESP. Or when using OBMM, it will install the appropriate version. Bug-fix: Banked damages from previous combat does not carry on to new combats anymore. Previously, combatants would receive injuries before they receive actual hits because of this bug. Fixed now. Tweak: Health is restored faster when sitting: x2 when sitting, and x1.5 when on a horse. Read-me: A concise description of the mod: Gameplay changes, Compatibility, Details. Rewritten for ease of scanning. (And to get this ready for Skyrim users.) 0.68, 6 August 2011: Bug-fix: Another attempt at preventing save-game bloat caused by string variables. Note that this bloat exists in the OBSE's companion save-file not in the native saved-game file. It is recommended that this update is restarted from a clean-save. 0.67, 19 June 2011: Bug-fix: A fix to prevent save-game bloat caused by string variables. 0.66, 3 January 2011: Tweak: OBSE logs showed that this mod may cause saved-game bloat due to recreation of string variables. Tweaked now so that the string variables are cleaned at game-load so that only one set is only present in saved-games. 0.65, 21 December 2009: Bug-fix: The INI file was incorrectly archived outside the INI folder. This resulted in some values not getting initialised properly. This could also be the cause of non-appearing HUDs. The INI file should be located in the Data\ini sub-folder. Bug-fix: As of 0.63, Battle fatigue should only be applied to the player. However, there was a bug which applied Battle fatigue to anyone BUT the player. This is now fixed. 0.64, 16 December 2009: Bug-fix: Drain and Fortify Health effects are now taken into account in determining Battle fatigue and injuries and in healing health. Tweak: This note added: MMM OnLoadCS scripts with disabled Health, Magicka, Fatigue effects =================================================================== MMM's diversifaction system uses ModActorValue to vary the Health, Magicka, and Fatigue of actors. Unfortunately, this causes I think, some unusual effects to the actors in the game. Two examples are: 1. Health is healed rather than lost when physical damage is inflicted. 2. Actors continously casting healing spells because their AI detects a loss of health due to the modified base Health with ModActorValue. This was confirmed by shadowborn: http://www.bethsoft.com/bgsforums/index.php?showtopic=1049752&view=findpost&p=15272211 "kuertee MMM OnLoadCS disabled hmf effects.esp" disables these effects from MMM's scripts. Note, however, that MMM's diversifcation system on other attributes (e.g. Strength, Intelligence, etc...) are still intact. 0.63, 29 November 2009: New feature: HUD. To use the HUD: Install Pluggy, rename "Data\obse\plugins\OBSE_Elys_Pluggy.dll" to "Data\obse\plugins\OBSE_Elys_Pluggy_HUD.dll". Ensure that showHUDInGameMode or showHUDInMenuMode in the INI file is set to 1. Its location on screen can also be configured in the INI file. Tweak: In regards to healing, when the player sleeps, all NPCs are assumed to also be asleep. This should heal NPC's (especially companions') injuries at the same rate as the player. Tweak: Removed all health fixing features. Constantly healing NPCs and over-max-health NPCs may have been caused by MMM's actor diversifaction features from OnLoadCSNPC scripts. The new feature below disables these effects from MMM. New feature: An option to disable Health, Magicka and Fatigue effects (i.e. mesh-scale effects and and undead speed effects are kept) from MMM's diversifaction system. Activate the "kuertee MMM OnLoadCS disabled hmf effects.esp". MMM's diversifaction effects works by offsetting actors' Health, Magicka, Fatigue and other attributes by a random amount. Unfortunately, negatively offsetting Health, Magicka and Fatigue causes the AI to "think" that these are damaged. Actors with appropriate healing magic will try to heal these stats by continously casting and or consuming healing magic. Tweak: In addition to the above, Battle fatigue is now only applied to the player. Similar to MMM's diversifaction system Battle fatigue caused NPCs to continously try and fail to heal themselves. Not applying Battle fatigue to NPCs prevents this. Bug-fix: Removal of the BFandI scripts and effects from NPCs. Another bug-fix/re-coded feature to ensure that the token scripts are disabled on inactive NPCs. Inactive NPCs are those that have been unloaded from memory. NPCs are usually unloaded from memory when the player moves too far away from them. Bug-fix: Fixed an OBSE error at the very end of the GameMode block when an actor other than the player dies. 0.62, 19 October 2009: Bug-fix: Previously, the Battle fatigue effect would stick (i.e. not heal) on the player. This is now fixed. Bug-fix: Correct application of injuries. Previously, an injury will not be applied if it had the same value of the last healed injury. When this mod is used over the previous version, any unapplied injuries from previous battles will be applied when the game starts. As with all my mods, there is no need to start this mod from a "cleaned save". Bug-fix: Application magical relief from injuries. Previously, the fractional values of injuries would produce unusual injury and relief values. Bug-fix: Reliefs do not carry past their duration after sleeping. Tweak: Relief duration is now normalised to 4 hours rather than 12 hours. 0.61, 3 October 2009: Bug-fix: Removing injuries and the token from dead NPCs. Tweak: Auto-heal on NPCs start after half-an-hour of being out of combat instead of when they get out of combat. The in-combat state of NPCs can be off even when they seem to be still in combat in-game. Tweaks: Various tweaks in regards to tracking changes in health. 0.60, 25 September 2009: Bug-fix: A safe-guard to cancel the scripts on actors that are invalid. Bug-fix: Strength penalties were not "stacking" across multiple injuries. New feature: Magical reliefs from injuries: Magic (spells or potions) offer relief from injuries. The magnitude of the spell or potion determines the magnitude of relief. Set healingMagicReliefFactor (default = 1) to enable this feature. The formula for reliefs is: injury point * magnitude / 100 * healingMagicReliefFactor. The actor's Willpower determines the duration of the relief. Set healingMagicReliefDuration (default = 12) in the INI file. The formula for the duration is: willpower / 100 * healingMagicReliefDuration. New feature: Current health affects healing efficiency. The amount of damage affects the amount of time required to heal health to the full. Set healthAffectsHoursToFullHealth (default = 1) to enable this feature. The formula for the length of time heal is restored to full is: hoursToFullhealth / (health / max health) * healthAffectsHoursToFullHealth. New feature: Collection of damage for injury determination can now be configured. Previously, this was hard-coded at 1 second. Set secondsToCaptureDamageForInjury (default = 2) in the INI file. Bug-fix: Removal of the ever-increasing health bug. I think (or more to the point: my tests shows that) this bug exists in the vanilla game. An actor's health will heal over and above their maximum health when their health is not a whole number. Sometimes, damage will work negatively: adding to the actor's health rather than removing from the actor's health. This fix constantly checks for these cases, and forces the actor's health to be a whole number or the actor's health to its maximum when more than their maximum. 0.59, 7 September 2009: Tweak: Users can now remove the effects of the mod from NPCs. Previously, all non-creature actors were affected. Set "applyToNPCs" to 0 in the INI file to remove the mod's effects from NPCs. (Thanks for the suggestion Mercer.) 0.58, 3 September 2009: Bug-fix: Ensured that at least more than 1 Health needs to have been lost before any injuries are applied. In normal circumstances a check of whether there is health loss is sufficient. However, if the actor is constantly losing health (e.g. Damage Health magic effect of 1 Health per second), the random checks for injuries occur too often. 0.57, 8 August 2009: Tweak: Rewritten how the token injuries are kept and how the penalties are distributed across the affected attributes. 0.56, 12 July 2009: New feature: Strength penalties can be disabled from injuries. By default, arm injuries affect Agility and Strength, body injuries affect Endurance and Strength, and leg injuries affect Speed and Strength. Each injury can now be configured to affect Strength or not. Do this in the INI file. 0.55, 28 June 2009: Bug-fix: Removal of persistant shader. I was incorrect to assume that [gfx]_initial_glow-all.esp removed all persistant effects. With my fix, the effectDrain shader should never persist. Just make sure that kuerteeBattleFatigueAndInjuries.esp is loaded after any mods that change the effectDrain's shader properties. And when playing with LAME, make sure that kuertee bgMagicEVShader default drain effects.esp is loaded after bgMagicEVShader.esp. 0.54, 13 June 2009: New feature: Added a penalty multiplier. 1 point per injury may be a little weak for some. By default the multiplier is 5 points. Note, however, that the penalty score is different to the injury score. What are displayed in the Active effects screen are penalty points. So, the damage and healing settings in the INI file are still "geared" to 1 injury point per battle fatigue or injury. 0.53, 8 June 2009: Bug-fix: Fixed the problem that causes the reference to FOHE (Fortify Health) to stall the script. This was evident when Battle fatigue or injuries were not getting healed. New feature: LAME shader patch. LAME (when its bgMagicEVShader.esp optional mod is used) adds long-lasting visual effects to Drain effects. (Battle fatigue and injuries are effected as Drains to Health, and Attributes.) If you do not want to see these visual effects (because they can be quite distracting), either deactivate bgMagicEVShader.esp or load "kuertee bgMagicEVShader default drain effects.esp" after bgMagicEVShader.esp. Bug-fix: Previously, all healing rates used the value for healing when asleep. Fixed now. 0.52, 30 May 2009: Bug-fix: Prevents actors receiving more Health than their maximum Health. This seems to have been caused by the vanilla Oblivion game: With an active Health drain, actors can accumulate (via potion or spell) more Health than their maximum health. 0.51, 24 May 2009: Bug-fix: Healing of health now handled with ModActorValue2 (rather than ModActorValue) to prevent healing over the maximum health. 0.50, 22 May 2009 - Initial release. Contact ======= kuertee in the Bethesda forums: http://www.bethsoft.com/bgsforums/ Credits ======= kuertee (author) Ryujiin for the original Real Injury mod. Tools Used ========== Oblivion Mod Manager - http://www.tesnexus.com/downloads/file.php?id=2097 Oblivion Script Extender (OBSE) - http://obse.silverlock.org/ TES4Edit - http://www.tesnexus.com/downloads/file.php?id=11536 Readme Generator - http://lhammonds.game-host.org/obmm/tools_readme_generator1.asp Licensing/Legal =============== You can do whatever you want with this mod but all I ask in return is that you give me credit if you distribute any part of this mod. I would also like to know what mods are including my work. There's a few others, I'm opening his mod again now, will paste them hereDone, all of his scripts are in the spoiler. I also copied the ini file and readme. This might be unusual to do but I only want to be able to use NewHudS, get it to work with my mod.There's other .esps but I think they don't relate to the HUD. I'll try starting the game again with his mod but the other esps disabled just to be sureMod Link:http://www.nexusmods.com/oblivion/mods/24604/?
lollol Posted October 3, 2014 Author Posted October 3, 2014 Double checked in OBMM, the other ESP files don't get installed(His mod has OMOD conversion). They aren't being used and the HUD still works(Only interested in the HUD functions).Back now, and checked the other quest script. Found something: if GetGameLoaded || started == 0 Let started := 1 Let showHUDInGameMode := 1 Let hudGameX := 10 Let hudGameY := 625 Let hudGameScale := 0.25 Let hudGameOpacity := 100 Let showHUDInMenuMode := 1 Let hudMenuX := 660 Let hudMenuY := 95 Let hudMenuScale := 0.25 Let hudMenuOpacity := 100 RunBatchScript "Data\ini\Heart SystemDupeIni.ini" EndifAdded it to my script, just made my own ini and linked to it.I cut out all the Battle Fatigue & injury stuff and left only the HUD part:
Vaelorian Posted October 3, 2014 Posted October 3, 2014 Try this script. If it doesn't work, open your console and tell me what it says: scn zzzOneHeartOnlyModefloat fQuestDelayTimeshort xshort yfloat scaleshort opacityshort menuXshort menuYfloat menuScaleshort menuOpacityshort showModelong HUDlayershort menuAlignlong pTempStringlong pHUDHeartbegin gamemodeif fQuestDelayTime != 1 let fQuestDelayTime := 1endifLet x := 0Let y := 0Let scale := .25Let opacity := 100Let showMode := 1Let menuX := 0Let menuY := 0Let menuScale := .25Let menuOpacity := 100let HUDlayer := 500let menuAlign := 9If pTempString == 0 Let pTempString := CreateString -1 "pluggy" 0 1EndIfIf pHUDHeart == 0 SetString pTempString "Textures\Menus\OneHeartOnlyRiskyMode.png" Let pHUDHeart := NewHudS pTempString -1 showMode x y HUDlayer menuScale menuOpacity menuAlign 1 0 -1 PrintToConsole HudSInfo pHUDHeart 4 Endifend
lollol Posted October 3, 2014 Author Posted October 3, 2014 Trying it right now. Will edit this with what it saysIt says HudSInfoOnly once, it adds it again after I load. So the "If pHUDHeart== 0 " only returns true on the first frame. If I speculate, I think the Let NewHudS := command isn't resolving so it might instead sets pHUDHeart to Undefined(some kind of placeholder for when there is no answer, could be Alt+255 which is the spacebar). Tried editing it to include a %, since PrintToConsoles uses same syntax as MessageBox according to CS wiki. It returns the number 20
Vaelorian Posted October 3, 2014 Posted October 3, 2014 According to the CSwiki, what should've been outputted to the console from the HUDSInfo line was 1 (meaning that the HUD displays during gameplay only), so I probably wrote it wrong. I do apologize, it's 8:53 am and I had two hours sleep, so I am tired. As for pHUDHeart==0 returning true only the first frame, that is expected and intended; you're basically asking the game if the object is empty, and if it is creating the HUD element. After you've created the element, it isn't empty anymore. Hopefully this will fix it... scn zzzOneHeartOnlyModefloat fQuestDelayTimeshort xshort yfloat scaleshort opacityshort menuXshort menuYfloat menuScaleshort menuOpacityshort showModelong HUDlayershort menuAlignlong pTempStringshort tmplong pHUDHeartbegin gamemodeif fQuestDelayTime != 1 let fQuestDelayTime := 1endifLet x := 0Let y := 0Let scale := .25Let opacity := 100Let showMode := 11Let menuX := 0Let menuY := 0Let menuScale := .25Let menuOpacity := 100let HUDlayer := 500let menuAlign := 9If pTempString == 0 Let pTempString := CreateString -1 "pluggy" 0 1EndIfIf pHUDHeart == 0 SetString pTempString "Textures\Menus\OneHeartOnlyRiskyMode.png" Let pHUDHeart := NewHudS pTempString -1 showMode x y HUDlayer menuScale menuOpacity menuAlign 1 0 -1 set tmp to (HudSInfo pHUDHeart 4) PrintToConsole tmp Endifend It should display 11 in the console this time.
lollol Posted October 3, 2014 Author Posted October 3, 2014 no message gets displayed in the console with the new script. Waited 1 minute ingame incase it would be due to lagChanged it to this. PrintToConsole "%f equals pHUDHeart" tmp Message "%f equals pHUDHeart" tmp To output a number from a variable a "%f" is neededGeneral form of Message/MessageBox/PrintToConsoleMessage "Displays this text and this %f" {a Number from a Variable placed here is added in place of %f} {Duration of displayed message}Now it does give me 11. Does this confirm that the heart is infact rendered? Perhaps it's offscreen? Also, If I change the script by setting the show setting to 1(gamemode only) then the printed text also becomes 1.Also, Battle Fatigue uses 2 quests, its HUD image doesn't work if either of the quest scripts are disabled. I tested by opening it in CS, and setting the quests with a blank script. The Token Object script can be disabled and the HUD image still appears. Just added this in case we have to do the very long way which would be to add his complete system to this mod, and slowly delete all the excess until it does only what we need. At least we don't have to bother with the token script which has 1015 lines in it.
lollol Posted October 3, 2014 Author Posted October 3, 2014 I have basic functionality now. Apparently, the stuff we fill in for NewHudS must be in a separate script. Need to have 2 Quests, and have our script link to a secondary Quest Script.All it has is this in the second script: Let hudGameX := 100 ;Original is 10 Let hudGameY := 625 Let hudGameScale := 0.25 Let hudGameOpacity := 100 Let hudMenuX := 660 Let hudMenuY := 95 Let hudMenuScale := 0.25 Let hudMenuOpacity := 100 There's no logical sense to why we'd have to do this. Nowhere in the pluggy files included in the download, or on CS wiki tells us to do this. I'd guess it's due to some kind of Bethesda bug.To do list:- Get this to work in MenuMode(but not loading screens, main menu or the bartering/repair/recharge/enchant/spellmaking menus since the normal Health bar is hidden during these). Lower priority for now unless it's quite easy to do.- I want to try to have several hearts appear, being controlled by tokens. From there, by using a second heart image and a second token type, I want to add the lost heart icons that represent lost HP. I want to have a healing spell that removes one damage token.Basic healing with the heart system: I want to have a healing spell that removes one damage token. As a bonus, it would be great if a script could cause Heal Minor Wounds to restore a heart when cast on the player. For a release version, this will make it feel more "organic" for the player if they obtain and use the standard restoration spells and don't see Script Effect On Self. Perhaps the script can detect when a particular spell ID is cast on the player, and react by removing a damage counter. Just so it'll look normal in the spell book, other then Heal Minor Wounds being buffed to heal 3 health per second for 8 seconds.The first token will be the total number of hearts the player has. Represents total HPThe second token will be the number of hearts the player has lost. Represents a damage counter.Info about the hearts Just info, these would be added later on:For a good part of the game, 5 or 6 hearts will be the normal cap. I'll probably decide on the actual cap when actually playing with the complete system. I'll add Heart Containers one by one, each one is more difficult to obtain then the last. The Leveled list Random heart containers will be the same. I'm thinking the first Heart Container might be in Vilverin, after defeating Jalbert. The others might be in a custom dungeon. They would follow an order of difficulty, with a decent gap between them. The first custom one might be doable right away for a skilled player, the others, no. The easiest Random will have a 5-10% chance to appear in a boss chest. The others would be much lower, the random heart containers are a bonus. After the heart system works with the tokens, I want to create the event handler that will add damage tokens.To-do list, in order-Set up basic function for the Event handler-Set up the on-hit limited invulnerability. The invulnerability will last 1 second for now.-Set up the on-hit PlayIdle(have it play anything for now)
movomo Posted October 3, 2014 Posted October 3, 2014 Looks cool. Maybe your armor could save your hit dice with some kind of armorrating-armorclass conversion. and your magicka is displayed in a similar way too. You can cast only 7 or so spells per a day. oh wait nvm. It's getting similar to baldur's gate rather than zelda. I don't want to play pen and paper on the pc... Anyway.. in general I would not recommend using tokens. Pretty much anything that can be done with tokens, can also be achieved with the array. And tokens are hard to keep track of them, and slow, they can be a real puta when you attemp to attach object scripts on them.
lollol Posted October 3, 2014 Author Posted October 3, 2014 Ok, how would i set up this array? Right now I'm intended to keep Magicka and Stamina normal. The Restoration spells will have more relative power now, so I will increase their cost for the player. Heal Legendary Wounds will instantly restore 3 hearts, and then restore 3 hearts again after a duration. It will consume like 70% to 90% of player's magicka at 100 restoration and 100 int, depending on race/birthsignTrying to add 2nd and 3rd hearts right now. Just edited my scripts and going to try it
lollol Posted October 3, 2014 Author Posted October 3, 2014 Am now trying to have 3 hearts display at same time. Looks cool.Maybe your armor could save your hit dice with some kind of armorrating-armorclass conversion.and your magicka is displayed in a similar way too. You can cast only 7 or so spells per a day.oh wait nvm. It's getting similar to baldur's gate rather than zelda. I don't want to play pen and paper on the pc...Anyway.. in general I would not recommend using tokens. Pretty much anything that can be done with tokens, can also be achieved with the array. And tokens are hard to keep track of them, and slow, they can be a real puta when you attemp to attach object scripts on them. Actually thought about doing an armorrating-armorclass conversion. Too complicated though. 3 hearts, worked
movomo Posted October 3, 2014 Posted October 3, 2014 OBSE arrays are quite straightforward to learn. Unless you have to use pluggy arrays, use OBSE's. They are very convenient and cool. OBSE command doc has an excellent documentation of their array feature. See the "Array Variables" section if you're new to it. Basically an array is a container of.. things. a sequenced container of things. In OBSE you can put anything into it. numbers, strings, refs, even other arrays, anything you name it. and in OBSE you can extend/shrink the arrays any time you want. (This has some drawback on the back-end, that it takes up more memory heap, but generally they are more efficient than doing the same thing without them.) So once you consructed an array(whether it is an array, or a map, or a stringmap) with the ar_Construct command, you can build up a structured data set with it. This becomes very handy when you have to deal with a large amount of npcs, and still handy even if the player is your only concern because it can have indefinite amount of stuff in it. It also helps keeping your script short, with while/foreach keywords. For pluggy arrays, I don't remember correctly. You must remember the array ID when constructing it and.. err.. well, it's been ages I had coded with pluggy. But not that it isn't good. they are efficient. pluggy also has its own array tutorial somewhere in the released file. The basics are the same with OBSE though. Sorry
lollol Posted October 3, 2014 Author Posted October 3, 2014 Never had to use IDs for Pluggy, but I only have used NewHudS For the second heartIf pHUDHeartSecond == 0 SetString pTempString "Textures\Menus\OneHeartOnlyRiskyMode.png" Let pHUDHeartSecond := NewHudS pTempString 1 11 xSecond y HudS_SclX pHUDHeartSecond scale HudS_SclY pHUDHeartSecond scale Endif I had to set everything in a separate script, then reference it in the main one. Then it workedOk, will check out the obse arrays. 3 hearts worked.
lollol Posted October 3, 2014 Author Posted October 3, 2014 Think I found the command I'll need for the next part.SetEventHandler OnHit.Need this so i can trigger a loss of a heart, limited invulnerability, animation.How to track the total number of hearts? In place of tokens. My character should have 3. It should carry over between save and restarts.I need to track 2 variables, Current Hearts and Maximum Hearts. What command in OBSE replaces tokens. Going by your earlier post, I will look at Array Variables. http://obse.silverlock.org/obse_command_doc.html#Array_VariablesAlthough I need to go to bed now.
movomo Posted October 3, 2014 Posted October 3, 2014 Umm, you only need 2 variables? why don't you set two more integers in your quest. It should be enough unless you want to do more complicated works on the hearts. Forget about tokens, and arrays too in this case.
Vaelorian Posted October 3, 2014 Posted October 3, 2014 Ugh, teach me to try to figure what's wrong with an Oblivion script after two hours' sleep. Sorry about that. Still haven't had time to sleep, by the way. Life is being... Rather unkind. Friend is sick and I went to visit him in the hospital. Anyway, good to see you got this working. If you set the showMode to 11, it will work in menus. Of course, you then need to add a check for which menu it is, and disable it in ones you don't want it to appear. This page has codes for the various menu modes: http://cs.elderscrolls.com/index.php?title=MenuMode I don't think an array is optimal here; you're only implementing the system on the player, you don't have to keep track of too many things. You can still do it, of course. If you plan on having a static maximum number of hearts possible, you can use either a standard OBSE array (information about it here: http://cs.elderscrolls.com/index.php?title=Introduction_to_OBSE_arrays) or a Pluggy array (information about it here: http://cs.elderscrolls.com/index.php?title=Introduction_to_Pluggy_Arrays). If you want a dynamic array, use the Pluggy one. I suppose using an array makes a few things easier to do than quest variables (such as a dynamic number of hearts), but of course the downside is that you have to learn just one more thing. It's up to you. If you don't want to use arrays, just add two int variables to your script.
lollol Posted October 3, 2014 Author Posted October 3, 2014 Umm, you only need 2 variables? why don't you set two more integers in your quest. It should be enough unless you want to do more complicated works on the hearts. Forget about tokens, and arrays too in this case. I need it to do this: Short TotalHeartCount Short HeartDamageCounter SetEventHandler OnHit Player ;If player is hit during temporary invulnerability, These 3 lines might be unnecessary if I use SetGhost ;Return ;Endif ; Other code: Add one to a damage counter variable, ; then check if HeartDamageCounter >= TotalHeartCount; Since HeartDamageCounter = TotalHeartCount means 0 HP and ; HeartDamageCounter > TotalHeartCount means negative HP. ; If true then trigger player's death; later this will have a PlayIdle DeathAnimation 1 ; Elseif damage counter != max heart count Player.PlayIdle Hitstun Animation 1 ; Force the player to do a short hit stun animation, this will last only about 15-30 frames. Functions like ; a mini-stagger/recoil ;Trigger temporary invulnerability, this is due to the reduced health and the stun animation. It will last a little bit longer then the animation ;so the player can't be stuck in a "combo". Probably will last 10-15 frames longer then the animation. The easiest way to do this is ;probably Player.SetGhost 1 for like 30-40 frames, then Player.SetGhost 0. Could make the first If -> Return -> Endif part unnecessary ;since OnHit shouldn't be triggered if the player has SetGhost. Random Heart Containers will have a static number possible, they will be a late addition. Currently thinking the total cap might be 10. First Script scn zzzOneHeartOnlyMode float fQuestDelayTime short x short y float scale short opacity short menuX short menuY float menuScale short menuOpacity short showMode long HUDlayer short menuAlign long pTempString short tmp long pHUDHeart long pHUDHeartSecond long pHUDHeartThird short hudGameX short hudGameY float hudGameScale short hudGameOpacity short hudMenuX short hudMenuY float hudMenuScale short hudMenuOpacity short SecondhudGameX short ThirdhudGameX short xSecond short xThird begin gamemode if fQuestDelayTime != 1 let fQuestDelayTime := 1 endif Let x := zzzHeartSystemTheSecondQuest.hudGameX Let y := zzzHeartSystemTheSecondQuest.hudGameY Let scale := zzzHeartSystemTheSecondQuest.hudGameScale Let opacity := zzzHeartSystemTheSecondQuest.hudGameOpacity Let menuX := zzzHeartSystemTheSecondQuest.hudMenuX Let menuY := zzzHeartSystemTheSecondQuest.hudMenuY Let menuScale := zzzHeartSystemTheSecondQuest.hudMenuScale Let menuOpacity := zzzHeartSystemTheSecondQuest.hudMenuOpacity Let xSecond := zzzHeartSystemTheSecondQuest.SecondhudGameX Let xThird := zzzHeartSystemTheSecondQuest.ThirdhudGameX If pTempString == 0 Let pTempString := CreateString -1 "pluggy" 0 1 EndIf If pHUDHeart == 0 SetString pTempString "Textures\Menus\OneHeartOnlyRiskyMode.png" ;Let pHUDHeart := NewHudS pTempString -1 showMode x y HUDlayer menuScale menuOpacity menuAlign 1 0 -1 Let pHUDHeart := NewHudS pTempString 1 11 x y HudS_SclX pHUDHeart scale HudS_SclY pHUDHeart scale ;set tmp to (HudSInfo pHUDHeart 4) ;PrintToConsole tmp Endif If pHUDHeartSecond == 0 SetString pTempString "Textures\Menus\OneHeartOnlyRiskyMode.png" Let pHUDHeartSecond := NewHudS pTempString 1 11 xSecond y HudS_SclX pHUDHeartSecond scale HudS_SclY pHUDHeartSecond scale Endif If pHUDHeartThird == 0 SetString pTempString "Textures\Menus\OneHeartOnlyRiskyMode.png" Let pHUDHeartThird := NewHudS pTempString 1 11 xThird y HudS_SclX pHUDHeartThird scale HudS_SclY pHUDHeartThird scale Endif end Second Script SCN zzzOneHeartOnlyModeTheSecond short hudGameX short hudGameY float hudGameScale short hudGameOpacity short hudMenuX short hudMenuY float hudMenuScale short hudMenuOpacity short ThirdhudGameX short SecondhudGameX Short TotalHeartCount Short HeartDamageCounter Short InvulnerabilityPhase Short InvulnerabilityTimer Short Critical Short CriticalHealthMod Short CriticalSet begin GameMode If player.getdead StopQuest zzzHeartSystemTheSecondQuest ;Avoid CTD after death StopQuest zzzHeartSystem endif ; For whatever reason, NewHudS command requires the variables to be in another quest script If InvulnerabilityTimer >= 30 Player.SetGhost 0 Set InvulnerabilityPhase to 0 Set InvulnerabilityTimer to 0 Endif if InvulnerabilityPhase == 1 Set InvulnerabilityTimer to 1 + InvulnerabilityTimer ;Count Frames passed endif ;Let CriticalHealthMod := ( 1 - player.getav health ) If ( TotalHeartCount - HeartDamageCounter ) == 1 ;1 heart left Set Critical to 1 ; Change her 1h Idle, facial expression too if possible. I've seen pose mods also change expressions player.ResetHealth ; Before a Death Animation is added, this could be better then Player.Kill. Have her regular health set to 1 Else Set CriticalSet to 0 Player.Resethealth If CriticalSet == 0 player.modav2 health CriticalHealthMod Set CriticalSet to 1 endif endif Let hudGameX := 100 Let hudGameY := 680 Let hudGameScale := 0.25 Let hudGameOpacity := 100 Let hudMenuX := 560 Let hudMenuY := 350 Let hudMenuScale := 0.25 Let hudMenuOpacity := 100 Let SecondhudGameX := 150 ;Second Heart Let ThirdhudGameX := 200 ;Third Heart ;SetEventHandler OnHit Player ;If player is hit during temporary invulnerability, These 3 lines might be unnecessary if I use SetGhost ;Return ;Endif ; Other code: Add one to a damage counter variable, Let HeartDamageCounter := HeartDamageCounter + 1 ; then check if HeartDamageCounter >= TotalHeartCount ; Since HeartDamageCounter = TotalHeartCount means 0 HP and ; HeartDamageCounter > TotalHeartCount means negative HP. player.kill ; If true then trigger player's death; later this will have a PlayIdle DeathAnimation 1 Else ;Player didn't die from attack ;Player.PlayIdle HitstunAnimation 1 ; Force the player to do a short hit stun animation, this will last only about 15-30 frames. Functions like ; a mini-stagger/recoil ;Trigger temporary invulnerability, this is due to the reduced health and the stun animation. It will last a little bit longer then the animation ;so the player can't be stuck in a "combo". Probably will last 10-15 frames longer then the animation. ;The easiest way to do this is ;probably Player.SetGhost 1 for like 30-40 frames, then Player.SetGhost 0. ;Could make the first If -> Return -> Endif part unnecessary ;since OnHit shouldn't be triggered if the player has SetGhost. Player.SetGhost 1 Set InvulnerabilityPhase to 1 endif end
lollol Posted October 4, 2014 Author Posted October 4, 2014 Nothing happens with the event handler. Only trying to print a console message when the player is attackedIn my main quest script I added this line just below Begin Gamemode SetEventHandler OnHit FnOnPlayerHitByEnemy Object::player Event handler script sscn FnOnPlayerHitByEnemy ref player ref attacker begin Function { player, attacker} PrintToConsole "player was hit by the attacker" Message "player was hit by the attacker" ;Let zzzHeartSystem.HeartDamageCounter := zzzHeartSystem.HeartDamageCounter + 1 ;Let zzzHeartSystemDamageSystem.InvulnerabilityTrigger := 1 endAlso does this event handler command require a specific reference for the attacking NPC to be already declared. As in, if the player was attacked by Baurus then it must state:SetEventHandler OnHit FnOnPlayerHitByEnemy Object::player Ref::BaurusRefor else it doesn't run? I would love suggestions about the gameplay system itself. Did not think about how healing will work until a few days ago
movomo Posted October 4, 2014 Posted October 4, 2014 1. your filter condition should be "ref" or "first", not "object". "object" means the attacker. 2. do not use "player" or "playerRef" as your variable name. Oblivion language is case-insensitive. They will be confused that with the built-in references. I'm not sure if we can override the namespace in OBSE. Anyway, make sure that you won't accidentally override any of the pre-existing editor IDs, game settings and all that. Try this instead. SetEventHandler "OnHit" FnOnPlayerHitByEnemy "ref"::PlayerRef or SetEventHandler "OnHit" FnOnPlayerHitByEnemy "first"::PlayerRef Worth noting that this "filter"::pair notation is internally a StringMap mapping notation. Even if OBSE doc does not enclose the "filter" part with double quotes, don't forget to do that. Those "ref" or "object" are actually string keys, not some kind of another keywords or modifiers. Event names are strings, too. And my advice is that OBSE compiler often acts like a bitch. Sometimes it slips a lot of your mistakes away, or sometimes just refuses to compile correct things. So if something does not work, try other ways. Don't expect any of the functions are doing its job correctly. Be a paranoid, populate debug prints, dump arrays, see what's happening with your eyes, unless you already have experience with the same kind of script. As to the multiple heart tokens. You can access any quest variable prepending the questID to the variable name, like yourQuest.some_varSo quest object is like a container of psuedo-global variables. Don't use the real global variables. Use quest instead.So... Do it as you see fit, but I think you don't need to give tokens to the player to track down pc's current and max hearts. If you use an array for that then you can extend the number of hearts indefinitely, but it is up to your choice. I only have played very old series of zelda franchise when I was young. I think.. I had ten or twelve hearts in the end
lollol Posted October 4, 2014 Author Posted October 4, 2014 10-12 hearts is about what the cap will be, though it will be very hard to get all of them. RNG will give about 5, one with a 10% chance of appearing in boss chests or boss npcs found in caves. The others, much lower. High end player will have 5-8 depending on luck. RNG hearts are a bonus to ease difficulty a little over time. Trying now
lollol Posted October 4, 2014 Author Posted October 4, 2014 Function Script scn FnOnPlayerHitByEnemy ref player ref refs begin function { player refs } Messagebox "player was hit by the attacker" end SCN Quest Script... Begin GamemodeSetEventHandler OnHit FnOnPlayerHitByEnemy "first"::zzzHeartSystem.attackedPlayer ... end Declared Ref attackedplayer in other quest scriptdidn't work, tried both having player attack an npc and be attackedStrangely worked suddenly. I made a third quest script. Third script just listed some variables didn't have Begin block. Tried adding this to it and it suddenly worksBegin GamemodeSetEventHandler OnHit FnOnPlayerHitByEnemy "first"::zzzHeartSystem.attackedPlayer end
Recommended Posts
Archived
This topic is now archived and is closed to further replies.