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...

[SKY] Total Objectives Completed before Next Stage


dottedgirl
 Share

Recommended Posts

So, I've hit a bit of a wall in my quest design.

The player is asked to look for clues surrounding a murder. I want it so that the player must find all of the clues before being able to move on to the next step. The player should also be able to find each clue in whatever order he/she discovers them.

My issues is simply with having the quest keep track of the total number of clues found. I'm not sure the best way to do that- from what I've read, it seems like a new global variable isn't really going to work here. My first thought was to do something like 'setstage' and add 1 each time a clue is found, but it seemed like it was becoming convoluted as I tried that method.

Here is my current script for each clue object. It works perfectly to be sure that the player can only find a clue once (though, could re-check the clue if he/she wanted to).


Quest Property ChristmasParty  Auto  


int vialfound


Event onactivate(ObjectReference akActionRef)

    if vialfound < 1

       vialfound = 1

       Debug.MessageBox("You found a clue!")

   endif

    Debug.MessageBox("There is an empty vial of a deadly poison in this basket!")

 endEvent


All that is left is to add some way for the game to keep track of total clues found. Thoughts?

Link to comment
Share on other sites

Why can't you use a global variable? They would work very well in this instance.

But I would suggest, since you already have a quest (which I know nothing about quests), but from what I understand, you can keep a variable in the quest script, and use it to keep track of the count.

Each object would have a script on it that would then add one to that count. (the same could be done with a global variable.)

And when the count is at the correct amount, then you advance the quest stage.

Link to comment
Share on other sites

Why can't you use a global variable? They would work very well in this instance.

But I would suggest, since you already have a quest (which I know nothing about quests), but from what I understand, you can keep a variable in the quest script, and use it to keep track of the count.

Each object would have a script on it that would then add one to that count. (the same could be done with a global variable.)

And when the count is at the correct amount, then you advance the quest stage.

The guide I was reading says that global variables don't persist and that using the quest by itself would be best.

However, I can't seem to 'add' a value to global variables. Every time I try to debug, it tells me that the variable (cluesfound) is 0.0000, even after the script supposedly set it to 1.

My very original thought was to just declare a variable within the script for the object, but I then found that even if I declare the same variable name on a different object, the variables are only attached to the seperate objects and don't carry over.

I'll be honest, I'm not 100% sure what you mean by 'quest script'. It might just be me being a n00b though ;)

Link to comment
Share on other sites

Using global variable is rather simple to setup and use.

1. Create >Miscellaneous >Global object. Like 'myInputGlobalName'.

2. Attach property of 'global' to your script using the name you gave the global for the auto-fill to work.

3. get your global variable value with:

float myVal = myInputGlobalName.GetValue()

Now the local variable 'myVal' will contain your global value.

4. set your global variable value with:

myInputGlobalName.SetValue(1)

This will set the global with a value of '1'.

You are correct, a variable in one script will not carry over to another script, that is why Global Variables were created, so you can do this.

A quest script is a script, attached to the quest. I believe there are two types you can attach to your script. I prefer a full script, rather than a fragment.

Link to comment
Share on other sites

Alright, now I have:


Quest Property ChristmasParty  Auto  

GlobalVariable Property cluesfound  Auto 


int vialfound

float myVal = cluesfound.GetValue()


Event onactivate(ObjectReference akActionRef)

    if vialfound < 1

       vialfound = 1

       Debug.MessageBox("You found a clue!")

       myVal = myVal + 1

       cluesfound.SetValue(myVal)

   endif

    Debug.MessageBox("There is an empty vial of a deadly poison in this basket!")

 endEvent

But the compiler gives me these errors:

d:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\InvestigateVial.psc(10,14): no viable alternative at input 'cluesfound'

d:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\InvestigateVial.psc(10,24): required (...)+ loop did not match anything at input '.'

d:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\InvestigateVial.psc(10,6): Unknown user flag cluesfound

No output generated for InvestigateVial, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on InvestigateVial

Link to comment
Share on other sites

Ha, my mistake, it is called GlobalVariable.

I think the mistake here might be you are trying to use a 'function' outside of an Event.

But I cannot be sure because your line numbers on the error do not seem to match the script you show.

float myVal = cluesfound.GetValue()

I dont think you can use 'getValue' outside of an Event block of code.

Link to comment
Share on other sites

Nearly there! I Adjusted as you suggested- perfect! Though when I debug in-game, it doesn't seem like the global variable gets updated.

First, here are both scripts on both objects. They are nearly identical.


Scriptname modEmilyClue extends ObjectReference  


Quest Property ChristmasParty  Auto  

GlobalVariable Property cluesfound  Auto


int bodyfound

float myval


Event onactivate(ObjectReference akActionRef)

    if bodyfound < 1

       bodyfound = 1

       Debug.MessageBox("You found a clue!")

       myVal = cluesfound.GetValue()

       myVal = myVal + 1

       cluesfound.SetValue(myVal)

   endif

    Debug.MessageBox("There are fresh wounds on Emily's body. She may have been in a fight recently!")

    Debug.MessageBox(cluesfound.getvalue())

Scriptname InvestigateVial extends ObjectReference  Conditional

{Investiagate the empty poison vial.

Advance in the quest.

Disable investigating the vial.}


Quest Property ChristmasParty  Auto  

GlobalVariable Property cluesfound  Auto 


int vialfound

float myVal


Event onactivate(ObjectReference akActionRef)

    if vialfound < 1

       vialfound = 1

       Debug.MessageBox("You found a clue!")

       myVal = cluesfound.GetValue()

       myVal = myVal + 1

       cluesfound.SetValue(myVal)

   endif

    Debug.MessageBox("There is an empty vial of a deadly poison in this basket!")

    Debug.MessageBox(cluesfound)

 endEvent

So I go in game to test, and it works almost exactly as planned, except the first debug message of the global variable tells me "None" for it's value. After activating the second object (works the same in either order), the debug value I get is 0.00000.

So, it seems like the variable is updating...But not adding 1 to it. Am I missing something somewhere?

Link to comment
Share on other sites

I'm assuming the same is going for the in-game console? I try, in game, getglobalvalue cluesfound and always get 0.0000. So, the variable IS updating, but it's not showing me that it is updating? Like, if I were to try a conditional, say if it is equal to five, that should be accurate?

Link to comment
Share on other sites

Are you getting this message at all?

Debug.MessageBox("You found a clue!")

Yes, I am getting that message. I've tweaked all of the scripts and they are now working as expected, with the cluesfound variable updating correctly. Now I must script the rest of the quest, which hopefully will be a little more straightforward (its mostly dialogue based) than this has been. Thanks for all of your help so far!

Link to comment
Share on other sites

Okay, I'm now to the point of adding objectives to the quest. I've modified the clue scripts to set the stage if the fifth clue has been found:


Scriptname cluechest extends ObjectReference 

Quest Property ChristmasParty  Auto 

GlobalVariable Property cluesfound  Auto

int chestfound

float myVal

Event onactivate(ObjectReference akActionRef)

    if chestfound < 1

	   chestfound = 1

	   Debug.MessageBox("You found a clue!")

	   myVal = (cluesfound.GetValue() + 1)

	   utility.wait(0.20)

	   cluesfound.SetValue(myVal)

   endif

    Debug.MessageBox("Odd, there are only three presents under the tree. Whoever brought  them must have known there would only be three people left alive!")

   if myVal == 5

	  ChristmasParty.setObjectiveDisplayed(30)

	  ChristmasParty.setstage(30)

   endif

endEvent

However, the fifth clue (no matter what order I do it in) does not seem to execute the setstage/setobjectivedisplayed. I'm wondering if I have a screw loose in my code.

Link to comment
Share on other sites

Can you explain what you have the scripts attached to?

You might also want to display 'myValue' right after you set the global variable so you know what value the game thinks it is set to.

cluesfound.SetValue(myVal)

Debug.MessageBox("Clue %.0f", myVal)

PS. You may have to use a real message object and use the Show command.

Edited by WillieSea
Link to comment
Share on other sites

Alright, so I have the scripts attached to a few different things. Bear in mind that this is my first time making anything, so for all I know this was a silly way to do it.

I duplicated these items and attached the script to them.

-Horker Loaf (also put in the disable havok script and disable activation so that the player can't pick it up)

-Poison bottle (also put in the disable havok script and disable activation so that the player can't pick it up)

-A Chest container

-A knapsack container

Finally, I made an NPC Emily, and put her in the cell, set her to start dead, and attached the script to her.

EDIT

What about creating aliases for the quest? Would it be 'neater' if I were to attach papyrus scripts to the aliases of the objects?

Edited by dottedgirl
Link to comment
Share on other sites

Suddenly, out of no where, my NPC quest dialogue no longer shows up.

I had read before that I need to generate the SEQ file- which I did a long while ago when I first dug into this mod. I tried generating it again, thinking that I needed an updated version of it, but the Steam method of generation just doesn't work (no file is generated, I've even tried deleting the older SEQ file)

Sigh.

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...