Engine
-
Posts
4 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Engine
-
-
Ahh crap, that one function I listed was supposed to be getMineableMaterial(). I'll play around some more with that one though.
-
Working on a script that reports how many of each type of asteroid are in a sector and how many units of resource are in those. I can not for the life of me figure out how to pull the specific types. I can get total mineable in sector without an issue, but for example: if I want to know "how many Trinium asteroids are in this sector and how many units of Trinium are in all of those" I just can't figure out the proper function to call.
I've played with the following
Enum: MaterialType.type (eg. Trinium). Also, the "Iron" type seems to be broken as it returns an error no slot for slot type 0. all the other types return the total number of astroids in the system (including non mineable).
Function: getMineableResources()
Function: getMineableResources()
-
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
How to count the number of a specific asteroid in a sector?
in Mods
Posted
Gona chalk this up to being up for nearly 30 hours when I was scripting this, but the answer above was correct, I was thinking getMineableMaterial() would directly return the material type. Oops :). Thanks for the help Laserzwei.