Jump to content

Adding gold via script doesn't work


Duriel7

Recommended Posts

Hi everyone,

 

So I understood my problem is common. By researching some hours, I was not able to find why adding gold via script couldn't work, while adding anything else is doable.

 

Context : I'm doing a mod to choose class, jobs, RP orientations... via a scripted book. I learned like everything I need to know in only some minutes by retroingineering people's scripts/CK wiki/TESAlliance and other forums... BUT... the thing is, I cannot add gold to the inventory and I still can't find why.

 

Here are 2 pieces of my script (these are in a function that is called after the player choose to accept the job they have been presented on my message boxes) :

    if jobBard == 1
        ; Bard bonus ---------------------------------------------------------------------
        game.Getplayer().modav("speechcraft", 10)
        game.Getplayer().modav("speechcraftpowermod", 30)
        game.Getplayer().additem(Coin, 100, true)
        game.Getplayer().additem(iLute, 1, true)
    endif
    if jobMerchant == 1
        ; Merchant bonus -----------------------------------------------------------------
        game.Getplayer().modav("speechcraft", 20)
        game.Getplayer().modav("speechcraftpowermod", 50)
        game.Getplayer().additem(Coin, 500, true)
    endif

The first, Bard, can have his lute added properly with the property name "iLute".

For Merchant, I tried everything I could, like "Gold" "Septims" "GoldCoin" or other things... and when linking the property to the Gold001 misc item in the CK it works but in game the script does not give me my gold.

I also have a function for RP orientation concerning wealth (from no-gold-hobo to richest-in-the-world) that are some randoms (Utility.RandomInt()) and they do not add gold neither. The randoms work perfectly, no errors on the compilation.

 

Do somebody here have the knowledge and please can you teach me the secret of gold creation ?

I'm desperate. Nothing has ever resisted my will and logic this hard before.

Edited by Duriel7
Link to comment
Share on other sites

I tried obviously adding my script to my quest.

I have this quest that gives the book, then the book have another script with an OnRead Event that allows the player to choose their class.

I tried adding the script extended from OBjectReference to the quest, as I read on CK wiki tuto that gold might (to my understanding) be added only by quests or events, but might it be that gold can only be added by scripts extended from Quest ?

I still cannot understand why I can't add gold like the page : https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Quest_Loose_Ends#Giving_the_Amulet_to_Bendu

If it's only in quests scripts then I know where I am moving. I will test it and see if it works but I'm not sure what to do.

Link to comment
Share on other sites

There is nothing wrong with the syntax you have. The only possible reason that gold will not be added is if the property is not properly filled. But you've stated that you've assigned the correct data to the property.

 

Unless...

 

Test on a new game if you have not. Sometimes changes to a script will not be reflected on a mid-game save when the object holding the script has already been loaded.

Link to comment
Share on other sites

Hi,

So tried on my quest with a quest type extended script. Nothing.

 

Yes, I only try on new games, with Alternate Start : Live Another Life, it's easy to get on a new game fast enough to make a new game each time.

I know there's nothing wrong with my syntax U_U that's what bugging the crap out of me.

I read here and there many many modders having the same problem, and I don't understand why. I tried also just adding a New Property directly in the CK, it's the same result. I made debug.messabox lines to test my things, the amount of gold is well detected (I mean my randoms are working as intended) but this amount is not added to the player.

 

It must be something I cannot see because I lack knowledge of Papyrus scripting. In Java (my most well known language) I can do that on a mini game and it works first try. It's bugging me even more.

 

Meanwhile thanks for your answer. I will continue to try ajustements to my script and mod and see if something changes to report here my advancements.

 

EDIT : Jesus Christ, my Dear Ishara, you know what ? I reverted the changes I made with all this s*** concerning quests and all, I created a new char, and what ? The gold was added !

I believe you gave me luck. Jeez thank you so much even if you did nothing more than just reply to my topic. Sometimes informatics is just mystery as said by a former teacher of mine. The stranger thing was, I tried a new char just before, and the game crashed when I clicked on "Choose my class" button but not on the newest one. So yeah mystery is real here.

Edited by Duriel7
Link to comment
Share on other sites

  • Recently Browsing   0 members

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