kasichyko Posted April 26, 2017 Share Posted April 26, 2017 Some general info:Ok so I'm making a mod (which I intend to create a whole collection of before releasing them and maybe even add more once Im done) and so far i got an Unique NPC placed, its whole outfit, weapons, scripted item (which is the reward), a book to trigger/start the mod's main quest... what I need help with is the quest itself, I'm having a rough time trying to make it start and then procceed.Actual request:Link some quest example I can open on CK to learn how to trigger and complete quest stages (for example by: reading the book, acquiring specific quest items, walking into a specific spot, defeating specific NPCs... and well that would cover most of what I need help with) PD: I guess that with a simple script action that can trigger the quest to start (part where im failing) and complete objectives I could then handle it and apply it to the different tasks previously mentioned.Thanks for your time! Link to comment Share on other sites More sharing options...
Lisselli Posted April 26, 2017 Share Posted April 26, 2017 This will start a quest when the player walks through it and kill the script.Quest myQuest ; change this to a property and point it to your quest. AUTO STATE StartQuest Event OnTriggerEnter(ObjectReference akTriggerRef) akTriggerRef = Game.GetPlayer() ; Trigger will now always expect the player. if akTriggerRef GoToState("Done") myQuest.Start() endif EndEvent ENDSTATE State Done EndState Link to comment Share on other sites More sharing options...
ReDragon2013 Posted April 26, 2017 Share Posted April 26, 2017 (edited) Dear Lisselli,probably you has written the sample script in hurry. Unfortuantely the comparison was missing: Scriptname SampleTriggerScript extends ObjectReference ; script should be attached to an object, like a triggerbox to start the quest if player enters the trigger Quest PROPERTY myQuest auto ; point it to your created quest ; -- EVENT -- ;============================= auto STATE Waiting ;=============== EVENT OnTriggerEnter(ObjectReference akTriggerRef) IF (akTriggerRef == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - not the player, do not start the quest ENDIF ;--------------------------- gotoState("Done") myQuest.Start() ; if you want to start the quest once only, delete the trigger and this script ; or else remove the next two lines self.Disable() self.Delete() ENDEVENT ;======== endState ;============================= state Done endStateTutorial for quest scriptinghttps://www.creationkit.com/index.php?title=Bethesda_Tutorial_Basic_Quest_ScriptingObjectives how to do?https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Quest_ObjectivesBethesda has made some generic scripts, which begin with "default" for example "defaultQuestRespawnScript.psc".Use these script with your own quest related properties, if possible. Edited April 26, 2017 by ReDragon2013 Link to comment Share on other sites More sharing options...
kasichyko Posted April 27, 2017 Author Share Posted April 27, 2017 Thanks a lot, i'll give it a try this weekend hopefully ^^ Link to comment Share on other sites More sharing options...
Lisselli Posted April 27, 2017 Share Posted April 27, 2017 (edited) As usual scripting styles of two people will run into each other. Neither way is wrong:It wasn't missing. I wrote it that way on purpose. It's just another way to check if the ObjectReference is the player.You can even use if !akTriggerRef for the script to ignore the player.When you assign an object to a parameter, you don't need to compare it to the exact same object. It will simply return false(none in the case of ObjectReferences) if it doesn't match the object assigned to it.Don't need a return either. Your style is of a very cautious approach, and nothing wrong with that. My style is cautious as well but also using the least amount of coding as possible.You can even just put the Interaction Keyword on the trigger's form to PlayerKeyword and remove the akTriggerRef check entirely. Edited April 27, 2017 by Lisselli Link to comment Share on other sites More sharing options...
foamyesque Posted April 27, 2017 Share Posted April 27, 2017 (edited) Lisselli: Taking your word that it works -- I've never tried-- Is there a reason you prefer that over this? if akTriggerRef == Game.GetPlayer() Edited April 27, 2017 by foamyesque Link to comment Share on other sites More sharing options...
ReDragon2013 Posted April 27, 2017 Share Posted April 27, 2017 (edited) Let me explain the issue, you could have. my version: EVENT OnTriggerEnter(ObjectReference akTriggerRef) IF (akTriggerRef == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - not the player, do not start the quest ENDIF ;-------------------- gotoState("Done") myQuest.Start() ENDEVENTversion above a bit more intuitiv: EVENT OnTriggerEnter(ObjectReference akTriggerRef) IF (akTriggerRef == Game.GetPlayer() as ObjectReference) gotoState("Done") myQuest.Start() ENDIF ENDEVENTyour version without comparison: EVENT OnTriggerEnter(ObjectReference akTriggerRef) akTriggerRef = Game.GetPlayer() as ObjectReference ; Trigger will now always expect the player. IF akTriggerRef gotoState("Done") myQuest.Start() ENDIF ENDEVENTLiselli wrote: "My style is cautious as well but also using the least amount of coding as possible."Ok.. you wanted to reduce the script size. Nevertheless you need a comparison against the player. You wrote: "It's just another way to check if the ObjectReference is the player."It's not really a comparison in my eyes because your kind of comparison with akTriggerRef will be always true.What is wrong with your version?The first objectRef (certainly a NPC or an animal as well) who enters the trigger is taken as the player and let the quest start.The player can be miles away from the triggerbox, that means not the player started the quest in this case. Edited April 27, 2017 by ReDragon2013 Link to comment Share on other sites More sharing options...
kasichyko Posted April 29, 2017 Author Share Posted April 29, 2017 (edited) Yeah I can see the problem there (I actually have some previous knowledge about programming stuff) akTriggerRef = Game.GetPlayer() if akTriggerRefIn this line you're saying that whatever triggers the object is consider as player. akTriggerRef = Game.GetPlayer() if akTriggerRefAnd this line isn't really checking if the one triggering is actually the player Edited April 29, 2017 by kasichyko Link to comment Share on other sites More sharing options...
Recommended Posts