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

Neverending "undefined variable" error. How to set properties?


kamilanawrot
 Share

Recommended Posts

Hello,

I am sorry if I posted this in the wrong section of the forum, I am new here.

I have a problem that will probably seem very silly to advanced modders, however I have been ripping my hair out over this for hours now.
Basically, I am trying to create a standard quest objective for my side quest: "Acquire proof from Salmo Aedour". The player then goes to the character named Salmo, and is supposed to talk to them, and upon Salmo saying a certain line, the next stage of the quest begins, and a note named "Salmo's Written Proof" is added to the inventory, which then has to be delivered back to Koris.

Sounds simple, right?
Well, I have no idea what I am doing. down.gif
I created some Aliases (for the two characters and the note), and the dialogue works fine: so does the quest progressing to the next stage at the correct moment, etc.The only problem is that I do not receive the actual note.

I have tried to use

Game.GetPlayer().AddItem(Alias_SalmoLetter.GetReference())

in Stage 31 (that's the one when I'm supposed to receive it after Salmo says his line), and the script does in fact compile, however the item is not received (dialogue still follows through).
I then attempted to use the same code in the actual dialogue box on the specific response rather than in the Quest Stages tab, and when compiling, I get this:

Starting 1 compile threads for 1 files...
Compiling "TIF__02001311"...
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001311.psc(10,25): variable Alias_SalmoLetter is undefined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001311.psc(10,43): none is not a known user-defined type
No output generated for TIF__02001311, compilation failed.

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

From what I have been reading about, I need to set some properties for the actual note. But, honestly, I do not know how to do so.
If someone could help me write a script and tell me where to apply it, I would be eternally grateful.
Thank you, and I appreciate any help,
Kamila

Link to comment
Share on other sites

*EDIT*

I messed around some more and now everything compiles fine, no more undefined variable errors, but... the NPC has the object in his inventory, but it is not given to me. I get the objective of "Return the proof to Koris", but I'm screwed because, well.. I don't have the actual proof. It doesn't change locations from the NPCs inventory to mine.

I am still using the

Game.GetPlayer().AddItem(Alias_SalmoLetter.GetReference())

fragment in the quest stage that I want the note to be added during. All properties are defined now, dialogue works fine, I get the next stage of the quest, but no item is added.

Not sure what the problem is.

Link to comment
Share on other sites

Not sure how much I can help since I avoid dialog and quests like the plague.
 
So I just have some pointers.
 
1. Use a clean save game when your testing. (that means the save game your using has NEVER had the mod your working on active when it was saved.)
 
2. Ensure Alias_SalmoLetter actually points to the object your want added, via the properties or however quests do it. A good test would be to change it to a vanilla object, to make sure its not a problem with the actual letter your currently pointing to.

Link to comment
Share on other sites

The item must be a permanent reference. Items loose their reference(non permanent) once they are in an inventory.

 

A little tip:

Make your letter a normal book object.

 

When Salmo says line X use following script:

game.getplayer().additem(name_of_your_letter,1)

quest_name.setstage(XXX)

Don't use a ref, just the name of the object/letter.

 

When you talk to koris just do:

game.getplayer().removeitem(name_of_your_letter,1)

quest_name.setstage(XXX)

 

Each time the papyrus script must have the property Book with the name name_of_your_letter. Then it is filled automatically when you kill auto fill.

Edited by schatten
Link to comment
Share on other sites

As Schatten said, in the specific response where Salmo is supposed to give the player the note, use:
 

game.getplayer().additem(BookProperty, 1)

quest_name.setstage(); advance the quest to the next stage.

note this will not be transferring any items from Salmo's inventory, but instead creating a new object inside the player's inventory.

After you add these script fragments to the specific response. Immediately click ok, it will say that it failed to compile, this is okay!

Save the object, save your mod. Then reopen the quest object, and navigate back to where you put the script fragment. click the script, and go to properties, pressing ok or yes until you arrive at the property window. Add a book property named "BookProperty" and once it appears set it to your note that you wish to have added to the player's inventory.

When the player eventually arrives at Koris, add a condition to his/her response, GetItemCount "YourNote" >= 1 Run this condition of the Player. Then add this script fragment:

 

When you talk to koris just do:

game.getplayer().removeitem(BookProperty, 1)

quest_name.setstage(); advance the quest to the next stage.

Just like before save this quest object, without setting a property to start with. Save your mod, then reopen the quest. Add a book property to the new script fragment, and point it to your note.

This should help you achieve what you're desiring.

EDIT: You can use GetOwningQuest.SetStage(), as it has the same effect, but only if the responses are inside the of the quest you want to set the new stage for. Non-Latent native functions are brilliant.

Edited by TripleSixes
Link to comment
Share on other sites

Thank you for the responses, I really appreciate getting some help with it. However, I keep getting this error when compiling:
 

Starting 1 compile threads for 1 files...
Compiling "TIF__02001311"...
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001311.psc(23,14): script property BookProperty already defined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001311.psc(23,14): script variable ::BookProperty_var already defined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001311.psc(23,14): script property BookProperty already has a get function defined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001311.psc(23,14): script property BookProperty already has a set function defined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001311.psc(27,14): script property ThisBook already defined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001311.psc(27,14): script variable ::ThisBook_var already defined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001311.psc(27,14): script property ThisBook already has a get function defined
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001311.psc(27,14): script property ThisBook already has a set function defined
No output generated for TIF__02001311, compilation failed.

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

I deleted all the Auto properties and references and so on and so forth from the Quest Script tab, the Dialogue tab, the Quest Stages tab, anywhere where I might have accidentally set an auto property, but still I can't get rid of this error. Any ideas on what I missed?

Link to comment
Share on other sites

Just a simple error. I was typing in the wrong name this entire time.

I didn't realize that if I named the book property "ExampleBook", you were supposed to use "ExampleBook" in your script as opposed to either the alias, so lets say "Book", or the actual item ID, such as "ExampleBook01".

I kept using either the alias or the ID, hence the CKs confusion on what im trying to refer to. After clearing all properties and resetting them to Book Property ExampleBook Auto, and using the property name in my script, everything worked just fine.

User error :)

Link to comment
Share on other sites

Yep, damn properties! :P

 

To avoid confusion, you can name your property by using the id of the object. Doing this, the ck will fill the property automatically and you won't wonder what to use. An example taken in my own mod:

Message Property ASIS_ChoosePlaceMessage  Auto

refers to the message that has "ASIS_ChoosePlaceMessage" for ID. In the script:

button = ASIS_ChoosePlaceMessage.Show()
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...