Jump to content

A Script to begin quest by entering a cell


antstubell

Recommended Posts

You likely don't need a script for this; if this is a new cell you've created, setup a location for it if you haven't already, and then use the "Change Location" Story Manager event to start your quest.

 

How do I do that? Are there any tutorials about this? The whole Ck is very, very sparse on tutorials.

Link to comment
Share on other sites

The storymanager way as described above will work.

 

However if you don't want to use it, you don't have to START the quest upon entering the cell.

 

Plus, that script has a condition getstage(0). But if the quest isn't started, stage 0 isn't reached yet.

 

So let's do like this.

 

- Mark the quest as "start game enabled"

 

- If you have something that will fire at stage 0, delete everything and put it on stage 10 (like objectives and stuff like that)

 

- Now put a trigger at the entrance of your cell (select a random item, then click on the box with a T inside in the toolbar)

 

- scroll down in the popped menu and select "xmarker"

 

- move and size your trigger as you want

 

- add a script to it, new script

 

- Type this

 

Quest property myQuest auto

Int property preReqStage auto

Int property StageToSet auto

Event OnTriggerEnter(ObjectReference akActionRef)
    if akActionRef == Game.GetPlayer()
        if myQuest.GetStage() == preReqStage
            myQuest.SetStage(StageToSet)
        endif
    endif
EndEvent

 

- Compile, exit and double click on the script

 

- Fill the properties with your values: Quest will be your quest, preReqStage will be 0 and StageToSet will be 10

 

- Treat the stage 10 as the start of your quest, so script objectives accordingly atc.

Link to comment
Share on other sites

The storymanager way as described above will work.

 

However if you don't want to use it, you don't have to START the quest upon entering the cell.

 

Plus, that script has a condition getstage(0). But if the quest isn't started, stage 0 isn't reached yet.

 

So let's do like this.

 

- Mark the quest as "start game enabled"

 

- If you have something that will fire at stage 0, delete everything and put it on stage 10 (like objectives and stuff like that)

 

- Now put a trigger at the entrance of your cell (select a random item, then click on the box with a T inside in the toolbar)

 

- scroll down in the popped menu and select "xmarker"

 

- move and size your trigger as you want

 

- add a script to it, new script

 

- Type this

 

Quest property myQuest auto

Int property preReqStage auto

Int property StageToSet auto

Event OnTriggerEnter(ObjectReference akActionRef)
    if akActionRef == Game.GetPlayer()
        if myQuest.GetStage() == preReqStage
            myQuest.SetStage(StageToSet)
        endif
    endif
EndEvent

 

- Compile, exit and double click on the script

 

- Fill the properties with your values: Quest will be your quest, preReqStage will be 0 and StageToSet will be 10

 

- Treat the stage 10 as the start of your quest, so script objectives accordingly atc.

Brilliant, works perfectly just 1 more request. This quest can be triggered by entering either 1 of 2 different cells. I can repeat what you've shown me in the other cell so if the player goes to either cell the quest will begin. Now I need to add some script, not quite sure what to add my mind is exploding, to stage 10 that checks if the player has been to the other cell and initiated the quest and if so don't display stage 10. Stage 10 basically says "Find Weapons" but if the player knows this already because quest has begun he doesn't need it to popup again. To put it in the player's view "There are 2 places to go and I need to find x weapon(s) in these 2 places."

I hope I made it clear but you are a smart guy.

Link to comment
Share on other sites

http://i0.kym-cdn.com/entries/icons/original/000/010/277/genius-meme.png

 

I forgot something. I need a script to end the quest when the 3 weapons from 2 locations have been collected. Could this be done by adding them by name or checking inventory - that wouldn't work what if a player gets 1 weapon and stores it in a chest and goes back for another. How can I end the quest when the 3 specific weapons have been colected? I already use a changecontainer script for when the player takes a weapon.

Link to comment
Share on other sites

So i suppose they are custom weapons?

 

Do you want a counter to display in the objective?

Yes custom weapons, 3 in total for this quest (other mods have similar quests so would be useful for those too). Not so much a counter but something along the lines of "You've found a weapon" each time player finds one of the specific weapons and when the final weapon is collected for the quest "You've found a weapon" but quest ends. Like I said have to consider that the player might collect 1 or 2, go back to their home, drop off 1 or 2 weapons and go back to get the 3rd, this is very posible due to weight restrictions. So script must take into account that the weapons will not be a permanent part of the inventory, just acquiring or maybe opening the container (chest or in 1 case a corpse) will count as "weapon found".

 

Edit: Or the popup can mention them by name "You've found XXXXXX" but still end quest at final weapon discovery

Edited by antstubell
Link to comment
Share on other sites

Depending on the way you want the message to display, the script will change.

 

- Create a new global variable, wich will be the counter for the weapons

 

- Put this script on every weapon

 

GlobalVariable property WeaponCount auto

Quest property myQuest auto

Int property preReqStage auto

Int property StageToSet auto

Auto State Ready

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
 if myQuest.GetStage() == preReqStage   
    if akNewContainer == Game.GetPlayer()
        WeaponCount.Mod(1)
        if WeaponCount.GetValue() == 3
            myQuest.SetStage(StageToSet)
        endif
        GoToState("Picked")
    endif
 endif
EndEvent

EndState

State Picked
EndState    

 

Fill the properties accordingly, put it on all the weapons and test it. There's no message for now until you tell me what type of message you want. So when testing you have to get the global value via console.

 

Type of message are:

- message box ---> pop up message which stops the game

- notification ---> message on the top right (like when you receive gold etc.)

- objective ---> showing a completed objective out of thin air, without it being displayed before.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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