HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[script]DisarmUtils

07-02-2011, 12:10 AM#1
BBQ
Introduction
DisarmUtils is written in Zinc and requires the Jass NewGen Pack along with the latest version of JassHelper.

This is just a simple snippet that is meant to make disarming easier, and does so by taking advantage of the Cargo Hold ability. It also provides responses that are evaluated when a unit is effectively disarmed or rearmed. It should be noted that the responses will only be evaluated through the use of this snippet's functions. Achieving the same effects by other means will not result in the evaluation of any response.

Disarming units with the help of the Cargo Hold ability has many advantages over using Drunken Haze or any other similar ability. Namely,
  • It does not involve any dummy casters.
  • Unlike Drunken Haze, it works properly on magic immune units and is not removed by Purge or any other similar abilities.
  • It is basically bug-free.
CreditsLimitations
The only limitation of this snippet is the fact that you cannot choose whether to disarm melee or ranged attacks separately. It is also advised to do all the disarming in your map by using the functions which are provided by this snippet.
The snippet
Requirements:
Expand DisarmUtils:

Available functions
This snippet provides the following functions to the user:
  • function Disarm takes unit whichUnit returns nothing
  • function Rearm takes unit whichUnit returns nothing
  • function TimedDisarm takes unit whichUnit, real duration returns nothing
  • function IsUnitDisarmed takes unit whichUnit returns boolean
  • function OnUnitDisarmed takes response whichResponse returns nothing
  • function OnUnitRearmed takes response whichResponse returns nothing
response is either a function or a static method that takes unit (the unit that was disarmed or rearmed) and returns nothing.