How to run mod code at start/end of turn

Recommended Posts

Hello, i am trying to make a mod that slows the alarm; as far as i know no such mods exist.

I snipped some code from the teleport shroud mod that is capable of stopping the alarm, but i don't know how to run it every turn. I don't want it to be a program, item, or augment. Just global code that runs passively in the background. Any example code that runs a simple function once a turn?

Link to comment
Share on other sites

Hi Caleb!

First off, this place is pretty much dead. I pretty much only come here to tell people that it's dead and tell them to join the Discord ( ). You'll get much faster response times that way, mod support (and modding support from the community) for the game is quite good.

Most of the game's 'background' stuff during missions is handled in escape_mission.lua or mission_util.lua, both are in sim/missions. You could try searching for a function in mission_util that is triggered at start of turn and append your code to that. You could even just write a new escape_mission script from scratch and have it be triggered at start of turn, and add it via the add escape script API. However, the drawback of that is that the final mission uses ending_1 instead of escape_mission (all other missions use both escape_mission and a second, mission type-specific script file). So it would be an incomplete solution.

A really easy way to do this would be through a custom ability (given to e.g. agents rather than items or augments), although you'd have to make sure it's only triggered once per turn, not once per turn per agent. So it is a bit overkill, but it would definitely work.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.