RoadWarrior9 Posted October 15, 2017 Share Posted October 15, 2017 (edited) I'm used to setting a var to an object and using it's properties and methods but for the life of me I can't figure this out in papyrus. I have a trigger (DefaultEmptyTrigger) that I want to use setstage on a quest when the player enters the trigger. I have created a new script on the trigger and added the following code: Scriptname RW9test1 extends ObjectReference Const Quest Property RW9enableCPSwb Const Auto Event OnTriggerEnter(ObjectReference akTriggerRef) if akTriggerRef == Game.GetPlayer() Debug.MessageBox(akTriggerRef + " just entered us!") RW9enableCPSwb.SetStage(10) endifEndEvent The debug message does display in game so I know the trigger is running the code. So how do I set the var or property RW9enableCPSwb to a quest object?Thanks :) Edited October 15, 2017 by RoadWarrior9 Link to comment Share on other sites More sharing options...
Deleted6306543User Posted October 15, 2017 Share Posted October 15, 2017 Properties are set in the CK and saved to the plugin after the script is compiled. Try double-clicking on the script in the CK or right-clicking on it and selecting Properties. Link to comment Share on other sites More sharing options...
SKKmods Posted October 15, 2017 Share Posted October 15, 2017 The static variable reference properties button on scripts had me baffled for some time (e.g. took me forever to figure out how to actually make PlayerRef work) and to tun that painful learning into help: if you manually typed in Quest Property RW9enableCPSwb Const Auto then you need to remove it and ... Select your script, press [properties] button, dropdown arrow next to [add property] button, Create Using Form, In FormEditorID box the Quest data ID of your quest (RW9enableCPSwb ?), the quest property will be injected into your script with an invisible link to its actual form reference id. Link to comment Share on other sites More sharing options...
RoadWarrior9 Posted October 15, 2017 Author Share Posted October 15, 2017 Thank you! I will give that a try. The lack of documentation makes it hard to figure out :p Link to comment Share on other sites More sharing options...
JonathanOstrus Posted October 15, 2017 Share Posted October 15, 2017 If you already created the script and attached to the object, you could just open the properties and assign the quest to the property. There's no need to delete it from the script (which would cause a compile error due to the setstage command remaining) and add it back via the properties window. Also you could use a vanilla script which has the exact same function "DN009_SetStageOnEnterScript". Then you just set the quest and stage properties accordingly. You won't get the message box, though after you've set it up you wouldn't want it anyway. There's no particular reason you have to use a built in vanilla script though. If you wish to use your own you may. I personally like to use vanilla scripts when applicable for 2 reasons: 1. so I don't have to write the code myself, 2. save mod file size. Though for small scripts like this one in particular it's of negligible consequence. Link to comment Share on other sites More sharing options...
Recommended Posts