Jump to content
Padwan

[MOD-Plugin] Loot Collection for Carrier Command

Recommended Posts

This is a plugin for the Carrier Command Mod (see https://www.avorion.net/forum/index.php/topic,4268.0.html).

 

This will add a new command to make your fighters collect loot for you:

 

tS63hIq.png

 

 

Installation

 

1. copy the contents of this zip into your Game Directory "Avorion"

2. edit the file mods/CarrierCommander/config/CarrierCommanderConfig.lua and add the folling line to the Config.carrierScripts table definition:

loot = {name="lootCommand", path = "mods/CarrierCommander/scripts/entity/ai/"}

 

JxPs1yx.png

 

3. edit the file mods/CarrierCommander/scripts/lib/lists.lua and add the lines

   
list.actionTostringMap[7] = "Collecting loot."
list.actionToColorMap[7] = ColorRGB(0.1, 0.8, 0.1)

 

G9rYqkx.png

 

 

Usage

 

Ingame in the Settings tab of the Carrier Commander Interface make sure to choose a squad for looting in the "Looting config" section.

Also use the checkboxes to configure what loot your fighters should go after.

 

8rKN1xA.png

 

Then in the ship commands tab activate the looting command.

 

 

Note that the other Carrier Commands might interfere with the looting script if your looting squad has weapons (gravitation turrets count as weapons to), mining lasers or salvaging lasers equipped, you can make dedicated looting fighters using repair turrets to prevent that.

 

This plugin was developed using Carrier Command version 0.9 and the current default branch of the game (version 0.15.8 ), i haven't tested it with the current beta branch yet.

 

Happy looting! :)

lootCommand_0.9.zip

Share this post


Link to post
Share on other sites

Thank you very much. this is working great and catches a lot of loot that was being lost to the despawn timer before.  now if only we could get access to looting cargo rather than loosing that to despawn lol.

I almost used cargo shuttles to do this but since they are common crap I couldn't get the stats I wanted so made the repair fighters like you mentioned.

 

btw I am using latest stable combined with command carrier 0.10 and this is fine. so its forward compatible for those using cc10!

Share this post


Link to post
Share on other sites

Thx for the mod!!

Maybe you can make an anti-torpedo hunter script? So the hunters only hunt incoming torpedoes.

That would be great!

Share this post


Link to post
Share on other sites

Thx for the mod!!

Maybe you can make an anti-torpedo hunter script? So the hunters only hunt incoming torpedoes.

That would be great!

 

I'm not sure that would work, torpedos are pretty fast. Also you can usually shoot them down pretty well with some automated turrets set to defensive mode.

Share this post


Link to post
Share on other sites

Ok, I think this mod keeps crashing the server. It seems to only crash when using the loot option along with multiple options.

Share this post


Link to post
Share on other sites

Ok, I think this mod keeps crashing the server. It seems to only crash when using the loot option along with multiple options.

 

Thats not much info to work on.. any crash logs? Steps to reproduce?

Share this post


Link to post
Share on other sites

is there any word on the stability issues? im running a small kludged together modpack on my (underpopulated XD) server, and after we were forced to restart due to issues with the unofficial version of minecorp, ive gotten leary about throwing things in without checking >~<

Share this post


Link to post
Share on other sites

New to the forum and would love to check out the mod.  Where is the Zip folder to download. Can't seem to find the link.

 

Thanks!

 

<edit>  Yep.. figured it out. I forgot to log in and didn't see the last line where the .ZIP link was.  ;-)

Share this post


Link to post
Share on other sites

This might be a bug. I have 6 squads but it will only allow me to go down as far as squad 4 to select. I won't allow me select squad 6.  Could be a resolution thing or the fact that I'm playing on the beta version (single player).  I'm playing at 2560x1440 res.

 

See attachment for screen shot.

Image_1.jpg.de06bb6fb61112638b64733c0105be6f.jpg

Share this post


Link to post
Share on other sites

This might be a bug. I have 6 squads but it will only allow me to go down as far as squad 4 to select. I won't allow me select squad 6.  Could be a resolution thing or the fact that I'm playing on the beta version (single player).  I'm playing at 2560x1440 res.

 

See attachment for screen shot.

you need to scroll the text in the window up farther before opening the drop down. then you can select those farther down without issue.

Share this post


Link to post
Share on other sites

Noticed that when this command is active (and checked the lua code to confirm my suspicions) it generates invisible blocks of wreckage to tell the fighters what position to go. The problem is that my ship's salvage turrets pick these up and immediately destroy them, causing the fighters to do loops. While it works fine if I leave my ship out of range, it's irritating none the less.

Share this post


Link to post
Share on other sites

can we get a fix for the newest update to the carrier commands. I added the lines but in the settings of the command box all I have is attack settings, it no longer scroll down to the other commands.

Share this post


Link to post
Share on other sites

After some editing I managed to make the interface work by making the configuration UI a separate file and storing it in the CCBasicCommands folder, to bring it in line with the rest of the commands.

 

specifically, the config part of lootCommand.lua needs to be stored in a lootCommand_config.lua (use one of the other commands for reference.) placing the two files in the CCBasicCommands folder allows them to be loaded with the other commands as per CarrierCommander.lua:

 

" local c = require(cc.commands[prefix].path.."_config") "

 

Edit:

 

After some testing it appears as though clicking the button does not activate the loot script properly. Since I'm not great at programming it seems I will have to wait for an official update to this mod.

 

 

Share this post


Link to post
Share on other sites

Updated this plugin for CC v1.9.0 ex.  Disclaimer: I'm not a programmer, so the code is rather crappy.  I had to rewrite most of the plugin.

I added a new feature to it that tracks the number of loot items remaining.

Install the two files under "Avorion\mods\CCBasicCommands\scripts\entity\ai"

Add the the following lines to lists.lua and CarrierCommanderConfig.lua

 

 

Lists.lua

list.actionTostringMap[7] = "Collecting Loot, %i items remaining"

list.actionToColorMap[7] = ColorRGB(0.1, 0.8, 0.1)

 

list.actionTostringMap = {}
setmetatable(list.actionTostringMap,{
  __index = function(t,k) return "Invalid order received" end    --fallbackfunction, getting called when indexed with an invalid key
})
    list.actionTostringMap["noHangar"] = "No Hangar found!"
    list.actionTostringMap["noFighterController"] = "No FighterController found!"
    list.actionTostringMap["targetButNoFighter"] = "Found a target, but no suitable fighters."
    list.actionTostringMap["idle"] = "Idle and waiting for targets."
    list.actionTostringMap[-1] = "Not doing anything."
    list.actionTostringMap[FighterOrders.Attack] = "Attacking ship %s"
    list.actionTostringMap[FighterOrders.Defend] = "Defending ship %s"
    list.actionTostringMap[FighterOrders.Return] = "Waiting for %i Fighter(s) in %i Squad(s) to dock at %s"
    list.actionTostringMap[FighterOrders.FlyToLocation] = "flying to location."
    --list.actionTostringMap[4] = nil                       reserved for new vanilla command
    list.actionTostringMap[5] = "Mining asteroids."
    list.actionTostringMap[6] = "Salvaging wrecks."
list.actionTostringMap[7] = "Collecting Loot, %i items remaining"

list.actionToColorMap = {}
setmetatable(list.actionToColorMap,{
  __index = function(t,k) return ColorRGB(0.9, 0.1, 0.1) end    --fallbackfunction, getting called when indexed with an invalid key
})
    list.actionToColorMap["noHangar"] = ColorRGB(0.9, 0.1, 0.1)
    list.actionToColorMap["noFighterController"] = ColorRGB(0.9, 0.1, 0.1)
    list.actionToColorMap["targetButNoFighter"] = ColorRGB(0.9, 0.1, 0.1)
    list.actionToColorMap["idle"] = ColorRGB(0.3, 0.3, 0.9)
    list.actionToColorMap[-1] = ColorRGB(0.3, 0.3, 0.3)
    list.actionToColorMap[FighterOrders.Attack] = ColorRGB(0.1, 0.8, 0.1)
    list.actionToColorMap[FighterOrders.Defend] = ColorRGB(0.3, 0.3, 0.3)
    list.actionToColorMap[FighterOrders.Return] = ColorRGB(0.5, 0.5, 0.0)
    list.actionToColorMap[FighterOrders.FlyToLocation] = ColorRGB(0.0, 0.5, 0.5)
    --list.actionToColorMap[4] = nil                       reserved for new vanilla command
    list.actionToColorMap[5] = ColorRGB(0.1, 0.8, 0.1)
    list.actionToColorMap[6] = ColorRGB(0.1, 0.8, 0.1)
list.actionToColorMap[7] = ColorRGB(0.1, 0.8, 0.1)
    list.tooltipadditions = {}

return list

 

 

CarrierCommanderConfig.lua

loot = {name="Loot Command", path = "mods/CCBasicCommands/scripts/entity/ai/lootCommand"},

 

local Config = {}

Config.Author = "Nexus, Dirtyredz, Hammelpilaw, Maxx4u, Laserzwei"
Config.ModName = "CarrierCommander"
Config.version = {
    major=1, minor=9, patch = 0,
    string = function()
        return  Config.version.major .. '.' ..
                Config.version.minor .. '.' ..
                Config.version.patch
    end
}



--new commands go here, <namespcae used by the script> = {name = <button text>, <path> = relative path from the /mods/-folder to the command, without .lua ending }
Config.carrierScripts = {
    dockAll = {name="Dock all Fighters", path = "mods/CarrierCommander/scripts/entity/ai/dockAllFighters"},
    salvage = {name="Salvage Command", path = "mods/CCBasicCommands/scripts/entity/ai/salvageCommand"},
    mine = {name="Mine Command", path = "mods/CCBasicCommands/scripts/entity/ai/mineCommand"},
    attack = {name="Attack Command", path = "mods/CCBasicCommands/scripts/entity/ai/aggressiveCommand"},
loot = {name="Loot Command", path = "mods/CCBasicCommands/scripts/entity/ai/lootCommand"},
repair = {name="Repair Command", path = "mods/CCBasicCommands/scripts/entity/ai/repairCommand"},
    --lootCommand = {name="Loot Command", path = "mods/CCLootPlugin/scripts/entity/ai/lootCommand"}
}

Config.forceUnsupervisedTargeting = false   -- forces the "Unsupervised targeting"- setting for attacking fighters. Default: false

Config.basePriorities = {
    ship = 20,
    guardian = 15,
    station = 10,
    fighter = 5,
}
Config.additionalPriorities = { --Only for modded additions. Modders: When creating a new Boss then use Entity():setValue("customBoss", someValidValue), to mark it. The Attack script will then activley search for those marked enemies and assign the priority set in the config

    --customBoss = 25
}

return Config

 

Loot_Command.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...