#### Dirac

##### 22710180

- Reaction score
- 147

JASS:

```
/**********************************************************************
My own version of the so called DummyCaster "system"
***********************************************************************
*
* struct Dummy
*
* method load takes integer abilityRawCode returns nothing
* method unload takes integer abilityRawCode returns nothing
* - Adds or removes the given ability
* - Dummy['A000'].load()
*
* static method operator x= takes real n returns nothing
* static method operator y= takes real n returns nothing
* static method operator z= takes real n returns nothing
* - Sets the unit's position
*
* static player owner
* - Sets the dummy's owner.
*
* integer level
* - Sets the dummy's ability level.
* - Dummy['A000'].level=2
*
* method castOnTarget takes unit target returns boolean
* method castOnPoint takes real x, real y returns boolean
* method cast takes nothing returns boolean
* - Dummy[OrderId].castOnTarget(unit)
*
***********************************************************************
HOW TO IMPLEMENT:
* Import this code into an empty trigger in your map, requires NewGen installed. Save the map, reopen it,
* and then delete the "!" exclamation mark from the textmacro below
*/
//! runtextmacro DUMMY_UNIT_CREATE()
/*********************************************************************/
//! zinc
library Dummy
{
public constant integer DUMMY_TYPE ='dumy';
public constant integer CROW_FORM ='Amrf';
unit dummy;
boolean p=false;
module Init
{
private static method onInit()
{
dummy=CreateUnit(Player(15),DUMMY_TYPE,0,0,0);
UnitAddAbility(dummy,CROW_FORM);
UnitRemoveAbility(dummy,CROW_FORM);
}
}
public struct Dummy[]
{
static method is(unit whichUnit)->boolean
{
return dummy==whichUnit;
}
static method operator x=(real n)
{
SetUnitX(dummy,n);
p=true;
}
static method operator y=(real n)
{
SetUnitY(dummy,n);
p=true;
}
static method operator z=(real n)
{
SetUnitFlyHeight(dummy,n,0);
}
static method operator owner=(player p)
{
SetUnitOwner(dummy,p,false);
}
method operator level=(integer i)
{
SetUnitAbilityLevel(dummy,this,i);
}
method cast()
{
IssueImmediateOrderById(dummy,this);
}
method castOnTarget(widget t)
{
if(!p)
{
SetUnitX(dummy,GetWidgetX(t));
SetUnitY(dummy,GetWidgetY(t));
}
p=false;
IssueTargetOrderById(dummy,this,t);
}
method castOnPoint(real x,real y)
{
if(!p)
{
SetUnitX(dummy,x);
SetUnitY(dummy,y);
}
p=false;
IssuePointOrderById(dummy,this,x,y);
}
method load()->boolean
{
return UnitAddAbility(dummy,this);
}
method unload()->boolean
{
return UnitRemoveAbility(dummy,this);
}
module Init;
}
}
//! endzinc
//! textmacro DUMMY_UNIT_CREATE
//! externalblock extension=lua ObjectMerger $FILENAME$
//! i setobjecttype("units")
//! i createobject("ewsp","dumy")
//! i makechange(current,"uabi","Avul,Aloc,Aeth")
//! i makechange(current,"uble","0")
//! i makechange(current,"ucbs","0")
//! i makechange(current,"umxp","0")
//! i makechange(current,"umxr","0")
//! i makechange(current,"umdl","war3mapImported\\dummy.mdl")
//! i makechange(current,"uico","replaceableTextures\\CommandButtons\\BTNtemp.blp")
//! i makechange(current,"uimz","0")
//! i makechange(current,"ulpz","0")
//! i makechange(current,"uprw","1")
//! i makechange(current,"uspa","")
//! i makechange(current,"ucbs","0")
//! i makechange(current,"udty","divine")
//! i makechange(current,"umvs","522")
//! i makechange(current,"umvt","hover")
//! i makechange(current,"ucol","0")
//! i makechange(current,"ufle","0")
//! i makechange(current,"ufoo","0")
//! i makechange(current,"uhom","1")
//! i makechange(current,"umpi","1000")
//! i makechange(current,"umpm","1000")
//! i makechange(current,"umpr","100")
//! i makechange(current,"urac","commoner")
//! i makechange(current,"usid","0")
//! i makechange(current,"usin","0")
//! i makechange(current,"utyp","")
//! i makechange(current,"ubui","")
//! i makechange(current,"upgr","")
//! i makechange(current,"unam","DummyUnit")
//! i makechange(current,"utip","DummySystem")
//! i makechange(current,"utub","")
//! endexternalblock
//! endtextmacro
```