The Elder Scrolls V: Skyrim

The Elder Scrolls V: Skyrim

View Stats:
FancyFace10 Feb 13, 2014 @ 11:16am
Skyrim Creation Kit, Papyrus problem?
Ok, so I have the quest laid out and everything, but there's a small problem;

I have a player-home-mod almost ready for publishing and I'm using an NPC to sell the house to the player, for 10 000 gold in return for a key, but when I give the gold to the NPC in-game, It only removes 1 gold, instead of 10 000. By pickpocketing, I'm able to see he has the 1 gold in his inventory. And I (The player) gets the key. This is the code I'm using, and thats not working;


Alias_NPC.GetReference().RemoveItem(Alias_key.GetReference(), 1, False, Game.GetPlayer())

Game.GetPlayer().RemoveItem(Alias_gold.GetReference(), 10000, False, Alias_NPC.GetRef())

Debug.notification("Key to ****** Added")

Aliases;
NPC = The npc to give the key to, and the NPC that takes the gold (ID: Custom)
key = The key to the house (ID: Custom)
gold = The gold to give (ID: Gold001)

HELP, PLEASE!
< >
Showing 1-3 of 3 comments
Dr. Shocks . DO Feb 13, 2014 @ 11:24am 
I suck at scripting, but after many hours I was able to write a simple script that will check the player for the required gold and if there's enough, the script will go through.
My script basically removes gold and gives the player a potion; but only if the player has enough gold.

I'll post my script [as I already posted it on the Nexus as FREE TO USE; with credit to me, Sjogga and TonyCubed];
Perhaps it will give you an idea of what is missing/wrong with your script.

Scriptname Shocks_BrewTank_Gold01 extends ObjectReference
{Script to add potions to player. Ability to select potion from property}

Message Property Question Auto
{Ask the player a question}

Message Property Yes Auto
{Player selects Yes to Question}

Message Property No Auto
{Player selects No to Question}

Potion Property itemToAddPotion Auto
{item to add to player - potion}

Int Property ItemCount = 1 Auto
{how many to add?}

MiscObject Property Gold001 Auto
{Check Player for Gold item}

Int Property GoldCount = 1 Auto
{How much Gold to remove from player}

Int Property GoldInv = 1 Auto
{Check Player for gold needed for purchase}

int Button

EVENT onActivate(objectReference akActionRef)
If akActionRef == Game.GetPlayer()
Button = Question.show()
if Button == 0
If (Game.GetPlayer().GetItemCount(Gold001) >= GoldInv)
Yes.show()
Game.GetPlayer().AddItem(itemToAddPotion, itemCount, false)
Game.GetPlayer().RemoveItem(Gold001, GoldCount, false)
Else
debug.notification("You don't have enough Gold")
EndIf
elseif Button == 1
No.show()
endif
EndIf
endEVENT
GoldInv is an extra variable, and in most cases can be replaced with GoldCount.




Last edited by Dr. Shocks . DO; Feb 13, 2014 @ 11:25am
FancyFace10 Feb 13, 2014 @ 12:15pm 
Scriptname Shocks_BrewTank_Gold01 extends ObjectReference
{Script to add potions to player. Ability to select potion from property}

Message Property Question Auto
{Ask the player a question}

Message Property Yes Auto
{Player selects Yes to Question}

Message Property No Auto
{Player selects No to Question}

Potion Property itemToAddPotion Auto
{item to add to player - potion}

Int Property ItemCount = 1 Auto
{how many to add?}

MiscObject Property Gold001 Auto
{Check Player for Gold item}

Int Property GoldCount = 1 Auto
{How much Gold to remove from player}

Int Property GoldInv = 1 Auto
{Check Player for gold needed for purchase}

int Button

EVENT onActivate(objectReference akActionRef)
If akActionRef == Game.GetPlayer()
Button = Question.show()
if Button == 0
If (Game.GetPlayer().GetItemCount(Gold001) >= GoldInv)
Yes.show()
Game.GetPlayer().AddItem(itemToAddPotion, itemCount, false)
Game.GetPlayer().RemoveItem(Gold001, GoldCount, false)
Else
debug.notification("You don't have enough Gold")
EndIf
elseif Button == 1
No.show()
endif
EndIf
endEVENT
GoldInv is an extra variable, and in most cases can be replaced with GoldCount. [/quote]


Originally posted by Shocks -GO SEAHAWKS!-:
I suck at scripting, but after many hours I was able to write a simple script that will check the player for the required gold and if there's enough, the script will go through.
My script basically removes gold and gives the player a potion; but only if the player has enough gold.

I'll post my script [as I already posted it on the Nexus as FREE TO USE; with credit to me, Sjogga and TonyCubed];
Perhaps it will give you an idea of what is missing/wrong with your script.

Scriptname Shocks_BrewTank_Gold01 extends ObjectReference
{Script to add potions to player. Ability to select potion from property}

Message Property Question Auto
{Ask the player a question}

Message Property Yes Auto
{Player selects Yes to Question}

Message Property No Auto
{Player selects No to Question}

Potion Property itemToAddPotion Auto
{item to add to player - potion}

Int Property ItemCount = 1 Auto
{how many to add?}

MiscObject Property Gold001 Auto
{Check Player for Gold item}

Int Property GoldCount = 1 Auto
{How much Gold to remove from player}

Int Property GoldInv = 1 Auto
{Check Player for gold needed for purchase}

int Button

EVENT onActivate(objectReference akActionRef)
If akActionRef == Game.GetPlayer()
Button = Question.show()
if Button == 0
If (Game.GetPlayer().GetItemCount(Gold001) >= GoldInv)
Yes.show()
Game.GetPlayer().AddItem(itemToAddPotion, itemCount, false)
Game.GetPlayer().RemoveItem(Gold001, GoldCount, false)
Else
debug.notification("You don't have enough Gold")
EndIf
elseif Button == 1
No.show()
endif
EndIf
endEVENT
GoldInv is an extra variable, and in most cases can be replaced with GoldCount.

I'm VERY VERY new to scripting, so I don't really understand how and where to use all that. I need someone to explain it to me aswell, it seems. Sorry.
Last edited by FancyFace10; Feb 13, 2014 @ 12:19pm
Dr. Shocks . DO Feb 13, 2014 @ 12:21pm 
Well, I don't know how your have your mod setup; but if your are looking for a way to sell your house to the player, there's a mod that allows you to do that without using a NPC.
[I plan on doing this when my mod is done].

Basically it has a ForSale sign in front of the house that the player can interact with.
If the player decides to buy the house, the gold is removed and the player is given a key.

Berts Bits And Bobsby berticus0001
http://www.nexusmods.com/skyrim/mods/36756/
[download the "For Sale - Sold"; modder's resource].

Additionally, Berticus has a tutorial on his site on how to setup the script:
http://bertscktutorial.ucoz.com/index/for_sale_sold/0-19


Good luck
< >
Showing 1-3 of 3 comments
Per page: 15 30 50

Date Posted: Feb 13, 2014 @ 11:16am
Posts: 3