for the last week I have been running tests trying to understand how it modding in TF2 works, and I gotta be honest: even though I have read all the wiki multiple times and have read tons of threads and downloaded several mods and studied them and even though i have easily made mods for other games in the past TF2 is very irritating to work with.
Now I have a very simple script and I just can't figure out where to put the line "addModifier("loadConstruction", ModifyFarm)", I have tried at the begining, the end, in the update function, first line of the modifyfarm function, in between data and the function in between the brackets of the data function, as an init function, and nothing works, the game always crashes because "data" is nil (and local).
local function ModifyFarm(fileName, data)
local updateFn = data.updateFn
if currentYear == 1850 then
if data.type == "INDUSTRY" then
if data.description.name == _("Farm") then
data.updateFn = function(params)
local result = updateFn(params)
result.rule.capacity = result.rule.capacity * 10
return result
end
end
end
end
return data
end
function data()
return {
update = function()
ModifyFarm()
end,
}
end
Alles anzeigen
Another question: is it possible to use postRunFn or runFn in scripts? or is it just for the mod.lua? and if so, where should i put it? the modding wiki doesn't explain much.