How to activate multiple CT Sections when an actor becomes Active
I'm trying to activate/visible multiple CT_Sections when the combat tracker switches to the active CT Actor.
I know you can declare a button in your ct_host_entry.xml as <button_ct_section_active> and pair it with a <sub_ct_section> and this will work. My problem is I want to activate 2 sections on the Actors turn.
I've tried creating a DB.addHandler to my ct_entry.lua trigger:
Code:
-- ct_entry.lua
function onInit()
super.onInit();
-- unrelated stuff deleted
DB.addHandler(DB.getPath(getDatabaseNode(), "active"), "onUpdate", self.onUpdateActive);
end
function onUpdateActive(nodeField)
local bState = (nodeField.getValue() == 1);
sub_stats.setVisible(bState);
sub_combat.setVisible(bState);
end
Likewise with overriding onActiveChanged in my ct_entry.lua and trying each of the commented methods:
Code:
-- ct_entry.lua
function onActiveChanged()
Debug.chat("ct_entry.lua -- onActiveChanged");
local bState = (DB.getValue(getDatabaseNode(), "active", 0) == 1);
Debug.chat(bState);
-- self.onSectionChanged("stats");
-- self.onSectionChanged("combat");
-- super.onSectionChanged("stats");
-- super.onSectionChanged("combat");
-- sub_stats.setVisible(bState);
-- sub_combat.setVisible(bState);
end
I've messed around with all sorts of stuff, without success. I need some guidance here. Help!