Caleb2020

How to run mod code at start/end of turn

Recommended Posts

Caleb2020    0

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?

Share this post


Link to post
Share on other sites
Hekateras    12
Posted (edited)

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 ( https://discordapp.com/invite/aQrXEse ). 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.

Edited by Hekateras

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now