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

System doesnt Work

Status
Not open for further replies.
Hello,readers.

Im developing a system which allows a dummy to cast something.
Here are the triggers:

Setup

Remove Abil

Target Unit Ex

Target Point Ex

[trigger=]Dummy Caster
Events
Map initialization
Conditions
Actions
Custom script: set udg_DC_Hash = InitHashtable()
-------- ---------------------------- --------
-------- Creating Dummy --------
-------- ---------------------------- --------
Set DC_Loc = (Center of (Playable map area))
Unit - Create 1 Dummy for Neutral Passive at DC_Loc facing Default building facing degrees
Set DC_DummyCaster = (Last created unit)
Custom script: call RemoveLocation(udg_DC_Loc)
Custom script: call ExecuteFunc("Configuration")
Custom script: endfunction
Custom script: function Encapsulate takes nothing returns nothing
Hashtable - Save DC_AddedAbil as (Key Added Ability) of DC_CastedAbil in DC_Hash
Hashtable - Save DC_Order as (Key Dummy Order) of DC_CastedAbil in DC_Hash
Custom script: endfunction
Custom script: function Configuration takes nothing returns nothing
-------- ---------------------------- --------
-------- Configuration Here --------
-------- ---------------------------- --------
-------- ---------------------------- --------
-------- Storm Bolt orders dummy to cast Banish --------
-------- ---------------------------- --------
Custom script: set udg_DC_CastedAbil = 'AHtb'
Custom script: set udg_DC_AddedAbil = 'AHbn'
Set DC_Order = banish
Custom script: call Encapsulate()
-------- ---------------------------- --------
-------- Thunder Clap orders dummy to cast Carrion Swarm --------
-------- ---------------------------- --------
Custom script: set udg_DC_CastedAbil = 'AHtc'
Custom script: set udg_DC_AddedAbil = 'AUcs'
Set DC_Order = carrionswarm
Custom script: call Encapsulate()
-------- ---------------------------- --------
-------- End of Configuration Here --------
-------- ---------------------------- --------
Custom script: endfunction
-------- ---------------------------- --------
-------- This function resets the dummy caster --------
-------- ---------------------------- --------
Custom script: function DummyCasterReset takes nothing returns nothing
Set DC_Loc = (Center of (Playable map area))
Unit - Move DC_DummyCaster instantly to DC_Loc
Custom script: call RemoveLocation(udg_DC_Loc)
Custom script: call UnitRemoveAbility(udg_DC_DummyCaster,GetSpellAbilityId())
Custom script: endfunction
-------- ---------------------------- --------
-------- This function orders the dummy caster to target unit --------
-------- Use call ExecuteFunc("OrderDummyCasterTargetUnit") --------
-------- ---------------------------- --------
Custom script: function OrderDummyCasterTargetUnit takes nothing returns nothing
Set DC_Loc = (Position of DC_Caster)
Unit - Move DC_DummyCaster instantly to DC_Loc
Custom script: call RemoveLocation(udg_DC_Loc)
Custom script: call IssueTargetOrder(udg_DC_DummyCaster,udg_DC_Order,udg_DC_Target)
Custom script: endfunction
-------- ---------------------------- --------
-------- This function orders the dummy caster to target point --------
-------- Use call ExecuteFunc("OrderDummyCasterTargetPoint") --------
-------- ---------------------------- --------
Custom script: function OrderDummyCasterTargetPoint takes nothing returns nothing
Set DC_Loc = (Position of DC_Caster)
Unit - Move DC_DummyCaster instantly to DC_Loc
Custom script: call RemoveLocation(udg_DC_Loc)
Custom script: call IssuePointOrderLoc(udg_DC_DummyCaster,udg_DC_Order,udg_DC_TargetLoc)
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
Set DC_Loc = (Position of DC_Caster)
Unit - Move DC_DummyCaster instantly to DC_Loc
Custom script: call RemoveLocation(udg_DC_Loc)
Custom script: call IssueTargetDestructableOrder(udg_DC_DummyCaster,udg_DC_Order,udg_DC_TargetDest)
Custom script: endfunction
-------- ---------------------------- --------
-------- This function orders the dummy caster with no target --------
-------- Use call ExecuteFunc("OrderDummyCasterNoTarget") --------
-------- ---------------------------- --------
Custom script: function OrderDummyCasterNoTarget takes nothing returns nothing
Set DC_Loc = (Position of DC_Caster)
Unit - Move DC_DummyCaster instantly to DC_Loc
Custom script: call RemoveLocation(udg_DC_Loc)
Custom script: call IssueImmediateOrder(udg_DC_DummyCaster,udg_DC_Order)
[/trigger]
[trigger=]Remove Abil
Events
Unit - A unit Starts the effect of an ability
Conditions
(Unit-type of (Triggering unit)) Equal to Dummy
Actions
Custom script: call DummyCasterReset()
[/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)
Custom script: set udg_DC_CastedAbil = GetSpellAbilityId()
Set DC_AddedAbil = (Load (Key Added Ability) of DC_CastedAbil from DC_Hash)
Set DC_Order = (Load (Key Dummy Order) of DC_CastedAbil from DC_Hash)
Custom script: call UnitAddAbility(udg_DC_DummyCaster,udg_DC_AddedAbil)
Custom script: call SetUnitAbilityLevelSwapped( udg_DC_AddedAbil , udg_DC_DummyCaster , GetUnitAbilityLevelSwapped(udg_DC_CastedAbil , udg_DC_Caster))
Custom script: call ExecuteFunc("OrderDummyCasterTargetUnit")
[/trigger]
[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)
Custom script: set udg_DC_CastedAbil = GetSpellAbilityId()
Set DC_AddedAbil = (Load (Key Added Ability) of DC_CastedAbil from DC_Hash)
Set DC_Order = (Load (Key Dummy Order) of DC_CastedAbil from DC_Hash)
Custom script: call UnitAddAbility(udg_DC_DummyCaster,udg_DC_AddedAbil)
Custom script: call SetUnitAbilityLevelSwapped( udg_DC_AddedAbil , udg_DC_DummyCaster , GetUnitAbilityLevelSwapped(udg_DC_CastedAbil , udg_DC_Caster))
Custom script: call ExecuteFunc("OrderDummyCasterTargetPoint")
Custom script: call RemoveLocation(udg_DC_TargetLoc)
[/trigger]


My problem is that the dummy doesnt follow the orders.

Here is the map:
 

Attachments

  • Dummy Caster.w3x
    19.7 KB · Views: 36
I don't have WE on this comp so I'll just give you a list of things you might want to check:
  • First, try giving the dummy unit an actual model. It can be anything. This will let you debug it properly to know whether it has moved, whether it has casted, etc.
  • Make sure the dummy has a cast point of 0.
  • Make sure the dummy has enough mana to cast.
  • Make sure the dummy has enough time to cast.
  • Make sure the dummy has a movement speed of 0 so the cast will be instant. (no turning or w/e)
  • Try running a 0 second timer after the ability finishes before calling the reset function.
 
Status
Not open for further replies.
Top