Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

WilliamGreywind

Item Modding Questions

Recommended Posts

Hey, I've been trying to re-work my mod, which is a hard mod because it replaces files. I saw how the example mod replaced Decker's agent item, so I was wondering how would I do the same with items. My entire mod revolves around reworking items and even adding new items to replace agents items. Can this all be done in the itemdef folder or do I have to add an agentdef folder as well? I've been working on the mod, trying to make it a soft mod so it can be used with other mods, but so far it seems to just not load. I would really appreciate some help if anyone can offer me some.

 

Edit:

And here I uploaded the log file of where it crashed. It seems that I haven't declared my mod, which goes under VIBM. Oh goodness, now I'm just foolish because I have no idea where I have to declare that mod so that it'll actually work.

Share this post


Link to post
Share on other sites
Puritifyer    6

I'm still learning the modding API and have yet to get my mod to load successfully, but to replace an item that's already on an agent, I imagine you might need to make an agentdef file (if you're changing actual item loadouts instead of individual items), itemdefs I assume would maybe let you replace an item's stats if it were kept the same as the original (in terms of name values since that is how the mod adds the Voight Scan).

 

Unfortunately I have gotten about as far as you have in terms of actually getting things to run, So the most I can offer is what I've pieced together via my failed attempts.

Share this post


Link to post
Share on other sites

Well, I've managed to at least get the game to start up for once, before the game refused to actually open Invisible, Inc. But now it just black screens and crashes for me. I guess that's an improvement because I accidentally forgot to put a }, at the end of the strings. But now I'm wondering where the source of my problem is. Perhaps I should upload my mod and see if anyone can spot where it's coming from. Though I feel I probably should just remove the agentdef part for now and work solely on items at least until I figure it out better.

Share this post


Link to post
Share on other sites
Shirsh    129

To find mistakes it's better to check game's log file, if it can load mod's scripts.zip but troubled later it will contain reference to wrong string in wrong file.

I had a lot of problems simply because by default my packer put files not directly in scripts.zip but in scripts.zip/scripts (it was a "save path" checkbox in the packer's options).

Share this post


Link to post
Share on other sites

To find mistakes it's better to check game's log file, if it can load mod's scripts.zip but troubled later it will contain reference to wrong string in wrong file.

I had a lot of problems simply because by default my packer put files not directly in scripts.zip but in scripts.zip/scripts (it was a "save path" checkbox in the packer's options).

 

Well I found the log. It said I haven't declared my mod, which goes under VIBM. Which I guess means that I must be doing something wrong because I don't know where to declare it.

 

And also, just one minor note I wanted to add, how do I make an item so that only one specific agent can use it? Like how Central can only pick up the Incognita Data core, how I can make a gun be only picked up by one agent? Or at least prevent other agents from being able to pick it up and fire it?

invisibleinc.zip

Share this post


Link to post
Share on other sites
Shirsh    129

Archived Prism's disguise have this one:      

traits = {  scan_vulnerable=true, CPUperTurn=2, pwrCost=2, warning=STRINGS.ITEMS.HOLO_MESH_WARNING, restrictedUse={{agentID=8,name=STRINGS.AGENTS.PRISM.NAME}}, drop_dropdisguise=true }, 

and Incognita hdd have a    

        traits = { cantdrop = true, pickupOnly="central"},

Where "central" is something from agentdefs.lua, I guess, because Central have a:

traits = util.extend( commondefs.DEFAULT_AGENT_TRAITS ) { inventoryMaxSize = 3, mp=8, mpMax=8, noUpgrade = true, central=true  },    
        tags = { "central" },

Have no idea which of them do it (for Central), I think restrictedUse should work better because didn't require to change agentdefs.

Share this post


Link to post
Share on other sites
Shirsh    129
Nov 14 13:54:56 -- ### ABORTING: FATAL SCRIPT ERROR ###

game/client/strict.lua:26: variable 'VIBM' is not declared

stack traceback:

    [C] in function 'traceback'

    game/client/state-manager.lua:31 in function <game/client/state-manager.lua:30>

    [C] in function 'assert'

    game/client/strict.lua:26 in function <game/client/strict.lua:24>

    VIBM/itemdefs.lua:58 in main chunk

    [C] in function 'require'

    game/client/include.lua:10 in function 'include'

    VIBM/modinit.lua:18 in function 'load'

    game/client/mod-manager.lua:343 in function 'loadModContent'

    game/client/states/state-main-menu.lua:106 in function 'onLoad'

    game/client/state-manager.lua:134 in function 'activateAtIndex'

    game/client/state-manager.lua:148 in function 'activate'

    game/client/states/state-splash.lua:66 in function 'onUpdate'

    game/client/state-manager.lua:40 in function <game/client/state-manager.lua:35>

    [C] in function 'xpcall'

    game/client/state-manager.lua:69 in function <game/client/state-manager.lua:62>

Maybe it's there? Itemdefs.lua string 58?

Share this post


Link to post
Share on other sites
wodzu_93    23

I succesfully ported an item mod by Nerava in private, so I should be of some help.

 

 

This is my modinit.lua file.

local util = include( "modules/util" )

local function init( modApi )

local dataPath = modApi:getDataPath()
local scriptPath = modApi:getScriptPath()

KLEIResourceMgr.MountPackage( dataPath .. "/gui.kwad", "data" )
modApi:addGenerationOption("extended_items", "ADDITIONAL ITEMS", "EXTENDED ITEMS\nEnable new items")
end

local function load( modApi, options )
local scriptPath = modApi:getScriptPath()

local itemdefs = include( scriptPath .. "/itemdefs" )

if options["extended_items"].enabled then
for name, itemDef in pairs(itemdefs) do
modApi:addItemDef( name, itemDef )
end

modApi:addAbilityDef( "manual_ice_break", scriptPath .."/manual_ice_break" )
end
end

return {
init = init,
load = load,
}

This is modinfo.txt file:

name = New Items And Augments
icon = gui/icons/nerava.png
author = Nerava

From what i experienced, you need following:

1. A .kwad file with 12x12 png file in it. This is needed to mark modded stuff. You need to create .kwad archive with proper folder structure, matching with one in modinfo.txt. Also, DO NOT add "modApi:setFooter()" line, it is unnecesary. 

 

2. Files must be packed into scripts.zip, game does not read bare folders.

 

When overwriting existing items, you HAVE TO write every required parameter, since mod loader completely replaces entries instead of merging original with new. For example, let's say I want to change STIM 1. This is my (wrong) itemdefs.lua:

local util = include( "modules/util" )
local commondefs = include( "sim/unitdefs/commondefs" )
local simdefs = include( "sim/simdefs" )

local tool_templates =
{
item_stim_1 = util.extend(commondefs.item_template)
{
name = "Mil-Stim",
desc = "Restores combat action.",
flavor = "A straight shot of serotonin to induce what may be politely described as a 'mild' berserker rage.",
traits = { cooldown = 0, cooldownMax = 9, combatRestored = true },
},

}

return tool_templates

This will either crash the game or throw error messages when you encounter this item. Proper entry:

local util = include( "modules/util" )
local commondefs = include( "sim/unitdefs/commondefs" )
local simdefs = include( "sim/simdefs" )

local tool_templates =

{
item_stim_1 = util.extend(commondefs.item_template)
{
name = "Mil-Stim",
desc = "Restores combat action.",
flavor = "A straight shot of serotonin to induce what may be politely described as a 'mild' berserker rage.", icon = "itemrigs/FloorProp_Bandages.png",
profile_icon = "gui/icons/item_icons/items_icon_small/icon-item_stim_small.png",
profile_icon_100 = "gui/icons/item_icons/icon-item_stim.png",
ITEM_LIST = true,
traits = { cooldown = 0, cooldownMax = 9, combatRestored = true },
requirements = { stealth = 2 },
abilities = { "carryable","recharge","use_stim" },
value = 400,
floorWeight = 1,
},

}

return tool_templates

Mod loader also has limitations. I've tried adding a line to tooltip in Incogita view (client/hud/tooltip_breakice.lua in original scripts.zip), made my own tooltip_breakice.lua file and added it to modinit.lua with 'include(scriptPath .. "/tooltip_breakice.lua")' and game just ignores it. In general, overwriting original files not specified in documentation is severly restricted.

 

Also, try to skip the strings.lua and hardcode strings as before the update. This should at least eliminate potential problems with string references. Add this later when you have the mod running.

Share this post


Link to post
Share on other sites

I see. Well, while I try to figure this out some more, let me post my mod as it currently stands. I can still manage to hard mod it, but I'm still hoping to get the newer mod in there. Hopefully another, more experienced set of eyes will help see what I can't while I try making this work.

VIBM No agentdef.zip

Share this post


Link to post
Share on other sites
Shirsh    129

I dig in, looks like you forget to change function that add agents to one that add items, but also looks like there's more limitations: probably mod folder must have exactly name that refferend in mod files ("VIBM" instead of "VIBM without agentdefs"), probably we should use locale DLC_strings (instead of MOD_strings - that was mine not worked stuff, or VIBM_strings) - but not sure about this. I added log thing to modinit, I think it makes reading game log easier. "soldAfter = NEVER_SOLD," item thing definitely not works anymore (had this one too).

Maybe there was something else, check it yourself, was working for me (when folder was renamed to VIBM):

scripts.zip

Share this post


Link to post
Share on other sites