Jump to content

Torch "Light" Spell


Recommended Posts

i want to make a light spell that uses the light that comes from a torch as most mods usually recommend a torch for light, i have seen some retextures for the light spell but that changes the light spell and its temporary so long as i have it installed.

 

i want a script that can be change within the cs and i wanted it to used in 2 ways,

1 was when the player walked in a cell to create an aura of light

2 in a standalone spell just for it

and if possible to have the light in the same place as the torch when lit to create a similar effect

if i can get any help for this i would be grateful.

Edited by bomo99
Link to comment
Share on other sites

You can create a scripted spell that equips your character with a torch and/or change the colors of the SpellILightSpellMedium light with R 184 G 123 & B 69.

i want the spell to work underwater like a normal light spell, so torches cannot be used. for the changing of the color is it possible to script a spell to act like a light spell with those colors? i dont want to change anything in the base game just add a new spell that is treated like a light spell

Link to comment
Share on other sites

Why don't you simply edit the vanilla game?

 

You can very easily detect and cancel the conflicts thanks to ObMM and TES4Edit.

i know that, i was wondering if there was another way to do this, since i could've just got a replacer.

Link to comment
Share on other sites

As a partial substitute it can be done with token in player's inventory, which is moving light source together with player. The spell would act as a switch. But there is one problem - SetPos command is not enough to fully update light source, light radius will not move with it. Only using Enable/Disable commands seems to do it, and so result will be flicky. It can be edited to accetable level, but a result will never be 100% perfect.

 

If you want still try it:

scn MagicTorchSpellScript

begin ScriptEffectStart
	if MagicTorchOn == 0 ;global variable
		set MagicTorchOn to 1
		player.AddItem MagicTorchToken 1
	else
		set MagicTorchOn to 0
	endif
end

And for token itself:

scn MagicTorchTokenScript

ref actor
short torch_on
short disabled
short count
short fullupdate
float x ;player
float y
float z
float tx ;torch coordinates
float ty
float tz
float sx ;coordinates for update
float sy
float sz
float diff

begin GameMode
	set actor to GetContainer
	if actor == player
		if torch_on != MagicTorchOn
			if MagicTorchOn == 1 ;torch on
				TorchMagicObject.Enable
				TorchMagicObject.MoveTo player
				set sx to player.GetPos X
				set sy to player.GetPos Y
				set sz to player.GetPos Z
			endif
			if MagicTorchOn == 0
				TorchMagicObject.Disable
				RemoveMe
			endif
			set torch_on to MagicTorchOn
		endif
		if torch_on == MagicTorchOn
			if torch_on != 0	
				if count == 3
					set count to 0
					if TorchMagicObject.GetInSameCell player == 0
						TorchMagicObject.Disable
						TorchMagicObject.MoveTo player
					else
						set x to player.GetPos X
						set y to player.GetPos Y
						set z to player.GetPos Z
						set z to z + 150
						set tx to TorchMagicObject.GetPos X
						set ty to TorchMagicObject.GetPos Y
						set tz to TorchMagicObject.GetPos Z
						; quick update
						if x != tx || y != ty || z != tz
							TorchMagicObject.SetPos X x
							TorchMagicObject.SetPos Y y
							TorchMagicObject.SetPos Z z
						endif
						;full update
						set fullupdate to 0
						if x > sx
							set diff to x - sx
						else
							set diff to sx - x
						endif
						if diff >= 750
							set fullupdate to 1
						endif
						if fullupdate == 0
							if y > sy
								set diff to y - sy
							else
								set diff to sy - y
							endif
							if diff >= 750
								set fullupdate to 1
							endif
						endif
						if fullupdate == 0
							if z > sz
								set diff to z - sz
							else
								set diff to sz - z
							endif
							if diff >= 750
								set fullupdate to 1
							endif
						endif
						if fullupdate != 0
							TorchMagicObject.Disable
							TorchMagicObject.MoveTo player
						endif
					endif
				else
					set count to count + 1
					if TorchMagicObject.GetDisabled
						TorchMagicObject.Enable
						set sx to TorchMagicObject.GetPos X
						set sy to TorchMagicObject.GetPos Y
						set sz to TorchMagicObject.GetPos Z
					endif
				endif
			endif
		endif
	endif
end

TorchMagicObject is edited light source to mimic torch light, except its radius is set to 1300 and there is no nif attached. It's also placed to one of test cells (I choosed zClothesTest) and initialy disabled it. Script are straight copy from CS editor.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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