Xpyder Posted February 17, 2016 Share Posted February 17, 2016 I want to solve the issue where running a portable server with Cycle, you don't get the power from the server. My plan is to modify it to run at the end of the Corps turn I want to modify the Cycle program to run before all the other programs.I suspect the easiest way to do this is to change the trigger from (simdefs.TRG_START_TURN) to whatever event marks the end of the corps turn. - I need to know where I can find triggers, if there isn't a list, I can look up an existing script if anyone knows of one that executes at the end of the corps turn (I MIGHT be able to derive from a combination of end of your turn and start of corps turn if Klei made them all follow the same naming scheme, but I'm not sure what scripts to look for) - I need to know how to override an existing script. Do I just put in a copy of the full script with the exact same name or will that duplicate the program? Can I just modify a single property of the Cycle object? Is there a better way to do this? I found where it is in the Mainframe_abilities.lua in the scripts.zip of the dlc . I downloaded (API EXAMPLE MOD) and it seems pretty straightforward provided I know how to overwrite an existing script and what the necessary trigger is and thanks in advance <3 <3 <3 Link to comment Share on other sites More sharing options...
Xpyder Posted February 17, 2016 Author Share Posted February 17, 2016 UPDATES: I dug into it a bit more and I can see how to modify it to run an event on the corps turn, but the code implies that I would be modifying the corps "power" not my own. I'll need to test once I can figure out how to override the DLC script. I found a mod that overrides a default script but I don't know how to modify this to reference the DLC abilities local mainframe_abilities_base = include("sim/abilities/mainframe_abilities") I'm guessing its something like this, but I need help with the real path local mainframe_abilities_contingencyplan = include("sim/dlc/dlc1/mainframe_abilities") Link to comment Share on other sites More sharing options...
Xpyder Posted February 18, 2016 Author Share Posted February 18, 2016 Here's what I have so far: Spoiler [brackets indicate untested pseudocode] local mainframe_abilities_contingencyplan = [include("sim/dlc/dlc1/mainframe_abilities")] mainframe_abilities_contingencyplan.cycle = util.extend( mainframe_abilities_contingencyplan.cycle ) { executeAbility = function( self, sim ) local player = sim:getCurrentPlayer() sim:getTags().clearPWREachTurn = nil -- disable old clear tag in case it's enabled mid campaign if player:isNPC() then sim:dispatchEvent( simdefs.EV_PLAY_SOUND, cdefs.SOUND_HUD_MAINFRAME_PROGRAM_AUTO_RUN ) sim:dispatchEvent( simdefs.EV_SHOW_WARNING, {txt=STRINGS.DLC1.PROGRAMS.CYCLE.WARNING, color=cdefs.COLOR_PLAYER_WARNING, sound = "SpySociety/Actions/mainframe_gainCPU",icon=self.icon } ) [sim:getCurrentPlayer():addCPUs( -sim:getCurrentPlayer():getCPUs( ), sim )] -- CPUs reference taken from Siphon Daemon player:addCPUs( 3 ) end end, onSpawnAbility = function( self, sim ) DEFAULT_ABILITY.onSpawnAbility( self, sim ) --sim:getTags().clearPWREachTurn = true -- handled in executeAbility end, onDespawnAbility = function( self, sim ) DEFAULT_ABILITY.onDespawnAbility( self, sim ) --sim:getTags().clearPWREachTurn = nil -- handled in executeAbility end, } Link to comment Share on other sites More sharing options...
Miderre Posted February 19, 2016 Share Posted February 19, 2016 On 2/17/2016 at 6:12 PM, Xpyder said: UPDATES: I dug into it a bit more and I can see how to modify it to run an event on the corps turn, but the code implies that I would be modifying the corps "power" not my own. I'll need to test once I can figure out how to override the DLC script. I found a mod that overrides a default script but I don't know how to modify this to reference the DLC abilities local mainframe_abilities_base = include("sim/abilities/mainframe_abilities") I'm guessing its something like this, but I need help with the real path local mainframe_abilities_contingencyplan = include("sim/dlc/dlc1/mainframe_abilities") Well in New Items and Auguments, there is this line: local dlc1 = include( "dlc1/itemdefs" ) so I'd guess that the "sim/dlc" part isn't needed in the file path. I'm no expert however. Link to comment Share on other sites More sharing options...
Xpyder Posted February 23, 2016 Author Share Posted February 23, 2016 Yeah, I've been looking at some other mods and it seems that dlc lua's are mounted at include( "dlc1/xxx" ) I'm probably going to change how I go about doing it but it's currently crashing whenever I try to load it (are there logs? i'm guessing i'm referencing something I haven't loaded but having trouble tracking it down) and beat my head against it too long so I need to regroup. Specifically because the power reset is coded into the Start Turn event directly, (not in the program) I'm guessing there might be other things that use that functionality. So for compatibility, instead I may register an on end of turn event that kind of overrides the default clearPWReachTurn functionality instead of just changing Cycle. Link to comment Share on other sites More sharing options...
Miderre Posted February 24, 2016 Share Posted February 24, 2016 Yeah there is a log. It will probably be under the Invisible Inc folder in your Documents folder. By itself the log isn't too helpful, but if you write to the log in your modifications you can really narrow done where the failure is. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
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.