Code:
scn wlwSQSTSurvival
; Options
; RAD modes
; 0: No effects
; 1: Visual and acustic effects
; 3: Ghoulification, human ghoul and Ghoul Reaver, no faction reaction
; 4: Ghoulification, human ghoul and Ghoul Reaver, everybody hates the player as Ghoul Reaver
; Ghoul functions
Short SetGhoul ; 1: Human ghoul, 2: Feral ghoul
Short ClearGhoul ; 1: Clear all ghoul features
Short DismissGhouls ; 1: Dismiss recruited ghoul
; Needed vars(move to main?)
Short GhoulFormEnabled
Short GhoulHardCore
; Ghoul conditions
Short IsGhoul ; 0: No, 1: Human ghoul, 2: Feral ghoul
Short IsCannibal ; 0|1 Set From outside
Short IsHardcore ; 0: It's jsut decorative, 1: The player is enemy to everyone
Short StateReilly ; -1: Enemy, 0: Neutral, 1: Ally, 2: In faction
Short StateBrotherhood ; -1: Enemy, 0: Neutral, 1: Ally, 2: In faction
Short StateOutcast ; -1: Enemy, 0: Neutral, 1: Ally, 2: In faction
Short StatePittRaider ; -1: Enemy, 0: Neutral, 1: Ally, 2: In faction
Short StatePittSlaves ; -1: Enemy, 0: Neutral, 1: Ally, 2: In faction
Short StateTribals ; -1: Enemy, 0: Neutral, 1: Ally, 2: In faction
Short StateSlavers ; -1: Enemy, 0: Neutral, 1: Ally, 2: In faction
Short WasHostile ; Last state was feral ghoul in harrdcore mode
Short CanRecruitGhoul ; Can recruit ghoul followers, has the perk Ghoul Alpha and is currently a feral ghoul
Short RecruitedGhoulCount ; Count of active ghoul followers
Short RecruitGhoulMax ; Count of active ghoul followers
Short CanUseGrenade ; Set from ghoul follower, dialogue condition
Short RecruitmentBlocked ; While timer > 0 recruitment blocked
; RAD conditions
Short RadState
; Private vars (do not use it from outside)
Short applyRadView
Short radTimer
Short initOnce
; Generic vars have to be initialized before use
Short short1
Short short2
Short short3
Float float1
Float float2
Float float3
Begin GameMode
; To Do: Verzögerungen in Sekunden bei Verwandlung für Effekte
; Effekte verdrahten
; Lässt sich der Spieler zur spielbaren Kreatur machen?
; RadX, RadAway-Wirkung blocken, wenn nicht erlaubt
; Script-Struktur
; Init
; Update
; Kontroll-Strukturen
; Haupt-Funktionen/Öffentliche Funktionen
; Effekte und Hilfs-Methoden
; Init system
If initOnce == 0
Set RadMode To wlwQuest.RadMode
Set initOnce To 2
EndIf
; Ghul-Status ermitteln
If GhulQuestRunning == 0 && IsGhoul > 0
Set FollowerMax To 3
Set FollowerCount To 0
Set ResetTimer To 1
DLC04FF02DunwichObeliskREF.enable
If wlwQuest.RadMode == 3
SetObjectiveDisplayed wlwQuestGhoulHeal 20 1
Else
SetObjectiveDisplayed wlwQuestGhoulHeal 10 1
EndIf
Set GhulQuestRunning To 1
EndIf
; Start-Message Rads
If RadMsgOnce == 0 && Player.GetAv RadiationRads > 400
Set wlwQuestFunction.ShowMsg To 1
Set RadMsgOnce To 1
EndIf
; Gift-Halluzinationen (im Survivor-Modus und nicht als Ghul)
If wlwQuest.ModeSurvivor == 1 && IsGhoul == 0
If Player.HasMagicEffect wlwPoisonBaseEffect
If PoisonTimer > 50
RiMod wlwEffectPoisonHalluzination
If GetRandomPercent > 50 && Player.GetHealthPercentage > 0.25
PlaySound VOCRadioGhouls
IMod wlwEffectPoisonHalluzination
EndIf
Set PoisonApplied To 1
Set PoisonTimer To 0
Else
Set PoisonTimer To PoisonTimer + GetSecondsPassed
EndIf
Else
If PoisonApplied == 1
RiMod wlwEffectPoisonHalluzination
Set PoisonApplied To 0
EndIf
EndIf
EndIf
; Radiation-Effekte
If ApplyGhoulLevel == 0 && Player.GetInCell PPurity01 == 0 ; Neuberechnung blocken waehrend Wandlungen, geblockt wahrend Main-Quest
If RadMode == wlwQuest.RadMode
If Player.GetAv RadiationRads > 800
If RadState == 0 && IsGhoul == 0
wlwPlayerMatchHumanRef.MatchRace Player
Set KarmaLevel To Player.GetAv Karma
EndIf
If RadState != 2
If RadMode == 1
Set ApplyRadLevel To 2
ElseIf RadMode > 1 && IsGhoul != 2
Set ApplyGhoulLevel To 2
EndIf
Set RadState To 2
EndIf
ElseIf Player.GetAv RadiationRads > 600
If RadState == 0 && IsGhoul == 0
wlwPlayerMatchHumanRef.MatchRace Player
Set KarmaLevel To Player.GetAv Karma
EndIf
If RadState != 1
If RadMode == 1
Set ApplyRadLevel To 1
ElseIf RadMode == 2
Set ApplyGhoulLevel To 1
ElseIf RadMode == 3 && IsGhoul == 0
Set ApplyGhoulLevel To 1
EndIf
Set RadState To 1
EndIf
Else
If RadState != 0
If RadMode < 2
Set ApplyRadLevel To -1
ElseIf RadMode == 2
Set ApplyGhoulLevel To -1
EndIf
Set RadState To 0
EndIf
EndIf
Else
; Player hat Modus im Menu geaendert, zuerst nullen, dann wieder beginnen
Set RadMode To wlwQuest.RadMode
; Abgleich mit Variable
If RadState > 0
Set RadState To 0
Set ApplyGhoulLevel To -1
Set ApplyRadLevel To -1
EndIf
EndIf
EndIf
; Ghul-Level anpassen
If ApplyGhoulLevel != 0 && wlwQuestFunction.ApplyGhoulFx == 0
Set EquippedObject To Player.GetEquippedObject 5 ; Kaputte Waffen-Animationen verhindern
If EquippedObject
Player.UnequipItem EquippedObject 0 1
EndIf
If Player.GetInCell CitadelBRing == 0
Set wlwQuestFunction.ApplyGhoulFx To ApplyGhoulLevel
Set GhoulFxTimer To 1
Else ; Keine Effekte und schnelle Reaktion
Set GhoulFxTimer To 0
EndIf
EndIf
; Public Main Functions
;? Hier GhoulFxTimer, Animationen und Fade-Effekte verdrahten
If ClearGhoul == 1
Set IsGhoul To 0
Set CanRecruitGhoul To 0
Set DismissGhouls To 0
Set wlwPRKHumanFleshChance To 100
Player.RestoreAV RadiationRads 1000
Player.RemovePerk wlwPRKGhoulHardCoreMode
Player.RemoveSpell wlwSPLPlayerGhoul1
Player.RemoveSpell wlwSPLPlayerGhoul2
Player.RemoveFromFaction wlwFACPlayerGhoul1
Player.RemoveFromFaction wlwFACPlayerGhoul2
Player.RemoveItem wlwWPNPlayerGhoulGrenade 20 1
Player.RemoveItem wlwWPNPlayerGhoulClaws 1 1
Player.RemoveFromFaction FeralGhoulFaction
SetEnemy PlayerFaction FeralGhoulFaction
If IsCannibal == 0
Player.RemovePerk Cannibal
EndIf
If WasHostile == 1
Set WasHostile To 0
Set short1 To Player.GetAv Karma
If short1 < 0
Set short1 To Abs short1
RewardKarma short1
EndIf
Player.RemovePerk wlwPRKGhoulHardCoreMode
wlwREFMrHandyGodfrey.RemoveFromFaction FeralGhoulFaction
SetEnemy PlayerFaction MS13CanMez 1 1
SetEnemy PlayerFaction SmokerFaction 1 1
SetEnemy PlayerFaction GeneralIdleFaction 1 1
SetEnemy PlayerFaction WastelanderFaction 1 1
SetEnemy PlayerFaction WastelandScavengerFaction 1 1
SetEnemy PlayerFaction WastelandHunterFaction 1 1
SetEnemy PlayerFaction TraderFaction 1 1
SetEnemy PlayerFaction SlaverFaction 1 1
SetEnemy PlayerFaction SlaveFaction 1 1
SetEnemy PlayerFaction wlwTownFaction 1 1
SetEnemy PlayerFaction BigTownFaction 1 1
SetEnemy PlayerFaction CantCommonsFaction 1 1
SetEnemy PlayerFaction GirdershadeFaction 1 1
SetEnemy PlayerFaction LamplightResidentFaction 1 1
SetEnemy PlayerFaction MegatonResidentFaction 1 1
SetEnemy PlayerFaction ParadiseFallsResidentFaction 1 1
SetEnemy PlayerFaction RCResidentFaction 1 1
SetEnemy PlayerFaction TenpennyTowerResidentFaction 1 1
SetEnemy PlayerFaction wlwDLC04FerryBoatFaction 1 1
SetEnemy PlayerFaction wlwFACTTypeFollower 1 1
ClearFactionPlayerEnemyFlag MS13CanMez
ClearFactionPlayerEnemyFlag SmokerFaction
ClearFactionPlayerEnemyFlag GeneralIdleFaction
ClearFactionPlayerEnemyFlag WastelanderFaction
ClearFactionPlayerEnemyFlag WastelandScavengerFaction
ClearFactionPlayerEnemyFlag WastelandHunterFaction
ClearFactionPlayerEnemyFlag TraderFaction
ClearFactionPlayerEnemyFlag SlaverFaction
ClearFactionPlayerEnemyFlag SlaveFaction
ClearFactionPlayerEnemyFlag wlwTownFaction
ClearFactionPlayerEnemyFlag BigTownFaction
ClearFactionPlayerEnemyFlag CantCommonsFaction
ClearFactionPlayerEnemyFlag GirdershadeFaction
ClearFactionPlayerEnemyFlag LamplightResidentFaction
ClearFactionPlayerEnemyFlag MegatonResidentFaction
ClearFactionPlayerEnemyFlag ParadiseFallsResidentFaction
ClearFactionPlayerEnemyFlag RCResidentFaction
ClearFactionPlayerEnemyFlag TenpennyTowerResidentFaction
ClearFactionPlayerEnemyFlag wlwDLC04FerryBoatFaction
ClearFactionPlayerEnemyFlag wlwFACTTypeFollower
If MS09ArefuHates == 0
SetEnemy PlayerFaction ArefuFaction 1 1
ClearFactionPlayerEnemyFlag ArefuFaction
EndIf
If StateSlavers >= 0
SetEnemy PlayerFaction ParadiseFallsSlaverFaction 1 1
ClearFactionPlayerEnemyFlag ParadiseFallsSlaverFaction
EndIf
SetEnemy PlayerFaction ReillysRangersFaction 1 1
ClearFactionPlayerEnemyFlag ReillysRangersFaction
If StateReilly == 2
Player.AddToFaction ReillysRangersFaction 1
EndIf
If StateBrotherhood >= 0
Player.AddToFaction MQ01BrotherhoodDCFaction 1
SetEnemy PlayerFaction BrotherhoodSteelFaction 1 1
ClearFactionPlayerEnemyFlag BrotherhoodSteelFaction
If StateBrotherhood == 1
Player.AddToFaction MQPlayerBOSAllyFaction 1
ElseIf StateBrotherhood == 2
Player.AddToFaction BrotherhoodSteelFaction 1
EndIf
EndIf
If StateOutcast >= 0
SetEnemy PlayerFaction BrotherhoodOutcastFaction 1 1
ClearFactionPlayerEnemyFlag BrotherhoodOutcastFaction
EndIf
If StateOutcast == 1
Player.AddToFaction BrotherhoodOutcastAllyFaction 1
EndIf
; DLC-Gruppen
If StatePittRaiders == 0
SetEnemy PlayerFaction DLC01PittRaiderFaction 1 1
ClearFactionPlayerEnemyFlag DLC01PittRaiderFaction
EndIf
If StatePittSlaves == 0
SetEnemy PlayerFaction DLC01PittSlaveFaction 1 1
ClearFactionPlayerEnemyFlag DLC01PittSlaveFaction
EndIf
If StateTribals == 0
SetEnemy PlayerFaction DLC04TribalFriendlyFaction 1 1
ClearFactionPlayerEnemyFlag DLC04TribalFriendlyFaction
EndIf
EndIf
If GetQuestRunning wlwQSTStoryGhoulHeal == 1
SetStage wlwQuestGhoulHeal 20
EndIf
Set ClearGhoul To 0
ElseIf SetGhoul == 1
If IsGhoul == 0
Set IsGhoul To 1
Player.AddToFaction wlwFACTPlayerGhoul1 1
Player.MatchRace wlwREFPlayerGhoul1
Player.AddSpell wlwAEFPlayerGhoul1
Set SetGhoul To 0
Else
Set ClearGhoul To 1
EndIf
ElseIf SetGhoul == 2
If IsGhoul == 0
Set IsGhoul To 2
Set wlwPRKHumanFleshChance To 10
Set DismissGhouls To 0
Player.AddToFaction wlwFACTPlayerGhoul2 1
Player.MatchRace wlwREFPlayerGhoul2
Player.AddSpell wlwAEFPlayerGhoul2
Player.AddItem wlwWPNPlayerGhoulGrenade 3
Player.AddItem wlwWPNPlayerGhoulClaws 1
Player.EquipItem wlwWPNPlayerGhoulGrenade
Player.EquipItem wlwWPNPlayerGhoulClaws
Player.AddItem HumanFlesh 9 1
ClearFactionPlayerEnemyFlag FeralGhoulFaction
SetAlly PlayerFaction FeralGhoulFaction 1 1
If IsCannibal == 0
Player.AddPerk Cannibal
EndIf
If Player.HasPerk wlwPRKGhoulAlpha
Set CanRecruitGhoul To 1
EndIf
If IsHardcore == 1
Set WasHostile To 1
RewardKarma -2000
Player.AddPerk wlwPRKGhoulHardCoreMode
wlwREFMrHandyGodfrey.AddToFaction FeralGhoulFaction 1
Player.AddToFaction FeralGhoulFaction 1
Player.RemoveFromFaction ReillysRangersFaction
Player.RemoveFromFaction BrotherhoodSteelFaction
Player.RemoveFromFaction MQPlayerBOSAllyFaction
Player.RemoveFromFaction MQ01BrotherhoodDCFaction
Player.RemoveFromFaction BrotherhoodMQ11Faction
Player.RemoveFromFaction BrotherhoodOutcastAllyFaction
SetEnemy PlayerFaction MS13CanMez
SetEnemy PlayerFaction SmokerFaction
SetEnemy PlayerFaction GeneralIdleFaction
SetEnemy PlayerFaction WastelanderFaction
SetEnemy PlayerFaction WastelandScavengerFaction
SetEnemy PlayerFaction WastelandHunterFaction
SetEnemy PlayerFaction TraderFaction
SetEnemy PlayerFaction SlaverFaction
SetEnemy PlayerFaction SlaveFaction
SetEnemy PlayerFaction wlwTownFaction
SetEnemy PlayerFaction ArefuFaction
SetEnemy PlayerFaction BigTownFaction
SetEnemy PlayerFaction CantCommonsFaction
SetEnemy PlayerFaction GirdershadeFaction
SetEnemy PlayerFaction LamplightResidentFaction
SetEnemy PlayerFaction MegatonResidentFaction
SetEnemy PlayerFaction ParadiseFallsResidentFaction
SetEnemy PlayerFaction RCResidentFaction
SetEnemy PlayerFaction TenpennyTowerResidentFaction
SetEnemy PlayerFaction ParadiseFallsSlaverFaction
SetEnemy PlayerFaction ReillysRangersFaction
SetEnemy PlayerFaction BrotherhoodSteelFaction
SetEnemy PlayerFaction BrotherhoodOutcastFaction
SetEnemy PlayerFaction DLC01PittRaiderFaction
SetEnemy PlayerFaction DLC01PittSlaveFaction
SetEnemy PlayerFaction DLC04TribalFriendlyFaction
SetEnemy PlayerFaction wlwDLC04FerryBoatFaction
SetEnemy PlayerFaction wlwFACTTypeFollower
EndIf
Set SetGhoul To 0
Else
Set ClearGhoul To 1
EndIf
EndIf
; Apply RAD effects
If applyRadView == 1 ; Effects level 1
IMod wlwISMRad1
RiMod wlwISMRad2
Set applyRadView To 0
ElseIf applyRadView == 2 ; Effects level 2
IMod wlwISMRad2
RiMod wlwISMRad1
Set applyRadView To 0
ElseIf applyRadView == -1 ; Remove effects
RIMod wlwISMRad1
RIMod wlwISMRad2
RIMod wlwISMRad1Fade
RIMod wlwISMRad2Fade
Set applyRadView To 0
EndIf
; Sporadische RAD-Effekte
If RadState > 0 && wlwQSTSurvial.SurvivalMode > 0
If radTimer > 30
RIMod wlwISMRad1HFade
RIMod wlwISMRad2Fade
If GetRandomPercent < (RadState * 30)
Set RadFxApplied To 1
If RadState == 1
IMod wlwISMRad1Fade
ElseIf RadState == 2
IMod wlwISMRad2Fade
EndIf
SetRumble 0.1 0.1 7
If GetRandomPercent > 30
Set short1 To GetRandomPercent
If short1 < 3
PlaySound AMBDLC04BoatArrivalBell
ElseIf short1 < 6
PlaySound AMBDLC04PungaSprayRinging
ElseIf short1 < 9
PlaySound AMBPittCrowdCheer01
ElseIf short1 < 12
PlaySound DRSDeathclawCageClose
ElseIf short1 < 15
PlaySound DRSDLC05HangarClose
ElseIf short1 < 18
PlaySound DRSMetalHeavySingle01Close
ElseIf short1 < 21
PlaySound FXExplosionDebrisMansion
ElseIf short1 < 24
PlaySound NPCBrahminIdleGrazingLeft
ElseIf short1 < 27
PlaySound NPCDeathClawCageExit
ElseIf short1 < 30
PlaySound NPCDeathclawIdleClawScrape
ElseIf short1 < 33
PlaySound NPCFeralGhoulRadiate
ElseIf short1 < 36
PlaySound NPCFeralGhoulSeizureLong
ElseIf short1 < 39
PlaySound NPCHillfolkJugLPM
ElseIf short1 < 42
PlaySound NPCHumanSuicideGeneral
ElseIf short1 < 45
PlaySound OBJDLC05ClawVoice01
ElseIf short1 < 48
PlaySound OBJDLC05ClawVoice02
ElseIf short1 < 51
PlaySound OBJDLC05ClawVoice03
ElseIf short1 < 54
PlaySound OBJDLC05HealingArchHeal
ElseIf short1 < 57
PlaySound OBJDLC05ProbeAlienA01
ElseIf short1 < 60
PlaySound OBJDLC05ProbeAlienB02
ElseIf short1 < 63
PlaySound QSTAlienRadio02
ElseIf short1 < 66
PlaySound QSTBirthStart
ElseIf short1 < 69
PlaySound QSTEnclaveTroopsMoving2D
ElseIf short1 < 72
PlaySound QSTFadeToWhiteD
ElseIf short1 < 75
PlaySound QSTInhibitorPulseDistant
ElseIf short1 < 78
PlaySound QSTPartyClapping2D
ElseIf short1 < 81
PlaySound QSTPartyNoiseMaker2D
ElseIf short1 < 84
PlaySound QSTSiloLaunch
ElseIf short1 < 87
PlaySound VOCBehemothSigh
ElseIf short1 < 90
PlaySound VOCDLC04MaleChildGiggle
ElseIf short1 < 93
PlaySound VOCDLC04MaleChildOooh
ElseIf short1 < 96
PlaySound VOCDLC04MaleChildSnarl
ElseIf short1 < 100
PlaySound VOCRobotLibertyPrimeCombat23
EndIf
EndIf
EndIf
Set radTimer To 0
Else
Set radTimer To radTimer + 1
EndIf
EndIf
; Ghoul effects
If IsGhoul > 0
If IsGhoul == 1
If GetRandomPercent < 30
Set ApplyGhoulFx To 1
EndIf
If GetRandomPercent < 40
Set ApplyGhoulSound To 1
EndIf
If GhoulHardCore == 1 && Player.GetAv RadiationRads < 601
;? Replace by ModAv
Player.CastImmediateOnSelf wlwIngRadBomb
EndIf
ElseIf IsGhoul == 2
If Player.GetItemCount wlwWPNGhoulGrenade < 3
Player.AddItem wlwWPNGhoulGrenade 3
EndIf
If GetRandomPercent < 50
Set ApplyGhoulFx To 1
EndIf
If GetRandomPercent < 80
Set ApplyGhoulSound To 1
EndIf
If RecruitmentBlocked > 0 ; Quest delay 1 second
Set RecruitmentBlocked To RecruitmentBlocked - 1
EndIf
If GhoulHardCore == 1 && Player.GetAv RadiationRads < 801
;? Replace by ModAv
Player.CastImmediateOnSelf wlwIngRadBomb
EndIf
EndIf
If ApplyGhoulFx == 1
; In naechster Version weg
RiMod wlwFxGhoulHalluzination1
RiMod wlwFxGhoulHalluzination2
RiMod wlwFxGhoulHalluzination3
RiMod wlwFxGhoulHalluzination4
Set short1 To GetRandomPercent
If short1 > 75
IMod wlwFxGhoulHalluzination1
ElseIf short1 > 50
IMod wlwFxGhoulHalluzination2
ElseIf short1 > 25
IMod wlwFxGhoulHalluzination3
Else
IMod wlwFxGhoulHalluzination4
EndIf
Set ApplyGhoulFx To 0
EndIf
If ApplyGhoulSound == 1
Set short1 To GetRandomPercent
If short1 > 75
PlaySound3D wlwNPCFeralGhoulAlert
ElseIf short1 > 50
PlaySound3D wlwNPCFeralGhoulAware
ElseIf short1 > 25
PlaySound3D NPCFeralGhoulSeizureLong
Else
PlaySound3D NPCFeralGhoulSeizureShort
EndIf
Set ApplyGhoulSound To 0
EndIf
EndIf
End