Script fragment in dialogue to remove gold from player?

Post » Mon Jun 18, 2012 11:37 am

I am writing a quest, and would like to be able to use a script fragment to remove 500 gold from the player in one of the dialogue responses. Barring that, I would at least like to know the correct way to define a new script to call in the response.

I see some promising information http://www.creationkit.com/RemoveItem_-_ObjectReference, but I am unclear as to how exactly to set this up in a new script. Can someone help please?
User avatar
HARDHEAD
 
Posts: 3499
Joined: Sun Aug 19, 2007 5:49 am

Post » Mon Jun 18, 2012 1:20 am

This explain exactly how to do it. Scroll down to the part about Giving the Amulet to B http://www.creationkit.com/Bethesda_Tutorial_Quest_Loose_Ends

Hope this helps :)
User avatar
Chantel Hopkin
 
Posts: 3533
Joined: Sun Dec 03, 2006 9:41 am

Post » Mon Jun 18, 2012 2:53 am

Thank you Emma. http://www.creationkit.com/Bethesda_Tutorial_Quest_Loose_Ends#Giving_the_Amulet_to_Bendu
Game.GetPlayer().RemoveItem(Gold001, 500)
appears slightly different than http://www.creationkit.com/RemoveItem_-_ObjectReference
Game.GetPlayer().RemoveItem(GoldBase, 500)
[both edited to remove 500 gold, for my purposes]. I cannot get either of them to work as http://www.creationkit.com/Bethesda_Tutorial_Dialogue#Scripting_Dialogue. This is the compile result I get in both cases:
Starting 1 compile threads for 1 files...Compiling "TIF__02001DA8"...d:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02001DA8.psc(18,28): variable Gold001 is undefinedNo output generated for TIF__02001DA8, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on TIF__02001DA8

I assume I must create a new script, but I am unsure as to how to set it up. After clicking http://www.creationkit.com/Bethesda_Tutorial_Basic_Quest_Scripting#Adding_Scripts I need to define script properties, such as "Type," "Object," etc. This is where I am unsure, since the tutorial given in the Wiki focuses on one limited example.

Sorry to bother, but would you mind clarifying these details please? I just don't know what all of those mean. This is part of a quest, so I would think I could use the "Quest" property, but then again, this is an object (gold) transaction, so I could also assume this would be an Object Reference, and so on.
User avatar
Mrs Pooh
 
Posts: 3340
Joined: Wed Oct 24, 2007 7:30 pm

Post » Mon Jun 18, 2012 9:44 am

So my latest attempts to make this work involved:
Script contentsScriptname PayReparations extends Quest  MiscObject Property Gold  Auto  Game.GetPlayer().RemoveItem(GoldBase, 500)Compiler output:Starting 1 compile threads for 1 files...Compiling "PayReparations"...d:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PayReparations.psc(5,4): no viable alternative at input '.'No output generated for PayReparations, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on PayReparations

And
Script contentsScriptname PayReparations extends Quest  MiscObject Property Gold  Auto  Game.GetPlayer().RemoveItem(Gold001, 500)Compiler output:Starting 1 compile threads for 1 files...Compiling "PayReparations"...d:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PayReparations.psc(5,4): no viable alternative at input '.'No output generated for PayReparations, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on PayReparations

Both failures, in other words.
User avatar
OTTO
 
Posts: 3367
Joined: Thu May 17, 2007 6:22 pm

Post » Mon Jun 18, 2012 10:43 am

When you're working on objects that have script fragments (topic infos for instance), you don't need to do "Add Script" - in fact you shouldn't. Just type something into the fragment box (like a comment), let it compile, and you'll see that it creates a script for you. Then you can add properties to that fragment - in your case, you need to add a MiscItem property to Gold001, which you can then reference in your script.
User avatar
Taylor Bakos
 
Posts: 3408
Joined: Mon Jan 15, 2007 12:05 am

Post » Mon Jun 18, 2012 1:35 pm

Well actually that is what I originally tried to do. Pasting in either
Game.GetPlayer().RemoveItem(GoldBase, 500)
or
Game.GetPlayer().RemoveItem(Gold_001, 500)
failed to compile. I tried several other iterations of the code as well ("Gold" instead of "GoldBase" or "Gold_001," etc.), to no avail.

Then you can add properties to that fragment - in your case, you need to add a MiscItem property to Gold001, which you can then reference in your script.

By this, do you mean adding in
MiscObject Property Gold  Auto
into the script fragment? If not, would you mind giving me an example of what you mean? I'm not sure of the proper syntax of these commands, when used in the script fragments window.
User avatar
Rozlyn Robinson
 
Posts: 3528
Joined: Wed Jun 21, 2006 1:25 am

Post » Sun Jun 17, 2012 11:48 pm

For fragments (specifically) add the Property with the Properties button next to the TIF_blahblah script. Use MiscObject. Not important what it's called as long as it points to Gold001.
User avatar
remi lasisi
 
Posts: 3307
Joined: Sun Jul 02, 2006 2:26 pm

Post » Mon Jun 18, 2012 12:47 am

Note you might need to remove all references to Gold first in the script first to get it to compile. You might also need to rename the TIF script by going to the Advanced tab for properties to be add-able.

I'll put this in the CK wiki later since its a common problem.
User avatar
Tanya Parra
 
Posts: 3435
Joined: Fri Jul 28, 2006 5:15 am

Post » Mon Jun 18, 2012 11:07 am

By this, do you mean adding in
MiscObject Property Gold  Auto
into the script fragment? If not, would you mind giving me an example of what you mean? I'm not sure of the proper syntax of these commands, when used in the script fragments window.
click on the script name in the little box to the right of the papyrus fragments and click on edit properties, in the window that pops up click add property, in the type field select miscobject, in the name field enter gold001, the rest can be left blank since you are using the name of an item that already exists

and just in case (may have no relevance to you), something i noticed while testing out my own fragments was that i kept receiving an error on a line that i had already removed, i can only guess it's from scripts being so detached from the creation kit because to get a new script to work i had to manually delete the script files in the data folder
User avatar
lacy lake
 
Posts: 3450
Joined: Sun Dec 31, 2006 12:13 am

Post » Mon Jun 18, 2012 5:02 am

and just in case (may have no relevance to you), something i noticed while testing out my own fragments was that i kept receiving an error on a line that i had already removed, i can only guess it's from scripts being so detached from the creation kit because to get a new script to work i had to manually delete the script files in the data folder

Try renaming the script from the Dialog window. Sometimes that works.
User avatar
Ella Loapaga
 
Posts: 3376
Joined: Fri Mar 09, 2007 2:45 pm


Return to V - Skyrim