Jump to content

Script Help


GowiHasti

Recommended Posts

Say I've added a weapon like SkyforgeSteelMace and I want it to be an option to choose as a weapon from Eorlund. Do I need to simply add the dialogue and create a script to add to Eorlund's response or what and if so what should
I add, this?:

 

Game.GetPlayer().AddItem(SkyforgeSteelMace , 1, true)

Edited by GowiHasti
Link to comment
Share on other sites

I've done that. I just want it a bit more immersive. I know in Fallout 3 a similar thing was possible as I modded in a special armor and a companion and had him give it upon figuring out the code phrase. THats why I wondered if something similar was possible here. Anybody know one way or another?

Link to comment
Share on other sites

This is the intersection between Papyrus scripting and CK Dialog, and the general subject is called "Code Fragments".

 

I'm am NOT an expert at using Papyrus Fragments to support scripting. I know enough to know that's how you would do what you want, but I've never actually used the technique myself.

 

You can scan through the existing vanilla dialog for common quests, like the main quest like in Helgen's keep, were your companion gives you a bow to shoot the bear, during the sneaking tutorial, near the exit, to see how it is done.

 

Essentially, a stage of the quest has a condition triggered small section of Papyrus code, referred to as a Fragment, to add the bow to the player's inventory.

 

Fragments are just scripts, but they have the following differences from other scripts:

 

1] They never work by themselves, but are almost always triggered by a stage of dialog. They can be triggered by activators or magical effects too.

 

2] They are short, usually less than 20 lines, including comments

 

3] They usually do just one thing.

 

4] They do not stay active in memory, storing information for later use, they are temporary, not persistent.

 

5] Unlike quest stages, the status of and variables of Fragments are usually not saved in the savegame file.

 

You can make a fragment persistent, but for a host of reasons, it is a bad game design practice.

 

 

Here is a tutorial on the subject:

https://www.creationkit.com/index.php?title=Quest_Stage_Fragments

 

www. creationkit.com/index.php?title=Quest_Stage_Fragments

 

I hope that info gets you started.

-

Edited by VanKrill
Link to comment
Share on other sites

The easiest way is a lot like what VanKrill said. If you're new to scripting and creating quests I would highly recommend the relevant YouTube videos by BestInSlot and DarkFox127.

 

You can go to the dialog you've created and find the script fragment box that triggers at the end of the dialog.

 

In the script fragment you need to create a property and specify that property as a weapon type property. You can name it SkyforgeSteelMaceProperty. Then from the property menu you can select SkyforgeSteelMace as the object of that weapon property.

 

Your actual script fragment would just need to be Game.GetPlayer().AddItem(SkyforgeSteelMaceProperty,1)

 

You don't need to specify parts of the fragment that are the same as the default. But other than that you're on the right track. Good luck!

Link to comment
Share on other sites

Thank you all.

 

The easiest way is a lot like what VanKrill said. If you're new to scripting and creating quests I would highly recommend the relevant YouTube videos by BestInSlot and DarkFox127.

You can go to the dialog you've created and find the script fragment box that triggers at the end of the dialog.

In the script fragment you need to create a property and specify that property as a weapon type property. You can name it SkyforgeSteelMaceProperty. Then from the property menu you can select SkyforgeSteelMace as the object of that weapon property.

Your actual script fragment would just need to be Game.GetPlayer().AddItem(SkyforgeSteelMaceProperty,1)

You don't need to specify parts of the fragment that are the same as the default. But other than that you're on the right track. Good luck!

How do I create the property like you said? And should I add something, unsure what exactly, related to the companions house keeping so it knows I've completed the part of the quest to get a weapon from Eorlund?

Link to comment
Share on other sites

Script fragments must be handled differently than full scripts. To add a property for use on a script fragment, the full script that the fragment will belong to needs to be created. This cannot be done by hand. The Creation Kit must make it. This is because the full script's name is a combination of the editor ID and the editor name of the object containing the reference to the fragment(s) along with any user designated prefix. In order to do this add a single commented out line or just the semi-colon (;). Then compile the script fragment. Once compiled you can use the property button and the resultant window to add whatever properties that you might need. Next, add in the actual code and recompile. Do note that some records may not update the interface after the first compilation. If this happens simply close and reopen the record(s).

 

You can probably use the condition function GetStageDone on your topic info and have it target the appropriate stage of the appropriate companions quest.

Link to comment
Share on other sites

Script fragments must be handled differently than full scripts. To add a property for use on a script fragment, the full script that the fragment will belong to needs to be created. This cannot be done by hand. The Creation Kit must make it. This is because the full script's name is a combination of the editor ID and the editor name of the object containing the reference to the fragment(s) along with any user designated prefix. In order to do this add a single commented out line or just the semi-colon ( :wink:. Then compile the script fragment. Once compiled you can use the property button and the resultant window to add whatever properties that you might need. Next, add in the actual code and recompile. Do note that some records may not update the interface after the first compilation. If this happens simply close and reopen the record(s).

 

You can probably use the condition function GetStageDone on your topic info and have it target the appropriate stage of the appropriate companions quest.

Thank you for explaining so I understand exactly what to do, I believe. I'll give this a try as soon as I can get a decent amount of spare time to do so.

Link to comment
Share on other sites

I've run into a snag I'd like advice on. I attempt to add a new topic so I can link it to the main topic regarding 'I was told you'd have a weapon for me' and Eorlund asking what you'd like but as soon as I hit new topic I got a box saying 'Failure Must Press OK to confirm quest creation before adding topics.' What do I do now?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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