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

Dummy Caster v1.4

  • Like
Reactions: deepstrasz and KnnO

Description

Triggers

Changelogs

Dummy Caster


This is the Dummy Caster system,this allows you to use dummy to cast abilities based on your orders.
This system is good for stunning,nova,and destroy trees.
Doesnt support summonings and channeling.
If you want a vJASS version:
MUIDummyCasterbyMcKill2009

Dummy Caster

Example Point

Example Unit

  • Dummy Caster
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_DC_Hash = InitHashtable()
      • -------- ---------------------------- --------
      • -------- Creating Dummy --------
      • -------- ---------------------------- --------
      • Set DC_Loc = (Center of (Playable map area))
      • For each (Integer DC_I) from 1 to 12, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Player(DC_I)) at DC_Loc facing Default building facing degrees
          • Set DC_DummyCaster[DC_I] = (Last created unit)
      • Custom script: call RemoveLocation(udg_DC_Loc)
      • Custom script: endfunction
      • -------- ---------------------------- --------
      • -------- This function resets the dummy caster --------
      • -------- ---------------------------- --------
      • Custom script: function DummyCasterReset takes nothing returns nothing
      • -------- ---------------------------- --------
      • -------- you can remove this line if you want --------
      • -------- ---------------------------- --------
      • Custom script: call DisplayTextToForce( GetPlayersAll(), ( "Dummy Caster casted" + GetAbilityName(udg_DC_AddedAbil) ) )
      • -------- ---------------------------- --------
      • Set DC_Loc = (Center of (Playable map area))
      • Unit - Move DC_DummyCaster[DC_ID] instantly to DC_Loc
      • Custom script: call RemoveLocation(udg_DC_Loc)
      • Custom script: call UnitRemoveAbility(udg_DC_DummyCaster[udg_DC_ID],udg_DC_AddedAbil)
      • Custom script: endfunction
      • -------- ---------------------------- --------
      • -------- This function applies the ability to the dummy caster --------
      • -------- ---------------------------- --------
      • Custom script: function ApplyDummyCaster takes nothing returns nothing
      • Custom script: call UnitAddAbility(udg_DC_DummyCaster[udg_DC_ID],udg_DC_AddedAbil)
      • Custom script: call SetUnitAbilityLevel(udg_DC_DummyCaster[udg_DC_ID],udg_DC_AddedAbil,udg_DC_Level)
      • Custom script: endfunction
      • -------- ---------------------------- --------
      • -------- This function orders the dummy caster to target unit --------
      • -------- Use call ExecuteFunc("OrderDummyCasterTargetUnit") --------
      • -------- ---------------------------- --------
      • Custom script: function OrderDummyCasterTargetUnit takes nothing returns nothing
      • Custom script: call ApplyDummyCaster()
      • Unit - Move DC_DummyCaster[DC_ID] instantly to DC_Loc
      • Custom script: call IssueTargetOrder(udg_DC_DummyCaster[udg_DC_ID],udg_DC_Order,udg_DC_Target)
      • Custom script: call DummyCasterReset()
      • Custom script: endfunction
      • -------- ---------------------------- --------
      • -------- This function orders the dummy caster to target point --------
      • -------- Use call ExecuteFunc("OrderDummyCasterTargetPoint") --------
      • -------- ---------------------------- --------
      • Custom script: function OrderDummyCasterTargetPoint takes nothing returns nothing
      • Custom script: call ApplyDummyCaster()
      • Unit - Move DC_DummyCaster[DC_ID] instantly to DC_Loc
      • Custom script: call IssuePointOrderLoc(udg_DC_DummyCaster[udg_DC_ID],udg_DC_Order,udg_DC_TargetLoc)
      • Custom script: call DummyCasterReset()
      • Custom script: endfunction
      • -------- ---------------------------- --------
      • -------- This function orders the dummy caster to target destructable --------
      • -------- This is good for destroying trees --------
      • -------- Use call ExecuteFunc("OrderDummyCasterTargetDest") --------
      • -------- ---------------------------- --------
      • Custom script: function OrderDummyCasterTargetDest takes nothing returns nothing
      • Custom script: call ApplyDummyCaster()
      • Unit - Move DC_DummyCaster[DC_ID] instantly to DC_Loc
      • Custom script: call IssueTargetDestructableOrder(udg_DC_DummyCaster[udg_DC_ID],udg_DC_Order,udg_DC_TargetDest)
      • Custom script: call DummyCasterReset()
      • Custom script: endfunction
      • -------- ---------------------------- --------
      • -------- This function orders the dummy caster with no target --------
      • -------- Use call ExecuteFunc("OrderDummyCasterNoTarget") --------
      • -------- ---------------------------- --------
      • Custom script: function OrderDummyCasterNoTarget takes nothing returns nothing
      • Custom script: call ApplyDummyCaster()
      • Unit - Move DC_DummyCaster[DC_ID] instantly to DC_Loc
      • Custom script: call IssueImmediateOrder(udg_DC_DummyCaster[udg_DC_ID],udg_DC_Order)
      • Custom script: call DummyCasterReset()
[trigger=]Target Point
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Thunder Clap Ex
Actions
Set DC_Caster = (Triggering unit)
Set DC_TargetLoc = (Position of DC_Caster)
-------- ---------------------------- --------
-------- Thunder Clap orders dummy to cast Carrion Swarm --------
-------- ---------------------------- --------
Custom script: set udg_DC_AddedAbil = 'AUcs'
Set DC_Order = carrionswarm
Set DC_Loc = (Position of DC_Caster)
Set DC_Level = (Level of (Ability being cast) for DC_Caster)
Custom script: call ExecuteFunc("OrderDummyCasterTargetPoint")
Custom script: call RemoveLocation(udg_DC_Loc)
Custom script: call RemoveLocation(udg_DC_TargetLoc)
[/trigger]
[trigger=]Target Unit
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Storm Bolt Ex
Actions
Set DC_Caster = (Triggering unit)
Set DC_Target = (Target unit of ability being cast)
-------- ---------------------------- --------
-------- Storm Bolt orders dummy to cast Banish --------
-------- ---------------------------- --------
Custom script: set udg_DC_AddedAbil = 'AHbn'
Set DC_Order = banish
Set DC_Loc = (Position of DC_Caster)
Set DC_Level = (Level of (Ability being cast) for DC_Caster)
Custom script: call ExecuteFunc("OrderDummyCasterTargetUnit")
Custom script: call RemoveLocation(udg_DC_Loc)
[/trigger]
v1.0
-Released
v1.1
-Removed Configuration(due to the Timed Lightning Issue)
v1.2
-Fixed SetUnitAbilityLevel script
v1.3
-Added new function(ApplyDummyCaster)
v1.4
-Fixed kill application.(due to defskulls)
Contents

Dummy Caster v1.3 (Map)

Reviews
16:00, 25th Oct 2012 Magtheridon96: Approved.
Level 29
Joined
Mar 10, 2009
Messages
5,016
Mckill2009,flame strike is a channeling ability
that's what I said >>> coz not all abilities are instant cast like flamestrike, it has a delay
im using location instead of coordinates because it might cause bugs.
ex.when i used coordinates,the units selection circle is moved,but not the model
use SetUnitPosition instead os SetUnitX/Y
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
How can you approve this bugged system ?
Try let the Dummy casts Slow (Sorceress) to multiple picked units (or even single unit).

You'll notice, it can't.

Why ?
Because it only corresponds to only (Triggering player)'s unit which in this case, it will only cast the spell if the dummy's owning player is the player casting the spell.

Solution:
Create each player their own dummy unit and make it array for each instance.
Dummy[1] for Player 1
-----
Dummy[12] for Player 12

Just noticed this just now while I was experimenting some things.
And please, before you start any argument, I think you should try it first (I was weird too).

Also, it is better this way, create each player their own dummy unit, why ?
Because certain game (such as DotA) will count as Player Kill like dummy casting Storm Bolt that deals damage. So, what if the dummy kills the unit ?
The trigger interprets as Neutral Passive kills the unit, does that mean NP will get the gold ? No.
This is why it is nice to have each dummy for each player.
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
hey what does set udg_DC_AddedAbil = 'AUcs' mean? I tried copying it and I got errors
It sets the integer variable DC_AddedAbil equal to some ability ID, in this case that of default Carrion Swarm. Internally an "ability code" variable (different from an ability variable) is really just an integer variable because a rawcode like like 'AUcs' is actually a base-62 number (A-Z, a-z, 0-9); specifically 'AUcs' is 2501010 in decimal (base-10) notation. You can see every ability's rawcode in the editor by pressing ctrl+D to toggle between 'raw data' view mode. So while you can know an integer and ability code variable are the same type, GUI really limits you and will not let you treat an integer like an ability code, and vice-versa as well. GUI will literally not let you assign the integer that corresponds to Holy Light to an integer variable because GUI 'thinks' that abilities and integers are not interchangeable like they are.

Even though you can't set it with GUI, you can set it with a custom script line, which is what you see. The rawcode must be within two apostrophes like 'xxxx' so the computer knows it's base-62. The udg_ prefix in the variable name is there because that gets added to every single variable made with the variable editor, to avoid any possible naming conflicts (udg = user defined global). You must include this prefix before every variable when referencing them with custom script lines.

What is the purpose of the variable DC_AddedAbil? It's the ability that will be added to the dummy unit before it is ordered to cast it. This is something you should be setting with a trigger as part of your usage of the system. Why are you getting an error? Probably because the variable literally doesn't exist in your map (yet). There is a WE setting called "create unknown variables when pasting trigger data" which does exactly what it sounds like it does. However, it can't look for variables in use in Custom Script lines, and as far as I can tell that variable is only ever referenced in custom script lines. Therefore it was not automatically created when you pasted this system's triggers into your map.

So the line is referencing a variable that doesn't exist so the compiler can't proceed and throws an error. How do you fix it? Well, create the variable. Make an integer variable named DC_AddedAbil and you should be able to save. But IMO that's not the best solution. Instead you should simply change it to be an ability code variable rather than an integer. This won't change how anything interacts with the variable in the custom script lines, but it will allow you to set the variable normally as a GUI Set Variable... action rather than having to use the custom script line and type in the rawcode manually.



All of that being said, I really would recommend that you not use this resource at all, and instead learn how to use and manipulate dummy units for casting yourself. It's very easy. This system was fine in 2012 and it was probably fine up through its last update in 2016, but it's really not up to modern standards. It's a little annoying to work with, has little flexibility, and requires you to manually interact with in a bunch of ways that basically mean you do as much setup as managing the dummies manually would be! IMO a much better use of your time is understanding how to use dummy units simply and properly without a system like this to do the (small) steps for you.
 
Top