Jump to content

Need help with custom summon


darkmaelstrom

Recommended Posts

Hey everyone, I hope you can help. I'm trying my hand at making a custom summon as directed on The TES construction set Wiki. The page here-

http://cs.elderscrolls.com/constwiki/index...moned_Creatures has a script to summon the creature for 30 seconds (Step 4) and then have it vanish, but my problem is...if the creature is killed before the timer runs out, the summon icon is staying in the upper right corner. A minor issue I know, but any way to stop this?

Link to comment
Share on other sites

Could you post the script?

Use the code tags so things stay intact.

ScriptName SummonWolfAlly

;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 AnwolfSummonedWolf
  ;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 WolfDenRef 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 WolfDenRef 0 0 10	
  ;Reset our creature if dead						
SUMN.resurrect		
  ;Set our creature to an unprocessed state										
SUMN.disable

Link to comment
Share on other sites

I'd love an answer to that as well. :smile: I used that script for a couple of my mods and the icon does indeed stay on screen. And it is entered correctly in the script edit window.

 

 

I asked about a long time ago at the BGS CS forums but no-one was able to help.

Link to comment
Share on other sites

Okay, I tried the tutorial and this is what I found:

The code is buggy.

The ScriptEffectUpdate block loops continuously for the duration of the spell. This duration is set in the "Effect Item" form.

There is no apparent break command for the ScriptEffectUpdate block.

I found an ugly workaround.

 

The code is buggy because it has no way to break out of the ScriptEffectUpdate block. If the rat is killed before the end of the spell, the script continuously kills the rat, puts it back in its holding cell, resurrects then disables it until the 30 seconds are up. I can almost feel a stack overflow occurring somewhere. Also, the conditional test at 28 seconds always kills the rat before its supposed 30 second lifespan. If you let the rat live out its life, you'll notice it always dies two seconds early. To fix this, just change the 28 second tests to 30.

 

I discovered the loop bug by tagging ScriptEffectFinish with a message box (My original intent was to see if the spell icon display was dependent on the script or hard coded). I did some online research but couldn't find a proper means to break out of the block.

 

Anyway, the ugly workaround is to put a dispel command after the rat is killed.

 

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 WolfDenRef 0 0 10
  ;Reset our creature if dead
	SUMN.resurrect	
  ;Set our creature to an unprocessed state							
	SUMN.disable
	player.dispel <SPELLNAME> ;Ugly fix is here!								 
endif

 

Where <SPELLNAME> is whatever you called the spell in the Object Window (not the name of the script).

 

If anyone knows of a better method of breaking out of the ScriptEffectUpdate block, I'd like to know about it.

 

Happy coding!

Link to comment
Share on other sites

I asked about a long time ago at the BGS CS forums but no-one was able to help.
If anyone knows of a better method of breaking out of the ScriptEffectUpdate block, I'd like to know about it.

I know the one who created that script, you could ask him to join the discussion?

His name is gdarknight.

 

To fix this, just change the 28 second tests to 30.

That is done to secure that the spell will properly work. After 30 seconds, the spell and the script will end. So do the blocks.

A better fix would be to add 2 seconds both to the 28 in the script and the 30 of the spell (outside of the script.) 30-32.

That way the Update could have a bit more room to process. That might be useful if you want have a realistic fade effect.

Link to comment
Share on other sites

Okay, I tried the tutorial and this is what I found:

The code is buggy.

The ScriptEffectUpdate block loops continuously for the duration of the spell. This duration is set in the "Effect Item" form.

There is no apparent break command for the ScriptEffectUpdate block.

I found an ugly workaround.

 

The code is buggy because it has no way to break out of the ScriptEffectUpdate block. If the rat is killed before the end of the spell, the script continuously kills the rat, puts it back in its holding cell, resurrects then disables it until the 30 seconds are up. I can almost feel a stack overflow occurring somewhere. Also, the conditional test at 28 seconds always kills the rat before its supposed 30 second lifespan. If you let the rat live out its life, you'll notice it always dies two seconds early. To fix this, just change the 28 second tests to 30.

 

I discovered the loop bug by tagging ScriptEffectFinish with a message box (My original intent was to see if the spell icon display was dependent on the script or hard coded). I did some online research but couldn't find a proper means to break out of the block.

 

Anyway, the ugly workaround is to put a dispel command after the rat is killed.

 

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 WolfDenRef 0 0 10
 ;Reset our creature if dead
	SUMN.resurrect	
 ;Set our creature to an unprocessed state							
	SUMN.disable
	player.dispel <SPELLNAME>;Ugly fix is here!								 
endif

 

Where <SPELLNAME> is whatever you called the spell in the Object Window (not the name of the script).

 

If anyone knows of a better method of breaking out of the ScriptEffectUpdate block, I'd like to know about it.

 

Happy coding!

 

Ugly fix is better than no fix at all! Thanks!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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