Starbound

Starbound

Crew Customization +
Congratz man!
nice work! I have been wanting to do this for ages but never had the time. Since I was able to test this a ton before life caught up with me, I think I can help with some of the issues/unknown.

To prevent any sort of auto/broken item switching behavior when a crewmember is not following you, set:

"parameters": {
"scriptConfig": {
"behaviorConfig" {
"emptyHands": false
}
}
}


In the vanilla script, the medic/chemist active effects trigger are not tied to whether the medic/chemist has those items.

For sheathed items you can essentially recreate the items table found on the npctype file, wherein you create an "override" column and add the primary/sheathed weapon attributes there.

Any armor found in the override table on spawn will overwrite anything not programmatically set via a script. Even if the npctype file has an override item table as well.

it would be formatted like:

"parameters" {
"items": {
"override": [[0,[{"primary": ["weaponid"], "sheathedprimary": ["weaponid"] }]]]
}
}

To help clarify other unknown behaviors:

- NPCs will only use weapons from their primary hand.
- 2hs have a higher selection preference than a 1h/shield combo.
- NPCs do not switch between 2h weaps and 1h weaps.
- NPCs will prioritize using a gun until they either run out of energy or 5-10 seconds has gone by. It will then go into melee for a time until they gain their energy back.
- Shields will be used only if its found on the secondary slot

- NPCs/Crewmbers DO have energy limits, and due to crewmembers being forced to level 1, they only have ~10 energy. This means that the cool lategame guns usually will only be fired once before the npc switches to melee.

Hope this helps!
Last edited by Depression Hurts, Eat More KFC; 12 Mar, 2020 @ 12:37pm
< >
Showing 1-15 of 17 comments
FelmastProMcLane  [developer] 12 Mar, 2020 @ 12:59pm 
Oh wow, it's you! Thanks, I was looking at your mod for how to set items and gear but it's still beyond my understanding.
I will see how to implement this info because it seems to be better than "replacing" defaults, but also i don't have much experience.
Do you suggest to increase the maxEnergy using patches for npcs?
I will also update the info in the description for clarification.
I would say instead of making patches to npctype files, you instead write a little script that overwrites the crewmember spawn command. From there you can take the parameter table, overwrite the npc with the changes that you need done, then spawn them yourself.

that is the code I wrote up to have spawned in crewmembers solely rely on the items table that you generate instead of using overrides.


function overrideParams(parameters)
local items = {"primary": "weaponid", "secondary": "weaponid" ... etc }
parameters.items = crewutil.buildItemOverrideTable(items)
if path(parameters.scriptConfig,"initialStorage","crewUniform") then
parameters.scriptConfig.initialStorage.crewUniform = {}
end
if path(parameters.scriptConfig,"initialStorage","itemSlots") then
parameters.scriptConfig.initialStorage.itemSlots = nil
end
if path(parameters.scriptConfig,"crew","uniform") then
parameters.scriptConfig.crew.uniform = {slots = {}}
end
setPath(parameters.scriptConfig, "behaviorConfig", "emptyHands", self.emptyHands)

return parameters
end

function crewutil.buildItemOverrideTable(t)
local items = {}
local container = nil
t = t or {}

for k,v in pairs(t) do
t[k] = {v}
end
items.override = {}
table.insert(items.override, {})
container = items.override[1]
table.insert(container, 0)
table.insert(container, {})
container = items.override[1][2]
table.insert(container, t)
return items
end
FelmastProMcLane  [developer] 12 Mar, 2020 @ 1:28pm 
Looks like i can use that, as the scripts i edit do have access to the npc's configParameters.
on another note your description said that this helps with npcspawner+ lag. I have been out of the game for a bit, what kind of lag are you experiencing?
FelmastProMcLane  [developer] 12 Mar, 2020 @ 1:45pm 
I read in your mod's comments that it could cause lag, mine lags when i have a few crew members and lowering the update time of their uniforms helps, but it seems that not everyone who uses your mod and/or my mod has lag.
It more like lag spikes every few seconds, usually while moving around in the ship.
I removed some mods and reduced the amount of items on my ship, that also helped.
In my case I don't think it has anything to do with your scripts.
ah yeah. Do you use byos? or something of the sort? I have found that in certain situation and areas the game just needs to do a hard recalculate of everything.

Let me know if you need/like any help on this. Id ideally like this to work really well with NpcSpawner+, so I can point people with crewmembers to your mod :D
FelmastProMcLane  [developer] 12 Mar, 2020 @ 3:47pm 
I use Tier 9/10 ships, but the lag seems to be loading items in the ship, because when i move to empty rooms an then back to "full" rooms, it lags.
Thanks for the help!, i'm currently studying how crewmember data is stored in the savefile
https://starbounder.org/Modding:Lua/Tables/Playercompanions

Everytime setCompanions is called your playerfile is updated.

The Playercompanions scope also supports the storage table, however that only gets updated when the player saves/loads or warps

As for how it looks raw, its a merge between the Pet class and Recruit class (if necessary).

PodId is the unique id of the Recruit. This never changes, Uuid(uniqueId) is the unique world id of the spawned in/current instance of the Recruit...this is world specific and changes often).

If you want to see the json raw. follow the to_json() calls. Starting with the Pet and then seeing the additional parameters for Recruit
Last edited by Depression Hurts, Eat More KFC; 12 Mar, 2020 @ 5:03pm
if you want to see / interact with the data itself, you can inject your own scripts to the Playercompanion scope by adding a .patch file and, say, adding some scripts to modify
(Ex:)
https://github.com/ThreeTen22/CrewCustomization/blob/master/player.config.patch
which allows for functions like
https://github.com/ThreeTen22/CrewCustomization/blob/master/scripts/companions/companionsextended.lua
that you can use eworld.sendEntityMessage() to get information
Last edited by Depression Hurts, Eat More KFC; 12 Mar, 2020 @ 5:02pm
FelmastProMcLane  [developer] 12 Mar, 2020 @ 6:06pm 
Thanks, i did notice something you may find interesting, because default crew uniform doesn't include the head slot, your mod's overrides of that slot still works after respawning the crewmember, but weapons and the rest of the uniform do reset to their defaults.
That is intended. If you remember some colony missions have you make a hat for someone. When a person becomes a crewmember they keep the hat you made for them.
FelmastProMcLane  [developer] 12 Mar, 2020 @ 6:30pm 
I mean, after spawning -> detaching -> hiring -> beam down to planet, their uniform resets to the default (protectorate stuff).
But it seems that head gear overrides set in the spawnerPanel are kept.
moonshiner 11 Nov, 2020 @ 8:46am 
Hello, sorry for posting in here, but steam doesn't allow me to comment on the mod itself.
I would be very grateful if you'd upload the mod to Nexus or Chucklefish forums or anywhere else. I've got a gog version of the game and no crew customization mod I could download works with frackin universe and crew spawner (most are old versions).
FelmastProMcLane  [developer] 11 Nov, 2020 @ 9:14am 
Will do, but when my internet is fixed, it is too slow to do anything right now. :steamsad:
moonshiner 11 Nov, 2020 @ 9:25am 
Thank you!
< >
Showing 1-15 of 17 comments
Per page: 1530 50