Jump to content

Custom Summon Duration Help


Recommended Posts

Heya people.
After a long time, I finally managed to make custom summons work outside OBME, which is very crash prone for me, by following the tutorial on cs.uesp website.
Now, I would like to extend the duration in which the summons are active, but by changing this parameter in the reference script on the tutorial page

    if ( SUMN.getdead == 1 ) && ( timer < 28 )                
        set timer to 28
    endif

From 28 to 29, to make the summon last longer,the duration of it doesn't change, and it stays at 28 before fading out.
I'm very noob when it comes to scripting, so, can someone help me figure out how to do it?
Thank you in advance

 

Edited by 9zAZO
Link to comment
Share on other sites

Script I used is this one nder spoiler, so what am I getting wrong? 🤔

Timer is set to 30, but the summon disappears once 28 seconds are hit no matter what I seem to edit

 

Spoiler
ScriptName SummonRatSCR

;This script can be used as a template for custom summoned creatures/NPCs

float timer
float fade
short playonce
ref SUMN

Begin ScriptEffectStart

;Set temp reference for scripting. 
;Allows faster transition of script as template. Also allows for leveled summon.
    set SUMN to SummonRat1REF
    ;Reset our creature if re-summoned before time runs out on spell                                            
    SUMN.disable        

    ;Now we move our creature to the Player
    ;Move the creature reference to the worldspace of the Player
    SUMN.moveto Player 30 30 10    
    ;Make our creature visible and active    
    SUMN.enable                        

    set fade to 1    ;Resets the alpha fade variable to 1

End

Begin ScriptEffectUpdate

    if ( timer > 30 )    ;Creature is dead and fade timer passed
        ;Move our creature back to its holding cell
        SUMN.kill
        SUMN.moveto CreatureCageREF 0 0 10 
        ;Reset our creature if dead
        SUMN.resurrect    
        ;Set our creature to an unprocessed state                            
        SUMN.disable                                    
    endif

    ;Adjust timer state for early fade/disable upon death
    if ( SUMN.getdead == 1 ) && ( timer < 28 )                
        set timer to 28
    endif

    if ( timer > 0.1 ) && ( playonce == 0 )
        ;Play effect for creature entrance
        SUMN.pms effectSummonMythicDawn 1            
        set playonce to 1
    endif

    
    ;Increment timer
    set timer to timer + GetSecondsPassed        


    if ( timer > 28 ) && ( playonce == 1 )
        ;Play effect for creature exit/death
        SUMN.kill            
        set playonce to 2
    endif

    if ( playonce == 2 )    
        ;Fade creature for exit/death                                            
        set fade to fade - 0.03
        SUMN.saa fade
    endif
        

End

Begin ScriptEffectFinish

    ;Move our creature back to its holding cell
    SUMN.moveto CreatureCageREF 0 0 10    
    ;Reset our creature if dead                        
    SUMN.resurrect        
    ;Set our creature to an unprocessed state                                        
    SUMN.disable                                                    

End


 

Link to comment
Share on other sites

Looking at the spell StandardSummonSkeletonApprentice, under effects is the one item "summon skeleton" and the duration is 40.  You would need to set the duration here possibly longer than what you want to make sure the script runs its course.

Looking at spell SELpSummonHaskill (where the duration is set to 5 seconds and it has a scripted effect), I see this:

set timer to timer + ScriptEffectElapsedSeconds

Maybe you should be using that instead of GetSecondsPassed.

I am guessing at this based on what I am seeing in current spells.  I am not an expert on this.

Edited by GamerRick
Link to comment
Share on other sites

In my opinion, I would make these changes:

Begin ScriptEffectStart

    ;Set temp reference for scripting. 
    ;Allows faster transition of script as template. Also allows for leveled summon.
    set SUMN to SummonRat1REF
    ;Reset our creature if re-summoned before time runs out on spell                                            
    SUMN.disable        

    ;Now we move our creature to the Player
    ;Move the creature reference to the worldspace of the Player
    SUMN.moveto Player 30 30 10    
    ;Make our creature visible and active    
    SUMN.enable    

    ;Set variables 
    set fade to 1    ;Resets the alpha fade variable to 1
    set timer to 0   ;Reset timer
    set playonce to 0 ;Reset stage

End

On second part I would change order of commands:

Begin ScriptEffectUpdate
    ;Increment timer
    set timer to timer + GetSecondsPassed
  
    ;Play introducing effect first 
    if ( timer > 0.1 ) && ( playonce == 0 )
        ;Play effect for creature entrance
        SUMN.pms effectSummonMythicDawn 1            
        set playonce to 1
    endif
          
    ;If something kills a creature before a time out, move a timer ahead
    if ( SUMN.getdead == 1 ) && ( timer < 28 )                
        set timer to 28
    endif
      
    ;kill a creature and set it to fade
    if ( timer > 28 ) && ( playonce == 1 )
        if SUMN.GetDead == 0
            SUMN.kill
        endif
        set playonce to 2
    endif
          
    ;Fade creature
    if ( playonce == 2 )    
        set fade to fade - 0.03
        SUMN.saa fade
    endif
          
    ;once creature faded or was a time out, prepare it for next summon
    if ( timer > 30 )    ;Creature is dead and fade timer passed
        ;Move our creature back to its holding cell
        SUMN.moveto CreatureCageREF 0 0 10 
        ;Reset our creature if dead
        SUMN.resurrect            
        ;Set our creature to an unprocessed state                            
        SUMN.disable                                    
    endif
              
End

Now it should be clear: you need to adjust timers in three parts - "moving timer ahead" part, "killing a creature" part and "prepare next summon" part.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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