scripting a transaction

Post » Sun Nov 18, 2012 12:01 am

Hey everyone, lately ive been trying to make a custom house i made in falkreath purchasable, normally this shouldnt be a problem but for some reason just as with my last mod the quest making isnt acting right (i understand nothing works right at first i mean more so than usual), so now im trying to do it with jsut scripts on objects, basically i made a construction site and when you activate the blue prints the xmarker that is the enable parent of the house should be enabled, here is what i have so far..

ObjectReference Property House Auto

Event OnActivate(objectreference akactivator)
game.getplayer().GetGoldAmount()
;the above part i know works
if goldamount >= (3000)
game.getplayer().Removeitem(gold001, 3000)
house.Enable()
else
debug.messagebox("it will cost 3000 gold to finish this cottage")
endif
endevent

;the part i cant get past right now is the goldamount >= (3000) i tried a number a variations but im stumped and dont even
;know if the rest of the script will work, i would really appreciate any help
User avatar
JAY
 
Posts: 3433
Joined: Fri Sep 14, 2007 6:17 am

Post » Sat Nov 17, 2012 9:30 pm

you want to use

Game.GetPlayer(),GetItemCount(f), That will check to see how much gold the player has. GetGoldAmount() isn't a correct function.

You might have to make another property that is tied to player gold and then use that as the parameter for GetItemCount(propertyname)



Scratch what I said above.

What you want to do is make a new Misc Object property. Then in the drop down menu find Gold001 and click it to give your property that value.

Lets say you name it whatever (I wouldn't but for example purposes)

Now in your script use GetPlayer().GetItemCount(whatever)

Then you can do 1 of two things.

Say something like


int PlayerGoldCount = GetPlayer(),GetItemCount(whatever)

then check

if PlayerGoldCound >= 3000

or just use

if GetPlayer().GetItemCount(whatever) >= 3000

Understand?
User avatar
Lily Evans
 
Posts: 3401
Joined: Thu Aug 31, 2006 11:10 am

Post » Sun Nov 18, 2012 7:20 am

I think this will solve your problem:
ObjectReference Property House AutoMiscObject Property Gold001 AutoEvent OnActivate(objectreference akactivator)If Game.GetPlayer().GetGoldAmount() >= 3000Game.Getplayer().RemoveItem(Gold001, 3000)House.Enable()ElseDebug.MessageBox("it will cost 3000 gold to finish this cottage")endIfEndEvent
You forgot to add in gold as a property so when the script fires the player wouldn't lose any gold when they purchase the house. You also needed to change "If GoldAmount" to "If Game.GetPlayer().GoldAmount()", this is because gold amount checks the amount of gold an Npc has and since you didn't state what Npc to check it did nothing. Here's an example:
Spoiler

If Bob.GetGoldAmount() == 100Debug.MessageBox("Bob is poor!")
This will return the amount of gold that Bob has. Hope this helps! :biggrin:
User avatar
Nick Pryce
 
Posts: 3386
Joined: Sat Jul 14, 2007 8:36 pm

Post » Sun Nov 18, 2012 2:22 am

thank you both very much i really do appreciate it, most of what ive learned about scripting i have picked up myself so i didnt even know about miscobject properties
User avatar
K J S
 
Posts: 3326
Joined: Thu Apr 05, 2007 11:50 am

Post » Sun Nov 18, 2012 2:08 am

No problem, I'm glad I could help.
User avatar
Austin England
 
Posts: 3528
Joined: Thu Oct 11, 2007 7:16 pm


Return to V - Skyrim