How to mod agents with loadouts - finally dig it.


Recommended Posts

Guys, I finally understand how it should be done:

2 agentdefs in scripts.zip:

1st (for example agentdefs_1) with agent definition only for agent_1 (base loadout )
code for it in modinit.lua:

local agentdefs = include( scriptPath .. "/agentdefs_1" )
        for name, agentDef in pairs(agentdefs) do
            modApi:addAgentDef( name, agentDef, "agent_1", "agent_1_a")
    end

^^ this way it require to have only one agent in agentdefs_1, to not have a mess (is it a problem though? like if everyone created dozen agents at once?) 

2nd  (for example agentdefs_2) with agent definition for alternative loadout (like archive) named for example "agent_1_a"
and with that code:

local agentdefs = include( scriptPath .. "/agentdefs_2" )
        for name, agentDef in pairs(agentdefs) do
            modApi:addAgentDef( name, agentDef, nil  )
    end

^^ here so many agents as needed (ie when you make a dozen agents in one mod there needed separate files for base loadouts, but all secondary can be in one file), "nil" here prevent agent from appearing in agents list on its own, useful for hostages, prisoners and any other non-regular characters. Good to overwriting agents without additions too.

If anyone have a picture with detective-alike Slowpoke, post it please.

Link to comment
Share on other sites

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.