It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
How to pause the game every 30 seconds. I tried the following in input.as under the tick function but to no avail:

[code]
if (get_gameTime() % 30 == 0) {
pause();
}
[/code]
Post edited June 26, 2017 by freevryheid
This question / problem has been solved by legrafimage
Never tried to mod Star Ruler 2, freevryheid, but generally I'd suspect that your function is too likely to miss the moment, and get skipped.

A safer bet (and I'm assuming get_gameTime() returns seconds) is to set a temporary variable to gameTime, then wait as follows:

if (get_gameTime() - yourTempVar >= 30) [
pause();
set yourTempVar = get_gameTime();
]


(obviously I don't know the precise formatting/commands and haven't checked, but the above should be clear enough)
avatar
legraf: Never tried to mod Star Ruler 2, freevryheid, but generally I'd suspect that your function is too likely to miss the moment, and get skipped.

A safer bet (and I'm assuming get_gameTime() returns seconds) is to set a temporary variable to gameTime, then wait as follows:

if (get_gameTime() - yourTempVar >= 30) [
pause();
set yourTempVar = get_gameTime();
]

(obviously I don't know the precise formatting/commands and haven't checked, but the above should be clear enough)
Thanks legraf, got it to work!

[code]
int gt = get_gameTime();
if (gt % 30 == 0 && !flagged) {
flagged = true;
pause();
}

if (gt % 31 == 0 && flagged) {
flagged = false;
}
[/code]

Had to add a flag as the function is called multiple times within a second. Multiple calls to pause() causes it to pause, unpause, pause, etc

My next mod is adjusting autoexplore so scouts don't have to stop before moving on to next star. Should keep em alive longer :)
Here's the mod:

I cant post links so assemble it yourself:

https : //github.com/freevryheid/sr2mods

+ Pauses game every 30s (on speed = 1)
+ Scouts on auto-explore don't stop (none FTL)

Just git clone into your SR2 mods folder. Activate the mod in game.

enjoy
Fixed pause for high speed games. Setting speed to 10 allows turn-based style of play.