Jump to content

Combining Soulgems


Pronam

Recommended Posts

I thought it would be nice to create a nice long script..and then you'll get an long outcome..

(People that are cross-forum...I didn't get a response on another topic earlier, so that's why I try it already...)

 

Obviously I did something wrong, but where?

 

The scripts is attached to a container and seems to disregard the meaning of it. Enhancing soulgems instead of upgrading them. As a Petty soulgem with a Petty soul and a Lesser soulgem with a Petty soul should become a Lesser soulgem with a Lesser soul. Rather than that, it creates a Common soulgem (common soul) or a Greater or Grand and it seems to ignore things every once in a while.

 

I'm willing to trow it off the table if it's just not going to work anyway, but if someone could point out the problem it would be appreciated. Perhaps I shouldn't have put it in the timer? Or the use of return is wrong? It has to end each time as otherwise it'll combine gems that actually aren't there anymore.

A fun thing is that when you put out set MStarted to 0 after MStarted == 1 you'll get about 10000 gems and more..

(and it'll probably crash after a while..)

 

short Mhit ; Spell is cast on the container.
short MStarted ; Combining triggered to start, variables set to GetItemCount.
; the types of soulgems
short EP
short EL
short EC
short EGT
short EGD
short PP
short LP
short LL
short CP
short CL
short CC
short GTP
short GTL
short GTC
short GTGT
short GDP
short GDL
short GDC
short GDGT
float timer

Begin Onactivate
if MStarted == 1
	message "Wait until the spell is finished."
else
	activate
endif
end

Begin OnMagicEffectHit SEFF && SLTP
if MStarted == 0
	pms effectReflect 4
	pms effectDetectLife 5
	set timer to 5
	set EP to 0
	set EL to 0
	set EC to 0
	set EGT to 0
	set EGD to 0
	set PP to 0
	set LP to 0
	set LL to 0
	set CP to 0
	set CL to 0
	set CC to 0
	set GTP to 0
	set GTL to 0
	set GTC to 0
	set GTGT to 0
	set GDP to 0
	set GDL to 0
	set GDC to 0
	set GDGT to 0
	set Mhit to 1
elseif MStarted == 1
	message "Wait until the spell is finished."
endif
end

Begin GameMode
if Mhit == 1
	if MStarted == 0
		set EP to GetItemCount SoulGemEmpty1Petty
		set EL to GetItemCount SoulGemEmpty2Lesser
		set EC to GetItemCount SoulGemEmpty3Common
		set EGT to GetItemCount SoulGemEmpty4Greater
		set EGD to GetItemCount SoulGemEmpty5Grand
		set PP to GetItemCount SoulGem1Petty1PettySoul
		set LP to GetItemCount SoulGem2Lesser1PettySoul 
		set LL to GetItemCount SoulGem2Lesser2LesserSoul
		set CP to GetItemCount SoulGem3Common1PettySoul
		set CL to GetItemCount SoulGem3Common2LesserSoul
		set CC to GetItemCount SoulGem3Common3CommonSoul
		set GTP to GetItemCount SoulGem4Greater1PettySoul
		set GTL to GetItemCount SoulGem4Greater2LesserSoul
		set GTC to GetItemCount SoulGem4Greater3CommonSoul
		set GTGT to GetItemCount SoulGem4Greater4GreaterSoul
		set GDP to GetItemCount SoulGem5Grand1PettySoul
		set GDL to GetItemCount SoulGem5Grand2LesserSoul
		set GDC to GetItemCount SoulGem5Grand3CommonSoul
		set GDGT to GetItemCount SoulGem5Grand4GreaterSoul
		set MStarted to 1
	elseif MStarted == 1
		set MStarted to 0
		set timer to timer - GetSecondsPassed
		if timer >= 1
			If PP != 0 
				if LP != 0
					removeitem SoulGem1Petty1PettySoul 1
					removeitem SoulGem2Lesser1PettySoul 1
					additem SoulGem2Lesser2LesserSoul 1
					return
				elseif CP != 0
					removeitem SoulGem1Petty1PettySoul 1
					removeitem SoulGem3Common1PettySoul 1
					additem SoulGem3Common2LesserSoul 1
					return
				elseif CL != 0
					removeitem SoulGem1Petty1PettySoul 1
					removeitem SoulGem3Common2LesserSoul 1
					additem SoulGem3Common3CommonSoul 1
					return
				elseif GTP != 0
					removeitem SoulGem1Petty1PettySoul 1
					removeitem SoulGem4Greater1PettySoul 1
					additem SoulGem4Greater2LesserSoul 1
					return
				elseif GTL != 0
					removeitem SoulGem1Petty1PettySoul 1
					removeitem SoulGem4Greater2LesserSoul 1
					additem SoulGem4Greater3CommonSoul 1
					return
				elseif GTC != 0
					removeitem SoulGem1Petty1PettySoul 1
					removeitem SoulGem4Greater3CommonSoul 1
					additem SoulGem4Greater4GreaterSoul 1
					return
				elseif GDP != 0
					removeitem SoulGem1Petty1PettySoul 1
					removeitem SoulGem5Grand1PettySoul 1
					additem SoulGem5Grand2LesserSoul 1
					return
				elseif GDL != 0
					removeitem SoulGem1Petty1PettySoul 1
					removeitem SoulGem5Grand2LesserSoul 1
					additem SoulGem5Grand3CommonSoul 1
					return
				elseif GDC != 0
					removeitem SoulGem1Petty1PettySoul 1
					removeitem SoulGem5Grand3CommonSoul 1 
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GDGT != 0
					removeitem SoulGem1Petty1PettySoul 1
					removeitem SoulGem5Grand4GreaterSoul 1 
					additem SoulGem5Grand5GrandSoul 1
					return
				endif
			elseif LP != 0
				if LP > 1
					removeitem SoulGem2Lesser1PettySoul 2
					additem SoulGem2Lesser2LesserSoul 1
					return
				elseif CP != 0
					removeitem SoulGem2Lesser1PettySoul 1
					removeitem SoulGem3Common1PettySoul 1
					additem SoulGem3Common2LesserSoul 1
					return
				elseif CL != 0
					removeitem SoulGem2Lesser1PettySoul 1
					removeitem SoulGem3Common2LesserSoul 1
					additem SoulGem3Common3CommonSoul 1
					return
				elseif GTP != 0
					removeitem SoulGem2Lesser1PettySoul 1
					removeitem SoulGem4Greater1PettySoul 1
					additem SoulGem4Greater2LesserSoul 1
					return
				elseif GTL != 0
					removeitem SoulGem2Lesser1PettySoul 1
					removeitem SoulGem4Greater2LesserSoul 1
					additem SoulGem4Greater3CommonSoul 1
					return
				elseif GTC != 0
					removeitem SoulGem2Lesser1PettySoul 1
					removeitem SoulGem4Greater3CommonSoul 1
					additem SoulGem4Greater4GreaterSoul 1
					return
				elseif GDP != 0
					removeitem SoulGem2Lesser1PettySoul 1
					removeitem SoulGem5Grand1PettySoul 1
					additem SoulGem5Grand2LesserSoul 1
					return
				elseif GDL != 0
					removeitem SoulGem2Lesser1PettySoul 1
					removeitem SoulGem5Grand2LesserSoul 1
					additem SoulGem5Grand3CommonSoul 1
					return
				elseif GDC != 0
					removeitem SoulGem2Lesser1PettySoul 1
					removeitem SoulGem5Grand3CommonSoul 1 
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GDGT != 0
					removeitem SoulGem2Lesser1PettySoul 1
					removeitem SoulGem5Grand4GreaterSoul 1 
					additem SoulGem5Grand5GrandSoul 1
					return
				endif
			elseif CP  != 0
				elseif LL != 0
					removeitem SoulGem2Lesser2LesserSoul 1
					removeitem SoulGem3Common1PettySoul 1
					additem SoulGem3Common3CommonSoul 1
					return
				elseif CP > 1
					removeitem SoulGem3Common1PettySoul 2
					additem SoulGem3Common2LesserSoul 1
					return
				elseif CL != 0
					removeitem SoulGem3Common1PettySoul 1
					removeitem SoulGem3Common2LesserSoul 1
					additem SoulGem3Common3CommonSoul 1
					return
				elseif GTP != 0
					removeitem SoulGem3Common1PettySoul 1
					removeitem SoulGem4Greater1PettySoul 1
					additem SoulGem4Greater2LesserSoul 1
					return
				elseif GTL != 0
					removeitem SoulGem3Common1PettySoul 1
					removeitem SoulGem4Greater2LesserSoul 1
					additem SoulGem4Greater3CommonSoul 1
					return
				elseif GTC != 0
					removeitem SoulGem3Common1PettySoul 1
					removeitem SoulGem4Greater3CommonSoul 1
					additem SoulGem4Greater4GreaterSoul 1
					return
				elseif GDP != 0
					removeitem SoulGem3Common1PettySoul 1
					removeitem SoulGem5Grand1PettySoul 1
					additem SoulGem5Grand2LesserSoul 1
					return
				elseif GDL != 0
					removeitem SoulGem3Common1PettySoul 1
					removeitem SoulGem5Grand2LesserSoul 1
					additem SoulGem5Grand3CommonSoul 1
					return
				elseif GDC != 0
					removeitem SoulGem3Common1PettySoul 1
					removeitem SoulGem5Grand3CommonSoul 1 
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GDGT != 0
					removeitem SoulGem3Common1PettySoul 1
					removeitem SoulGem5Grand4GreaterSoul 1 
					additem SoulGem5Grand5GrandSoul 1
					return
				endif
			elseif GTP  != 0
				if LL != 0
					removeitem SoulGem4Greater1PettySoul 1
					removeitem SoulGem2Lesser2LesserSoul 1
					additem SoulGem4Greater2LesserSoul 1
					return
				elseif CL != 0
					removeitem SoulGem4Greater1PettySoul 1
					removeitem SoulGem3Common2LesserSoul 1
					additem SoulGem4Greater3CommonSoul 1
					return
				elseif CC != 0
					removeitem SoulGem4Greater1PettySoul 1
					removeitem SoulGem3Common3CommonSoul 1
					additem SoulGem4Greater4GreaterSoul 1
					return
				elseif GTP > 1
					removeitem SoulGem4Greater1PettySoul 2
					additem SoulGem4Greater2LesserSoul 1
					return
				elseif GTL != 0
					removeitem SoulGem4Greater1PettySoul 1
					removeitem SoulGem4Greater2LesserSoul 1
					additem SoulGem4Greater3CommonSoul 1
					return
				elseif GTC != 0
					removeitem SoulGem4Greater1PettySoul 1
					removeitem SoulGem4Greater3CommonSoul 1
					additem SoulGem4Greater4GreaterSoul 1
					return
				elseif GDP != 0
					removeitem SoulGem4Greater1PettySoul 1
					removeitem SoulGem5Grand1PettySoul 1
					additem SoulGem5Grand2LesserSoul 1
					return
				elseif GDL != 0
					removeitem SoulGem4Greater1PettySoul 1
					removeitem SoulGem5Grand2LesserSoul 1
					additem SoulGem5Grand3CommonSoul 1
					return
				elseif GDC != 0
					removeitem SoulGem4Greater1PettySoul 1
					removeitem SoulGem5Grand3CommonSoul 1 
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GDGT != 0
					removeitem SoulGem4Greater1PettySoul 1
					removeitem SoulGem5Grand4GreaterSoul 1 
					additem SoulGem5Grand5GrandSoul 1
					return
				endif
			elseif GDP  != 0
				elseif LL != 0
					removeitem SoulGem5Grand1PettySoul 1
					removeitem SoulGem2Lesser2LesserSoul 1
					additem SoulGem5Grand3CommonSoul 1
					return
				elseif CL != 0
					removeitem SoulGem5Grand1PettySoul 1
					removeitem SoulGem3Common2LesserSoul 1
					additem SoulGem5Grand3CommonSoul 1
					return
				elseif CC != 0
					removeitem SoulGem5Grand1PettySoul 1
					removeitem SoulGem3Common3CommonSoul 1
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GTL != 0
					removeitem SoulGem5Grand1PettySoul 1
					removeitem SoulGem4Greater2LesserSoul 1
					additem SoulGem5Grand3CommonSoul 1
					return
				elseif GTC != 0
					removeitem SoulGem5Grand1PettySoul 1
					removeitem SoulGem4Greater3CommonSoul 1
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GTGT != 0
					removeitem SoulGem5Grand1PettySoul 1
					removeitem SoulGem4Greater4GreaterSoul 1
					additem SoulGem5Grand5GrandSoul 1
					return
				elseif GDP > 1
					removeitem SoulGem5Grand1PettySoul 2
					additem SoulGem5Grand2LesserSoul 1
					return
				elseif GDL != 0
					removeitem SoulGem5Grand1PettySoul 1
					removeitem SoulGem5Grand2LesserSoul 1
					additem SoulGem5Grand3CommonSoul 1
					return
				elseif GDC != 0
					removeitem SoulGem5Grand1PettySoul 1
					removeitem SoulGem5Grand3CommonSoul 1 
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GDGT != 0
					removeitem SoulGem5Grand1PettySoul 1
					removeitem SoulGem5Grand4GreaterSoul 1 
					additem SoulGem5Grand5GrandSoul 1
					return
				endif
			elseif LL != 0
				if GTL != 0
					removeitem SoulGem2Lesser2LesserSoul 1
					removeitem SoulGem4Greater2LesserSoul 1
					additem Soulgem4Greater4GreaterSoul 1
					return
				elseif GDL != 0
					removeitem SoulGem2Lesser2LesserSoul 1
					removeitem SoulGem5Grand2LesserSoul 1
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GDC != 0
					removeitem SoulGem2Lesser2LesserSoul 1
					removeitem SoulGem5Grand3CommonSoul 1
					additem SoulGem5Grand5GrandSoul 1
					return
				endif
			elseif CL != 0
				if GTL != 0
					removeitem SoulGem3Common2LesserSoul 1
					removeitem SoulGem4Greater2LesserSoul 1
					additem Soulgem4Greater4GreaterSoul 1
					return
				elseif GDL != 0
					removeitem SoulGem3Common2LesserSoul 1
					removeitem SoulGem5Grand2LesserSoul 1
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GDC != 0
					removeitem SoulGem3Common2LesserSoul 1
					removeitem SoulGem5Grand3CommonSoul 1
					additem SoulGem5Grand5GrandSoul 1
					return
				endif
			elseif CC != 0
				if GDL != 0
					removeitem SoulGem3Common3CommonSoul 1
					removeitem SoulGem5Grand2LesserSoul 1
					additem SoulGem5Grand5GrandSoul 1
					return
				endif
			elseif GTL != 0
				if GTL > 1
					removeitem SoulGem4Greater2LesserSoul 2
					additem SoulGem4Greater4GreaterSoul 1
					return
				elseif GDL != 0
					removeitem SoulGem4Greater2LesserSoul 1
					removeitem SoulGem5Grand2LesserSoul 1
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GDC != 0
					removeitem SoulGem4Greater2LesserSoul 1
					removeitem SoulGem5Grand3CommonSoul 1
					additem SoulGem5Grand5GrandSoul 1
					return
				endif
			elseif GDL != 0
				if GDL > 1
					removeitem SoulGem5Grand2LesserSoul 2
					additem SoulGem5Grand4GreaterSoul 1
					return
				elseif GDC != 0
					removeitem SoulGem5Grand2LesserSoul 2
					removeitem SoulGem5Grand3CommonSoul 1
					additem SoulGem5Grand5GrandSoul 1
					return
				endif
			elseif EP == 2
				removeitem SoulGemEmpty1Petty 2
				additem SoulGemEmpty2Lesser 1
				return
			elseif EL == 3
				removeitem SoulGemEmpty2Lesser 2
				additem SoulGemEmpty3Common 1
				return	
			elseif EC == 4
				removeitem SoulGemEmpty3Common 2
				additem SoulGemEmpty4Greater 1
				return			
			elseif EGT == 5
				removeitem SoulGemEmpty4Greater 2
				additem SoulGemEmpty5Grand 1
				return	
			endif
		endif
		if timer < 1
			pms effectEnchantAlteration 1
			playsound UIItemEnchant
			set Mhit to 2
			set MStarted to 0
		endif
	endif
elseif Mhit == 2
	set Mhit to 0
endif
End

Link to comment
Share on other sites

I think the problem might be just an issue with how you need to run through so many conditional statements just to detect what is placed inside. The reason why this might be a factor is because the game mode block may be running through twice (due to all those return calls) and not moving to the next stage of the process.

 

What you might want to do instead is break it up into specific passes for detection. Once all the detection passes have been completed, invalidate them with a variable change and replace and remove only one set before resetting the script. Essentially, making it so that only one task is handled per usage instead of running continuously until all gems inside are combined.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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