Code: Select all
function OnEvent(eventType, sourceID, targetID, unitType, longitude, latitude)
if (eventType == "Destroyed") then
SendChat(tostring(sourceID:GetUnitType()) .. " killed a " .. unitType .. " " .. tostring(targetID:GetUnitType()))
....
end
This
Code: Select all
SendChat(tostring(sourceID:GetUnitType()) .. " killed a " .. unitType
outputs "Gunshot killed a Invalid"
while this
Code: Select all
SendChat(tostring(sourceID:GetUnitType()) .. " killed a " .. tostring(targetID:GetUnitType()))
outputs "Gunshot killed a Fighter"
What's up with unitType (not GetUnitType)? 'Invalid' isn't a normal Lua error, (e.g. 'trying to index a nil value', 'expected string got userdata') so I'm lost.