Jump to content

"AddCombatPartyDef" does nothing if party is not defined


Recommended Posts

Title.

Under "content/combat_parties", this is defined:

function AddCombatPartyDef(id, fn)
    if GENERATORS[id] then
        print (loc.format( "Combat party generator {1} is already defined. If you aren't reloading combat, look into this", id ))
        GENERATORS[id] = fn
    end
end

For some reason, the function is added if a function already exists, and not if the function does not exist.

Link to comment
Share on other sites

7 hours ago, rooks said:

Thanks for the heads up.  This looks to be an old (strangely defined) function, as I can't find anywhere in the code that uses it.

Maybe it's for modders?

Either way, I'm using it for custom combat parties.

Speaking of which, is there a way to make the helper function in the combat party def publicly accessible? It seems like it is applicable in many situations.

Link to comment
Share on other sites

  • Developer

Ah in that case I will amend AddCombatPartyDef like this:

Spoiler


function AddCombatPartyDef(id, fn)
    if GENERATORS[id] then
        print (loc.format( "Combat party generator {1} is already defined. If you aren't reloading combat, look into this", id ))
    end
    GENERATORS[id] = fn
end
 

As for the helper functions, the best I can do is make them global.  Which ones were you referring to specifically?  PickTeams, FindValidTeams, etc.?

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.

×
  • Create New...