I have this portion of the code that write who is being attack in the game.
Code:
function widget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer) local txt = "TakingFire unitTeam ".. unitTeam.. " unit".. unitDefID.. " id"..unitID write(txt) end
Anyone knows if I could find out through this widget which unit is attacking my unit?
Desire outcome will be Unit 123 from Team 0 is attacking Unit 456 from Team 1 at x y z location. Instead of the current> TakingFire unitTeam 0 unit 123.
What knorke said. However.... maybe that's gadget only!
As using widgets to know who's attacking through the fog of war could theorically be considered some sort of cheating, it might have been disabled in widgets. Try and see!
function gadget:UnitDamaged(unitID,unitDefID,unitTeam,damage,paralyzer,weaponID,attackerID,attattackerDefID,attackerTeam) local x,y,z=Spring.GetUnitPostion(unitID) local txt = "Unit "..unitID.." from Team"..unitTeam.." is being attacked by Unit "..attackerID.." from Team "..attackerTeam.."at"..x..y..z
Spring.SendLuaUIMsg(txt) end
Thanks! =) Which sends the information to a widget to write it in a txt. The portion that contains of the widget that receive the information:
Code:
function widget:RecLuaMsg(txt,playerID) write(txt) end
My questions here: 1. The information is successfully written in a txt file. But I randomly I will have this error message:
Code:
LuaRules::RunCallIn:error=2, unitDamged, [string "LuaRules/Gadgets/logger.lua"]:16: attemot to concatenate local 'attackerTeam'(a nil value)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum