Joebles
Chieftain
- Joined
- Jun 9, 2014
- Messages
- 62
Okay, so I'm running into a roadblock with a UA. Essentially, I want the trait to add progress toward your next golden age every time one of your units pillages an enemy tile. While I think I know exactly how to do this in the DLL, I want to do it through LUA in order to maximize compatibility.
The problem I have is I can't seem to find any lua functions to hook into relating to pillaging. The Plot object has a potential function, SetImprovementPillaged, but this test code:
does not appear to work - it gives me "attempt to index field 'Plot' (a nil value)" error. I'm assuming that means that since Plot is related to an object, I can't hook a new function into it this way (or probably at all)
Are the only functions you can properly hook into in the GameEvents / Events / LuaEvents objects? Or am I missing a critical bit that would allow me to get into other kinds of functions?
I apologize if this is a really basic and/or obvious LUA question, I'm slowly learning about the language but it's kind of patchwork and I'm obviously missing things.
The problem I have is I can't seem to find any lua functions to hook into relating to pillaging. The Plot object has a potential function, SetImprovementPillaged, but this test code:
Code:
function PillageTest(pillaged)
print("SetImprovementPillaged fired.")
end
Plot.SetImprovementPillaged.Add(PillageTest)
does not appear to work - it gives me "attempt to index field 'Plot' (a nil value)" error. I'm assuming that means that since Plot is related to an object, I can't hook a new function into it this way (or probably at all)
Are the only functions you can properly hook into in the GameEvents / Events / LuaEvents objects? Or am I missing a critical bit that would allow me to get into other kinds of functions?
I apologize if this is a really basic and/or obvious LUA question, I'm slowly learning about the language but it's kind of patchwork and I'm obviously missing things.