• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Unit selection & blacked out UI command card

Status
Not open for further replies.
Level 11
Joined
Mar 6, 2008
Messages
898
Hiho,

I did some work on my LTW map and just implemented a small feature that makes it possible for the players to select some important units from their so-called builder.
So the player clicks on an ability button at his builder's command card and a certain unit (building) is selected.

So far so good.

However, the whole thing did not work as expected.

Whenever I clicked on my abilities in order to select such a unit, the unit got selected correctly, however had a blacked out command card which is very bad as I want to select it in first place to click on its command card buttons ...

This is a known bug and several other people have collected their experiences with it, however with no successful workaround to fix it.

So the easy way of adding and removing an ability to refresh tooltips does not work here.

But since this is an important feature for the map are there are other work arounds to solve this?

As code I used this:

JASS:
if p == GetLocalPlayer() then
    call ClearSelection()
    call SelectUnit(myUnit, true)
endif

Which is more or less equal to PlayerUnitSelectSinge (or what it is called) - a blizzard's implementation.

Regards,
Robbepop



EDIT: SOLVED

I was trying to select units with dummy abilities within a spellbook and found out that this was the source of my problem.
So before selecting a unit via SelectUnit(...) I had to make sure that the issuing unit cancels its spellbook to return to normal command card UI.
This required the following workaround as the normal cancellation command does not work:

JASS:
function CancelSpellbook takes unit u returns nothing
    call IssueImmediateOrder(u, "stop")
    call PauseUnit(u, true)
    call PauseUnit(u, false)
endfunction

This did it for me!
 
Last edited by a moderator:
Did you try using a timer to delay the selection a bit?
JASS:
if GetLocalPlayer() == p then
    call ClearSelection()
endif
call TimerStart(CreateTimer(), 0.1, false, function callbackWhereYouSelectTheUnit)
'callbackWhereYouSelectTheUnit' would just select the unit (of course, you would have to make it MUI, but just run it as it is with a global for now since you just want to see if it works). Try playing around with the time delay (0.1) to see if you can get it to work.
 
Level 11
Joined
Mar 6, 2008
Messages
898
Yes I have tried that with different waits at different positions within the code (also the one shown by your example) - did not work for me ... :/

edit: does really nobody know a solution or workaround for this problem?
 
Last edited:
Level 11
Joined
Mar 6, 2008
Messages
898
*bump*

I was able to identify the core problem which I (we) have to solve.

The current scenario is that I am selection those units via another unit which got a spellbook based ability set to select other units.
When I move all the spellbook'ed selection abilities out of the spellbook (so that they are in the direct unit command card) everything works correctly and the units get selected when I use one of the selection dummy abilities.
So this problem has got something to do with the spellbook.
I have tried to perform a 1 second wait and manually ordered the selctor unit to cancel the spellbook (ESC - the red button in the lower right corner) and now everything works even in the spellbook.
However, now I got the problem that I have to do that manually and just-in-time in order to make it work since I can't seem to make the cancellation of the spellbook automatic via IssueImmediateOrderById(851976) which normally triggers the cancellation.

I hope you can help me with that!

Regards,
Robbepop


EDIT: SOLVED (view first post to see how)
 
Last edited:
Status
Not open for further replies.
Top