| 12-17-2008, 11:46 PM | #1 |
So my map is pretty much ready for release but there's still one more bug that annoys me. Wc3 has this really cool /sarcasm thing it does where when you replace a unit, if the first unit had a build or hero menu open and the new unit doesnt have that menu, the entire command menu goes blank. So, this only happens if the first unit has a menu open that the second unit does not have, but it's still a problem. Anyway to fix said problem? I tried deselecting the first unit before replacing it already, since deselecting ingame clears menus, but that didn't work. |
| 12-17-2008, 11:51 PM | #2 |
I've encountered a similar problem in the past, I solved it by deselecting/reselecting the unit. You say that doesn't work, though, but I'm not so sure. The better solution would be to obviously not use the ReplaceUnit BJ and just trigger the entire replacement yourself. Things tend to fix themselves when you avert the use of complex BJ functions. |
| 12-18-2008, 12:01 AM | #3 |
Well actually I lied. It's not literally "replacing" the unit. The raider you see there is constantly in existence since it's a hero, it just gets hidden. When the builder unit crosses the line, it then becomes the hero you see there, but it removes the builder from the game and unhides the hero and moves it to that location. EDIT: I tested some different things... When using triggers to deselect or clear a selection for a player, it remembers what the current menu for that unit. Even selecting a completely different unit, then reselecting the original unit, it keeps the same menu up. Damn you Blizzard. I blame you. Any other ideas? |
| 12-18-2008, 04:53 AM | #4 |
i dunno if theres an way, but perhaps you could select the unit and force the player to press escape button (if thats possible with triggers ...) something like ForceUIKey()... dunno Or perhaps it works with Issue(Immediate)OrderById(...) but i dont know any orderid which works for that, dunno if there is one, the orderids for stop and holdposition dont work :/ |
| 12-18-2008, 05:05 AM | #5 | |
Quote:
|
| 12-18-2008, 07:31 AM | #6 |
The hide/unhide unit doesn't work, that's in the root of the problem anyways because in the replacement function, one of the units is either being hidden or unhidden. akolyt0r, I forgot that it's possible to force players to "push" keys, and thanks for the note. I'm forcing them to press Esc, which works like a charm, even though it now makes a nice little 'click' noise every time the unit is replaced. Haha. It's ok though. Thanks guys :D |
| 12-18-2008, 12:58 PM | #7 |
Maybe you can use chaos to morph the unit and add/remove abilities appropriately? |
| 12-19-2008, 07:22 AM | #8 |
try force deslection before you do what ever you do to make it disapear, then force selection. |
| 12-19-2008, 08:42 AM | #9 | |
Quote:
i think problem is solved already ![]() |
| 12-19-2008, 08:50 AM | #10 |
my bad (though my way is far more elegant) |
| 12-19-2008, 09:58 AM | #11 | |
Quote:
...but it wont work. |
| 12-19-2008, 11:39 AM | #12 |
deleted unrelated code here.... EDIT: clear selection BEFORE you remove the first unit: JASS:
call ClearSelectionForPlayer(p) // <-----<<
call RemoveUnit(firstUnit)
set bj_lastCreatedUnit = CreateUnit(secondUnitType,....)
call SelectUnitForPlayerSingle(bj_lastCreatedUnit, p)
|
