Post tutorial Report RSS Tutorial: Enabling/Disabling Units by Tech Level for Galactic Conquest

In This tutorial we will be covering how to make units enable or disable themselves by Tech Levels. This is pretty easy but does require editing several Files and common sense.

Posted by on - Intermediate Client Side Coding

Tutorial: Enabling/Disabling Units by Tech Level for Galactic Conquest
By: rebel5555 (AKA Joshua R.)

In this tutorial we will be covering how to make units enable or disable themselves by Tech Levels. This is pretty easy but does require editing several Files and common sense.

So, lets start by finding a Unit that we want to enable at a certain tech level. I will be using the
XJ-Wing to enable itself at tech level 3 replacing the old and outdated X-Wing.

From SQUADRONS.XML

    <Squadron Name="XJ_Wing_Squadron">
        <Text_ID> TEXT_XJ_WING_SQUADRON </Text_ID>
        <Encyclopedia_Good_Against> TIE_Fighter TIE_Interceptor TIE_Avenger </Encyclopedia_Good_Against>
        <Encyclopedia_Vulnerable_To> Imperial_Lancer_Fregatte Assault_Gunboat </Encyclopedia_Vulnerable_To>
        <Required_Special_Structures>Rebel_Light_Ship_Yard</Required_Special_Structures>
        <GUI_Row> 1 </GUI_Row>
        <Is_Dummy>Yes</Is_Dummy>
        <Formation_Priority>1</Formation_Priority>
        <Is_Escort>Yes</Is_Escort>
        <Is_Bomber>no</Is_Bomber>
        <Autoresolve_Health>500</Autoresolve_Health>
        <Damage>40</Damage>
        <Affiliation>Rebel</Affiliation>
        <Political_Control>0</Political_Control>
        <Build_Cost_Credits>600</Build_Cost_Credits>
        <Build_Time_Seconds>20</Build_Time_Seconds>
        <Build_Tab_Space_Units>Yes</Build_Tab_Space_Units>
                <Build_Initially_Locked>Yes</Build_Initially_Locked>
                <Build_Can_Be_Unlocked_By_Slicer>No</Build_Can_Be_Unlocked_By_Slicer>
        <Tech_Level>3</Tech_Level>
        <Required_Timeline />
        <Required_Star_Base_Level>1</Required_Star_Base_Level>
        <Required_Special_Structures />
        <Behavior>DUMMY_SPACE_FIGHTER_SQUADRON</Behavior>
        <Squadron_Units>XJ-Wing, XJ-Wing</Squadron_Units>
        <Squadron_Units>XJ-Wing, XJ-Wing</Squadron_Units>
        <Squadron_Units>XJ-Wing, XJ-Wing</Squadron_Units>
                
        <Squadron_Offsets>15.0,15.0,0.0</Squadron_Offsets>
        <Squadron_Offsets>15.0,-15.0,0.0</Squadron_Offsets>
        <Squadron_Offsets>15.0,90.0,0.0</Squadron_Offsets>
        <Squadron_Offsets>15.0,-90.0,0.0</Squadron_Offsets>
        <Squadron_Offsets>0.0,30.0,0.0</Squadron_Offsets>
        <Squadron_Offsets>0.0,-30.0,0.0</Squadron_Offsets>

        <Max_Squad_Size> 6 </Max_Squad_Size>
        <Icon_Name>i_button_x_wing.tga</Icon_Name>
        <GUI_Model_Name>RV_XJ-Wing.ALO</GUI_Model_Name>
        <GUI_Distance>95</GUI_Distance>
        <GUI_Offset>0 0 0</GUI_Offset>
        <GUI_Velocity>45</GUI_Velocity>

        <SFXEvent_Build_Started>RHD_Build_Vehicle</SFXEvent_Build_Started>
        <SFXEvent_Build_Cancelled>RHD_Unit_Canceled</SFXEvent_Build_Cancelled>
        <SFXEvent_Build_Complete>Unit_Complete_X_Wing</SFXEvent_Build_Complete>

        <FormationOrder>2</FormationOrder>
        <Squadron_Formation_Error_Tolerance>5.0</Squadron_Formation_Error_Tolerance>
        <Guard_Chase_Range>1000.0</Guard_Chase_Range>
        <Idle_Chase_Range>200.0</Idle_Chase_Range>
        <Attack_Move_Response_Range>300.0</Attack_Move_Response_Range>
        <Property_Flags> SmallShip </Property_Flags>
        <Autonomous_Move_Extension_Vs_Attacker>500.0</Autonomous_Move_Extension_Vs_Attacker>
    
        <Unit_Abilities_Data SubObjectList="Yes">
            <!-- Primary ability -->
            <Unit_Ability>
                <Type>SPOILER_LOCK</Type>
            
                <Mod_Multiplier>WEAPON_DELAY_MULTIPLIER,    3.0f</Mod_Multiplier>
                <Mod_Multiplier>SHIELD_REGEN_MULTIPLIER,    1.0f</Mod_Multiplier>
                <Mod_Multiplier>ENERGY_REGEN_MULTIPLIER,    1.0f</Mod_Multiplier>
                <Mod_Multiplier>SPEED_MULTIPLIER,        2</Mod_Multiplier>
            </Unit_Ability>
            <Unit_Ability>
                <Type>LURE</Type>
                <!-- details in the unit's XML -->
            </Unit_Ability>
        </Unit_Abilities_Data>
        
        <Encyclopedia_Text>TEXT_TOOLTIP_XJ_WING</Encyclopedia_Text>
        <Encyclopedia_Unit_Class> TEXT_ENCYCLOPEDIA_CLASS_FIGHTER </Encyclopedia_Unit_Class>
        
        <!--<MULTIPLAYER SKIRMISH VALUES BEGIN>-->
        <Tactical_Build_Cost_Multiplayer>600</Tactical_Build_Cost_Multiplayer>
        <Tactical_Build_Time_Seconds>30</Tactical_Build_Time_Seconds>
        <Tactical_Build_Prerequisites />
        <Tactical_Production_Queue>Tactical_Units</Tactical_Production_Queue>
        <!--<Build_Limit_Current_Per_Player>0</Build_Limit_Current_Per_Player>-->
        <!--<Build_Limit_Lifetime_Per_Player>0</Build_Limit_Lifetime_Per_Player>-->  
        <!--<MULTIPLAYER SKIRMISH VALUES END>-->
        <Population_Value>1</Population_Value>
        <Score_Cost_Credits> 600</Score_Cost_Credits>
    </Squadron>

Alright, I've got my code for XJ-Wing's Squadron and I've set it's tech level to level 3. Next we're going to add the trigger that enables it in GC and disables the X-Wing.

This is were you will most likely have to edit several files. Lets open CAMPAIGNS_MULTIPLAYER.XML & CAMPAIGNS_SINGLEPLAYER.XML. These files are the basis for any Galactic Conquests (I've seen some mods use both of them or just one of them). In CAMPAIGNS_SINGLEPLAYER.XML the first entry should be:

<Campaign Name="Sandbox_Alderaans_Demise_Rebel">

Under this entry find:

<Rebel_Story_Name>Story_Plots_Sandbox_10B_Rebel.xml</Rebel_Story_Name>

The Above code references an XML file that contains the plot information for this particular GC Scenario. now find that file and open it. When you have opened it find:

    <Active_Plot>Story_Sandbox_10B_Rebel.XML</Active_Plot>

This is the file that contains the triggers that enable/disable units for this certain GC, now lets open that file.

When you open that file you will/should see the following code:

<?xml version="1.0" ?>



<!--****** This story file is used to automatically set some things that would normally happen ******-->
<!--****** in story mode for the full campaign.  This file should be generic enough to use for  ******-->
<!--****** any sandbox campaign set.                                                           ******-->

<!-- Sandbox Campaign: Alderaan's Demise -->

<Story>

    <Event Name="Universal_Story_Start">
        <Event_Type>STORY_ELAPSED</Event_Type>
        <Event_Param1>0</Event_Param1>
        <Story_Dialog>Dialog_R_Sandbox_Intro</Story_Dialog>
        <Story_Chapter>1</Story_Chapter>
        <Story_Tag>Intro_Tag</Story_Tag>
    </Event>
    


<!-- Force Rebels to get X-wing instead of Z-95 to start -->
    <Event Name="Unlock_X_wings">
        <Event_Type>STORY_TRIGGER</Event_Type>
        <Reward_Type>BUILDABLE_UNIT</Reward_Type>
        <Reward_Param1>Rebel_X-Wing_Squadron</Reward_Param1>
        <Reward_Param2>Z95_Headhunter_Rebel_Squadron</Reward_Param2>
        <Prereq>Universal_Story_Start</Prereq>
    </Event>


<!-- Rebel Hero Release -->


    <!-- Spawn Starting Heroes -->

    <Event Name="Rebel_AI_Heroes_01">
        <Event_Type>STORY_TRIGGER</Event_Type>
        <Reward_Type>SPAWN_HERO</Reward_Type>
        <Reward_Param1>Mon_Mothma_Team</Reward_Param1>
        <Reward_Param2>Hoth</Reward_Param2>
        <Prereq>Universal_Story_Start</Prereq>
    </Event>

    <Event Name="Rebel_AI_Heroes_02">
        <Event_Type>STORY_TRIGGER</Event_Type>
        <Reward_Type>SPAWN_HERO</Reward_Type>
        <Reward_Param1>Droids_Team</Reward_Param1>
        <Reward_Param2>Hoth</Reward_Param2>
        <Prereq>Universal_Story_Start</Prereq>
    </Event>


    <!-- Spawn Tech 1 Heroes -->

    <Event Name="Rebel_AI_Heroes_03">
        <Event_Type>STORY_TECH_LEVEL</Event_Type>
        <Event_Param1>1</Event_Param1>
    </Event>

    <Event Name="Rebel_AI_Heroes_04">
        <Event_Type>STORY_TRIGGER</Event_Type>
        <Reward_Type>SPAWN_HERO</Reward_Type>
        <Reward_Param1>Han_Solo_Team</Reward_Param1>
        <Reward_Param2>Hoth</Reward_Param2>
        <Prereq>Rebel_AI_Heroes_03</Prereq>
    </Event>


    <!-- Spawn Tech 2 Heroes -->

    <Event Name="Rebel_AI_Heroes_05">
        <Event_Type>STORY_TECH_LEVEL</Event_Type>
        <Event_Param1>2</Event_Param1>
    </Event>

    <Event Name="Rebel_AI_Heroes_06">
        <Event_Type>STORY_TRIGGER</Event_Type>
        <Reward_Type>SPAWN_HERO</Reward_Type>
        <Reward_Param1>Sundered_Heart</Reward_Param1>
        <Reward_Param2>Hoth</Reward_Param2>
        <Prereq>Rebel_AI_Heroes_05</Prereq>
    </Event>



    <!-- Spawn Tech 3 Heroes -->

    <Event Name="Rebel_AI_Heroes_07">
        <Event_Type>STORY_TECH_LEVEL</Event_Type>
        <Event_Param1>3</Event_Param1>
    </Event>

    <Event Name="Rebel_AI_Heroes_08">
        <Event_Type>STORY_TRIGGER</Event_Type>
        <Reward_Type>UNIQUE_UNIT</Reward_Type>
        <Reward_Param1>Home_One</Reward_Param1>
        <Reward_Param2>Hoth</Reward_Param2>
        <Prereq>Rebel_AI_Heroes_07</Prereq>
    </Event>



    <!-- Spawn Tech 4 Heroes -->

    <Event Name="Rebel_AI_Heroes_09">
        <Event_Type>STORY_TECH_LEVEL</Event_Type>
        <Event_Param1>4</Event_Param1>
    </Event>

    <Event Name="Rebel_AI_Heroes_10">
        <Event_Type>STORY_TRIGGER</Event_Type>
        <Reward_Type>SPAWN_HERO</Reward_Type>
        <Reward_Param1>Obi_Wan_Team</Reward_Param1>
        <Reward_Param2>Hoth</Reward_Param2>
        <Prereq>Rebel_AI_Heroes_09</Prereq>
    </Event>

    <Event Name="Rebel_AI_Heroes_11">
        <Event_Type>STORY_TRIGGER</Event_Type>
        <Reward_Type>SPAWN_HERO</Reward_Type>
        <Reward_Param1>Red_Squadron</Reward_Param1>
        <Reward_Param2>Hoth</Reward_Param2>
        <Prereq>Rebel_AI_Heroes_09</Prereq>
    </Event>



</Story>

What we are going to do is create a new entry that will tell the game
to enable our XJ-Wing and replace/disable the X-Wing. here's the Code:

    <!--Replace X-Wing with XJ-Wing-->
    <Event Name="Remove_X-Wing">
        <Event_Type>STORY_TRIGGER</Event_Type>
        <Reward_Type>BUILDABLE_UNIT</Reward_Type>
        <Reward_Param1>XJ_Wing_Squadron</Reward_Param1>
        <Reward_Param2>Rebel_X-Wing_Squadron</Reward_Param2>
        <Prereq>Unlock_X_wings Rebel_AI_Heroes_07</Prereq>
    </Event>

What the following code does is It Replaces the X-Wing with the XJ-Wing
at tech level 3. You ask How do I know it's tech level 3? That's easy
it's this following section of code that tells us this:

    <Event Name="Rebel_AI_Heroes_07">
        <Event_Type>STORY_TECH_LEVEL</Event_Type>
        <Event_Param1>3</Event_Param1>
    </Event>

Now our XJ-Wing will replace the X-Wings in the GC "Alderaan's Demise". To do this with other GC's follow the previous steps to find out which GC Plots files are what or you can just add this to every Story_Sandbox_#_Rebel/Empire.XML + STORY_UNIVERSAL_TRIGGERS_R/E.XML.

From another site where my tutorial is at the user JC9542 has brought to my attention that if you start at higher Tech Level you can have multiple versions of a unit. JC9542 along with Smallpox's help have came up with a solution to this that I have added to the above tutorial. Below are the primary guidelines to do this.

JC9542 wrote: So far as I can figure it out the important things are:
1.Upgraded Squadron/company must be initially locked, but not sliceable.
2.Event code for 2nd upgrade and so on needs to have at least 2
parameters to trigger, an event from the correct tech level and the
previous upgrade has to have occured.


I hope this tutorial has been helpful and hasn't confused you. Remember
coding can be frustrating so if you are feeling like throwing your
computer out the window just take a break.

Have fun,

Rebel5555 (AKA Joshua R.)

Post comment Comments
rebel5555 Author
rebel5555 - - 33 comments

If you need any help following this tutorial or want to post any feedback please feel free to leave me a comment or send me a pm.

Reply Good karma+1 vote
Guest
Guest - - 689,373 comments

This comment is currently awaiting admin approval, join now to view.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: