Azazellz Posted January 12, 2018 Share Posted January 12, 2018 Changing light source parameters (color, radius, fade, pulsation) via scripts. It is possible? The point is that I'm trying to make an "upgrade" for the QuickLite mod, with the ability to select different light styles. But, unfortunately, I do not see the right way to make this. Creating hundreds of different versions of light sources - this is not the right way. Link to comment
darkconsole Posted January 12, 2018 Share Posted January 12, 2018 i do not think so. gonna have to ask the skse people to look into lights or try to do an skse plugin yourself, i think. not sure if they will be willing to do old skyrim skse updates tho. Link to comment
Azazellz Posted January 13, 2018 Author Share Posted January 13, 2018 1 hour ago, darkconsole said: or try to do an skse plugin yourself Too complicated for me. 1 hour ago, darkconsole said: not sure if they will be willing to do old skyrim skse updates tho. Not sure too. It seems that I have to go the "wrong" way and create hundred different versions of the light sources. Well, that's sad. Link to comment
darkconsole Posted January 13, 2018 Share Posted January 13, 2018 not exactly sure what your project is, but here are some ideas. without knowing your project i shall invent one as an example. i have not actually tested this - typed this at work so there may be some stupid error did not debug at all. but the idea should work barring a logic bomb or syntax error that was not caught in notepad. goal: create a switch that changes the brightness in a room. 1) create 3 different Light forms of 3 different brightnesses. 2) place 1 light, the dimmest light in room. 3) place switch activator in room. 4) attach this script to the switch, filling the properties as specified. ScriptName dcc_lamp_ActLampSwitch extends ObjectReference ;; properties ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ObjectReference Property CurrentLamp Auto; {the actual lamp you placed in the 3d world.} Light Property Light1 Auto; {the dimmest class of light.} Light Property Light2 Auto; {the medium class of light.} Light Property Light3 Auto; {the bright class of light.} ;; events ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Event OnActivate(ObjectReference Who) If(self.CurrentLamp == self.Light1) self.ChangeLamp(self.Light2) ElseIf(self.CurrentLamp == self.Light2) self.ChangeLamp(self.Light3) ElseIf(self.CurrentLamp == self.Light3) self.ChangeLamp(self.Light1) EndIf Return EndEvent ;; methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function ChangeLamp(Light Replacement) {replace the current lamp with a new lamp.} Light NewLamp = self.CurrentLamp.PlaceAtMe(Replacement,1,TRUE,TRUE); self.CurrentLamp.Disable() NewLamp.Enable() self.CurrentLamp.Delete() self.CurrentLamp = NewLamp Return EndFunction but this is just a really simple example. if you have less than 128 lights that need to be controlled you can do some wicked things like create an array in creationkit for papyrus to iterate over changing them all out as required. this way you just place the initial light you want visible when the player first installs your mod, and you can just swap them out with a few classes rather than doing something like placing 10 lights per light all in the exact same spot in the game world already. Link to comment
Azazellz Posted January 13, 2018 Author Share Posted January 13, 2018 This is exactly the way I called "the wrong way." Instead of changing the parameters of single light source, we create many sources and switch between them. My goal was to create one light source (for player self-light spell) and change its parameters using scripts, but it seems that this is impossible. Well, maybe it's possible to change the light source attached to the magic effect (via scripts)? It goes under "Assoc. Item 1" for magic effect. Spoiler Or, at least, change magic effect, attached to spell? Create one magic effect or one spell - it's easier than creating a lot of spells, each with its own light source. Link to comment
darkconsole Posted January 13, 2018 Share Posted January 13, 2018 it gets even more strange once magic effects get involved. i ended up creating an event system that my lightsabers listen for lol. Scriptname dcc_ls_EffectGlowTorch extends ActiveMagicEffect {stacks the brighter light for use when force torch overcharge is on.} ;; i attempted my hardest to do this without a script. ;; the game only picks one Hit Art per enchant/spell though. ;; so stacking a brighter light, even when disabled by conditions ;; shuts the other light off completely as it wont even have a ;; place to mount in 3d. but when a spell is applied uniquely ;; the game is able to properly stack the hit art. ;; when two are stacked, the one in alphabetical order wins... ;; so the brighter light just needs to be named to win. yeah. ;; https://darkconsole.tumblr.com/post/167053041024/bethesdas-art-of-magic-effect-application ;; this also means this will be problematic for NPCs because ;; of skyrim lets magic effects fall off them. but it will ;; be just fine for the player. Spell Property SaberLightSpell Auto {the spell of the normal light.} Spell Property TorchLightSpell Auto {the spell of the brighter light.} Spell Property TorchSpell Auto {the spell that triggers torch.} Sound Property OverchargeSound Auto {sound when overcharged.} Int Property SoundID = 0 Auto Hidden {sound currently playing.} Event OnEffectStart(Actor Who, Actor From) {when ignited decide what mode the saber should be in.} If(Who.HasSpell(self.TorchSpell)) Who.AddSpell(self.TorchLightSpell,FALSE) self.SoundID = self.OverchargeSound.Play(Who) self.RegisterForSingleUpdate(1.0) Else self.UnregisterForUpdate() Who.AddSpell(self.SaberLightSpell,FALSE) EndIf self.RegisterForModEvent("DCC.Lightsaber.ToggleTorchOvercharge","OnToggleTorchOvercharge") Return EndEvent Event OnEffectFinish(Actor Who, Actor From) {when deactivated turn off all special effects and modes.} If(self.SoundID > 0) Sound.StopInstance(self.SoundID) EndIf Who.RemoveSpell(self.SaberLightSpell) Who.RemoveSpell(self.TorchLightSpell) ;;If(self != None) ;; self.UnregisterForUpdate() ;; self.UnregisterForModEvent("DCC.Lightsaber.ToggleTorchOvercharge") ;;EndIf Return EndEvent Function OnToggleTorchOvercharge(Form Whom, Bool Overcharged) {when overcharge is toggled reboot the effect.} Actor Who = Whom as Actor If(Who != self.GetTargetActor()) ;; only handle yourself m8 Return EndIf Debug.Notification(Who.GetDisplayName() + " toggle overcharge ") self.OnEffectFinish(Who,Who) self.OnEffectStart(Who,Who) Return EndFunction Function OnUpdate() self.GetTargetActor().DamageAV("Magicka",1.5) self.RegisterForSingleUpdate(1.0) Return EndFunction Scriptname dcc_ls_EffectToggleTorch extends ActiveMagicEffect Spell Property TorchSpell Auto Event OnEffectStart(Actor Who, Actor From) Int EID = 0 Bool Overcharged = FALSE ;;;;;;;; If(Who.HasSpell(self.TorchSpell)) Who.RemoveSpell(self.TorchSpell) Overcharged = FALSE Else Who.AddSpell(self.TorchSpell,FALSE) Overcharged = TRUE EndIf ;;;;;;;; If(Who.IsWeaponDrawn()) ;; tell the lightsabers to get their shit together. EID = ModEvent.Create("DCC.Lightsaber.ToggleTorchOvercharge") ModEvent.PushForm(EID,Who) ModEvent.PushBool(EID,Overcharged) ModEvent.Send(EID) EndIf Return EndEvent Link to comment
Azazellz Posted January 14, 2018 Author Share Posted January 14, 2018 6 hours ago, darkconsole said: it gets even more strange once magic effects get involved. i ended up creating an event system that my lightsabers listen for lol. Well, it was interesting to read, but, unfortunately, my problem can not be solved in this way. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.