Tutorial; ReferenceFleets - HWRM/KarosGraveyard GitHub Wiki

How to Add Reference and Reactive Fleets in Singleplayer

To add Reactive Fleet spots in singleplayer maps:

addReactiveFleetSlot(<sSobGroup>, <iPlayerIndex>, ?, {x, y, z}, ?, ?, ?, <sShipType>)

x, y, z is the map location to insert the reactive reinforcements at. Best guess on the ?,?,? is the rotation of the entry point.

From Mecha on the Relic Forums (discussion thread):

*1 Introduction
"Homeworld 2 uses the AI's ship comparison routines to compare a player's fleet coming in to a level with what the designers expect the player to have. If the fleet is bigger extra ships are spawned for the computer opponents. If the fleet is smaller the resources in the level are boosted to allow the player to attain more ships of their choosing. This document explains how to set up reference fleets for each level, how to specify where reinforcements come in and how to specify the ships that can be spawned."

2 Reactive Fleet Slots
"In maya, from the level ed tool you can place reactive fleet slots. These appear as wire frame spheres and let you specify where reinforcements for each player appear. In the properties for the slot you can specify the player index, whether the ships start in hyperspace and also what sob group they get added to. The sob group doesn't have to exist, a new one will be created in this case. Each slot can also specify the ship types that can be spawned in the slot. An empty string here will allow all the ships in the reinforcement file for the player who owns the slot. If you wish to restrict the ships then enter their names in the field marked "Allowed Ship Types" with a comma between each one."

3 Resource Boosting
"When the player's fleet is smaller than the expected fleet for the level the game will try to boost the resources in the level. In maya you can flag a resource as modifiable by the reactive fleet system. The difference in RUs between the player's fleet and the reference fleet will then be spread around all marked resources. You can also specify slots for new asteroids, these will be filled up first and once full the remaining Rus will be spread around the marked resources in the level."

4 Reference Fleet
"Place a file named "ReferenceFleet.lua" in the level folder. The file should look something like this:"*

Fleet = 
{
    -- these are the ships we expect the player to have:
    {
        Type = "Sp_Tanker",
        Number = 6,
    },
    {
        Type = "Hgn_Mothership",
        Number = 1,
    },
    {
        Type = "Hgn_ResourceCollector",
        Number = 4,
    },
    {
        Type = "Hgn_Interceptor",
        Number = 2,
    },
    {
        Type = "Hgn_Scout",
        Number = 2,
    },
    {
        Type = "Hgn_AttackBomber",
        Number = 2,
    },
}

-- and we think they should have this much money:
RUs = 500

*"Inside the Fleet block you specify the ships that should make up the player's fleet for the level. This will be the fleet you balanced the level against. The fleet should include everything that will belong to the player, not just the ships they will bring over. So, in this example from level 2 the tankers are included. You can also specify the amount of money you expect the player to have."

5 Reinforcements
"You need to specify what ships can be used to reinforce a player and you do this by placing a "PlayerReinforce.lua" file in the level directory for each player you want to be included in the system. So to specify reinforcements for player 2 you'd put "Player2Reinforce.lua" in the directory."

"The format of the file looks like this:"*

-- reinforcement options for this player
Reinforcements = 
{
    {
        Type = "Vgr_Interceptor",
        Weight = 1,
    },
    {
        Type = "Vgr_Bomber",
        Weight = 1,
    },
}

"Inside the Reinforcements block you list the ship types that can be used to reinforce the player. The weighting variable is a way of assigning priority to a ship type. The chance of a ship type being chosen is it's weighting divided by the total weighting for all the ship types in the file. So in this example both the interceptors and the bombers have a 50% chance of being chosen."

Related Pages

function: addReactiveFleetSlot

thread: discussion thread

Comments

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial

⚠️ **GitHub.com Fallback** ⚠️