Variable Investor Mod

Post » Thu Jun 21, 2012 3:11 am

Hi there,

I need some help by modifying the vanilla-papyrus-script of the investor perk. Every help is welcome to advance this ability.

My intention is, that, if you choose the dialogue option and start to invest, a pop-up-windows shows up, in which you can type the amount of gold you want to invest. One quarter of that amount will be the additional amount, that the merchant gets permanently. Also should it be possible, to invest more than one time in the same merchant (so you could rise his gold amount step by step).

The original script looks like this:

Scriptname PerkInvestorQuestScript extends Quest  Conditionalmiscobject Property Gold  Autoint Property GoldAmount = 500 Autofunction GoldTransfer (ObjectReference VendorRef)game.getplayer().RemoveItem(Gold, InvestAmount.value as int)VendorRef.additem(Gold, InvestAmount.value as int)Actor VendorActor=VendorRef as ActorVendorActor.ModFavorPoints(PerkInvestorFavorReward.value as Int)EndFunctionglobalvariable Property PerkInvestorFavorReward  AutoGlobalVariable Property InvestAmount  Auto

Unfortunately I'm not that, what you call a expert scripter - so I would be glad about every suggestion.

Thanks!
User avatar
Kate Schofield
 
Posts: 3556
Joined: Mon Sep 18, 2006 11:58 am

Post » Thu Jun 21, 2012 2:53 am

I think there's more to it than that script. That snippet only gives the vendor the gold immediately (not changing their permanent respawning gold supply) and makes you their friend...
User avatar
Cayal
 
Posts: 3398
Joined: Tue Jan 30, 2007 6:24 pm

Post » Thu Jun 21, 2012 3:12 am

the way perkinvestor works is

1. the vendor should have levelLists in their inventory that are set to Chance In None = Use Global. the global in question should be a specific globalVariable that is just for your vendor. if you want multiple choice, you should create multiple lists and variables.

all of the variables start out at a value of 100 (so that there is a 100% chance the list will never spawn)


2. once your dialogue is initiated and the player makes their choice, you do the transfer gold, then you set the appropriate global to a value of 0 (so now that list has a 0% chance to never spawn items)
User avatar
Steven Nicholson
 
Posts: 3468
Joined: Mon Jun 18, 2007 1:24 pm

Post » Thu Jun 21, 2012 1:27 am

Yesterday night I played around with the investor perk in the CK. So here's some more info:

The perk, which is seen in the game is settled in "Investor" (FormType "Perk"), but this perk just refers to a Quest-Form named "PerkInvestor" (like said above). In this Quest you got all the dialogue options and the script, that I posted before. The script from above uses a GlobalVariable called "InvestAmount" (in Vanilla = 500), which you also find in the CK.
In addition there are many other GlobalVariables and LeveledItems called f. e. "PerkInvestorWhiterunMagic" and "PerkInvestorWhiterunMagicList". The variables all got (also been said) a value of 100. The lists look like this:

http://i47.tinypic.com/6r7x9i.jpg

There you got the LeveledItem "PerkInvestorStoreUpgrade", which looks like this:

http://i47.tinypic.com/jsoemu.jpg

In addition: Every merchant, in which you can invest, has a LeveldItemList of the type “PerkInvestorWhiterunMagicList” in his “Container” (f. e. “MerchantWhiterunFarengarsChest”).

So far the vanilla settings.

What I've tried, was…
- to modify the GlobalVariable "InvestAmount" (from 500 to 1500),
- set the line from the above script "int Property GoldAmount = 500 Auto" to "int Property GoldAmount = 1500 Auto"
- alter the count of the “PerkInvestorStoreUpgrade” from 500 to 1500

So this happens: Still I can invest only one time in a single merchant (just logic, didn’t alter something which helps me by this). If I invest in a merchant, I lose only 500 gold (this amount is stated in the dialogue as well), but he gets 1500 gold permanently. Although this is not quite what I wanted, it’s a little development from nothing ;-)

What I don’t get: Why I do not lose more money, if I invest? In the dialogue options (Quest “PerkInvestor” -> “Dialogue Views”) I can find, that the expelled amount of gold is set as the variable “InvestAmount”. So if I alter this, why I don’t lose more money? I hope this is easy for someone, who get more into scripts than me.

But how can I invest more often in a merchant? Just say: Every character level I reach, I can invest one time in every merchant.

Sorry for my dilettante kind of approach – but I try my best to get into it. So if you got any ideas, post your script (or the needed settings in the CK) and please explain it to me.

Thanks!
User avatar
Dalley hussain
 
Posts: 3480
Joined: Sun Jun 18, 2006 2:45 am

Post » Wed Jun 20, 2012 11:05 pm

if you want to see an example of multiple investment amounts for a merchant, you can download my mod and poke around. i have all the source code included

search "black tower and black sacrament armor" on nexus (the site is down right now i cant link it directly)
User avatar
Hella Beast
 
Posts: 3434
Joined: Mon Jul 16, 2007 2:50 am

Post » Thu Jun 21, 2012 7:24 am

Okay,

I loaded your mod and take a look at it in the CK. Could you point out, on which entries I should focus? And what exactly do you mean with multiple investment amounts? Did you implented various options of amounts, which can be invested (f. e. 500, 1000 and 1500) or do you just multiply the count of the "PerkInvestorStoreUpgrade", so that the merchant got more money from your investment.
User avatar
Carlos Vazquez
 
Posts: 3407
Joined: Sat Aug 25, 2007 10:19 am

Post » Thu Jun 21, 2012 2:38 am

Now I got a little further, but really need help by understanding what happens: In the quest "PerkInvestor" you find under "Player Dialogue" and then "PerkInvestorBranch1Topic1" various replies from all merchant-npcs, who would take an investment from you. Double-click on one of the replies opens the topic info, in which several conditions are deposited.
One of this conditions seem important, if you want to invest more often than one time:
S GetGlobaValue Global:'PerkInvestorWhiterunMagic' (note: the last to words can differ, according to the merchant, which reply was chosen) == 100.0

If you delete this condition, the dialogue option "I'd like to make an investment in your store" won't disappear anymore, if you did invest in the specific merchant before. So far so good.
Now you can invest as often as you want in the same merchant. His gold capital even rises every single time and even if you wait a few days it will stick on the (multiple times) rised amount... but: If you sell him goods and his capital falls below the rised capital, he will stick on this lower capital - regardless how long you wait for respawning. And here is my question: Why? What tells him, that his permanent capital is not the often rised, but the initial one?
User avatar
James Rhead
 
Posts: 3474
Joined: Sat Jul 14, 2007 7:32 am

Post » Thu Jun 21, 2012 5:38 am

Additional to the initial script in my thread opening posting, there is another important one to the whole investment function:

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 1Scriptname TIF__000B1FE0 Extends TopicInfo Hidden;BEGIN FRAGMENT Fragment_0Function Fragment_0(ObjectReference akSpeakerRef)Actor akSpeaker = akSpeakerRef as Actor;BEGIN CODEPerkInvestorArcadiaGV.Value=http://forums.bethsoft.com/topic/1369909-variable-investor-mod/0(GetOwningQuest() as PerkInvestorQuestScript).GoldTransfer(AKSpeaker);END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin commentglobalvariable Property PerkInvestorArcadiaGV  Auto 

It's the script for Arcadia (Whiterun Apothecary), but there is one of that for every merchant (you can invest in). The global variable "PerkInvestorArcadiaGV" is defined as the CK-variable "PerkInvestorWhiterunApotheecary". Setting this variable to zero ("PerkInvestorArcadiaGV.Value=http://forums.bethsoft.com/topic/1369909-variable-investor-mod/0") will spawn the Item "PerkInvestorWhiterunMagicList" (which carry the item "PerkInvestorStoreUpgrade", which carry the additional 500 gold) in the chest of arcadia.

Is this right or do I get something wrong? Do "PerkInvestorArcadiaGV.Value=http://forums.bethsoft.com/topic/1369909-variable-investor-mod/0" set this variale to zero? Or is it just a check?
User avatar
Liv Brown
 
Posts: 3358
Joined: Wed Jan 31, 2007 11:44 pm

Post » Thu Jun 21, 2012 12:18 am

Yes, this would appear to be the really important part, the one that actually accomplishes the "investing".
User avatar
Milagros Osorio
 
Posts: 3426
Joined: Fri Aug 25, 2006 4:33 pm

Post » Thu Jun 21, 2012 10:05 am

Okay,

great! My idea is: Every time the above script is triggered, add 500 to the count of the object "Gold001" in the leveled item "PerkInvestorStoreUpgrade". Just need someone to script that. So is there any command to increase the "count" of a miscobject ("Gold001"), which is in an leveleditem? If yes, to increase this, every time the script is triggered, is all what should be done. But I'm not fluid in papyrus, so please... Could anyone just post the line(s) which is/are needed to do so?

After that, it is even unnecessary to implement multiple variables and lists. Every merchant only has to get a own "PerkInvestorUpgrade"-Item, which is made easily.
User avatar
maddison
 
Posts: 3498
Joined: Sat Mar 10, 2007 9:22 pm

Post » Wed Jun 20, 2012 8:20 pm

Hi,

I tried to script it by myself and can even compile this piece of script:

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 1Scriptname TIF__000B1FDC Extends TopicInfo Hiddenmiscobject Property Gold Autoleveleditem Property VendorList Auto;BEGIN FRAGMENT Fragment_0Function Fragment_0(ObjectReference akSpeakerRef)Actor akSpeaker = akSpeakerRef as Actor;BEGIN CODEPerkInvestorFarengarGV.Value=http://forums.bethsoft.com/topic/1369909-variable-investor-mod/0(GetOwningQuest() as PerkInvestorQuestScript).GoldTransfer(AKSpeaker)VendorList.AddForm(Gold, 1, 2000);END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin commentglobalvariable Property PerkInvestorFarengarGV Auto

miscobject Property Gold Auto = Gold001
leveleditem Property VendorList Auto = PerkInvestorStoreUpgrade

But it doesn't work. The amount of gold just rises around 500 gold (the standard investment value). Why my extra count of 2000 doesn't show up? Is something wrong with the syntax of the script?
User avatar
Benito Martinez
 
Posts: 3470
Joined: Thu Aug 30, 2007 6:33 am

Post » Thu Jun 21, 2012 4:14 am

Hi again,

I found my mistake :biggrin: - my script was successful all the time, but I defined one of the variables as constant, so that the chance, that the list won't spawn, remained by 100 percent (so nothing happened). I killed now the flag at "constant", and it works!

So this is it! Multiple investments are possible. I just need some help by stick the rised capital to a save game. At this moment, after a save and a new load the rised amount is gone (because AddForm don't stick to a savegame). But I read somewhere, that there is a way to script around that problem. I don't know exactly what I have to script to do so, neither where the lines have to be placed. Could someone please add the needed lines to my script above? Or just post, how to do it?
User avatar
Taylah Haines
 
Posts: 3439
Joined: Tue Feb 13, 2007 3:10 am


Return to V - Skyrim