| 07-05-2006, 01:29 PM | #1 |
Alright, so in my map I'm issuing upgrade commands to some of the buildings. What I'd like to do is to make sure that the user can't cancel these upgrades. My goal here is to keep the upgrade animation (as well as the health 'transfer') if at all possible to make the transition as smooth as possible. Though my fallback solution is just to instantly complete the upgrade if the user presses cancel. At any rate, I've been trying to make this work by resuming the upgrade when a user presses cancel, and setting the upgrade progress to wherever it was when they tried to cancel. However, I can't seem to find any way to get the upgrade-to unit type, nor the current construction progress - for a 'unit cancels upgrade' type event. I'm curious if there are any easy solutions to this (maybe some way to hide/disable the cancel button during an upgrade)? If not, no biggie, I don't want to spend too much time on this feature. |
| 07-05-2006, 02:49 PM | #2 |
Hmm, a random idea so I'm not sure if it will work but... try giving the unit the ward classification, I believe it should cause the command card to be disabled, of course even in this case it will probably be possible to cancel it through other means. |
| 07-05-2006, 03:49 PM | #3 |
You can try changing the owner of the building to a neutral player until the upgrade finishes. Also try pausing the bulding. |
| 07-05-2006, 07:30 PM | #4 | |
Quote:
I believe if you change the owner of the building to another player, when the upgrade is finished it will give it to the current owner of the building, not the players before. So he/she wouldn't get the upgrade he/she just paid for. |
| 07-05-2006, 08:05 PM | #6 |
Tried already with ward as naakaloh suggested? If yes, try locust. Ugly, but should work. |
| 07-05-2006, 09:02 PM | #7 |
Lol, you cant locust it! its irriversable. Once its upgraded the building is gone (well not gone but useless). |
| 07-06-2006, 02:01 AM | #8 |
You can hide the unit, remove locust, and unhide the unit. |
| 07-06-2006, 08:49 AM | #9 |
Thanks for the help, all! After fiddling with your solutions, I wandered off in my own direction a bit , and ended up with this trigger: JASS:function Trig_Building_Upgrades_Actions takes nothing returns nothing local unit u = GetTriggerUnit() call SetUnitAnimation(u, "birth") call SetUnitTimeScalePercent(u, (60.0 / udg_anim_upgrade_time) * 100.00) call TriggerSleepAction(udg_anim_upgrade_time) call SetUnitAnimation(u, "stand") call SetUnitTimeScalePercent(u, 100.00) set u = null endfunction //=========================================================================== function InitTrig_Building_Upgrades takes nothing returns nothing local integer i = 0 set gg_trg_Building_Upgrades = CreateTrigger() call TriggerAddAction(gg_trg_Building_Upgrades, function Trig_Building_Upgrades_Actions) loop exitwhen i >= bj_MAX_PLAYERS call TriggerRegisterPlayerUnitEvent(gg_trg_Building_Upgrades, Player(i), EVENT_PLAYER_UNIT_UPGRADE_FINISH, null) set i = i + 1 endloop endfunction Note that when I issue an upgrade order, I also set its upgrade progress to 100% to instantly upgrade the building. So this solution only works because I'm using the upgrade animation in a purely cosmetic fasion. Reason I'm going this route is that, in my very limited testing, a normal upgrade also makes the health of the building, if damaged, 'jump' (it's not a smooth transition like I thought it was) Though, I find it kind of weird that the upgrade animations (the human town hall ones, at least) end kinda abruptly - at least when you're speeding them up a bunch (I'm running the upgrades over 5 seconds) |
| 07-06-2006, 02:47 PM | #10 | |
Quote:
The unit will be clickable, but it will still not be the same, the life bar when you hover over it will dissapear, and other things will go missing. Its bad to add locust and hide/unhide to remove it, i used this method also until i was told that it was not good. |
