- Joined
- Nov 2, 2004
- Messages
- 1,993
There's something weird (not) happening. BlzUnitHideAbility and BlzUnitDisableAbility are not working in certain cases.
The calls to
When
If I do
When
The calls to
SetupCtrls
in the initializer work as expected.When
ButtonControlCndAcn
is triggered (SPELL_CAST event) to "OPEN", CTRL_SFX
and CTRL_CAM
are not hidden as they should be, but the other abilities are shown as expected.If I do
BlzUnitHideAbility(MVUnit, CTRL_SFX, true/false)
in ButtonControlCndAcn
itself instead, they are shown/hidden as expected.When
ButtonControlCndAcn
is triggered (SPELL_CAST event) to "NEXT PAGE", abilities that should be hidden are hidden, but the ones that should be shown are not.
JASS:
library ModelViewer initializer InitModelViewer
globals
private constant integer CTRL_SFX = 'A004'
private constant integer CTRL_CAM = 'A00J'
private constant key CTRL_OPEN
private constant key CTRL_OFF
private unit MVUnit
endglobals
private function SetupCtrls takes integer id, boolean close returns nothing
local boolean page1 = (not close) and GetUnitAbilityLevel(MVUnit, id) == 1
call BlzUnitHideAbility(MVUnit, CTRL_SFX, not close) // These aren't hidden when close == false
call BlzUnitHideAbility(MVUnit, CTRL_CAM, not close) // But they are when called in the trigger func instead
if id == CTRL_SFX then
call BlzUnitHideAbility(MVUnit, 'A00N', not page1) // PosX
call BlzUnitHideAbility(MVUnit, 'A00O', not page1) // PosY
call BlzUnitHideAbility(MVUnit, 'A00Q', not page1) // PosZ
call BlzUnitHideAbility(MVUnit, 'A00R', not page1) // Scale
call BlzUnitHideAbility(MVUnit, 'A00S', not page1) // Roll
call BlzUnitHideAbility(MVUnit, 'A00T', not page1) // Pitch
call BlzUnitHideAbility(MVUnit, 'A00U', not page1) // Yaw
call BlzUnitHideAbility(MVUnit, 'A00V', close or page1) // Alpha
call BlzUnitHideAbility(MVUnit, 'A010', close or page1) // Color
elseif id == CTRL_CAM then
call BlzUnitHideAbility(MVUnit, 'A007', not page1) // PosX
call BlzUnitHideAbility(MVUnit, 'A003', not page1) // PosY
call BlzUnitHideAbility(MVUnit, 'A00E', not page1) // PosZ
call BlzUnitHideAbility(MVUnit, 'A00D', not page1) // Distance
call BlzUnitHideAbility(MVUnit, 'A00C', not page1) // Rotation
call BlzUnitHideAbility(MVUnit, 'A000', not page1) // AoA
call BlzUnitHideAbility(MVUnit, 'A00B', not page1) // Roll
call BlzUnitHideAbility(MVUnit, 'A006', close or page1) // FoV
call BlzUnitHideAbility(MVUnit, 'A005', close or page1) // FarZ
endif
endfunction
//=========
//==== Button Control ====
private function ButtonControlCndAcn takes nothing returns boolean
local integer spellId = GetSpellAbilityId()
local integer id
// OPEN
if spellId == CTRL_SFX or spellId == CTRL_CAM then
call UnitRemoveAbility(MVUnit, 'A00H') // Apply Cam
call UnitRemoveAbility(MVUnit, 'A00A') // Save Cam
call UnitRemoveAbility(MVUnit, 'A00G') // Delete Cam
call UnitRemoveAbility(MVUnit, 'A008') // Mouse Controls
call SetupCtrls(spellId, false)
call UnitAddAbility(MVUnit, 'A009') // Increase
call UnitAddAbility(MVUnit, 'A00M') // Decrease
call UnitAddAbility(MVUnit, 'A00L') // Reset
call UnitAddAbility(MVUnit, 'A00P') // Page
call UnitAddAbility(MVUnit, 'A00I') // Back
call SaveInteger(htbToggles, CTRL_OPEN, 0, spellId)
// CLOSE
elseif spellId == 'A00I' then
call UnitRemoveAbility(MVUnit, 'A009') // Increase
call UnitRemoveAbility(MVUnit, 'A00M') // Decrease
call UnitRemoveAbility(MVUnit, 'A00L') // Reset
call UnitRemoveAbility(MVUnit, 'A00P') // Page
call UnitRemoveAbility(MVUnit, 'A00I') // Back
call SetupCtrls(LoadInteger(htbToggles, CTRL_OPEN, 0), true)
call UnitAddAbility(MVUnit, 'A00H') // Apply Cam
call UnitAddAbility(MVUnit, 'A00A') // Save Cam
call UnitAddAbility(MVUnit, 'A00G') // Delete Cam
call UnitAddAbility(MVUnit, 'A008') // Mouse Controls
call SaveInteger(htbToggles, CTRL_OPEN, 0, CTRL_OFF)
// NEXT PAGE
elseif spellId == 'A00P' then
set id = LoadInteger(htbToggles, CTRL_OPEN, 0)
if GetUnitAbilityLevel(MVUnit, id) == 1 then
call SetUnitAbilityLevel(MVUnit, id, 2)
else
call SetUnitAbilityLevel(MVUnit, id, 1)
endif
call SetupCtrls(id, false)
endif
return false
endfunction
private function InitModelViewer takes nothing returns nothing
set MVUnit = gg_unit_hhou_0002
call SaveInteger(htbToggles, CTRL_OPEN, 0, CTRL_OFF)
call SetupCtrls(CTRL_SFX, true)
call SetupCtrls(CTRL_CAM, true)
endfunction
endlibrary
Last edited: