[Snippet] Station money transfer

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
graphicboy
Posts: 718
Joined: Wed, 3. Jul 13, 03:21
xr

[Snippet] Station money transfer

Post by graphicboy » Sun, 24. Mar 19, 05:27

This is a trimmed back, modified aiscript from the only other station money transfer mod I could find. After removing the noise and getting it working, I figured it might be beneficial to the community.

Every 10 minutes:
  • If you have money in the build budget, but nothing to build, the money is transferred to your main station account.
  • If the station has 1,000,000 more than you last set its budget to, it'll transfer the difference to you.
Scripts can't use "min budget" because it triggers the "give money" job, and the "max budget" is twice what you typed in. I don't know what station those numbers sense for, but it doesn't for any of mine.

Enjoy.

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<diff>
	<replace sel="/aiscript[@name='trade.station']/params/param[@name='debugchance']">
		<param name="debugchance" default="100"/>
	</replace>

	<replace sel="/aiscript[@name='trade.station']/interrupts/handler[1]/actions/do_if[1]" pos="after">

		<do_if value="player.age" min="@$nextbudgetwarning">
			<set_value name="$nextbudgetwarning" exact="player.age + 10min" />

			<do_if value="(this.station.buildstorage.wantedmoney == 0) and (this.station.buildstorage.money gt 0)">
				<transfer_money from="this.station.buildstorage" to="this.station" amount="this.station.buildstorage.money"/>
			</do_if>

			<!-- this.station.maxbudget = twice what you last set it to. -->
			<set_value name="$lastManualEntry" exact="this.station.maxbudget/2"/>
			<set_value name="$trigger" exact="$lastManualEntry + 1000000"/>

			<do_if value="this.station.money gt $trigger">
				<transfer_money from="this.station" to="faction.player" amount="this.station.money - $lastManualEntry"/>
			</do_if>
		</do_if>

	</replace>
</diff>

RPINerd
Posts: 54
Joined: Fri, 8. Mar 19, 20:21
x4

Re: [Snippet] Station money transfer

Post by RPINerd » Thu, 28. Mar 19, 21:45

Thank you for this! I feel like station profits should get paid out to the player in the base game...

pflip
Posts: 32
Joined: Mon, 17. Dec 18, 12:16
x4

Re: [Snippet] Station money transfer

Post by pflip » Sun, 31. Mar 19, 07:17

Thank you.

I was thinking if it will make sense that the station (if it had surplus above budget) should fund its building cost.

What I mean >

Dear station manager, if there is something to build at this station and building funds are not enough and you have extra money, use it to build your own darn thing and don`t bother me :)
________________

--- Pflip

---- Imperare sibi maximum imperium est -----

Chris0132
Posts: 1463
Joined: Sun, 22. Jun 08, 01:25
xr

Re: [Snippet] Station money transfer

Post by Chris0132 » Sun, 31. Mar 19, 14:39

RPINerd wrote:
Thu, 28. Mar 19, 21:45
Thank you for this! I feel like station profits should get paid out to the player in the base game...
They do, in a very similar manner to this. If they go well over the last budget you set, they call you and if you dismiss it, you get the money.

It just doesn't actually tell you that's what's happening, nor is it documented, and they shoudn't really need to call you about it.

graphicboy
Posts: 718
Joined: Wed, 3. Jul 13, 03:21
xr

Re: [Snippet] Station money transfer

Post by graphicboy » Mon, 1. Apr 19, 03:16

---
Last edited by graphicboy on Mon, 1. Apr 19, 03:33, edited 1 time in total.

graphicboy
Posts: 718
Joined: Wed, 3. Jul 13, 03:21
xr

Re: [Snippet] Station money transfer

Post by graphicboy » Mon, 1. Apr 19, 03:33

language wrote:
Sat, 16. Mar 19, 13:55
(`language` ping) Hi. Was having an issue getting constant deposits despite my snippet above. Removed RandomTrader and the problem seems to be going away?

language
Posts: 73
Joined: Mon, 9. Dec 13, 10:55
x4

Re: [Snippet] Station money transfer

Post by language » Thu, 4. Apr 19, 21:18

graphicboy wrote:
Mon, 1. Apr 19, 03:33
I have no explanation to this. Random trader accesses only buy/sell offers.
The only money it touches is while checking if the commander/player has enough to buy wares while buying from non player station.

graphicboy
Posts: 718
Joined: Wed, 3. Jul 13, 03:21
xr

Re: [Snippet] Station money transfer

Post by graphicboy » Fri, 5. Apr 19, 02:39

language wrote:
Thu, 4. Apr 19, 21:18
graphicboy wrote:
Mon, 1. Apr 19, 03:33
I have no explanation to this. Random trader accesses only buy/sell offers.
The only money it touches is while checking if the commander/player has enough to buy wares while buying from non player station.
Thanks for the reply. Didn't make sense to me either, so must be a false positive, or something else got into an odd state.

Post Reply

Return to “X4: Foundations - Scripts and Modding”