What's happening is Erengard uses an investment chest with an attached script to make things happen: you put gold inside the chest then spend that gold on upgrades and keeping the mine functioning (as well as being where you start getting paid). What's happening is that the instant I put money into the chest, it immediately empties and resets to 0 so I can't make anything happen. This is the script of the chest:
begin em_s_moneychest
short state
long gold_pre
long gold_diff
long gold_amount
if ( em_g_account != gold_amount )
set gold_diff to em_g_account - gold_amount
while ( gold_diff > 0 )
addItem "gold_001" 30000
set gold_diff to gold_diff - 30000
endwhile
while ( gold_diff < -29999 )
removeItem "gold_001" 30000
set gold_diff to gold_diff + 30000
endwhile
while ( gold_diff < -7499 )
removeItem "gold_001" 7500
set gold_diff to gold_diff + 7500
endwhile
while ( gold_diff < -1499 )
removeItem "gold_001" 1500
set gold_diff to gold_diff + 1500
endwhile
while ( gold_diff < -249 )
removeItem "gold_001" 250
set gold_diff to gold_diff + 250
endwhile
while ( gold_diff < -49 )
removeItem "gold_001" 50
set gold_diff to gold_diff + 50
endwhile
while ( gold_diff < -9 )
removeItem "gold_001" 10
set gold_diff to gold_diff + 10
endwhile
while ( gold_diff < -2 )
removeItem "gold_001" 3
set gold_diff to gold_diff + 3
endwhile
while ( gold_diff < 0 )
removeItem "gold_001" 1
set gold_diff to gold_diff + 1
endwhile
set gold_amount to getItemCount "gold_001"
endif
if ( state==1 )
if ( menumode==0 )
set gold_amount to getItemCount "gold_001"
set gold_diff to gold_amount - gold_pre
set em_g_account to em_g_account + gold_diff
if ( GetJournalIndex "EM_PCOwner" == 10 )
MessageBox "You now have %G goldpieces invested in your mine." em_g_account
endif
set state to 0
endif
endif
if ( OnActivate==1 )
set gold_pre to getItemCount "gold_001"
set state to 1
Activate
endif
end