iqoniq Posted August 13, 2021 Share Posted August 13, 2021 The deposit script on my CCM+ mod deals can end up dealing with large values (50 million+). It seems to be that once it hits a certain level, the game starts changing the values a couple of seconds later of it's own volition after it's displayed the balance. The correct amount is initially reported, but then before the script has even finished it's run through (I put a few debug messageboxes in to see when it changed), it will add or subtract some arbitrary amount (from - 40 to +16). It's not going over the limit of 2,147,483,647 as the script will automatically start rejecting any transactions that will take it over a 2 billion vault limit so I know it's not that. Can someone please explain to me what's going on, because I'm completely foxed? TIA. Link to comment Share on other sites More sharing options...
SKKmods Posted August 13, 2021 Share Posted August 13, 2021 Are you using Mod() or SetValue()Are you passing an Int or Float variable. Link to comment Share on other sites More sharing options...
iqoniq Posted August 13, 2021 Author Share Posted August 13, 2021 Are you using Mod() or SetValue()Are you passing an Int or Float variable. SetValue and Int. The script looks like this. Function dodeposit() int balance = 0 int depositamount = ccm_depositamount.GetValueInt() int vsrcid = ccm_vsrcid.GetValueInt() int balanceduplicate = 0 ;; used to show the original amount int notificationalert = ccm_notification.GetValueInt() ; Check to see which vault is being managed. if vsrcid == 1 balance = ccm_balancev1.GetvalueInt() balanceduplicate = balance ccm_balancev1.SetValue(balance + depositamount) elseif vsrcid == 2 balance = ccm_balancev2.GetvalueInt() balanceduplicate = balance ccm_balancev2.SetValue(balance + depositamount) ; Above is rinsed and repeated for the rest of the vaults, but truncated for brevity. endif if notificationalert == 0 debug.messagebox("Deposit of " + depositamount+ " caps into Vault #" + vsrcid + " has been accepted. Balance increased from " + balanceduplicate + " caps to " + balance + " caps.") elseif notificationalert == 1 debug.notification("Deposit of " + depositamount + " caps into Vault #" + vsrcid + " has been accepted. Balance increased from " + balanceduplicate + " caps to " + balance + " caps.") endif depositquest.setstage(30) endfunction Link to comment Share on other sites More sharing options...
SKKmods Posted August 13, 2021 Share Posted August 13, 2021 I have found "issues" with GetValueInt and SetValueInt and you may be seeing similar plus autocasting int values. To ensure that is not your problem I would suggest: 1. When storing in ActorValues or GlobalValues always pass precomputed float variables to trim out any casting conversion issues.2. When modifying an existing value use Mod not Set so ccm_balancev1.Mod(depositamount) Link to comment Share on other sites More sharing options...
iqoniq Posted August 13, 2021 Author Share Posted August 13, 2021 I wasn't able to resolve the issues with the global variables, but I've worked around it by creating custom actor values, and Mod'ing the values and it works. Thanks for the help :) Link to comment Share on other sites More sharing options...
Recommended Posts