UnitStateChangeDetected Lua

Jaegerguy

Chieftain
Joined
Jul 12, 2020
Messages
26
So, when does the event UnitStateChangeDetected trigger? I had wanted to write a script that does things when a particular unit attacks, but by reading some posts around here I've come to understand that such a thing isn't possible without modifying the DLL. I guess there is no chance that you could check if an unit is attacking with it, but I still would like to know what a "state change" entails.
 
See UnitFlagManager.lua

Code:
------------------------------------------------------------
-- this goes off when a unit moves into or out of the fog
------------------------------------------------------------
function OnUnitFogEvent( playerID, unitID, fogState )
end
Events.UnitStateChangeDetected.Add( OnUnitFogEvent );
 
See UnitFlagManager.lua

Code:
------------------------------------------------------------
-- this goes off when a unit moves into or out of the fog
------------------------------------------------------------
function OnUnitFogEvent( playerID, unitID, fogState )
end
Events.UnitStateChangeDetected.Add( OnUnitFogEvent );

Thanks! I hadn't even realised the existence of such Lua files, except the scripts for the official scenarios. (I used the Modiki documentation, and now that I look at it, the source files are clearly stated there too) :crazyeye:
 
Top Bottom