Quantcast

Jump to content

» «
Photo

Bank Account

GTA4 .NET script mod
51 replies to this topic
AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#31

Posted 15 September 2012 - 04:32 AM Edited by AngryAmoeba, 15 September 2012 - 04:34 AM.

If you can narrow down where the unsupported ATMs are, I'll add them immediately. I've added every ATM that I've found, but I knew I probably missed some, especially in Alderney. Thanks for the report!

I agree that the vanilla ATM screen is a big blemish for the mod. I always just ignored it, since you can check your balance by pressing B, but I understand your idea and I like it. I'm just not sure how to perfectly detect when the vanilla ATM screen is displayed. I could check for a nearby ATM every time E is pressed, but it might trigger when you pick up an object or whistle for a taxi near an ATM, for instance.

Another problem is that the starting and ending animations are never perfectly aligned with the ATM. Usually, your hand clips through the ATM. I know there's a way to fix this, but never figured it out.

@ch3y3zze: Previously, it was indeed possible to add ATM locations to the code by yourself. Unfortunately, now the script is compiled into a DLL file, which can't be directly edited in Notepad. You can decompile it, but I've never tried that so I don't know how easy it is.

ch3y3zze
  • ch3y3zze

    ni**erKILLER

  • BUSTED!
  • Joined: 30 Aug 2012

#32

Posted 15 September 2012 - 04:37 AM Edited by ch3y3zze, 15 September 2012 - 04:43 AM.

yeah download ILSpy and add scripthookdotnet to it then all .net scripts will be open source for u ;D

if u really want to protect your source u need to obfuscate, compiling isnt enough

AngryAmoeba, for clipping u can get appropriate offset from atm vector3 and control distance u can access atm, perhaps if too close, u remove control from player and task them to go where ur offset is, face the correct heading and then play animation, u can loop these instructions and dont move to next instruction until a condition is satisfied, if u need help let me know ;D

AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#33

Posted 15 September 2012 - 08:55 PM

No need for me to obfuscate, since I'm not trying to keep the code secret. This script is compiled only because it has multiple .CS source files.

Thanks for the suggestion, though it's pretty much what I've already tried to do. Right now when the player starts a transaction, I make them turn toward the proper heading, looping if necessary (can't loop until the heading is exact, though, because sometimes it's just not possible and the loop continues forever). I tried making the player walk to the correct Vector3, but that wasn't precise the task seemed to end once he was just near the correct position. I'll revisit this and see if I can do better.

AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#34

Posted 16 November 2012 - 05:56 AM Edited by AngryAmoeba, 03 September 2013 - 02:56 PM.

Alright, I've been sitting on this update for a while. Just making sure the improvements didn't break anything.

Changes in v1.3
- Improved animation alignment by sliding the player into place.
- Partially fixed bug where ATMs wouldn't work if they weren't individually coded for.
. . . . Now they should all work when they're nearby (i.e. when they're loaded into the game world).
. . . . To mark them on the map from far away, I still have to code for them individually.
- Partial workaround for bug where the ATM screen showed your cash instead of your balance.
. . . . Can't display more than $999,999,999 (because that's the max cash amount).
. . . . Makes the cash displayed in the top-right count up/down obnoxiously.
- Changed default ResetKey INI setting to X (previously Delete).
- Added INI setting LoseCashOnChaseDeath (applies only to deaths during chases, instead of all deaths).
- Cash isn't deposited or withdrawn until transactions are actually complete.
- Fixed jerky cop car movement during transactions.
- Refactored code to improve its structure somewhat, and compiled to DLL file.
- Simplified BankAccount.dat file.

The Loot
  • The Loot

    Square Civilian

  • Members
  • Joined: 14 Apr 2010

#35

Posted 27 February 2013 - 08:18 AM

Finally installed the new version and I'm getting an error.

CODE
2013-02-26 23:37:52 - Error in constructor of script 'BankAccount':
                     System.ArgumentNullException: Value cannot be null.
                     Parameter name: String
                        at GTA.ScriptThread.LoadScriptNow()


INI here if needed.
CODE

; You earn this % of your balance every day
InterestRate = 1.0

; Mark nearest ATM on map when you try to start a transaction too far from ATMs
MarkNearestATM = true
IconScale = 1.5

; Lose all the cash you're carrying when you die or get arrested
LoseCashOnArrest = true
LoseCashOnChaseDeath = true
LoseCashOnDeath = true

; "Mission complete" sound effect for earning interest
PlaySound_Interest = true

; Messages for earning interest, marking ATMs, and being a bit too far from an ATM
ShowMsg_Interest = true
ShowMsg_MarkedATM = true
ShowMsg_MoveCloser = true
MsgDurationSeconds = 4

; See here for all key names:
; msdn.microsoft.com/en-us/library/system.windows.forms.keys.aspx
StartAndEndKey = B
ResetKey = X

DepositKey = A
WithdrawKey = D
DefaultMoveAmount = 1000

; Adjusting the move amount
MoveMoreKey = W
MoveLessKey = S
ChangeAmount = 1000
ChangeFastModifier = ShiftKey
ChangeFastAmount = 10000
ChangeSlowModifier = ControlKey
ChangeSlowAmount = 100

AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#36

Posted 27 February 2013 - 09:36 AM

I think I figured it out, but you almost stumped me! Never saw that error before it didn't even make sense to me (because the script constructor has no parameters). Your INI settings worked fine, and Google turned up nothing useful...

Turns out you probably still have the old BankAccount.cs file (replaced by BankAccount.net.dll in the latest version). I bet the new version of the script is running fine, even though the old one is crashing when it tries to read the new, simplified BankAccount.dat file. smile.gif

MeGusta90
  • MeGusta90

    I want a cool image under this sentence

  • Members
  • Joined: 01 Mar 2013
  • None

#37

Posted 02 March 2013 - 03:25 PM

I like this mod, makes wrecks more fun and realistic.

AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#38

Posted 02 March 2013 - 07:20 PM

I think you meant to post that here. wink.gif

The Loot
  • The Loot

    Square Civilian

  • Members
  • Joined: 14 Apr 2010

#39

Posted 02 March 2013 - 11:07 PM

QUOTE (AngryAmoeba @ Wednesday, Feb 27 2013, 02:36)
Turns out you probably still have the old BankAccount.cs file (replaced by BankAccount.net.dll in the latest version). I bet the new version of the script is running fine, even though the old one is crashing when it tries to read the new, simplified BankAccount.dat file. smile.gif

That could be, but I swore I had removed all the old files. I'll give it another try.

Darlyn
  • Darlyn

    Keyboard & mouse

  • Members
  • Joined: 22 Apr 2006

#40

Posted 09 March 2013 - 06:00 PM Edited by Darlyn, 09 March 2013 - 06:09 PM.

Wait, why'd you remove the auto-save function? I recall you only needing to end the transaction for the dat to be written to in previous versions. I can help you modify it so that it saves at the end of the transaction, like I've done with other script mods.

Also, why'd you make it a DLL? I could've fixed it myself if I had the source.

AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#41

Posted 09 March 2013 - 06:10 PM Edited by AngryAmoeba, 09 March 2013 - 06:15 PM.

QUOTE
Wait, why'd you remove the auto-save function? I recall you only needing to end the transaction for the dat to be written to in previous versions. I can help you modify it so that it saves at the end of the transaction, like I've done with other script mods.

Also, why'd you make it a DLL? I could've fixed it myself if I had the source.

Yeah, the very first version worked that way. I considered it a bug, since your balance really shouldn't save unless you save the game. If someone just wants to mess around and spend all their money without saving, next time they load the game their account shouldn't be empty.

I'll add an INI option for you.

And the script has to be a DLL because it now consists of six separate source files, instead of just one.

AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#42

Posted 10 March 2013 - 10:50 AM Edited by AngryAmoeba, 03 September 2013 - 02:50 PM.

Updated the first post with the new version.

Changes in v1.3.1
- Added SaveAfterTransaction and SaveAfterInterest INI options.

jykl
  • jykl

    Buttmunch

  • Members
  • Joined: 05 Jun 2013

#43

Posted 22 June 2013 - 03:15 AM

Weird bug. Sometimes I lose all of my money just by gaining a star. Really annoying.

AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#44

Posted 22 June 2013 - 09:18 AM Edited by AngryAmoeba, 22 June 2013 - 09:47 AM.

Wow! That's been reported before but I couldn't figure it out. Thanks for reminding me, because I just took another look and found it immediately. Updated the first post with a hotfix! Sorry about your financial losses. sad.gif

Edit: In case you're curious, the script got confused when LoseCashOnChaseDeath was enabled and you died outside of a chase.

jykl
  • jykl

    Buttmunch

  • Members
  • Joined: 05 Jun 2013

#45

Posted 24 June 2013 - 08:44 AM

QUOTE (AngryAmoeba @ Saturday, Jun 22 2013, 09:18)
Wow! That's been reported before but I couldn't figure it out. Thanks for reminding me, because I just took another look and found it immediately. Updated the first post with a hotfix! Sorry about your financial losses. sad.gif

Edit: In case you're curious, the script got confused when LoseCashOnChaseDeath was enabled and you died outside of a chase.

Damn you work fast. Thanks, man!

AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#46

Posted 02 September 2013 - 10:57 PM

Small update in the first post.

Changes in v1.3.2
- Transactions show how much interest you'll earn next, and in how many hours.
- Added ShowNextInterestInfo INI option.
- Added "reloadini" console command (gets settings from the INI without stopping the script).
- DepositKey and WithdrawKey can be held down to move money faster.
- Minor cleanup.
- Retroactively renamed versions 1.2.8 and 1.2.9 to 1.3 and 1.3.1.

WandererNiko
  • WandererNiko

    Wanderer

  • Members
  • Joined: 14 Jul 2013

#47

Posted 07 September 2013 - 04:35 PM

Nice mod, but when I press B, the game shows me a message "Error in BankAccount.main", I already got the ScriptHook, and my game is in the version 1.0.7.0. What's wrong?


AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#48

Posted 07 September 2013 - 10:13 PM

My first guess is that you don't have the latest version of the scripthook, 1.7.1.7. If you already have the latest version, please post the whole error message (see the ScriptHookDotNet.log file).


Ricebox
  • Ricebox

    Mommy

  • Members
  • Joined: 13 Sep 2013
  • None

#49

Posted 16 September 2013 - 07:08 AM

Fun stuff. A suggestion, though; the feds should clear your bank account if you die with more than three or four stars (maybe make it configurable).


AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#50

Posted 29 September 2013 - 01:09 AM

Thanks for the suggestion, Ricebox. I added a few INI settings for that in today's update, which is in the first post.

 

Changes in v1.3.3

- During transactions, the interest countdown is in real minutes and seconds.
- Added UseGameTimeCountdown INI option to show in-game hours and minutes instead.
- INI settings for losing money on death/arrest let you choose how much you lose.
- Added INI settings to lose money from your account when you die or get arrested.
- Added minimum wanted level INI settings for losing money on chase death.
- Renamed INI settings for saving data to clarify that they don't save the game.
- Divided INI into sections: Bank Account, HUD & Sound, and Keys.
- Reduced bug: When balance is huge, ATM screen shows $999999999 instead of $0.
- Minor cleanup.


Ricebox
  • Ricebox

    Mommy

  • Members
  • Joined: 13 Sep 2013
  • None

#51

Posted 01 October 2013 - 05:36 AM

Cool! Is there anyway I can have ATM screens showing how much cash I have on me again? I try to keep the HUD at a minimum so I'm kind of forced to take advantage of in-game features like that.


AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#52

Posted 13 October 2013 - 11:32 PM

Sorry for the delay. Included that option in this little update. Download is in the first post.

 

Changes in v1.3.4

- Changed INI settings:
. . . . For saving data: They also autosave the game.
. . . . For losing money: Negative numbers make you lose ALL of your cash/balance.
- Added INI option to show cash instead of balance on ATM screen (as in vanilla).
- Reduced max account balance to $2 billion to simplify code and avoid bugs.
- Fixed crash if you typed a balance over 4,294,967,295 into BankAccount.dat.
- Minor cleanup.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users