Jump to content

[LE] Turning off Light with Quest


Recommended Posts

So I'm using a small FX light to illuminate an item I want the player to notice and pick up. I want the light to disable upon pickup, so I went with a 2-stage quest (0 -> 10 where stage 10 disables the light)

I have a script on the item (an amulet) with this in the source and a propertyname linking it to the quest:

Scriptname CryptGroveCursedAmuletScript extends ObjectReference  

Quest Property CryptGroveCursedAmuletQuestProperty  Auto  

Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
 if (newContainer == Game.GetPlayer())
  CryptGroveCursedAmuletQuestProperty.SetStage(10)
 endif
EndEvent

Then I have this placed in the Papyrus Fragment section of the second quest stage using the RefID: 0100A0A6.Disable(true)

However, I get the following Papyrus error:

Starting 1 compile threads for 1 files...
Compiling "QF_0crypt_Grove_CursedAmulet_0100A0A3"...
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_0crypt_Grove_CursedAmulet_0100A0A3.psc(8,4): required (...)+ loop did not match anything at input 'A0A6'
No output generated for QF_0crypt_Grove_CursedAmulet_0100A0A3, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on QF_0crypt_Grove_CursedAmulet_0100A0A3

Am I doing this correctly, and how do I fix this error and make it work?

Link to comment
Share on other sites

You cannot use RefIDs directly in Papyrus; it isn't the console. If you want Papyrus to communicate with a game object you need to use either properties or variables that store it or functions that generate one, as you did with the Quest on the amulet script.

 

Put an ObjectReference property into your fragment, fill it with the light's reference, and replace '0100a0a6' (which, incidentally isn't constant anyway -- first two digits will shift depending on where in the load order your mod is) with the property name.

Edited by foamyesque
Link to comment
Share on other sites

Use this slightly modified script version of the one you are using.

 

CryptGroveCursedAmuletScript02

 

 

Scriptname CryptGroveCursedAmuletScript02 extends ObjectReference  
 
Quest Property CryptGroveCursedAmuletQuestProperty  Auto  
 
ObjectReference Property Light01 Auto
{Disables link Ref}
 
Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
         if (newContainer == Game.GetPlayer())
            CryptGroveCursedAmuletQuestProperty.SetStage(10)
            Light01.disable()
   endif
EndEvent

 

 

 

Just link the Ref script's propery to your light.

Hope it helps....

Edited by maxarturo
Link to comment
Share on other sites

If we're restructuring the logic, I'd go further and stick the script in a state where it stops listening for OnContainerChanged events after the first one successfully fires and put the script on an alias instead of the item itself :tongue:

That's on the modders choice how he want to move.
This is the same script but it will fire only ONCE (you mean something like this foamyesque ?).
CryptGroveCursedAmuletScript03

Scriptname CryptGroveCursedAmuletScript03 extends ObjectReference  
 
Quest Property CryptGroveCursedAmuletQuestProperty  Auto  
 
ObjectReference Property Light01 Auto
{Disables link Ref}
 
auto state waiting
Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
         if (newContainer == Game.GetPlayer())
            CryptGroveCursedAmuletQuestProperty.SetStage(10)
            Light01.disable()
            GoToState("Done")
   endif
EndEvent
ENDSTATE

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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