Guest Messenjah Posted August 20, 2012 Share Posted August 20, 2012 Woohoo! It is actually storing the value and updating it now! However, when I call on the PayGold() function, it doesn't seem to remove any gold from my inventory. Although the guards don't seem to attack me and the people I stole from appear to still be after me. :P Any way to fix that function? Link to comment Share on other sites More sharing options...
steve40 Posted August 20, 2012 Share Posted August 20, 2012 Did you have enough gold?If you're not doing so already, you probably want to use a test somewhere to make sure that the player has enough gold before buying the favor. Link to comment Share on other sites More sharing options...
gasti89 Posted August 20, 2012 Share Posted August 20, 2012 (edited) Maybe there's something wrong with the parameters i suggested in the RemoveItem, try using "ASXDiscount as int". As for the check, there's a condition "Can pay crime gold", but actually you need half of it, so you must find a dynamic condition that will lead to a negative answer by the NPC (or not show the pay option at all, your choice) EDIT: Maybe i've found a solution (don't have the CK now, just looking the Wiki). Put on the dialogue a condition "GetGold", run it on TARGET. Now check the "Use Global" in the comparison field. You'll now have access to your globals, select ASXDiscount. The only thing i'm afraid about is: the gold count is a Int, while the Global is a Float. Will this always return false? Edited August 20, 2012 by gasti89 Link to comment Share on other sites More sharing options...
Guest Messenjah Posted August 20, 2012 Share Posted August 20, 2012 I'll take a look at it in a bit. As for my tests... the gold it requires is like 12 coins lol. I have well over 17000 gold right now. I'm using a level 43 character and I almost never buy anything in-game. Link to comment Share on other sites More sharing options...
steve40 Posted August 21, 2012 Share Posted August 21, 2012 The only thing i'm afraid about is: the gold count is a Int, while the Global is a Float. Will this always return false? It should work perfectly :thumbsup: Link to comment Share on other sites More sharing options...
Guest Messenjah Posted August 22, 2012 Share Posted August 22, 2012 Put on the dialogue a condition "GetGold", run it on TARGET. Now check the "Use Global" in the comparison field. You'll now have access to your globals, select ASXDiscount. Didn't work. It will check the value of the global but not if the player has the same value as the global. Wouldn't you need to use PLAYER instead of using TARGET? The main problem I'm worried about is how to get the script to pull gold from the player's inventory. I have plenty of gold for it to pull gold out of and yet it won't remove a single coin. :P Link to comment Share on other sites More sharing options...
gasti89 Posted August 22, 2012 Share Posted August 22, 2012 (edited) In that case target is the player so both will do the same i think. About the gold removal function, what about this: Function PayGold() Int GoldAmount = ASXDiscount as Int Game.GetPlayer().RemoveItem(Gold, GoldAmount) ReachCrimeGold.SetCrimeGold(0) ReachCrimeGold.SetCrimeGoldViolent(0) ReachCrimeGold.SetPlayerEnemy(False) EndFunction EDIT: Btw, i don't know why it doesn't make a check for Gold matching the Global. Have you set the comparison to ">="? Cause if you set it to "==" it will work only if you have exactly the same amount of gold of the Global. Edited August 22, 2012 by gasti89 Link to comment Share on other sites More sharing options...
steve40 Posted August 23, 2012 Share Posted August 23, 2012 (edited) Guys, I think I know what the problem is. The "Gold" property should not be made "conditional" it doesn't make sense to do so.I'm also very suspicious that the "Gold" property is not being filled correctly. Try renaming "Gold" to "Gold001" and auto-filling the properties again.Also, why is it necessary to use the global variable "ASXDiscount"? It's just complicating the matter unnecessarily. Why not simply make "Discount" a conditional property and use that instead. I've tidied up the script somewhat. Before using this script, **remove the previous conditional function** that you were trying, as it shouldn't be necessary. Scriptname ASX_BrothelDialogueQuest extends Quest Conditional Int Property RaajahFriend Auto Conditional Int Property ContractRunning Auto Conditional Int Property FavorPoints Auto Conditional Int Property SuraniGreet Auto Conditional Int Property AcceptJob Auto Conditional Int Property Discount auto conditional; trade gold in whole numbers Quest Property BrothelQuest Auto Faction Property ReachCrimeGold Auto MiscObject Property Gold001 Auto {I renamed "gold" so it will auto-fill. THE PROPERTY SHOULD *NOT* BE CONDITIONAL - steve40} Function UpdateGold() {Updates Discount to discounted value. Used during initial dialogue} Discount = Math.Floor(ReachCrimeGold.GetCrimeGold() / 2) ; make sure it is an int EndFunction Function PayGold() {Function used to remove correct ammount of gold from player inventory and removes crime gold from the correct faction} Game.GetPlayer().RemoveItem(Gold001, Discount) ReachCrimeGold.SetCrimeGold(0) ReachCrimeGold.SetCrimeGoldViolent(0) ReachCrimeGold.SetPlayerEnemy(False) EndFunction If you REALLY need the "ASXDiscount" global, then try this: Scriptname ASX_BrothelDialogueQuest extends Quest Conditional Int Property RaajahFriend Auto Conditional Int Property ContractRunning Auto Conditional Int Property FavorPoints Auto Conditional Int Property SuraniGreet Auto Conditional Int Property AcceptJob Auto Conditional GlobalVariable Property ASXDiscount Auto Conditional Int Property Discount auto conditional; trade gold in whole numbers Quest Property BrothelQuest Auto Faction Property ReachCrimeGold Auto MiscObject Property Gold001 Auto {I renamed "gold" so it will auto-fill. THE PROPERTY SHOULD *NOT* BE CONDITIONAL - steve40} Function UpdateGold() {Updates ASXDiscount to discounted value. Used during initial dialogue} Discount = Math.Floor(ReachCrimeGold.GetCrimeGold() / 2) ; make sure it is an int ASXDiscount.SetValue(Discount as float) ; ASXDiscount global variable is a float UpdateCurrentInstanceGlobal(ASXDiscount) EndFunction Function PayGold() {Function used to remove correct ammount of gold from player inventory and removes crime gold from the correct faction} Game.GetPlayer().RemoveItem(Gold001, Discount) ReachCrimeGold.SetCrimeGold(0) ReachCrimeGold.SetCrimeGoldViolent(0) ReachCrimeGold.SetPlayerEnemy(False) EndFunction Edit: these lines of code appear to be redundant at this time: Int Property RaajahFriend Auto Conditional Int Property ContractRunning Auto Conditional Int Property FavorPoints Auto Conditional Int Property SuraniGreet Auto Conditional Int Property AcceptJob Auto Conditional Quest Property BrothelQuest Auto Edited August 23, 2012 by steve40 Link to comment Share on other sites More sharing options...
steve40 Posted August 23, 2012 Share Posted August 23, 2012 (edited) EDIT: Btw, i don't know why it doesn't make a check for Gold matching the Global. Have you set the comparison to ">="? Cause if you set it to "==" it will work only if you have exactly the same amount of gold of the Global. Possibly because he has made the Gold MiscObject as a conditional property and he might actually be comparing the Gold *REFERENCE* against the discount, rather than checking the gold VALUE/QUANTITY?? :tongue: Edit: the RemoveItem call on the gold *SHOULD* work no matter how you do it. If it isn't working then either the gold property isn't filling correctly, or the mod is broken. @messenjah: if you STILL can't get the script to work, try removing the script, save the mod, restart CK, reload the mod, add the script back, fill the properties again, save the mod then test it again. Edited August 23, 2012 by steve40 Link to comment Share on other sites More sharing options...
Recommended Posts