SCTX |
scn SE32GhostStagingSCRIPT
;
; Link w/standard Trigger zone - Does not daisy chain
; For simplicity in scripting, setup, and anaylsis - one ghost per trigger
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ref myParent ; this is my parent trigger
ref shaderFX ; store shader based on faction
ref stockFX ; store stock faction shader
short State1flag ; State #1 - Dead, Invisible, waiting for player to trigger
short State2flag ; State #2 - Alive, Aggressive
short State3flag ; State #3 - Dead for real this time
short DoProxOnce ; disallows mulitple triggerings from parent (aka - proximity check)
float fader ; stores alpha value
float targetAlpha ; keep this in one place for tweaking
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
begin onLoad
If GetStage SE32 >= 200
;Disable
moveTo JoelTestCellMarker ; using this as a dummy cell to dispose of the bodies
Else
set myParent to getParentRef
kill
saa 0 ; force invisibilitY
set fader to 0
set targetAlpha to 0.01
if getInFaction SE32FanaticFaction == 1 ; set up team colors based on faction
set shaderFX to SE32ZealotEffectNoAlpha
set stockFX to SE32ZealotEffect
elseif getInFaction SE32Defenders == 1
set shaderFX to SE32DefenderEffectNoAlpha
set stockFX to GhostEffect
endif
;pms shaderFX
pms stockFX ; debug - possibly abandoning idea of swapping to no-alpha shaders for transition
EndIf
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
begin onActivate
if getActionRef == player
If IsInCombat == 0
Message "The ghost does not respond."
; never allow activation/looting
; note: attempting to conditionalize for NPC w/dialogue topics or friendlies to allow yielding
EndIf
elseIf DoProxOnce != 1 ; fires when trigger is activated
set DoProxOnce to 1
set state2flag to 1 ; Enter State #2
resurrect 1
endif
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
begin gameMode
if state2Flag == 1
; player has hit trigger and resurrected - fade up
if fader < targetAlpha ; compare current alpha to goal
set fader to (fader + 0.00025) ; increment alpha value
saa fader
elseIf fader >= targetAlpha ; compare current alpha to goal
;sms shaderFX ; turn off this shader for the constant one
;pms stockFX ; this is to avoid some visual glitches I found
set state2flag to 2 ; set this to stop looping
endif
endif
if state3Flag == 1
; Killed and ready to fade back out
if fader > 0 ; compare current alpha to goal
set fader to (fader - 0.00055) ; decrement alpha value - kinda quickly
saa fader
elseIf fader <= 0
set state3flag to 2 ; set this to stop looping
;disable ; and poof me
moveTo JoelTestCellMarker ; dispose of the body
endif
endif
end
;Begin OnHit
; If GetInFaction SE32Defenders == 1
; sms SE32GhostEffect
; pms SE32GhostEffect
; Else
; sms SE32ZealotEffect
; pms SE32ZealotEffect
; EndIf
;End
begin onDeath
if State1Flag == 0
set State1Flag to 1 ; enter state #1
endif
if state2Flag >= 1
set State3Flag to 1 ; enter state #3
sms shaderFX ; turn off FX right quick
endif
end |