LUA play animation?

FurionHuang

Warlord
Joined
Apr 27, 2017
Messages
184
Hey folks,

I was looking into Fire Tuner's panel codes and found these lines:
Code:
<Action>if (g_SelectedPlayer ~= nil and g_SelectedPlayer &gt;= 0 and g_SelectedUnitID ~= nil and g_SelectedUnitID &gt;= 0) then
    local pPlayer = Players[g_SelectedPlayer];
    if pPlayer ~= nil then
        local pUnit = pPlayer:GetUnits():FindID(g_SelectedUnitID);
        if (pUnit ~= nil) then
            SimUnitSystem.SetAnimationState(pUnit, "DEATH");
        end
    end
end
</Action>
That makes think it might be possible to trigger some unit animations in game play via lua.
YET, I also discovered this "SimUnitSystem" was only FT code. When copy-paste into lua script, the game doesn't know what function was that.
So I believe there must be somewhere we can find how to translate this "SimUnitSystem.SetAnimationState" to an actual LUA code. I started looking at FT .dll files but found nothing relevant. Would you guys happen to have any idea?
@LeeS would you be interested?
 
It seems that SimUnitSystem is not available in gameplay script context, only UI context.
 
It seems that SimUnitSystem is not available in gameplay script context, only UI context.
So how do I add LUA script to my MOD as UI context? Gameplay is straight forward, but when I added the script under AddUserInterface, game went back to start menu when initiating. And then I created another xml file with this code:
Code:
<Context Name="DS_PlayAnim">
</Context>
This "DS_PlayAnim" is both lua and xml name. Ran the game, nothing happened. Moved the xml under AddUserInterface, back to start menu again.
 
modinfo
Code:
        <UserInterface>       
            <Properties>
                <Context>InGame</Context>
            </Properties>
            <Items>
                <File>Scripts/YnAMP_InGame.xml</File>
            </Items>
        </UserInterface>
 
Is it possible to change the position of unit graphics?
My problem is that you can start the attack animation using
Code:
SimUnitSystem.SetAnimationState(pUnit, "ATTACK");
but I have not found a way to let the unit graphics move on the opponent's plot like in a real combat animation.
 
Back
Top Bottom