Help with "attack" ability

PurgeandFire

zxcvmkgdfg
Reaction score
509
I'd approach it a little differently. I'd lock their movement by using:
JASS:
call SetUnitPropWindow(<unit>, 0)

(or the GUI equivalent). This will perform an effect similar to ensnare, without any buffs etc. To allow them to move again, you can just set the prop window back to the unit's default prop window. The unit can still rotate though iirc, so you may want to periodically set the facing to prevent that.

Next, I'd use cargo hold to disarm the unit (again, this doesn't have a buff or anything so it is very easy to implement). The only issue is that it'll remove the command card stuff as well as the attack damage display, but I don't think the unit really needs to see that when it isn't his turn, right? For more info, see the cargo hold section of:
http://www.wc3c.net/showthread.php?t=81742

Basically, the cool thing about doing it that way is that you have full control over the unit's actions. Entangle will disable both, which is problematic because if you remove it for the unit to use his turn, he can move around freely (which would require extra code to fix). There may be other side effects too. However, you can just remove cargo hold and the unit will have the option to attack again. Then you can just issue an attackonce order (I think that exists, lol) (or have the unit do it, or whatever) and then just add cargo hold again. It should work just fine, in theory. I'm not quite sure why entangling roots doesn't work for you, but I would just avoid that since it seems like a lot of extra code.

------
As for getting a unit's stats, it isn't really that much of a limitation. Most maps will use databases, which are just hashtables filled with the proper values. For example, if you want to store armor, you can just assign on map init all the unit-types' base armor under their unit-type id. Then when you want to retrieve armor, you could just load it, add any bonuses from items/stats (agility), and you're good to go. You may be wondering, "wait, I have to load it for EVERY unit-type? And factor in EVERY bonus from items?" Not really. Just the ones you use on your map. Usually it'll just end up being your custom units and items. In that sense, it isn't that hard at all. It is just map-specific, which is why no one really made a system for it. (eh, technically there are systems to get armor but they use different methods that I wouldn't really recommend)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top