Talk:Scripting Tutorial: Summoned Creatures

From The Elder Scrolls Construction Set Wiki

Contents

[edit] Editing

Great tutorial, I was pleasantly surprised by the quality when I read it. For a first submission to the Wiki this is very good. I added the tutorial to the What's New box on the Main Page. And I did some editing, mainly internal links, but I also removed some HTML near the headers and the frame around the pictures (for consistency).
--Qazaaq 09:35, 13 June 2008 (EDT)


It was a very well written tutorial, but I have a problem. Everything works fine but my rat doesn't seem to be able to walk around. The animation is playing, but it doesn't go anywhere. It can jump and attack still, but can't run around. It's as if it is stuck in the floor a bit. I've tried changing the co-ords for it spawning, to no avail. It's probably some dumb problem Ive created somehow, but if anyone knows of a way to help me with this, it would be a great help.
Tegan

Edit: It was the AI package I created that stopped it from running around, I switched to the standard follow package and it worked a treat. Another word though, if you attack your ratty little friend, it will turn on you naturally, but the guards dont seem bothered about it. However if you have another creature following you which jumps to your rescue, the guards will maul it. Must be something to do with factions, I'll keep trying to figure it out.
Tegan

[edit] How do I change the time?

I looked at the script close to a billion times:

ScriptName SummonRatSCR

;This script can be used as a template for custom summoned creatures/NPC's

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 it's 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 && 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 + ScriptEffectElapsedSeconds        

    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 it's 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

I want to change the time from 30 seconds to 600 (10 min). can someone please help me?
--Yokomoko 06:14, 16 July 2009

First a general notice; please sign your comments with ~~~~, to automatically insert a signature, or use the signature button. I have done this for you this time.
In the ScriptEffectUpdate block there are five if-statement blocks that control the spells behavior at different times. You have to adjust three:
  • The first one (if timer > 30) removes the creature if the spell has ended. You should change that to if timer > 600.
  • The second one (if SUMN.getdead && timer < 28) skips the spell ahead to the fading-out-and-ending sequence by moving the timer to 2 seconds before the end. This happens if the creature dies before the spell would normally end. Change that to if SUMN.getdead && timer < 598 and change the only line in that block to set timer to 598.
  • The fourth one (if timer > 28 && playonce == 1) kills the creature 2 seconds before the spell ends. Changed that to if timer > 598 && playonce == 1.
It would be better to use a variable for the duration of the spell, but I'm not going to explain that. Maybe someone else will or you could open a thread on the Forums. The above modifications will work fine though.
--Qazaaq 09:09, 16 July 2009 (EDT)

sweet thanks! Yokomoko 15:09, 16 July 2009 (EDT)

[edit] How do I change the time, part deux

I made a variable to hold the time and modified the script accordingly, but I'd much rather grab the duration of the spell itself. Is this even possible? Blahpers 02:06, 8 August 2009 (EDT)

Well, OBSE has a function GetScriptActiveEffectIndex, which should be helpful. It can only be used in the Magic Effect script; I'm not familiar with this exact article, so I can't be certain that that will be possible here.
Dragoon Wraith TALK 14:50, 8 August 2009 (EDT)

[edit] Please Help!

I copied the tutorial exactly but it says no such thing as 'CreatureCageREF' Please help! --Oblivious12123 06:41, 27 August 2009 (EDT)


Edit: I have found the problem, i forgot to put the reference ID on the Anvil House thing. --Oblivious12123 07:39, 27 August 2009 (EDT)