Jump to content

Body Disappear after death Script


morismark

Recommended Posts

finally a few steps forward...

 

 

 

sequence I would:

1) player can't take NPC's item doesn'twork

2) NPC's death dragon animation now it work

3) NPC's body explosion doesn'twork

4) NPC's body disappear after explosion now it work

 

two final problems:

1) I've added unEquipAll() because I don't want that a player can take NPC's item. It work for an instant, than dead body auto re-dress.

2) The final explosion, now do not work. The body disappear without explosion.

 

can you help me?

 

Scriptname mORISexplosionScript extends Actor  
{esplosione dopo morte}

import game
import debug
import utility

event OnDying(Actor akKiller)
	RegisterForUpdate(1)
	gotoState("waiting")
endEvent

STATE waiting

event OnUpdate()
	if GetDistance( GetPlayer() ) < TriggerDistance 
		trace("DragonDeathScript: player close enough, trigger death sequence")
		gotoState("done")
		UnRegisterForUpdate()
		unEquipAll()
		(MQKillDragon as MQKillDragonScript).DeathSequence(self)
		Self.placeAtMe(AtronachFlameDeathExplosion)
		Self.Delete()
	endif
endEvent
endSTATE

STATE done
endSTATE

int Property TriggerDistance = 1000 Auto
{trigger distance for the powerup sequence}

Quest Property MQKillDragon Auto
Explosion property AtronachFlameDeathExplosion Auto
Link to comment
Share on other sites

Do not play with vanilla script function! The dragon death sequence is doing something more than only show "dragon death animation". You should make your own.

Next script is a sample code, how to do this?

 

mORISexplosionScript

 

Scriptname mORISexplosionScript extends Actor  
{esplosione dopo morte}
; https://forums.nexusmods.com/index.php?/topic/9480973-body-disappear-after-death-script/page-2

;;Quest PROPERTY MQ104 auto

;;WIFunctionsScript PROPERTY WI    auto                        ; Pointer to WIFunctionsScript on quest "WI"
;; {Used to call functions so that the dialogue in the scene in WIDragonKill quest is aware of
;; when the player is aborbing and done absorbing the dragons power.}

;;Faction PROPERTY NoDragonAbsorb      auto                    ; no death sequence if Dragon is in this faction
;;Faction PROPERTY MQKillDragonFaction auto

  GlobalVariable     PROPERTY DragonsAbsorbed      auto  
  ImageSpaceModifier PROPERTY DragonPowerAbsorbISM auto

  VisualEffect PROPERTY DragonAbsorbEffect     auto
  VisualEffect PROPERTY DragonAbsorbManEffect  auto
  VisualEffect PROPERTY FXDragonDeathLHandBits auto
  VisualEffect PROPERTY FXDragonDeathLHandFire auto
  VisualEffect PROPERTY FXDragonDeathRHandBits auto
  VisualEffect PROPERTY FXDragonDeathRHandFire auto

  EffectShader PROPERTY DragonHolesFXS         auto
  EffectShader PROPERTY DragonHolesBitsFXS     auto
  EffectShader PROPERTY DragonHolesBitsLiteFXS auto
  EffectShader PROPERTY DragonPowerAbsorbFXS   auto
  EffectShader PROPERTY DragonHolesSmokeFXS    auto
  EffectShader PROPERTY DragonHolesMagicFXS    auto
;;EffectShader PROPERTY DragonHolesLightFXS    auto

  Armor PROPERTY DragonUnderskin         auto
  Armor PROPERTY DragonBloodHeadFXArmor  auto
  Armor PROPERTY DragonBloodTailFXArmor  auto
  Armor PROPERTY DragonBloodWingLFXArmor auto
  Armor PROPERTY DragonBloodWingRFXArmor auto
  Armor PROPERTY SkinDragonHider         auto

;;Explosion PROPERTY MAGDragonPowerAbsorbExplosion auto

  Sound PROPERTY NPCDragonDeathSequenceFireLPM    auto
  Sound PROPERTY NPCDragonDeathSequenceWind       auto
  Sound PROPERTY NPCDragonDeathSequenceExplosion  auto
  Sound PROPERTY NPCDragonDeathSequenceSmolderLPM auto

  Int  PROPERTY VoicePointsReward = 1 auto                  ; How many soul points to give player?
;;Bool PROPERTY bIsAbsorbing          auto Conditional      ; set to TRUE while the absorb sequence is running

;-----------------------------------------------------------
; additional stuff as follow

  Explosion PROPERTY AtronachFlameDeathExplosion auto       ; use auto-fill by CK

  Int PROPERTY TriggerDistance = 1000 auto                  ; [default = 1000]
  {to trigger distance for the powerup sequence}

  Bool bAnim        ; [default=False]
  Bool bDetach      ; [default=False]


; -- EVENTs -- 3

EVENT OnCellAttach()
    bDetach = False
ENDEVENT

EVENT OnCellDetach()
    bDetach = TRUE
ENDEVENT


EVENT OnDying(Actor akKiller)  ; its running a few seconds before OnDeath() event will be triggered
    bAnim = TRUE
;    --------
    IF myF_Wait()
        myF_DeathSequence()
    ENDIF
;    --------
    bAnim = False
ENDEVENT


EVENT OnDeath(Actor akKiller)
    WHILE (bAnim)
        Utility.Wait(0.25)        ; just wait here until dying animation like dragon soul has been finished OR player has left the cell
    ENDWHILE

    gotoState("Done")                ; ### STATE ###

IF self.GetBaseObject()           ; make sure this actor is valid
ELSE
    RETURN    ; - STOP -
ENDIF
;---------------------
    IF self.Is3DLoaded()
        self.PlaceAtMe(AtronachFlameDeathExplosion as Form)
        self.UnEquipAll()         ; unequip all itmes
        Utility.Wait(0.1)
        self.RemoveAllItems()     ; https://www.creationkit.com/index.php?title=RemoveAllItems_-_ObjectReference
    ENDIF

;;;    self.DisableNoWait()
    self.Delete()                 ; mark this actor for delete, it keeps visible for a while until game engine cleaning it up
ENDEVENT


;================================
state Done
;=========
    EVENT OnCellAttach()
    ENDEVENT

    EVENT OnCellDetach()
    ENDEVENT
;=======
endState


; -- FUNCTIONs -- 3

;-----------------------
Bool FUNCTION myF_Wait()
;-----------------------
    actor player = Game.GetPlayer()
    
WHILE (TRUE)
    IF player.IsInCombat()
        Utility.Wait(3.0)
    ELSE
        float f = self.GetDistance(player as ObjectReference)
        IF (f > 0.0) && (f <= TriggerDistance)
            Debug.Trace("Player is close enough, trigger death sequence for " +self)        ; debugging only !!
            Return TRUE           ; player is near enough for animation
        ENDIF
;        ----------
        Utility.Wait(1.5)
        IF ( bDetach )            ; player has left the cell of this NPC
            IF self.Is3DLoaded()
            ELSE
                Return False      ; mod uninstalled /OR/ this actor is invalid
            ENDIF
        ENDIF
    ENDIF
ENDWHILE
ENDFUNCTION


;---------------------------
FUNCTION myF_DeathSequence()
;---------------------------
    actor dragonRef = self
    actor player    = Game.GetPlayer()

;==================================
    int i = myF_P1(dragonRef, player)
;==================================

; display dragon absorb effect art. One part on dragon one part on player.
; ------------------------------------------------------------------------
    DragonAbsorbEffect.Play(dragonRef, 8, player)
;;    dragonRef.placeAtME(MAGDragonPowerAbsorbExplosion)
    DragonAbsorbManEffect.Play(player, 8, dragonRef)
    
; Sounds for when the wispy particles being to fly at the player.
; ---------------------------------------------------------------
    NPCDragonDeathSequenceWind.play(dragonRef)
    NPCDragonDeathSequenceExplosion.play(dragonRef)
    Utility.Wait(0.1)
        
; On man power absorb effect shader.
; ----------------------------------
    DragonPowerAbsorbFXS.Play(player)
    Utility.Wait(1.0)

; turn off remaining effect bits and magic leak fxshaders
    Utility.Wait(1.0)

; ghost the dragon so you cannot hit him
; -------------------------------------
;;;    dragonRef.SetGhost(TRUE)                            ; ghost    ### REMOVED ### due to USKP bug #17080
        
; clear any arrows that may have been stuck in dragon
; ---------------------------------------------------
    dragonRef.clearExtraArrows()
    Utility.Wait(4.0)

; Stop fx shader on player showing power absorb.
; ----------------------------------------------    
    DragonPowerAbsorbFXS.Stop(player)

; End sound of dragon carcass bursting into flames.
; -------------------------------------------------
    Sound.StopInstance(i)                                  ; i :: soundInstanceFireID
    
; add lingering smoke and glow to dragon carcass.
; -----------------------------------------------
    DragonHolesSmokeFXS.Play(dragonRef)    
    
; Start sound for smoldering dragon
; ---------------------------------
    int soundInstanceSmolderID = NPCDragonDeathSequenceSmolderLPM.play(dragonRef)
    Utility.Wait(4.0)

; increment dragon count
; ----------------------
    DragonsAbsorbed.SetValue(DragonsAbsorbed.GetValue() + 1)    ; internal globalVar, but this is much better (ReDragon)
   ;DragonsAbsorbed.value = DragonsAbsorbed.value + 1           ; Do NOT increment a globalVar like THIS !!!

; add dragonsoul point to player
; ------------------------------
    player.modActorValue("dragonsouls", VoicePointsReward)

; ###
;; do this right now for MQ104 dragon:
;; -----------------------------------
;    IF MQ104.IsRunning() && !MQ104.IsStageDone(90)
;        MQ104.setStage(90)
;    ENDIF
; ###

; turn off effect shaders for smoldering carcass
; ----------------------------------------------
    DragonHolesSmokeFXS.Stop(dragonRef)
    
; Get rid of art attached to dragon and player showing streaming magic.
; ---------------------------------------------------------------------
    DragonAbsorbManEffect.Stop(player)
    DragonAbsorbEffect.Stop(dragonRef)
    Utility.Wait(4.0)

; Stop smoldering sound
; ---------------------
    Sound.StopInstance(soundInstanceSmolderID)
;=====================

;;;    dragonRef.AddToFaction(MQKillDragonFaction)         ; put dragon in faction so other quests know player has absorbed power
;;    DragonHolesLightFXS.Stop(dragonRef)                  ; UnUSED, Stop light emitting magic shader on dragon

;;;    WI.PlayerIsDoneAbsorbingPower(dragonRef)            ; *** WORLD INTERACTION FUNCTION *** - added by jduvall
;;;    bIsAbsorbing = False
    
    dragonRef.EquipItem(SkinDragonHider, TRUE)
ENDFUNCTION


;-----------------------------------------------
Int FUNCTION myF_P1(Actor dragonRef, Actor aRef)    ; internal helper
;-----------------------------------------------
;;;    actor aRef = Game.GetPlayer()

; Add Skeleton to dragons inventory
; ----------------------------------
    dragonRef.AddItem(DragonUnderskin)    

; Dragon wings particles bits
; ---------------------------
    FXDragonDeathLHandBits.Play(dragonRef, 12)            ; --> PLAY lhand
    FXDragonDeathRHandBits.Play(dragonRef, 12)            ; --> PLAY rhand
    Utility.Wait(0.2)
    
; Equip skeleton under skin
; -------------------------
    dragonRef.EquipItem(DragonUnderskin)
    Utility.Wait(0.5)
    
    dragonRef.PlaySubGraphAnimation("UnderSkinFadeOut")    
    
; ***[ WORLD INTERACTION FUNCTION ]*** - added by jduvall
; -------------------------------------------------------
;;;    WI.PlayerIsCurrentlyAbsorbingPower(dragonRef)
;;;    bIsAbsorbing = TRUE
        
; Start effect shader decorating holes in the base skin
; -----------------------------------------------------
    DragonHolesFXS.Play(dragonRef)                        ; --> PLAY fxs (1)

; Play disintegrating skin.
; -------------------------
    dragonRef.PlaySubGraphAnimation( "SkinFadeOut" )

; Play imagespace modifier which is timed to match sequence.
; ----------------------------------------------------------
    DragonPowerAbsorbISM.Apply()

; Sound of dragon carcass first bursts into flames until the flames die off. Must be turned off
; ---------------------------------------------------------------------------------------------
    int soundInstanceFireID = NPCDragonDeathSequenceFireLPM.play(dragonRef)
    Utility.Wait(1.0)
    
; Small bits rising from dragon fx shader.
; ----------------------------------------
    DragonHolesBitsLiteFXS.Play(dragonRef)                ; --> PLAY litefxs (2)
    Utility.Wait(1.0)

; Bigger bits rising from dragon fx shader.
; -----------------------------------------
    DragonHolesBitsFXS.Play(dragonRef)                    ; --> PLAY bitsfx (3)
    Utility.Wait(2.0)
    Utility.Wait(1.75)                        ; ???

; Play blood fade out if it is there
; ----------------------------------
    dragonRef.PlaySubGraphAnimation("BloodFade")
    
; Magic particles on wings
; ------------------------
    FXDragonDeathRHandFire.Play(dragonRef, 12)            ; --> PLAY rhandfire
    FXDragonDeathLHandFire.Play(dragonRef, 12)            ; --> PLAY lhandfire
    Utility.Wait(1.0)

; magic fire fx shader
; --------------------
    DragonHolesMagicFXS.Play(dragonRef)                   ; --> PLAY magicfxs (4)
    DragonHolesMagicFXS.Stop(dragonRef)                   ; <-- STOP magicfxs (4)
    Utility.Wait(0.25)
    
; StopDragon bits fxs
; -------------------
    DragonHolesBitsFXS.Stop(dragonRef)                    ; <-- STOP bitsfx (3)
    DragonHolesBitsLiteFXS.Stop(dragonRef)                ; <-- STOP litefxs (2)

;Stop holes fx shader now that main dragon skin is un-worn
; --------------------------------------------------------
    DragonHolesFXS.Stop(dragonRef)                        ; <-- STOP fxs (1)
    
; Play light emitting magic shader on dragon
;;    DragonHolesLightFXS.Play(dragonRef)                 ; --> PLAY lightfxs ### REMOVED ###
    Utility.Wait(1.8)                        ; ???

; unequipp invisible art
; ----------------------
    IF ( dragonRef.IsEquipped(DragonBloodHeadFXArmor) )
        dragonRef.unEquipItem(DragonBloodHeadFXArmor)
    ENDIF
    IF ( dragonRef.IsEquipped(DragonBloodTailFXArmor) )
        dragonRef.unEquipItem(DragonBloodTailFXArmor)
    ENDIF
    IF ( dragonRef.IsEquipped(DragonBloodWingLFXArmor) )
        dragonRef.unEquipItem(DragonBloodWingLFXArmor)
    ENDIF
    IF ( dragonRef.IsEquipped(DragonBloodWingRFXArmor) )
        dragonRef.unEquipItem(DragonBloodWingRFXArmor)
    ENDIF
    
    RETURN soundInstanceFireID
ENDFUNCTION

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

Do not play with vanilla script function! The dragon death sequence is doing something more than only show "dragon death animation". You should make your own.

Next script is a sample code, how to do this?

ÃÂ

mORISexplosionScript

 

Scriptname mORISexplosionScript extends Actor ÃÂ 
{esplosione dopo morte}
; https://forums.nexusmods.com/index.php?/topic/9480973-body-disappear-after-death-script/page-2

;;Quest PROPERTY MQ104 auto

;;WIFunctionsScript PROPERTY WIÃÂ ÃÂ ÃÂ  autoÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; Pointer to WIFunctionsScript on quest "WI"
;; {Used to call functions so that the dialogue in the scene in WIDragonKill quest is aware of
;; when the player is aborbing and done absorbing the dragons power.}

;;Faction PROPERTY NoDragonAbsorbÃÂ ÃÂ ÃÂ ÃÂ ÃÂ  autoÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; no death sequence if Dragon is in this faction
;;Faction PROPERTY MQKillDragonFaction auto

ÃÂ  GlobalVariableÃÂ ÃÂ ÃÂ ÃÂ  PROPERTY DragonsAbsorbedÃÂ ÃÂ ÃÂ ÃÂ ÃÂ  auto ÃÂ 
ÃÂ  ImageSpaceModifier PROPERTY DragonPowerAbsorbISM auto

ÃÂ  VisualEffect PROPERTY DragonAbsorbEffectÃÂ ÃÂ ÃÂ ÃÂ  auto
ÃÂ  VisualEffect PROPERTY DragonAbsorbManEffectÃÂ  auto
ÃÂ  VisualEffect PROPERTY FXDragonDeathLHandBits auto
ÃÂ  VisualEffect PROPERTY FXDragonDeathLHandFire auto
ÃÂ  VisualEffect PROPERTY FXDragonDeathRHandBits auto
ÃÂ  VisualEffect PROPERTY FXDragonDeathRHandFire auto

ÃÂ  EffectShader PROPERTY DragonHolesFXSÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ  auto
ÃÂ  EffectShader PROPERTY DragonHolesBitsFXSÃÂ ÃÂ ÃÂ ÃÂ  auto
ÃÂ  EffectShader PROPERTY DragonHolesBitsLiteFXS auto
ÃÂ  EffectShader PROPERTY DragonPowerAbsorbFXSÃÂ ÃÂ  auto
ÃÂ  EffectShader PROPERTY DragonHolesSmokeFXSÃÂ ÃÂ ÃÂ  auto
ÃÂ  EffectShader PROPERTY DragonHolesMagicFXSÃÂ ÃÂ ÃÂ  auto
;;EffectShader PROPERTY DragonHolesLightFXSÃÂ ÃÂ ÃÂ  auto

ÃÂ  Armor PROPERTY DragonUnderskinÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ  auto
ÃÂ  Armor PROPERTY DragonBloodHeadFXArmorÃÂ  auto
ÃÂ  Armor PROPERTY DragonBloodTailFXArmorÃÂ  auto
ÃÂ  Armor PROPERTY DragonBloodWingLFXArmor auto
ÃÂ  Armor PROPERTY DragonBloodWingRFXArmor auto
ÃÂ  Armor PROPERTY SkinDragonHiderÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ  auto

;;Explosion PROPERTY MAGDragonPowerAbsorbExplosion auto

ÃÂ  Sound PROPERTY NPCDragonDeathSequenceFireLPMÃÂ ÃÂ ÃÂ  auto
ÃÂ  Sound PROPERTY NPCDragonDeathSequenceWindÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ  auto
ÃÂ  Sound PROPERTY NPCDragonDeathSequenceExplosionÃÂ  auto
ÃÂ  Sound PROPERTY NPCDragonDeathSequenceSmolderLPM auto

ÃÂ  IntÃÂ  PROPERTY VoicePointsReward = 1 auto ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; How many soul points to give player?
;;Bool PROPERTY bIsAbsorbingÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ  auto ConditionalÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ ; set to TRUE while the absorb sequence is running

;-----------------------------------------------------------
; additional stuff as follow

ÃÂ  Explosion PROPERTY AtronachFlameDeathExplosion autoÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ; use auto-fill by CK

ÃÂ  Int PROPERTY TriggerDistance = 1000 autoÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ ; [default = 1000]
ÃÂ  {to trigger distance for the powerup sequence}

ÃÂ  Bool bAnimÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; [default=False]
ÃÂ  Bool bDetachÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ ; [default=False]


; -- EVENTs -- 3

EVENT OnCellAttach()
ÃÂ ÃÂ  ÃÂ bDetach = False
ENDEVENT

EVENT OnCellDetach()
ÃÂ ÃÂ  ÃÂ bDetach = TRUE
ENDEVENT


EVENT OnDying(Actor akKiller)ÃÂ  ; its running a few seconds before OnDeath() event will be triggered
ÃÂ ÃÂ  ÃÂ bAnim = TRUE
;ÃÂ ÃÂ  ÃÂ --------
ÃÂ ÃÂ  ÃÂ IF myF_Wait()
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ myF_DeathSequence()
ÃÂ ÃÂ  ÃÂ ENDIF
;ÃÂ ÃÂ  ÃÂ --------
ÃÂ ÃÂ  ÃÂ bAnim = False
ENDEVENT


EVENT OnDeath(Actor akKiller)
ÃÂ ÃÂ  ÃÂ WHILE (bAnim)
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ Utility.Wait(0.25)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; just wait here until dying animation like dragon soul has been finished OR player has left the cell
ÃÂ ÃÂ  ÃÂ ENDWHILE

ÃÂ ÃÂ  ÃÂ gotoState("Done")ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; ### STATE ###

IF self.GetBaseObject()ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ; make sure this actor is valid
ELSE
ÃÂ ÃÂ  ÃÂ RETURNÃÂ ÃÂ  ÃÂ ; - STOP -
ENDIF
;---------------------
ÃÂ ÃÂ  ÃÂ IF self.Is3DLoaded()
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ self.PlaceAtMe(AtronachFlameDeathExplosion as Form)
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ self.UnEquipAll()ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ  ; unequip all itmes
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ Utility.Wait(0.1)
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ self.RemoveAllItems()ÃÂ ÃÂ  ÃÂ  ; https://www.creationkit.com/index.php?title=RemoveAllItems_-_ObjectReference
ÃÂ ÃÂ  ÃÂ ENDIF

;;;ÃÂ ÃÂ  ÃÂ self.DisableNoWait()
ÃÂ ÃÂ  ÃÂ self.Delete()                 ; mark this actor for delete, it keeps visible for a while until game engine cleaning it up
ENDEVENT


;================================
state Done
;=========
ÃÂ ÃÂ  ÃÂ EVENT OnCellAttach()
ÃÂ ÃÂ  ÃÂ ENDEVENT

ÃÂ ÃÂ  ÃÂ EVENT OnCellDetach()
ÃÂ ÃÂ  ÃÂ ENDEVENT
;=======
endState


; -- FUNCTIONs -- 3

;-----------------------
Bool FUNCTION myF_Wait()
;-----------------------
ÃÂ ÃÂ  ÃÂ actor player = Game.GetPlayer()
ÃÂ ÃÂ  ÃÂ 
WHILE (TRUE)
ÃÂ ÃÂ  ÃÂ IF player.IsInCombat()
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ Utility.Wait(3.0)
ÃÂ ÃÂ  ÃÂ ELSE
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ float f = self.GetDistance(player as ObjectReference)
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ IF (f > 0.0) && (f <= TriggerDistance)
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ Debug.Trace("Player is close enough, trigger death sequence for " +self)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; debugging only !!
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ Return TRUEÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ; player is near enough for animation
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ENDIF
;ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ----------
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ Utility.Wait(1.5)
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ IF ( bDetach )ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; player has left the cell of this NPC
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ IF self.Is3DLoaded()
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ELSE
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ Return FalseÃÂ ÃÂ  ÃÂ   ; mod uninstalled /OR/ this actor is invalid
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ENDIF
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ENDIF
ÃÂ ÃÂ  ÃÂ ENDIF
ENDWHILE
ENDFUNCTION


;---------------------------
FUNCTION myF_DeathSequence()
;---------------------------
ÃÂ ÃÂ  ÃÂ actor dragonRef = self
ÃÂ ÃÂ  ÃÂ actor playerÃÂ ÃÂ ÃÂ  = Game.GetPlayer()

;==================================
ÃÂ ÃÂ  ÃÂ int i = myF_P1(dragonRef, player)
;==================================

; display dragon absorb effect art. One part on dragon one part on player.
; ------------------------------------------------------------------------
ÃÂ ÃÂ  ÃÂ DragonAbsorbEffect.Play(dragonRef, 8, player)
;;ÃÂ ÃÂ  ÃÂ dragonRef.placeAtME(MAGDragonPowerAbsorbExplosion)
ÃÂ ÃÂ  ÃÂ DragonAbsorbManEffect.Play(player, 8, dragonRef)
ÃÂ ÃÂ  ÃÂ 
; Sounds for when the wispy particles being to fly at the player.
; ---------------------------------------------------------------
ÃÂ ÃÂ  ÃÂ NPCDragonDeathSequenceWind.play(dragonRef)
ÃÂ ÃÂ  ÃÂ NPCDragonDeathSequenceExplosion.play(dragonRef)
ÃÂ ÃÂ  ÃÂ Utility.Wait(0.1)
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ 
; On man power absorb effect shader.
; ----------------------------------
ÃÂ ÃÂ  ÃÂ DragonPowerAbsorbFXS.Play(player)
ÃÂ ÃÂ  ÃÂ Utility.Wait(1.0)

; turn off remaining effect bits and magic leak fxshaders
ÃÂ ÃÂ  ÃÂ Utility.Wait(1.0)

; ghost the dragon so you cannot hit him
; -------------------------------------
;;;ÃÂ ÃÂ  ÃÂ dragonRef.SetGhost(TRUE)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; ghostÃÂ ÃÂ  ÃÂ ### REMOVED ### due to USKP bug #17080
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ 
; clear any arrows that may have been stuck in dragon
; ---------------------------------------------------
ÃÂ ÃÂ  ÃÂ dragonRef.clearExtraArrows()
ÃÂ ÃÂ  ÃÂ Utility.Wait(4.0)

; Stop fx shader on player showing power absorb.
; ----------------------------------------------ÃÂ ÃÂ  ÃÂ 
ÃÂ ÃÂ  ÃÂ DragonPowerAbsorbFXS.Stop(player)

; End sound of dragon carcass bursting into flames.
; -------------------------------------------------
ÃÂ ÃÂ  ÃÂ Sound.StopInstance(i)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ ; i :: soundInstanceFireID
ÃÂ ÃÂ  ÃÂ 
; add lingering smoke and glow to dragon carcass.
; -----------------------------------------------
ÃÂ ÃÂ  ÃÂ DragonHolesSmokeFXS.Play(dragonRef)ÃÂ ÃÂ  ÃÂ 
ÃÂ ÃÂ  ÃÂ 
; Start sound for smoldering dragon
; ---------------------------------
ÃÂ ÃÂ  ÃÂ int soundInstanceSmolderID = NPCDragonDeathSequenceSmolderLPM.play(dragonRef)
ÃÂ ÃÂ  ÃÂ Utility.Wait(4.0)

; increment dragon count
; ----------------------
ÃÂ ÃÂ  ÃÂ DragonsAbsorbed.SetValue(DragonsAbsorbed.GetValue() + 1)ÃÂ ÃÂ  ÃÂ ; internal globalVar, but this is much better (ReDragon)
ÃÂ ÃÂ  ;DragonsAbsorbed.value = DragonsAbsorbed.value + 1ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ ÃÂ ; Do NOT increment a globalVar like THIS !!!

; add dragonsoul point to player
; ------------------------------
ÃÂ ÃÂ  ÃÂ player.modActorValue("dragonsouls", VoicePointsReward)

; ###
;; do this right now for MQ104 dragon:
;; -----------------------------------
;ÃÂ ÃÂ  ÃÂ IF MQ104.IsRunning() && !MQ104.IsStageDone(90)
;ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ MQ104.setStage(90)
;ÃÂ ÃÂ  ÃÂ ENDIF
; ###

; turn off effect shaders for smoldering carcass
; ----------------------------------------------
ÃÂ ÃÂ  ÃÂ DragonHolesSmokeFXS.Stop(dragonRef)
ÃÂ ÃÂ  ÃÂ 
; Get rid of art attached to dragon and player showing streaming magic.
; ---------------------------------------------------------------------
ÃÂ ÃÂ  ÃÂ DragonAbsorbManEffect.Stop(player)
ÃÂ ÃÂ  ÃÂ DragonAbsorbEffect.Stop(dragonRef)
ÃÂ ÃÂ  ÃÂ Utility.Wait(4.0)

; Stop smoldering sound
; ---------------------
ÃÂ ÃÂ  ÃÂ Sound.StopInstance(soundInstanceSmolderID)
;=====================

;;;ÃÂ ÃÂ  ÃÂ dragonRef.AddToFaction(MQKillDragonFaction)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ; put dragon in faction so other quests know player has absorbed power
;;ÃÂ ÃÂ  ÃÂ DragonHolesLightFXS.Stop(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ ; UnUSED, Stop light emitting magic shader on dragon

;;;ÃÂ ÃÂ  ÃÂ WI.PlayerIsDoneAbsorbingPower(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; *** WORLD INTERACTION FUNCTION *** - added by jduvall
;;;ÃÂ ÃÂ  ÃÂ bIsAbsorbing = False
ÃÂ ÃÂ  ÃÂ 
ÃÂ ÃÂ  ÃÂ dragonRef.EquipItem(SkinDragonHider, TRUE)
ENDFUNCTION


;-----------------------------------------------
Int FUNCTION myF_P1(Actor dragonRef, Actor aRef)ÃÂ ÃÂ  ÃÂ ; internal helper
;-----------------------------------------------
;;;ÃÂ ÃÂ  ÃÂ actor aRef = Game.GetPlayer()

; Add Skeleton to dragons inventory
; ----------------------------------
ÃÂ ÃÂ  ÃÂ dragonRef.AddItem(DragonUnderskin)ÃÂ ÃÂ  ÃÂ 

; Dragon wings particles bits
; ---------------------------
ÃÂ ÃÂ  ÃÂ FXDragonDeathLHandBits.Play(dragonRef, 12)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; --> PLAY lhand
ÃÂ ÃÂ  ÃÂ FXDragonDeathRHandBits.Play(dragonRef, 12)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; --> PLAY rhand
ÃÂ ÃÂ  ÃÂ Utility.Wait(0.2)
ÃÂ ÃÂ  ÃÂ 
; Equip skeleton under skin
; -------------------------
ÃÂ ÃÂ  ÃÂ dragonRef.EquipItem(DragonUnderskin)
ÃÂ ÃÂ  ÃÂ Utility.Wait(0.5)
ÃÂ ÃÂ  ÃÂ 
ÃÂ ÃÂ  ÃÂ dragonRef.PlaySubGraphAnimation("UnderSkinFadeOut")ÃÂ ÃÂ  ÃÂ 
ÃÂ ÃÂ  ÃÂ 
; ***[ WORLD INTERACTION FUNCTION ]*** - added by jduvall
; -------------------------------------------------------
;;;ÃÂ ÃÂ  ÃÂ WI.PlayerIsCurrentlyAbsorbingPower(dragonRef)
;;;ÃÂ ÃÂ  ÃÂ bIsAbsorbing = TRUE
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ 
; Start effect shader decorating holes in the base skin
; -----------------------------------------------------
ÃÂ ÃÂ  ÃÂ DragonHolesFXS.Play(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; --> PLAY fxs (1)

; Play disintegrating skin.
; -------------------------
ÃÂ ÃÂ  ÃÂ dragonRef.PlaySubGraphAnimation( "SkinFadeOut" )

; Play imagespace modifier which is timed to match sequence.
; ----------------------------------------------------------
ÃÂ ÃÂ  ÃÂ DragonPowerAbsorbISM.Apply()

; Sound of dragon carcass first bursts into flames until the flames die off. Must be turned off
; ---------------------------------------------------------------------------------------------
ÃÂ ÃÂ  ÃÂ int soundInstanceFireID = NPCDragonDeathSequenceFireLPM.play(dragonRef)
ÃÂ ÃÂ  ÃÂ Utility.Wait(1.0)
ÃÂ ÃÂ  ÃÂ 
; Small bits rising from dragon fx shader.
; ----------------------------------------
ÃÂ ÃÂ  ÃÂ DragonHolesBitsLiteFXS.Play(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; --> PLAY litefxs (2)
ÃÂ ÃÂ  ÃÂ Utility.Wait(1.0)

; Bigger bits rising from dragon fx shader.
; -----------------------------------------
ÃÂ ÃÂ  ÃÂ DragonHolesBitsFXS.Play(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; --> PLAY bitsfx (3)
ÃÂ ÃÂ  ÃÂ Utility.Wait(2.0)
ÃÂ ÃÂ  ÃÂ Utility.Wait(1.75)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; ???

; Play blood fade out if it is there
; ----------------------------------
ÃÂ ÃÂ  ÃÂ dragonRef.PlaySubGraphAnimation("BloodFade")
ÃÂ ÃÂ  ÃÂ 
; Magic particles on wings
; ------------------------
ÃÂ ÃÂ  ÃÂ FXDragonDeathRHandFire.Play(dragonRef, 12)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; --> PLAY rhandfire
ÃÂ ÃÂ  ÃÂ FXDragonDeathLHandFire.Play(dragonRef, 12)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; --> PLAY lhandfire
ÃÂ ÃÂ  ÃÂ Utility.Wait(1.0)

; magic fire fx shader
; --------------------
ÃÂ ÃÂ  ÃÂ DragonHolesMagicFXS.Play(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ; --> PLAY magicfxs (4)
ÃÂ ÃÂ  ÃÂ DragonHolesMagicFXS.Stop(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ; <-- STOP magicfxs (4)
ÃÂ ÃÂ  ÃÂ Utility.Wait(0.25)
ÃÂ ÃÂ  ÃÂ 
; StopDragon bits fxs
; -------------------
ÃÂ ÃÂ  ÃÂ DragonHolesBitsFXS.Stop(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; <-- STOP bitsfx (3)
ÃÂ ÃÂ  ÃÂ DragonHolesBitsLiteFXS.Stop(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; <-- STOP litefxs (2)

;Stop holes fx shader now that main dragon skin is un-worn
; --------------------------------------------------------
ÃÂ ÃÂ  ÃÂ DragonHolesFXS.Stop(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; <-- STOP fxs (1)
ÃÂ ÃÂ  ÃÂ 
; Play light emitting magic shader on dragon
;;ÃÂ ÃÂ  ÃÂ DragonHolesLightFXS.Play(dragonRef)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ; --> PLAY lightfxs ### REMOVED ###
ÃÂ ÃÂ  ÃÂ Utility.Wait(1.8)ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ ; ???

; unequipp invisible art
; ----------------------
ÃÂ ÃÂ  ÃÂ IF ( dragonRef.IsEquipped(DragonBloodHeadFXArmor) )
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ dragonRef.unEquipItem(DragonBloodHeadFXArmor)
ÃÂ ÃÂ  ÃÂ ENDIF
ÃÂ ÃÂ  ÃÂ IF ( dragonRef.IsEquipped(DragonBloodTailFXArmor) )
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ dragonRef.unEquipItem(DragonBloodTailFXArmor)
ÃÂ ÃÂ  ÃÂ ENDIF
ÃÂ ÃÂ  ÃÂ IF ( dragonRef.IsEquipped(DragonBloodWingLFXArmor) )
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ dragonRef.unEquipItem(DragonBloodWingLFXArmor)
ÃÂ ÃÂ  ÃÂ ENDIF
ÃÂ ÃÂ  ÃÂ IF ( dragonRef.IsEquipped(DragonBloodWingRFXArmor) )
ÃÂ ÃÂ  ÃÂ ÃÂ ÃÂ  ÃÂ dragonRef.unEquipItem(DragonBloodWingRFXArmor)
ÃÂ ÃÂ  ÃÂ ENDIF
ÃÂ ÃÂ  ÃÂ 
ÃÂ ÃÂ  ÃÂ RETURN soundInstanceFireID
ENDFUNCTION 

I do it. Infact on script I've posted it calls "mqdragondeath" that reports the mainquest when kill dragon with all dlc2 miraaq updates ect...

Infact this is the problem. I do not how I can call in my script an animation.

For this reason I've open a thread. I want write a my script.

I've started frome the 0. I read manymanymanymany pages of wiki.creation kit.

 

Thanks it, I've understand, the deathexplosion, the self disable, what is different from ondeath ondying.

But There are many things, that I don't understand.

in english is more difficult, because a concept in english when it translate, takes on another meaning.

 

thanks everyone for understanding

 

P.s. off topic: in italian it doesn't find NOTHING!

there are two possibilities:

1) someone in Italy know scripting but he is jealous

2) no one in Italy knows scripting

 

who knows what the reality is

Edited by morismark
Link to comment
Share on other sites

Do not play with vanilla script function! The dragon death sequence is doing something more than only show "dragon death animation". You should make your own.

Next script is a sample code, how to do this?

 

mORISexplosionScript

 

Scriptname mORISexplosionScript extends Actor  
{esplosione dopo morte}
; https://forums.nexusmods.com/index.php?/topic/9480973-body-disappear-after-death-script/page-2

;;Quest PROPERTY MQ104 auto

;;WIFunctionsScript PROPERTY WI    auto                        ; Pointer to WIFunctionsScript on quest "WI"
;; {Used to call functions so that the dialogue in the scene in WIDragonKill quest is aware of
;; when the player is aborbing and done absorbing the dragons power.}

;;Faction PROPERTY NoDragonAbsorb      auto                    ; no death sequence if Dragon is in this faction
;;Faction PROPERTY MQKillDragonFaction auto

  GlobalVariable     PROPERTY DragonsAbsorbed      auto  
  ImageSpaceModifier PROPERTY DragonPowerAbsorbISM auto

  VisualEffect PROPERTY DragonAbsorbEffect     auto
  VisualEffect PROPERTY DragonAbsorbManEffect  auto
  VisualEffect PROPERTY FXDragonDeathLHandBits auto
  VisualEffect PROPERTY FXDragonDeathLHandFire auto
  VisualEffect PROPERTY FXDragonDeathRHandBits auto
  VisualEffect PROPERTY FXDragonDeathRHandFire auto

  EffectShader PROPERTY DragonHolesFXS         auto
  EffectShader PROPERTY DragonHolesBitsFXS     auto
  EffectShader PROPERTY DragonHolesBitsLiteFXS auto
  EffectShader PROPERTY DragonPowerAbsorbFXS   auto
  EffectShader PROPERTY DragonHolesSmokeFXS    auto
  EffectShader PROPERTY DragonHolesMagicFXS    auto
;;EffectShader PROPERTY DragonHolesLightFXS    auto

  Armor PROPERTY DragonUnderskin         auto
  Armor PROPERTY DragonBloodHeadFXArmor  auto
  Armor PROPERTY DragonBloodTailFXArmor  auto
  Armor PROPERTY DragonBloodWingLFXArmor auto
  Armor PROPERTY DragonBloodWingRFXArmor auto
  Armor PROPERTY SkinDragonHider         auto

;;Explosion PROPERTY MAGDragonPowerAbsorbExplosion auto

  Sound PROPERTY NPCDragonDeathSequenceFireLPM    auto
  Sound PROPERTY NPCDragonDeathSequenceWind       auto
  Sound PROPERTY NPCDragonDeathSequenceExplosion  auto
  Sound PROPERTY NPCDragonDeathSequenceSmolderLPM auto

  Int  PROPERTY VoicePointsReward = 1 auto                  ; How many soul points to give player?
;;Bool PROPERTY bIsAbsorbing          auto Conditional      ; set to TRUE while the absorb sequence is running

;-----------------------------------------------------------
; additional stuff as follow

  Explosion PROPERTY AtronachFlameDeathExplosion auto       ; use auto-fill by CK

  Int PROPERTY TriggerDistance = 1000 auto                  ; [default = 1000]
  {to trigger distance for the powerup sequence}

  Bool bAnim        ; [default=False]
  Bool bDetach      ; [default=False]


; -- EVENTs -- 3

EVENT OnCellAttach()
    bDetach = False
ENDEVENT

EVENT OnCellDetach()
    bDetach = TRUE
ENDEVENT


EVENT OnDying(Actor akKiller)  ; its running a few seconds before OnDeath() event will be triggered
    bAnim = TRUE
;    --------
    IF myF_Wait()
        myF_DeathSequence()
    ENDIF
;    --------
    bAnim = False
ENDEVENT


EVENT OnDeath(Actor akKiller)
    WHILE (bAnim)
        Utility.Wait(0.25)        ; just wait here until dying animation like dragon soul has been finished OR player has left the cell
    ENDWHILE

    gotoState("Done")                ; ### STATE ###

IF self.GetBaseObject()           ; make sure this actor is valid
ELSE
    RETURN    ; - STOP -
ENDIF
;---------------------
    IF self.Is3DLoaded()
        self.PlaceAtMe(AtronachFlameDeathExplosion as Form)
        self.UnEquipAll()         ; unequip all itmes
        Utility.Wait(0.1)
        self.RemoveAllItems()     ; https://www.creationkit.com/index.php?title=RemoveAllItems_-_ObjectReference
    ENDIF

;;;    self.DisableNoWait()
    self.Delete()                 ; mark this actor for delete, it keeps visible for a while until game engine cleaning it up
ENDEVENT


;================================
state Done
;=========
    EVENT OnCellAttach()
    ENDEVENT

    EVENT OnCellDetach()
    ENDEVENT
;=======
endState


; -- FUNCTIONs -- 3

;-----------------------
Bool FUNCTION myF_Wait()
;-----------------------
    actor player = Game.GetPlayer()
    
WHILE (TRUE)
    IF player.IsInCombat()
        Utility.Wait(3.0)
    ELSE
        float f = self.GetDistance(player as ObjectReference)
        IF (f > 0.0) && (f <= TriggerDistance)
            Debug.Trace("Player is close enough, trigger death sequence for " +self)        ; debugging only !!
            Return TRUE           ; player is near enough for animation
        ENDIF
;        ----------
        Utility.Wait(1.5)
        IF ( bDetach )            ; player has left the cell of this NPC
            IF self.Is3DLoaded()
            ELSE
                Return False      ; mod uninstalled /OR/ this actor is invalid
            ENDIF
        ENDIF
    ENDIF
ENDWHILE
ENDFUNCTION


;---------------------------
FUNCTION myF_DeathSequence()
;---------------------------
    actor dragonRef = self
    actor player    = Game.GetPlayer()

;==================================
    int i = myF_P1(dragonRef, player)
;==================================

; display dragon absorb effect art. One part on dragon one part on player.
; ------------------------------------------------------------------------
    DragonAbsorbEffect.Play(dragonRef, 8, player)
;;    dragonRef.placeAtME(MAGDragonPowerAbsorbExplosion)
    DragonAbsorbManEffect.Play(player, 8, dragonRef)
    
; Sounds for when the wispy particles being to fly at the player.
; ---------------------------------------------------------------
    NPCDragonDeathSequenceWind.play(dragonRef)
    NPCDragonDeathSequenceExplosion.play(dragonRef)
    Utility.Wait(0.1)
        
; On man power absorb effect shader.
; ----------------------------------
    DragonPowerAbsorbFXS.Play(player)
    Utility.Wait(1.0)

; turn off remaining effect bits and magic leak fxshaders
    Utility.Wait(1.0)

; ghost the dragon so you cannot hit him
; -------------------------------------
;;;    dragonRef.SetGhost(TRUE)                            ; ghost    ### REMOVED ### due to USKP bug #17080
        
; clear any arrows that may have been stuck in dragon
; ---------------------------------------------------
    dragonRef.clearExtraArrows()
    Utility.Wait(4.0)

; Stop fx shader on player showing power absorb.
; ----------------------------------------------    
    DragonPowerAbsorbFXS.Stop(player)

; End sound of dragon carcass bursting into flames.
; -------------------------------------------------
    Sound.StopInstance(i)                                  ; i :: soundInstanceFireID
    
; add lingering smoke and glow to dragon carcass.
; -----------------------------------------------
    DragonHolesSmokeFXS.Play(dragonRef)    
    
; Start sound for smoldering dragon
; ---------------------------------
    int soundInstanceSmolderID = NPCDragonDeathSequenceSmolderLPM.play(dragonRef)
    Utility.Wait(4.0)

; increment dragon count
; ----------------------
    DragonsAbsorbed.SetValue(DragonsAbsorbed.GetValue() + 1)    ; internal globalVar, but this is much better (ReDragon)
   ;DragonsAbsorbed.value = DragonsAbsorbed.value + 1           ; Do NOT increment a globalVar like THIS !!!

; add dragonsoul point to player
; ------------------------------
    player.modActorValue("dragonsouls", VoicePointsReward)

; ###
;; do this right now for MQ104 dragon:
;; -----------------------------------
;    IF MQ104.IsRunning() && !MQ104.IsStageDone(90)
;        MQ104.setStage(90)
;    ENDIF
; ###

; turn off effect shaders for smoldering carcass
; ----------------------------------------------
    DragonHolesSmokeFXS.Stop(dragonRef)
    
; Get rid of art attached to dragon and player showing streaming magic.
; ---------------------------------------------------------------------
    DragonAbsorbManEffect.Stop(player)
    DragonAbsorbEffect.Stop(dragonRef)
    Utility.Wait(4.0)

; Stop smoldering sound
; ---------------------
    Sound.StopInstance(soundInstanceSmolderID)
;=====================

;;;    dragonRef.AddToFaction(MQKillDragonFaction)         ; put dragon in faction so other quests know player has absorbed power
;;    DragonHolesLightFXS.Stop(dragonRef)                  ; UnUSED, Stop light emitting magic shader on dragon

;;;    WI.PlayerIsDoneAbsorbingPower(dragonRef)            ; *** WORLD INTERACTION FUNCTION *** - added by jduvall
;;;    bIsAbsorbing = False
    
    dragonRef.EquipItem(SkinDragonHider, TRUE)
ENDFUNCTION


;-----------------------------------------------
Int FUNCTION myF_P1(Actor dragonRef, Actor aRef)    ; internal helper
;-----------------------------------------------
;;;    actor aRef = Game.GetPlayer()

; Add Skeleton to dragons inventory
; ----------------------------------
    dragonRef.AddItem(DragonUnderskin)    

; Dragon wings particles bits
; ---------------------------
    FXDragonDeathLHandBits.Play(dragonRef, 12)            ; --> PLAY lhand
    FXDragonDeathRHandBits.Play(dragonRef, 12)            ; --> PLAY rhand
    Utility.Wait(0.2)
    
; Equip skeleton under skin
; -------------------------
    dragonRef.EquipItem(DragonUnderskin)
    Utility.Wait(0.5)
    
    dragonRef.PlaySubGraphAnimation("UnderSkinFadeOut")    
    
; ***[ WORLD INTERACTION FUNCTION ]*** - added by jduvall
; -------------------------------------------------------
;;;    WI.PlayerIsCurrentlyAbsorbingPower(dragonRef)
;;;    bIsAbsorbing = TRUE
        
; Start effect shader decorating holes in the base skin
; -----------------------------------------------------
    DragonHolesFXS.Play(dragonRef)                        ; --> PLAY fxs (1)

; Play disintegrating skin.
; -------------------------
    dragonRef.PlaySubGraphAnimation( "SkinFadeOut" )

; Play imagespace modifier which is timed to match sequence.
; ----------------------------------------------------------
    DragonPowerAbsorbISM.Apply()

; Sound of dragon carcass first bursts into flames until the flames die off. Must be turned off
; ---------------------------------------------------------------------------------------------
    int soundInstanceFireID = NPCDragonDeathSequenceFireLPM.play(dragonRef)
    Utility.Wait(1.0)
    
; Small bits rising from dragon fx shader.
; ----------------------------------------
    DragonHolesBitsLiteFXS.Play(dragonRef)                ; --> PLAY litefxs (2)
    Utility.Wait(1.0)

; Bigger bits rising from dragon fx shader.
; -----------------------------------------
    DragonHolesBitsFXS.Play(dragonRef)                    ; --> PLAY bitsfx (3)
    Utility.Wait(2.0)
    Utility.Wait(1.75)                        ; ???

; Play blood fade out if it is there
; ----------------------------------
    dragonRef.PlaySubGraphAnimation("BloodFade")
    
; Magic particles on wings
; ------------------------
    FXDragonDeathRHandFire.Play(dragonRef, 12)            ; --> PLAY rhandfire
    FXDragonDeathLHandFire.Play(dragonRef, 12)            ; --> PLAY lhandfire
    Utility.Wait(1.0)

; magic fire fx shader
; --------------------
    DragonHolesMagicFXS.Play(dragonRef)                   ; --> PLAY magicfxs (4)
    DragonHolesMagicFXS.Stop(dragonRef)                   ; <-- STOP magicfxs (4)
    Utility.Wait(0.25)
    
; StopDragon bits fxs
; -------------------
    DragonHolesBitsFXS.Stop(dragonRef)                    ; <-- STOP bitsfx (3)
    DragonHolesBitsLiteFXS.Stop(dragonRef)                ; <-- STOP litefxs (2)

;Stop holes fx shader now that main dragon skin is un-worn
; --------------------------------------------------------
    DragonHolesFXS.Stop(dragonRef)                        ; <-- STOP fxs (1)
    
; Play light emitting magic shader on dragon
;;    DragonHolesLightFXS.Play(dragonRef)                 ; --> PLAY lightfxs ### REMOVED ###
    Utility.Wait(1.8)                        ; ???

; unequipp invisible art
; ----------------------
    IF ( dragonRef.IsEquipped(DragonBloodHeadFXArmor) )
        dragonRef.unEquipItem(DragonBloodHeadFXArmor)
    ENDIF
    IF ( dragonRef.IsEquipped(DragonBloodTailFXArmor) )
        dragonRef.unEquipItem(DragonBloodTailFXArmor)
    ENDIF
    IF ( dragonRef.IsEquipped(DragonBloodWingLFXArmor) )
        dragonRef.unEquipItem(DragonBloodWingLFXArmor)
    ENDIF
    IF ( dragonRef.IsEquipped(DragonBloodWingRFXArmor) )
        dragonRef.unEquipItem(DragonBloodWingRFXArmor)
    ENDIF
    
    RETURN soundInstanceFireID
ENDFUNCTION

 

 

 

 

I've only move the sellf.removeitem just down "ondying event", Because I don't want that a player can take Unique Items for a second time too, Unique items are unique items.

This script is complicated for me, so this is the only thing that I do it.

Thanks for the time you have spent to me.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...