Perkus
Prince
Hi, I'm trying to call a Unit class method called GetAirCombatDamage. It should exist, as it's listed here http://wiki.2kgames.com/civ5/index.php/Lua_Game_Objects/Unit#GetAirCombatDamage, as well as in the Civ5LuaAPI.html. According to the first link, there is one argument, (<Unit> pDefender). Ok, but when I try to call it like this:
I get a Lua.log file message that "Instance does not exist." Calling it with nil
gives me "Instance no longer exists."
The unit in question is an air unit (pMyUnit:GetDomainType() == DomainTypes.DOMAIN_AIR) , and I'm quite sure the pMyUnit and the pTheirUnit are both valid because it's in the middle of a function that I've been working with and using for days, and otherwise works fine. For example, I can call:
in the same spot, and it works just fine. And yes, I've also tried it with 3 arguments instead.
I also tried printing the attributes on pMyUnit as shown on the wiki:
GetAirCombatDamage shows up. But it's in the second section of the list, after an item called just "__instances". Is this relevant?
Can anybody give me any idea why this doesn't work?
iMyDamageInflicted = pMyUnit:GetAirCombatDamage(pTheirUnit);
I get a Lua.log file message that "Instance does not exist." Calling it with nil
iMyDamageInflicted = pMyUnit:GetAirCombatDamage(nil);
gives me "Instance no longer exists."
The unit in question is an air unit (pMyUnit:GetDomainType() == DomainTypes.DOMAIN_AIR) , and I'm quite sure the pMyUnit and the pTheirUnit are both valid because it's in the middle of a function that I've been working with and using for days, and otherwise works fine. For example, I can call:
iMyDamageInflicted = pMyUnit:GetRangeCombatDamage(pTheirUnit, nil, false);
in the same spot, and it works just fine. And yes, I've also tried it with 3 arguments instead.
I also tried printing the attributes on pMyUnit as shown on the wiki:
PHP:
print("pMyUnit Attributes:")
for k, v in pairs(getmetatable(pMyUnit).__index) do
print(k)
end
print("End attributes.");
GetAirCombatDamage shows up. But it's in the second section of the list, after an item called just "__instances". Is this relevant?
Can anybody give me any idea why this doesn't work?