Results 1 to 14 of 14

Thread: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

  1. #1

    Default What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

  2. #2

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    I figured it out, you have to delete scripting.lua
    not sure what else that changes. also you have to save a copy of the mod, exit steam, unsubscribe from part1 online, open steam, then put the pack it in it's rightful folder in workshop->content->#####

  3. #3
    Julio-Claudian's Avatar Senator
    Join Date
    Dec 2011
    Location
    Britannia
    Posts
    1,215

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    Has deleting scripting.lua stopped the AE scripts? Or did you delete it from maga?

  4. #4
    Commissar Caligula_'s Avatar The Ecstasy of Potatoes
    Join Date
    Dec 2013
    Location
    The alcoves in the Koningin Astridpark
    Posts
    5,876

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    You definitely shouldn't delete scripting.lua, that'll just mean one or the other mods won't work. Replace it with this instead.
    Code:
    --------------------------------------------------------------------------------------------------------------------
    -- Include AE logging script
    --------------------------------------------------------------------------------------------------------------------
    
    -- We do this at the start so we can overload the default printing functions ASAP
    local dev = require "lua_scripts.dev"
    
    if dev.settings["gameLogging"] == "true" then
    	-- Overload printing functions with our own
    	out.ting = dev.gameLog
    	print = dev.gameLog
    	output = dev.gameLog
    end
    
    -----------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------
    --
    --	CAMPAIGN SCRIPT
    --
    --	First file that gets loaded by a scripted campaign.
    --	This shouldn't need to be changed by per-campaign, except for the
    --	require and callback commands at the bottom of the file
    --
    -----------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------
    
    -- change this to false to not load the script
    local load_script = true;
    
    if not load_script then
    	out.ting("*** WARNING: Not loading script for campaign " .. campaign_start_file .. " as load_script variable is set to false! Edit lua file at " .. debug.getinfo(1).source .. " to change this back ***");
    	return;
    end;
    
    -- force reloading of the lua script library
    package.loaded["lua_scripts.Campaign_Script_Header"] = nil;
    require "lua_scripts.Campaign_Script_Header";
    
    -- name of the campaign, sourced from the name of the containing folder
    campaign_name = get_folder_name_and_shortform();
    
    -- name of the local faction, to be filled in later
    local_faction = "";
    
    -- include path to other scripts associated with this campaign
    package.path = package.path .. ";data/campaigns/" .. campaign_name .. "/?.lua";
    package.path = package.path .. ";data/campaigns/" .. campaign_name .. "/factions/?.lua";
    
    -- create campaign manager
    cm = campaign_manager:new(campaign_name);
    
    dev.prequire("ae_preamble")
    dev.prequire("ae_start")
    
    -- require a file in the factions subfolder that matches the name of our local faction
    cm:register_ui_created_callback(
    	function()
    		local_faction = cm:get_local_faction();
    		
    		if not (local_faction == "") then
    			output("Loading faction script for faction " .. local_faction);
    			inc_tab();
    			_G.script_env = getfenv(1);
    			
    			-- faction scripts loaded here
    			if load_faction_script(local_faction) and load_faction_script(local_faction .. "_intro") then
    				dec_tab();
    				output("Faction scripts loaded");
    			else
    				dec_tab();
    			end;
    		end
    	end
    );
    
    -- try and load a faction script
    function load_faction_script(scriptname)
    	local success, err_code = pcall(function() require(scriptname) end);
    			
    	if success then
    		output(scriptname .. ".lua loaded");
    	else
    		script_error("ERROR: Tried to load faction script " .. scriptname .. " without success - either the script is not present or it is not valid. See error below");
    		output("*************");
    		output("Returned lua error is:");
    		output(err_code);
    		output("*************");
    	end;
    	
    	return success;
    end;
    
    
    
    -------------------------------------------------------
    --	function to call when the first tick occurs
    -------------------------------------------------------
    
    cm:register_first_tick_callback(
    	function()
    		if is_function(start_game_for_faction) then
    			start_game_for_faction(true);		-- set to false to not show cutscene
    		else
    			script_error("start_game_for_faction() function is being called but hasn't been loaded - the script has gone wrong somewhere else, investigate!");
    		end;
    		
    		start_game_all_factions();
    	end
    );
    
    -------------------------------------------------------
    --	additional script files to load
    -------------------------------------------------------
    
    --require("att_traits")
    require("maga/init")
    
    --------------------------------------------------------------------------------------------------------------------
    -- Include other AE scripts
    --------------------------------------------------------------------------------------------------------------------
    
    dev.prequire("ae_features")
    
    dev.log("scripting.lua ended\n")
    Thanks to Causeless for his post below correcting my mistakes
    Last edited by Commissar Caligula_; May 24, 2018 at 05:07 PM.



  5. #5

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    Quote Originally Posted by Commissar Caligula_ View Post
    You definitely shouldn't delete scripting.lua, that'll just mean one or the other mods won't work. Replace it with this instead.
    Code:
    --------------------------------------------------------------------------------------------------------------------
    -- Include AE logging script
    --------------------------------------------------------------------------------------------------------------------
    
    -- We do this at the start so we can overload the default printing functions ASAP
    local dev = require "lua_scripts.dev"
    
    if dev.settings["gameLogging"] == "true" then
        -- Overload printing functions with our own
        out.ting = dev.gameLog
        print = dev.gameLog
        output = dev.gameLog
    end
    
    -----------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------
    --
    --    CAMPAIGN SCRIPT
    --
    --    First file that gets loaded by a scripted campaign.
    --    This shouldn't need to be changed by per-campaign, except for the
    --    require and callback commands at the bottom of the file
    --
    -----------------------------------------------------------------------------------
    -----------------------------------------------------------------------------------
    
    -- change this to false to not load the script
    local load_script = true;
    
    if not load_script then
        out.ting("*** WARNING: Not loading script for campaign " .. campaign_start_file .. " as load_script variable is set to false! Edit lua file at " .. debug.getinfo(1).source .. " to change this back ***");
        return;
    end;
    
    -- force reloading of the lua script library
    package.loaded["lua_scripts.Campaign_Script_Header"] = nil;
    require "lua_scripts.Campaign_Script_Header";
    
    -- name of the campaign, sourced from the name of the containing folder
    campaign_name = get_folder_name_and_shortform();
    
    -- name of the local faction, to be filled in later
    local_faction = "";
    
    -- include path to other scripts associated with this campaign
    package.path = package.path .. ";data/campaigns/" .. campaign_name .. "/?.lua";
    package.path = package.path .. ";data/campaigns/" .. campaign_name .. "/factions/?.lua";
    
    -- create campaign manager
    cm = campaign_manager:new(campaign_name);
    
    dev.prequire("ae_preamble")
    dev.prequire("ae_start")
    
    -- require a file in the factions subfolder that matches the name of our local faction
    cm:register_ui_created_callback(
        function()
            local_faction = cm:get_local_faction();
            
            if not (local_faction == "") then
                output("Loading faction script for faction " .. local_faction);
                inc_tab();
                _G.script_env = getfenv(1);
                
                -- faction scripts loaded here
                if load_faction_script(local_faction) and load_faction_script(local_faction .. "_intro") then
                    dec_tab();
                    output("Faction scripts loaded");
                else
                    dec_tab();
                end;
            end
        end
    );
    
    -- try and load a faction script
    function load_faction_script(scriptname)
        local success, err_code = pcall(function() require(scriptname) end);
                
        if success then
            output(scriptname .. ".lua loaded");
        else
            script_error("ERROR: Tried to load faction script " .. scriptname .. " without success - either the script is not present or it is not valid. See error below");
            output("*************");
            output("Returned lua error is:");
            output(err_code);
            output("*************");
        end;
        
        return success;
    end;
    
    
    
    -------------------------------------------------------
    --    function to call when the first tick occurs
    -------------------------------------------------------
    
    cm:register_first_tick_callback(
        function()
            if is_function(start_game_for_faction) then
                start_game_for_faction(true);        -- set to false to not show cutscene
            else
                script_error("start_game_for_faction() function is being called but hasn't been loaded - the script has gone wrong somewhere else, investigate!");
            end;
            
            start_game_all_factions();
        end
    );
    
    -------------------------------------------------------
    --    additional script files to load
    -------------------------------------------------------
    
    --require("att_traits")
    --require("maga/init");
    
    --------------------------------------------------------------------------------------------------------------------
    -- Include other AE scripts
    --------------------------------------------------------------------------------------------------------------------
    
    dev.prequire("ae_features")
    
    dev.log("scripting.lua ended\n")
    That should work. If it doesn't, you might need to either add a ; to the end of --require("att_traits")
    OR
    Remove the ; from --require("maga/init");
    OR
    Remove --require("maga/init"); and put it at the very bottom instead (and maybe also do the ; stuff as well, idk how it works
    Close, but this won't work. The -- is a commented out line.

    To fix it, take Caligula's file here and replace the "--require("maga/init")" with "require("maga/init")". The ";" is entirely optional and doesn't do anything (it forcibly marks the end of a line, which can be sometimes useful in Lua).
    modificateurs sans frontières

    Developer for Ancient Empires
    (scripter, developed tools for music modding, tools to import custom battle maps into campaign)

    Lead developer of Attila Citizenship Population Mod
    (joint 1st place for Gameplay Mods in 2016 Modding Awards)

    Assisted with RMV2 Converter
    (2nd place for Warscape Engine Resources in 2016 Modding Awards)

  6. #6
    Commissar Caligula_'s Avatar The Ecstasy of Potatoes
    Join Date
    Dec 2013
    Location
    The alcoves in the Koningin Astridpark
    Posts
    5,876

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    Thanks for the help, I've corrected my post.



  7. #7

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    Thank you, guys!

  8. #8

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    I don't mean to a *total* n00b, but where is the AE scripting lua? I am interested in applying this to my game.

    thanks!

  9. #9
    Commissar Caligula_'s Avatar The Ecstasy of Potatoes
    Join Date
    Dec 2013
    Location
    The alcoves in the Koningin Astridpark
    Posts
    5,876

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    Quote Originally Posted by asher237 View Post
    I don't mean to a *total* n00b, but where is the AE scripting lua? I am interested in applying this to my game.

    thanks!
    @e_001_ancient_empires_master_pack1.pack
    campaigns
    main_attila
    scripting.lua
    You'll need to use the Pack File Manager to open the pack, and you can either edit the lua file inside PFM, or with something like Notepad++



  10. #10

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    Just couldn't find the pack. Got it! Thanks so much! I got a need to build client states...

  11. #11

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    Eh, couldn't get it to work without crashing. I will leave it be until you guys decide to actually implement such a script. I got the day off, and the greeks are getting uppity. cheers!

  12. #12
    Julio-Claudian's Avatar Senator
    Join Date
    Dec 2011
    Location
    Britannia
    Posts
    1,215

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    Quote Originally Posted by asher237 View Post
    Eh, couldn't get it to work without crashing. I will leave it be until you guys decide to actually implement such a script. I got the day off, and the greeks are getting uppity. cheers!
    It worked just fine for me

  13. #13

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    Not trying to sound lazy, but could someone make a submod for this?

  14. #14

    Default Re: What UI would I have to edit to make AE compatible with the MAGA region-giving mod?

    Quote Originally Posted by Julio-Claudian View Post
    It worked just fine for me
    I wonder what I am doing wrong then. It wants to re-download the mod whenever I edit the .lua as well. I am not using a modmanager aside from the wacky one that comes with Attila.

    edit: figured it out!!! Wooo! Subjugating the greek cities now. Thanks all!
    Last edited by asher237; May 28, 2018 at 02:46 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •