Difference between revisions of "Resurrect"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
m (further clean up)
imported>DragoonWraith
(→‎Animation Example: standardizing code style)
Line 8: Line 8:
== Animation Example ==
== Animation Example ==
The following code is used to allow the actor time to get up before continuing to execute:
The following code is used to allow the actor time to get up before continuing to execute:
  short FlagDead  ;Set to 1 when actor is dead and to 0 when resurection anim is
short FlagDead  ;Set to 1 when actor is dead and to 0 when resurection anim is
                    ;complete  
                  ;complete  
 
  short ResurrectAminTimer  ;Counts frames since resurrection
short ResurrectAminTimer  ;Counts frames since resurrection
 
  begin gamemode
Begin GameMode
 
   ;Set actor's Death Flag to 1 on death,(Note:You might have to interupt the current
   ;Set actor's Death Flag to 1 on death,(Note:You might have to interupt the current
   ;AI package here)
   ;AI package here)
   if (Actor.GetDead==1)
   if ( Actor.GetDead == 1 )
        set FlagDead to 1
    set FlagDead to 1
        Actor.resurrect 1
    Actor.resurrect 1
   endif
   endif
 
   ;Timer that prevents the script from running before resurrection animation is  
   ;Timer that prevents the script from running before resurrection animation is  
   ;finished(including AI packages).  Starts when actor is resurrected.  
   ;finished(including AI packages).  Starts when actor is resurrected.  
   if (FlagDead==1) && (Actor.GetDead ==0)
   if ( FlagDead == 1 ) && ( Actor.GetDead == 0 )
      set ResurrectAminTimer to ResurrectAminTimer+1
    set ResurrectAminTimer to ResurrectAminTimer + 1
   endif
   endif
 
   ;After 200 frames (enough for  resurrection animation to complete), resume script
   ;After 200 frames (enough for  resurrection animation to complete), resume script
   if ResurrectAminTimer>200
   if ( ResurrectAminTimer > 200 )
        set FlagDead to 0
    set FlagDead to 0
        set ResurrectAminTimer to 0
    set ResurrectAminTimer to 0
    endif
  endif
 
    ;when actor is alive and resurrect anim complete, Run main script
  ;when actor is alive and resurrect anim complete, Run main script
    if FlagDead == 0
  if FlagDead == 0
        ;Do stuff on actor
    ;Do stuff on actor
    endif
  endif
 
End


== Using on Player ==  
== Using on Player ==  

Revision as of 18:52, 16 April 2008

Syntax:

Resurrect AnimateFlag

Resurrects the calling actor. If the AnimateFlag argument is 1, the actor will animate getting up (as if from a knockdown). Scripting or AI packages may interrupt the animation, so one should be careful to avoid these.

The AnimateFlag appears to be optional when Resurrect is used from the Console, but not when used in script.

Animation Example

The following code is used to allow the actor time to get up before continuing to execute:

short FlagDead   ;Set to 1 when actor is dead and to 0 when resurection anim is
                 ;complete 

short ResurrectAminTimer  ;Counts frames since resurrection

Begin GameMode

  ;Set actor's Death Flag to 1 on death,(Note:You might have to interupt the current
  ;AI package here)
  if ( Actor.GetDead == 1 )
    set FlagDead to 1
    Actor.resurrect 1
  endif

  ;Timer that prevents the script from running before resurrection animation is 
  ;finished(including AI packages).  Starts when actor is resurrected. 
  if ( FlagDead == 1 ) && ( Actor.GetDead == 0 )
    set ResurrectAminTimer to ResurrectAminTimer + 1
  endif

  ;After 200 frames (enough for  resurrection animation to complete), resume script
  if ( ResurrectAminTimer > 200 )
    set FlagDead to 0
    set ResurrectAminTimer to 0
  endif

  ;when actor is alive and resurrect anim complete, Run main script
  if FlagDead == 0
    ;Do stuff on actor
  endif

End

Using on Player

Using Resurrect on the player will result in loss of magic and racial abilities and cause camera problems (camera becomes centered on player's feet). See UESP: Resurrecting the Player for analysis and alternate approaches.

See Also