WesternWolff Posted August 10, 2022 Share Posted August 10, 2022 Me again, your local modding noob hoping someone can help. I'm still getting the hang of papyrus scripting, and tried to mimic a script I found elsewhere to create a lantern that changes colours. The original script swaps out the model of a light and adds/deletes a light source, allowing you to turn a light on or off. I followed the syntax of the original script throughout, but changed it so that it checks which lantern is active and cycles between them, deleting the old light and adding a new one. Here's what it does / should do:Checks which lantern is active by looking at the "ActiveLantern" property (defined on the object)Enables the next lanternWaits 0.5 seconds (the only float that's working.)Disables the original lanternFinds the closest light source based on a formlist ("LightList") and deletes it.Creates a new light that matches the latern colour.The error I'm getting when compiling is that it can't create two of the three initial floats I'm using: D:\Games\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\_SHSCRLanternPuzzle.psc(3,15): cannot initialize a float to 1D:\Games\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\_SHSCRLanternPuzzle.psc(5,15): cannot initialize a float to 64 I've attached my .psc file as text I've edited this post to add a spoiler window so you can see my full code. I'm a little baffled because I initialize three floats the exact same way, but only two of them fail.Scriptname _SHSCRLanternPuzzle extends ObjectReferenceFloat Property ActiveLantern = 1 AutoFloat Property WaitTimer = 0.5 AutoFloat Property SearchRadius = 64 AutoObjectReference Property Light1 AutoObjectReference Property Light2 AutoObjectReference Property Light3 AutoObjectReference Property Light4 AutoObjectReference Property Light5 AutoObjectReference Property Light6 AutoObjectReference Property LightLocation AutoObjectReference Property PlayerREF AutoFormList Property LightList AutoLight Property LightType AutoSound Property LightChange AutoEvent OnInit()GoToState("InActive")EndEventState InActiveEvent OnActivate(ObjectReference akActionRef)GoToState("Active")If ActiveLantern == 1LightChange.Play(PlayerREF)Light2.enable()Utility.Wait(WaitTimer)Light1.disable()Game.FindClosestReferenceOfAnyTypeInListFromRef(LightList, LightLocation, SearchRadius).delete()LightLocation.PlaceAtMe(LightType)ElseIf ActiveLantern == 2LightChange.Play(PlayerREF)Light3.enable()Utility.Wait(WaitTimer)Light2.disable()Game.FindClosestReferenceOfAnyTypeInListFromRef(LightList, LightLocation, SearchRadius).delete()LightLocation.PlaceAtMe(LightType)ElseIf ActiveLantern == 3LightChange.Play(PlayerREF)Light4.enable()Utility.Wait(WaitTimer)Light3.disable()Game.FindClosestReferenceOfAnyTypeInListFromRef(LightList, LightLocation, SearchRadius).delete()LightLocation.PlaceAtMe(LightType)ElseIf ActiveLantern == 4LightChange.Play(PlayerREF)Light5.enable()Utility.Wait(WaitTimer)Light4.disable()Game.FindClosestReferenceOfAnyTypeInListFromRef(LightList, LightLocation, SearchRadius).delete()LightLocation.PlaceAtMe(LightType)ElseIf ActiveLantern == 5LightChange.Play(PlayerREF)Light6.enable()Utility.Wait(WaitTimer)Light5.disable()Game.FindClosestReferenceOfAnyTypeInListFromRef(LightList, LightLocation, SearchRadius).delete()LightLocation.PlaceAtMe(LightType)ElseLightChange.Play(PlayerREF)Light1.enable()Utility.Wait(WaitTimer)Light6.disable()Game.FindClosestReferenceOfAnyTypeInListFromRef(LightList, LightLocation, SearchRadius).delete()LightLocation.PlaceAtMe(LightType)EndIfGoToState("InActive")EndEventEndStateIn terms of what I've tried:I've searched the forums here, as well as Google, for instances of "cannot initialize a float to" - did find one reference on LoversLab, but no solution listed.I've confirmed that Float can use both of those numbers on the Creation Kit wiki.Tried swapping the failing "Float" to "Int", but that fails as well.Added decimals to the numbers, but that doesn't seem to make a difference.Downloaded SSEScript, and ran "Tools > Check for Errors" which tells me there are no errors, but also fails to compile the script.Any advice would be appreciated. I'm probably lacking some basic understanding, but so far no dice on determining what that might be. Thanks! Link to comment Share on other sites More sharing options...
dylbill Posted August 11, 2022 Share Posted August 11, 2022 For the floats, you have to put a period to initialize. So change to 1.0 and 64.0 Edit: and this is because 1 or 64 is viewed by papyrus as an int, so you're trying to initialize float properties to ints and papyrus doesn't like that. Link to comment Share on other sites More sharing options...
WesternWolff Posted August 11, 2022 Author Share Posted August 11, 2022 Update: It was the decimals in spite of the fact that, as mentioned above, I had already tried adding them to no effect.This appears to have been because Creation Kit was caching a separate version of the script. It kept trying to compile that version instead of the one I was editing (/source/scripts instead of /scripts/source, both of which exist for... some reason.)Thanks Dylbill Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 11, 2022 Share Posted August 11, 2022 The Creation Kit for SSE use "Data > Source > Scripts" by default instead of "Data > Scripts > Source" as LE did. Whether this is a bug or intentional is up for debate. However, it is what it is. If you wish to use "Data > Scripts > Source" you'll need to make sure all your source scripts are located there and modify the correct INI file to point to that folder location. Link to comment Share on other sites More sharing options...
Recommended Posts