Talk:Scripting Tutorial: Summoned Creatures

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

Editing[edit source]

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

How do I change the time?[edit source]

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)

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

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)

Please Help![edit source]

After finishing the script, it says that SUMN must be an object or object variable, I have copied the tutorial, any help?

There is a line in the script where SUMN is set to the reference of the Rat; you must use the world reference name of your creature here.Gdarknight 22:10, 25 April 2010 (EDT)

During testing on all races the rat, once summoned, just stands there idly. Even if I attack it, it just stands there. I have rechecked the tutorial several times, and have made corrections where tghere may be possible errors, however it still does nothing. --Oblivious12123 13:13, 5 June 2010 (EDT)

Possible leak in script?[edit source]

I have used this script several times and on several summons. I currently have it set to summon a mage apprentice with the timer at 1020 and the appropriate changes made to the script. For some reason, when the summoned monster dies, the spell effect still stays in place and causes all the monsters that were attacking the summoned monster to stop in their tracks and do nothing. As soon as I dispell the summon spell effect from me (player), the monsters attack me normally again. This could also be a problem between the spell timer and the script timer.... how does one change this - if I set the spell timer to 2 seconds the script effect only lasts 2 seconds....

Copy of script below:

Begin ScriptEffectStart

Set temp reference for scripting.
Allows faster transition of script as template. Also allows for leveled summon.

set SUMN to SummonJenaREF ;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 GameMode

if (timer > 1020) ;Creature is dead and fade timer passed ;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 endif

;Adjust timer state for early fade/disable upon death if (SUMN.getdead == 1) && (timer < 1018) set timer to 1018 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 > 1018) && (playonce == 1) ;Play effect for creature exit/death SUMN.pms effectSummonMythicDawn 2 set playonce to 2 endif

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


Someone changed the original script to use "Gamemode" instead of "scripteffectupdate". Using "Scripteffectupdate" instead should fix your problem. Gdarknight 22:16, 25 April 2010 (EDT)

Is there something wrong with the AI?[edit source]

After creating the spell, I go to playtest it. I have aquired the spell and I summon the rat in a fight. For some strange reason the rat seems to stand there and dosen't attack, it also doesn't follow me. I have set the aggression to 5 and have set the only faction to the player faction, and I have made sure at least 10 thousand times that the script is correct. Any help? Oblivious12123 16:10, 5 March 2010 (EST)

Honestly, I don't know. And I don't know if anyone else is checking here. This is honestly the place you're supposed to ask questions about the tutorial, but the author hasn't checked in in quite some time; not many people do. Unfortunately, you're almost guaranteed much better luck on the Forums.
I wish we could help you, I really do, but I just don't think we can.
Dragoon Wraith TALK 17:39, 5 March 2010 (EST)

I highly recommend using the default "FollowPlayer" AI package, as I had success with that. My custom AI packages seemed more buggy than the default. Gdarknight 22:19, 25 April 2010 (EDT)

Crashes[edit source]

I'm using this script to make a Spider Daedra companion summon a friendly spiderling. Two of my testers have reported crashes, which show some correlation with the summon dying. Has anyone else seen this?

Also, shouldn't the second code block be ScriptEffectUpdate instead of Gamemode? Joben 21:25, 16 March 2010 (EDT)

I changed the update block back to the original setting "ScriptEffectUpdate", which may solve the crashing problem. Gdarknight 22:21, 25 April 2010 (EDT)

Problems and Solutions[edit source]

Ok first off a possible answer to one of your problems: The Skeleton doesn't fight or follow. You need to make sure aggression is at 5 and that you have the "playerfaction" set AND you need to have a follow AI package set up for the creature... Just re-read the tutorial, you missed a key part.