Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Quest papryus scripts


razorkid10
 Share

Recommended Posts

I've been trying to wrap my head around how I could get the player to activate the next part of a quest by entering a trigger box, i'm new to scripting and the language is very alien to me.

 

I would like for the player to enter the trigger box, and then a sound plays, while also proceeding onto the next part of the quest.

 

I know this would be for the trigger box?

 

Quote

 

Scriptname MyTriggerBoxScript extends ObjectReference
 
Quest Property MyQuest Auto
Int Property StageToSet Auto
 
Event OnTriggerEnter(ObjectReference akActionRef)
    If akActionRef == Game.GetPlayer()
        MyQuest.SetStage(StageToSet)
    EndIf
 
EndEvent

 

and this for the play sound

 

Quote

 

int instanceID = mySFX.play(self) ; play mySFX sound from my self
Sound.SetInstanceVolume(instanceID, 0.5) ; play at half volume

 

 

But not sure how to compile them both for the desired effect.

Link to comment
Share on other sites

Everything that you want to happen when the player enters the trigger goes in the OnTriggerEnter event. After you've made sure that the trigger has been activated by the player and not some wandering NPC, then play the sound, set the stage, and do whatever else needs to happen.

 

I believe you will need to "Import Sound" in the trigger script to use the sound script's functions. You will also need to add a property to identify "mySFX" before you can call its Play() function.

 

If this is a one-time thing that the player can never do again once the quest has moved on, then you will also have to ensure that the trigger is deactivated afterwards, and re-activated if the player uses the console to set the quest back to an earlier stage.

Edited by BrettM
Link to comment
Share on other sites

Well I've tried making the basic script so that the quest proceeds onto the next stage when the trigger is entered.

 

 

 Scriptname arnimaredguardscript1 extends ObjectReference
 
Quest Property arnimareddawnquestbug Auto
Int Property StageToSet Auto
 
Event OnTriggerEnter(ObjectReference akActionRef)
    If akActionRef == Game.GetPlayer()
        arnimareddawnquestbug.SetStage(20)
    EndIf
 
EndEvent
 

But the compilation is failing, I'm very new with scripting so tell me what obvious elements i'm missing. The name of the quest is arnimareddawnquestbug, the name of the trigger in the reference editor ID is reddawnquestbox.

Link to comment
Share on other sites

If the compile is failing, then the compiler told you what IT thinks is missing or incorrect. Perhaps if you shared what the compiler told you was the problem, and the line number(s) that it didn't like, it would be easier to help. Otherwise we have to run an imaginary compiler in our heads while looking at your script and try to imagine what kind of errors it would find.

 

(Note that the CK Wiki has information about compiler error messages that can often point you in the right direction for solving a compile problem without needing to wait for someone to answer a post.)

 

I don't see any errors in the script as you posted it above that would cause a compile problem. To confirm, I copied your posted code and ran it through the compiler myself. It compiled without error. So if you're getting compiler errors, then you are trying to compile something other than the code you posted. Which means you are basically asking us to diagnose a problem with a script you haven't shown us that has compiler errors we haven't seen. Ummmm. :shrug:

Link to comment
Share on other sites

Ok I got this base script to work, sorry If i've caused any confusion, i'm trying to make an edit with the sound file now.

 

 

ScriptName examplescript Extends ObjectReference
 
Quest Property arnimareddawnquestbug Auto
Int Property StageToSet Auto
 
Event OnTriggerEnter(ObjectReference akActionRef)
    If akActionRef == Game.GetPlayer()
        arnimareddawnquestbug.SetStage(20)
        int instanceID = arnimacityalarm.play(self)
        Sound.SetInstanceVolume(instanceID, 0.5)

    EndIf

 

The compile errors.

Starting 1 compile threads for 1 files...
Compiling "examplescript"...
D:\Program Files (x86)\steamapps\common\skyrim\Data\Scripts\Source\temp\examplescript.psc(9,19): variable arnimacityalarm is undefined
D:\Program Files (x86)\steamapps\common\skyrim\Data\Scripts\Source\temp\examplescript.psc(9,35): none is not a known user-defined type
D:\Program Files (x86)\steamapps\common\skyrim\Data\Scripts\Source\temp\examplescript.psc(9,6): type mismatch while assigning to a int (cast missing or types unrelated)
No output generated for examplescript, compilation failed.

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

Link to comment
Share on other sites

Nevermind I seem to have gotten it to work now. For anyone that's interested.

 

 

 

ScriptName examplescript Extends ObjectReference
 
Quest Property arnimareddawnquestbug Auto
Int Property StageToSet Auto

Sound Property [iNSERT SOUND FILE ID] Auto
 
Event OnTriggerEnter(ObjectReference akActionRef)
    If akActionRef == Game.GetPlayer()
        arnimareddawnquestbug.SetStage(20)
        int instanceID = arnimacityalarm.play(self)
        Sound.SetInstanceVolume(instanceID, 0.5)

    EndIf

EndEvent

 

 

Obviously you will replace where I put my custom quest names and sound IDs.

Link to comment
Share on other sites

Also, for whatever sound file you want to use. Extract it from the skyrim BSAs or convert an existing soundfile to the .WAV format and place it in the skyrim/data/sound/FX folder. Then navigate to the audio folder in the object window in CK and attribute the extracted audio file to the sound objects with the green boxes, make sure to make a new one. To use the sound in your cell/level, create a sound marker and link it to the sound object.

Link to comment
Share on other sites

Now the NPC that starts the quest isn't opening with dialogue, even after generating the .SEQ file.

 

I think that my script negates all the previous stages in the quest and that it only starts when i reach the trigger. How would I make it so that this trigger only starts or appears at stage 10?

Link to comment
Share on other sites

I did tell you way up there that you would need to define the sound file in a property before you could call Play() on it. Glad you figured it out, though.

 

I haven't done any quest scripting, but I would guess that you would need to define your trigger as "Initially Disabled" to keep it non functional until it's time to activate it. Then you would need whatever script sets the stage to 10 to send an Enable command to the trigger to make it appear.

 

As I said earlier, you need to make sure that the trigger is disabled after the player no longer should use it, if it's a one-time thing. But you also need a way to re-enable it if the player uses the console to set the stage back to an earlier stage. If quest objects can have scripts attached to each stage, then an enable script attached to stage 10 plus a disable script attached to a later stage would make sense to me. But you'll need a proper answer from somebody who knows about quest scripting.

Link to comment
Share on other sites

Also could I get help with this script?

 

 

Scriptname reddawnassault extends ObjectReference  

import game
import debug

 Quest Property arnimareddawnquestbug Auto
Int Property StageToSet Auto
int property prereqStageOPT = -1 auto
Sound Property arnimacityalarm  Auto
ActorBase property myNPC auto
ObjectReference property SpawnPlace auto
ActorBase property myNPC2 auto
bool property disableWhenDone = true auto
bool property doOnce = True auto
 

auto STATE waitingForPlayer
Event OnTriggerEnter(ObjectReference akActionRef)
    if akactionref == getPlayer() as actor
            ; check to see if a pre-req stage was specificed and if it's been met
            if prereqStageOPT == -1 || arnimareddawnquestbug.getStageDone(prereqStageOPT) == 1
                ; Start the quest just in case it isn't already running.
                if arnimareddawnquestbug.isRunning() == FALSE
                    bool check = arnimareddawnquestbug.start()
                    ; do a quick check in case the quest could not be started
                    if !check
;                         debug.trace("ERROR: "+arnimareddawnquestbug+" not started by "+self)
                    endif
                endif



    arnimareddawnquestbug.SetObjectiveDisplayed(30)
    arnimareddawnquestbug.SetStage(30)
 SpawnPlace.PlaceActorAtMe(myNPC, 2).StartCombat(Game.GetPlayer())
 SpawnPlace.PlaceActorAtMe(myNPC, 2).StartCombat(Game.GetPlayer())
 SpawnPlace.PlaceActorAtMe(myNPC, 2).StartCombat(Game.GetPlayer())
 SpawnPlace.PlaceActorAtMe(myNPC, 2).StartCombat(Game.GetPlayer())
 SpawnPlace.PlaceActorAtMe(myNPC2, 2).StartCombat(Game.GetPlayer())
 SpawnPlace.PlaceActorAtMe(myNPC2, 2).StartCombat(Game.GetPlayer())
 SpawnPlace.PlaceActorAtMe(myNPC2, 2).StartCombat(Game.GetPlayer())

Endif

EndEvent

endSTATE

STATE hasBeenTriggered
    ; this is an empty state.
endSTATE

I want to make it so when I enter the trigger, npcs spawn and then they STOP spawning without leaving the trigger, also to pass onto the next stage of the quest. The current issue is that waves of enemies keep spawning.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...