Jump to content

Soul Gem Charger


Zephyr102

Recommended Posts

I'm working on a soul gem charger, inspired by the device from the Shadowcrest Vineyard mod (which my computer hates, unfortunately- it's an awesome home). My charger is based on the operation of the vanilla altars used to create Black Soul Gems, but with a new location and a new script designed to fully charge any empty soul gem.

 

http://img406.imageshack.us/img406/6561/wellofsouls4.th.jpg

 

So far, I've got it working, but it's rather crude. To test it, I put two of each soul gem in the container, fired a spell at it, then found that it had only converted one of each gem type. Another spell finished the job, but I'd like the script to replace all of the gems with just one cast spell, if possible. Here's the script so far-

 

ScriptName DJZWellScript

;For charging soul gems via the well of souls.

ref self



Begin OnMagicEffectHit 
;For every empty Soul Gem in the container, swap with appropriate charged gem.
set self to GetSelf
cast MGAnchoriteAltarSpell self
if ( GetItemCount SoulGemEmpty5Grand > 0 )
	removeitem SoulGemEmpty5Grand 1
	additem SoulGem5Grand5GrandSoul 1
endif
if ( GetItemCount SoulGemEmpty4Greater > 0 )
	removeitem SoulGemEmpty4Greater 1
	additem SoulGem4Greater4GreaterSoul 1
endif
if ( GetItemCount SoulGemEmpty3Common > 0 )
	removeitem SoulGemEmpty3Common 1
	additem SoulGem3Common3CommonSoul 1
endif
if ( GetItemCount SoulGemEmpty2Lesser > 0 )
	removeitem SoulGemEmpty2Lesser 1
	additem SoulGem2Lesser2LesserSoul 1
endif
if ( GetItemCount SoulGemEmpty1Petty > 0 )
	removeitem SoulGemEmpty1Petty 1
	additem SoulGem1Petty1PettySoul 1
endif
End

 

As my thread descrip suggests, this is my first time working with Oblivion/FO3 scripting, so any help would be golden.

Link to comment
Share on other sites

I have no idea if this works, but a simple loop should help (untested)

 

 


ScriptName DJZWellScript

;For charging soul gems via the well of souls.

ref self
short charginggrand
short charginggreat
short chargingcommon
short charginglesser
short chargingpetty

Begin OnMagicEffectHit 
;For every empty Soul Gem in the container, swap with appropriate charged gem.
set self to GetSelf
cast MGAnchoriteAltarSpell self
while ( charginggrand + charginggreat + chargingcommon + charginglesser + chargingpetty ) < 5

	if ( GetItemCount SoulGemEmpty5Grand > 0 )
		removeitem SoulGemEmpty5Grand 1
		additem SoulGem5Grand5GrandSoul 1
	else
		set charginggrand to 1
	endif
	
	if ( GetItemCount SoulGemEmpty4Greater > 0 )
		removeitem SoulGemEmpty4Greater 1
		additem SoulGem4Greater4GreaterSoul 1
	else
		set charginggreat to 1
	endif
	
	if ( GetItemCount SoulGemEmpty3Common > 0 )
		removeitem SoulGemEmpty3Common 1
		additem SoulGem3Common3CommonSoul 1
	else
		set chargingcommon to 1
	endif
	
	if ( GetItemCount SoulGemEmpty2Lesser > 0 )
		removeitem SoulGemEmpty2Lesser 1
		additem SoulGem2Lesser2LesserSoul 1
	else
		set charginglesser to 1
	endif
	
	if ( GetItemCount SoulGemEmpty1Petty > 0 )
		removeitem SoulGemEmpty1Petty 1
		additem SoulGem1Petty1PettySoul 1
	else
		set chargingpetty to 1
	endif
	
loop
End

 

Link to comment
Share on other sites

I haven't tested this out, but you might take a different approach where you don't cast a spell at the container and you just have to wait a number of seconds for the script to take effect. The default is for Begin Gamemode scripts to run every 5 seconds. Whether you come in at the beginning, middle, or end is a matter of chance. You may have to wait less than one second or a full five seconds for the first run to complete. If you put in four identical soul gems, with the way things are written, it might take 20 seconds (5 seconds X 4 soulgems) for the container to process all four soul gems.

 

  ScriptName DJZWellScript

;For charging soul gems via the well of souls.

Begin GameMode 
;For every empty Soul Gem in the container, swap with appropriate charged gem.

       if ( GetItemCount SoulGemEmpty5Grand > 0 )
               removeitem SoulGemEmpty5Grand 1
               additem SoulGem5Grand5GrandSoul 1
       endif
       if ( GetItemCount SoulGemEmpty4Greater > 0 )
               removeitem SoulGemEmpty4Greater 1
               additem SoulGem4Greater4GreaterSoul 1
       endif
       if ( GetItemCount SoulGemEmpty3Common > 0 )
               removeitem SoulGemEmpty3Common 1
               additem SoulGem3Common3CommonSoul 1
       endif
       if ( GetItemCount SoulGemEmpty2Lesser > 0 )
               removeitem SoulGemEmpty2Lesser 1
               additem SoulGem2Lesser2LesserSoul 1
       endif
       if ( GetItemCount SoulGemEmpty1Petty > 0 )
               removeitem SoulGemEmpty1Petty 1
               additem SoulGem1Petty1PettySoul 1
       endif
End

Link to comment
Share on other sites

@ Hickory: No luck- it won't do anything if I put multiple gems in. :|

 

@ David: Looks like it would work, tho I'll save it for a last-ditch fix in case I dun find anything that can do it in one cast.

 

Still hunting for a way to make the script repeat itself immediately/each frame til done, or a way to get a count of each crystal type and swap that many instead of one at a time.

Link to comment
Share on other sites

Still hunting for a way to make the script repeat itself immediately/each frame til done, or a way to get a count of each crystal type and swap that many instead of one at a time.

 

Again, this is untested, but try:

 

 


ScriptName DJZWellScript

;For charging soul gems via the well of souls.

ref self
short grandcount
short greatcount
short commoncount
short lessercount
short pettycount


Begin OnMagicEffectHit

;Get number of empty soul gems and replace with filled ones

   	set self to GetSelf
   	set grandcount to ( self.GetItemCount SoulGemEmpty5Grand )
   	set greatcount to ( self.GetItemCount SoulGemEmpty4Greater )
   	set commoncount to ( self.GetItemCount SoulGemEmpty3Common )
   	set lessercount to ( self.GetItemCount SoulGemEmpty2Lesser )
   	set pettycount to ( self.GetItemCount SoulGemEmpty1Petty )
 	 
   	cast MGAnchoriteAltarSpell self

   	if ( grandcount > 0 )
           	removeitem SoulGemEmpty5Grand grandcount
           	additem SoulGem5Grand5GrandSoul grandcount
   	endif
 	 
   	if ( greatcount > 0 )
           	removeitem SoulGemEmpty4Greater greatcount
           	additem SoulGem4Greater4GreaterSoul greatcount
   	endif
   	if ( commoncount > 0 )
           	removeitem SoulGemEmpty3Common commoncount
           	additem SoulGem3Common3CommonSoul commoncount
   	endif
   	if ( lessercount > 0 )
           	removeitem SoulGemEmpty2Lesser lessercount
           	additem SoulGem2Lesser2LesserSoul lessercount
   	endif
   	if ( pettycount > 0 )
           	removeitem SoulGemEmpty1Petty pettycount
           	additem SoulGem1Petty1PettySoul pettycount
   	endif
End

 

Link to comment
Share on other sites

Wewt, methinks that did it! Poured in an assortment of gems in varied stacks, and all were charge/swapped with one cast! I was wondering how to use the getitemcount command, and now I know. :P Will definitely credit you in the readme- thanks!

 

Update: Link!

Edited by DJZephyr
Link to comment
Share on other sites

That's great. :thumbsup:

 

And a kudos goes to you for your mention in the credits -- on at least two or three similar occasions, where I have helped or solved scripts, not once did I get so much as a mention. And that's alright, but it really is nice to be acknowledged, so thank you very much for that. Don't hesitate to PM me if you decide to add Black Soul gems or Azura's Star -- it shouldn't be that hard. :wink:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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