Update UI with Lua

qqqbbb

Prince
Joined
Sep 25, 2010
Messages
530
How do I update UI with Lua so it shows correct player happiness after it was changed with 'pPlayer:SetHappiness' ?
 
SetHappiness() is pretty much a pointless function as it directly updates an internal variable that's re-calculated/overwritten frequently (eg when the player adopts a policy/belief, finishes an improvement, completes a building/wonder, at the start of every turn, etc)

It's possible that your changing this internal variable and then the game core is immediately recalculating it

Try calling the event that updates the top panel directly via Events.SerialEventGameDataDirty(), or in LiveTuner select the TopPanel context and call the function directly via UpdateData()
 
Top Bottom