So for starters I would like to create a fairly simple mod that spawns an NPC patrol group (of a faction of player's choosing). Here's what I have written so far...
Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<mdscript name="Spawn_Patrol" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<!--Spawn HOA Arawn with escort fighters-->
<cue name="Spawn_Patrol_heartofalbion">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<!--Adjust number of ships spawned-->
<set_value name="$Num_HOA_Capship" exact="1"/>
<set_value name="$Num_HOA_Escort_Leader" exact="2"/>
<set_value name="$Num_HOA_Escort_Wingman" exact="3"/>
<!--Spawn Capship-->
<do_all exact="$Num_HOA_Capship">
<create_ship name="$HOA_Capship" macro="units_size_xl_capital_destroyer_1_macro" zone="$player.zone">
<owner exact="faction.heartofalbion" overridenpc="true"/>
<pilot group="argon.commander">
<owner exact="faction.heartofalbion"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</pilot>
<defence group="argon.defence"/>
<owner exact="faction.heartofalbion"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</defence>
<engineer group="argon.engineer"/>
<owner exact="faction.heartofalbion"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</engineer>
<units>
<unit category="unitcategory.welder" mk="1" exact="40"/> <!--Construction URV-->
<unit category="unitcategory.transport" mk="1" exact="10"/> <!--Cargolifter URV-->
<unit category="unitcategory.defence" mk="4" exact="150"/> <!--Intrepid URV MK2-->
<unit category="unitcategory.defence" mk="6" exact="100"/> <!--Overrun URV MK2-->
</units>
<position object="player.primaryship" max="5km"/>
</create_ship>
<start_script object="$HOA_Capship.pilot" name="'move.patrol'">
</start_script>
<!--Spawn Escort Fighters-->
<do_all exact="$Num_HOA_Escort_Leader">
<create_ship name="$HOA_Leader" group="hoa_heavy_fighter" zone="$player.zone">
<owner exact="faction.heartofalbion" overridenpc="true"/>
<pilot group="argon.pilot">
<owner exact="faction.heartofalbion"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</pilot>
<position object="$HOA_Capship" max="5km"/>
</create_ship>
<set_object_commander object="$HOA_Leader" commander="$HOA_Capship" />
<start_script object="$HOA_Leader.pilot" name="'move.escort'">
<param name="target" value="$HOA_Capship"/>
</start_script>
<do_all exact="$Num_HOA_Escort_Wingman">
<create_ship name="$HOA_Follower" group="hoa_heavy_fighter" zone="$player.zone">
<owner exact="faction.heartofalbion" overridenpc="true"/>
<pilot group="argon.pilot">
<owner exact="faction.heartofalbion"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</pilot>
<position object="$HOA_Leader" max="2km"/>
</create_ship>
<set_object_commander object="$HOA_Follower" commander="$HOA_Leader" />
<start_script object="$HOA_Follower.pilot" name="'move.escort'">
<param name="target" value="$HOA_Leader" />
</start_script>
</do_all>
</do_all>
</do_all>
</actions>
</cue>
<!--Spawn PMC Taranis with escort fighters-->
<cue name="Spawn_Patrol_plutarch">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<!--Adjust number of ships spawned-->
<set_value name="$Num_PMC_Capship" exact="1"/>
<set_value name="$Num_PMC_Escort_Leader" exact="2"/>
<set_value name="$Num_PMC_Escort_Wingman" exact="3"/>
<!--Spawn Capship-->
<do_all exact="$Num_PMC_Capship">
<create_ship name="$PMC_Capship" macro="units_size_xl_capital_destroyer_2_macro" zone="$player.zone">
<owner exact="faction.plutarch" overridenpc="true"/>
<pilot group="argon.commander">
<owner exact="faction.plutarch"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</pilot>
<defence group="argon.defence"/>
<owner exact="faction.plutarch"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</defence>
<engineer group="argon.engineer"/>
<owner exact="faction.plutarch"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</engineer>
<units>
<unit category="unitcategory.welder" mk="1" exact="40"/> <!--Construction URV-->
<unit category="unitcategory.transport" mk="1" exact="10"/> <!--Cargolifter URV-->
<unit category="unitcategory.defence" mk="4" exact="50"/> <!--Intrepid URV MK2-->
<unit category="unitcategory.defence" mk="6" exact="50"/> <!--Overrun URV MK2-->
</units>
<position object="player.primaryship" max="5km"/>
</create_ship>
<start_script object="$PMC_Capship.pilot" name="'move.patrol'">
</start_script>
<!--Spawn Escort Fighters-->
<do_all exact="$Num_PMC_Escort_Leader">
<create_ship name="$PMC_Leader" group="pmc_heavy_fighter" zone="$player.zone">
<owner exact="faction.plutarch" overridenpc="true"/>
<pilot group="argon.pilot">
<owner exact="faction.plutarch"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</pilot>
<position object="$PMC_Capship" max="5km"/>
</create_ship>
<set_object_commander object="$PMC_Leader" commander="$PMC_Capship" />
<start_script object="$PMC_Leader.pilot" name="'move.escort'">
<param name="target" value="$PMC_Capship"/>
</start_script>
<do_all exact="$Num_PMC_Escort_Wingman">
<create_ship name="$PMC_Follower" group="pmc_heavy_fighter" zone="$player.zone">
<owner exact="faction.plutarch" overridenpc="true"/>
<pilot group="argon.pilot">
<owner exact="faction.plutarch"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</pilot>
<position object="$PMC_Leader" max="2km"/>
</create_ship>
<set_object_commander object="$PMC_Follower" commander="$PMC_Leader" />
<start_script object="$PMC_Follower.pilot" name="'move.escort'">
<param name="target" value="$PMC_Leader" />
</start_script>
</do_all>
</do_all>
</do_all>
</actions>
</cue>
<!--Spawn Canteran Sucellus with escort fighters-->
<cue name="Spawn_Patrol_canteran">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<!--Adjust number of ships spawned-->
<set_value name="$Num_ROC_Capship" exact="1"/>
<set_value name="$Num_ROC_Escort_Leader" exact="2"/>
<set_value name="$Num_ROC_Escort_Wingman" exact="3"/>
<!--Spawn Capship-->
<do_all exact="$Num_ROC_Capship">
<create_ship name="$ROC_Capship" macro="units_size_xl_red_destroyer_macro" zone="$player.zone">
<owner exact="faction.canteran" overridenpc="true"/>
<pilot group="argon.commander">
<owner exact="faction.canteran"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</pilot>
<defence group="argon.defence"/>
<owner exact="faction.canteran"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</defence>
<engineer group="argon.engineer"/>
<owner exact="faction.canteran"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</engineer>
<units>
<unit category="unitcategory.welder" mk="1" exact="40"/> <!--Construction URV-->
<unit category="unitcategory.transport" mk="1" exact="10"/> <!--Cargolifter URV-->
<unit category="unitcategory.defence" mk="4" exact="50"/> <!--Intrepid URV MK2-->
<unit category="unitcategory.defence" mk="6" exact="50"/> <!--Overrun URV MK2-->
</units>
<position object="player.primaryship" max="5km"/>
</create_ship>
<start_script object="$ROC_Capship.pilot" name="'move.patrol'">
</start_script>
<!--Spawn Escort Fighters-->
<do_all exact="$Num_ROC_Escort_Leader">
<create_ship name="$ROC_Leader" group="can_heavy_fighter" zone="$player.zone">
<owner exact="faction.canteran" overridenpc="true"/>
<pilot group="argon.pilot">
<owner exact="faction.canteran"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</pilot>
<position object="$ROC_Capship" max="5km"/>
</create_ship>
<set_object_commander object="$ROC_Leader" commander="$ROC_Capship" />
<start_script object="$ROC_Leader.pilot" name="'move.escort'">
<param name="target" value="$ROC_Capship"/>
</start_script>
<do_all exact="$Num_ROC_Escort_Wingman">
<create_ship name="$ROC_Follower" group="can_heavy_fighter" zone="$player.zone">
<owner exact="faction.canteran" overridenpc="true"/>
<pilot group="argon.pilot">
<owner exact="faction.canteran"/>
<skills>
<skill type="boarding" value="5"/>
<skill type="combat" value="5"/>
<skill type="engineering" value="5"/>
<skill type="leadership" value="5"/>
<skill type="management" value="5"/>
<skill type="morale" value="5"/>
<skill type="navigation" value="5"/>
<skill type="science" value="5"/>
</skills>
</pilot>
<position object="$ROC_Leader" max="2km"/>
</create_ship>
<set_object_commander object="$ROC_Follower" commander="$ROC_Leader" />
<start_script object="$ROC_Follower.pilot" name="'move.escort'">
<param name="target" value="$ROC_Leader" />
</start_script>
</do_all>
</do_all>
</do_all>
</actions>
</cue>
</cues>
</mdscript>
- Are the codes I have for spawning capship crews correct? I based my original code on a MD file from the game called "test_BigBattle". However, I wanted the spawned ship crew to have all 5-star skills. The "test_BigBattle" script also did not spawn Engineer or Defence Officer for the capships (how exactly is that handled? I don't imagine for that test the script spawns capships with only a Captain, that would be useless).
So I compared the codes with ones from the XR Cheat Menu, and the author for that used a different method of crew spawning ("create_platform_actor"), which seems more lengthy and complicated... - Is there a way to automatically configure the spawned ship captain to Auto-Refuel and Auto-Resupply (defense drones and ammunition)? Ideally what I want this mod to do is for the player to be able to spawn NPC patrols that will not only keep sectors safe, but also help create economy sinks (by purchasing end products like drones and missiles).
- If I want the spawned ship to have a full stock of fuel cells, would this be the correct code to do so?
Code: Select all
<cargo> <wares list="[fuelcells]"> <fillpercent exact="100"/> </wares> </cargo>
