• 🏆 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!

[Spell] Hotkey and detection for auto-cast?

Status
Not open for further replies.
Yes. Autocast spells should have a hot key in editor. However, I will assume you tried this and it doesn't work. The next thing you can do is get the order to autocast. To get an order use this trigger:

  • GetOrder
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Triggering unit) Equal to (==) unit
    • Actions
      • Custom script: call BJDebugMsg(OrderId2String(GetIssuedOrderId()) + " - " + I2S(GetIssuedOrderId()))
      • Game - Display to (All players) the text: (Name of (Target unit of issued order))
      • Game - Display to (All players) the text: (Name of (Target destructible of issued order))
      • Game - Display to (All players) the text: (Name of (Target unit of issued order))

Then you can create a hot key and either...
  • Custom script: call IssueImmediateOrder(udg_Unit,"warstomp")
or...
  • Custom script: call IssueImmediateOrderById (udg_TempUnit, 852625)
use the order id.

The trick is in setting your hotkey now.

Maybe this makes sense to you: Big shots talking command strings

But if you are like me, you don't have time for that. You can use ESC or an arrow key if you are in a rush. Also, if you have room you can create a dummy spell with a transparent BTN and DISBTN icons and then make the name and tooltip a single space " ". This will get you a small window but it's the smallest interference I can think of.

You might want to read this as well, though it will not solve your problem: http://www.hiveworkshop.com/forums/lab-715/removing-standart-command-buttons-commandfunc-txt-261559/

Hotkeys are tricky but you can often find workarounds for your particular purpose, however, without knowing what kind of map project you are working on, this is all I got. Hope it helped.

And for question #2:

http://www.hiveworkshop.com/forums/...detect-if-ability-currently-auto-cast-247235/
 
Level 11
Joined
Oct 9, 2015
Messages
721
I didn't understoo the first part, but the second I got it clear.
Let me specify my intentions:
I want to make an ability (preferebly passive ability) with an auto-cast option that can be turned on and off throught an hotkey, then I want to detect either or not it's activated, my intention is to make an "alternate attack" button, if the auto-cast is off the unit will perform an action, if it's on it will perform an alternate action.
 
Level 8
Joined
Jan 28, 2016
Messages
486
What DracoLich is saying is that if you want the ability to be passive that you can "turn on/turn off", you're better off simulating that functionality using an instant-cast ability to detect when the spell is cast and track it with a boolean to set it on or off.

Better yet, do the same thing but with an Immolation-based spell! That way you can toggle the passive with a proper ability hotkey and have the UI effects you want, i.e.: different icons when on/off and that shiny glow that revolves around the icon. :D
 
Level 8
Joined
Jan 28, 2016
Messages
486
My bad. It doesn't but thought it did for some odd reason. Other than that, the method DracoLich provided would be fine. If you still want the shiny border thing, Legal_Ease's method is what you're after.
 
I didn't understoo the first part, but the second I got it clear.
Let me specify my intentions:
I want to make an ability (preferebly passive ability) with an auto-cast option that can be turned on and off throught an hotkey, then I want to detect either or not it's activated, my intention is to make an "alternate attack" button, if the auto-cast is off the unit will perform an action, if it's on it will perform an alternate action.

The first part is so that you can know the order being given. If you don't know the order then you can't trigger it. So with this "getOrder" trigger you can find out if there is an order ID for activate auto-cast. I suggest you create this trigger in your map and see how it works. Debugging is the key to great map making.

What you are trying to do is possible but it seems a bit funny since we already have on/off abilities. But, that's ok. If you want sparkles, we will get you sparkles. Once we know the order for activate auto-cast on your spell we can continue. So what we are going to do is a combination of what the others suggested and what I originally suggested. We will make 2 spells. The 1st one will be no target. It will be based off of channel or something like berserk. The second will be your auto-cast targeted spell. Make sure they both use the same icon position. This is your alternate attack, yes? Now, when a unit is ordered to cast Ability_1 then we remove Ability_1 and add ability_2 and order the unit to activate auto-cast. This is why we need to know the order. If the order is given to unactivate it then we remove Ability_2 and replace it with ability_1. Make sure both use the same hotkey and you will be golden. Also, you may want to reset is upon death or other events.

Does this make sense?

Also, now you can easily tell if the unit has auto-cast on. Check to see if the unit has the ability with an integer condition. (Level of Ability_2 for (picked unit)) greater than 0
 
Status
Not open for further replies.
Top