Name | Type | is_array | initial_value |
MDC_AbilityID | abilcode | No | |
MDC_Cast | integer | No | |
MDC_CastPoint | integer | No | |
MDC_CastTarget | integer | No | |
MDC_CastType | integer | No | |
MDC_DummyCaster | unit | No | |
MDC_DummyID | unitcode | No | |
MDC_Group | group | No | |
MDC_Hashtable | hashtable | No | |
MDC_Height | real | No | |
MDC_Level | integer | No | |
MDC_Location | location | No | |
MDC_OrderID | integer | No | |
MDC_Player | player | No | |
MDC_PointToPointCast | boolean | No | |
MDC_ProjectileAnglePoint | location | No | |
MDC_Target | unit | No | |
TestAngle | real | No | |
TestCount | integer | No | |
TestLocation | location | No |
//TESH.scrollpos=233
//TESH.alwaysfold=0
[B][COLOR="Yellow"][SIZE="3"]MUI DummyCaster v1.1[/SIZE][/COLOR][/B]
[tabs]
[tab=Intro]
- This system is related to my [url]http://www.hiveworkshop.com/forums/submissions-414/snippet-muidummycasters-211663/[/url] in jass resource, I've made a GUI version so that GUIers can have it's benefit
- Creates only 1 dummy for instant spells like firebolt, carrion swarm, banish, etc
- Supports channel spells by creating another dummy to channel the spell like flamestrike, starfall, blizzard, etc
- You may control the point where the dummy is created and cast to a target or location where you can see the projectile is traveling
- JNGP is not required
- Very easy to implement, MDC_Cast, MDC_CastPoint, MDC_CastTarget
[/tab]
[tab=Installation]
- Check the [b]Automatically create unknown variables when pasting trigger data[/b], via File/preferences/general tab
- Copy the dummy caster unit to your map
- Copy the MUI_DummyCaster folder which has the MDC Setup, MDC OnCast, MDC OffCast trigger in it
- Change the MDC_DummyID from MDC Setup to the imported dummy
- DONE!
[/tab]
[tab=Main Trigger]
[trigger]
MDC Setup
Events
Map initialization
Conditions
Actions
-------- Import the dummy from the object editor --------
Set MDC_DummyID = DummyCaster
-------- WARNING: Do not touch anything below this line! --------
-------- Initializing Hashtable --------
Custom script: set udg_MDC_Hashtable = InitHashtable()
-------- Default level is 1 --------
Set MDC_Level = 1
-------- Default 3 values you may use, pick one as desired --------
Set MDC_Cast = 1
Set MDC_CastPoint = 2
Set MDC_CastTarget = 3
[/trigger]
[trigger]
MDC OnCast
Events
Conditions
Actions
Custom script: call ExecuteFunc("MDC_Evaluate")
Custom script: endfunction
-------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
-------- Removing the location and resetting everything --------
Custom script: function MDC_Reset takes nothing returns nothing
Custom script: call RemoveLocation(udg_MDC_Location)
Custom script: set udg_MDC_Location = null
Set MDC_Level = 1
Set MDC_Height = 0.00
Set MDC_OrderID = 0
Set MDC_PointToPointCast = False
Custom script: endfunction
-------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
Custom script: function MDC_RefreshDummy takes unit u returns nothing
Custom script: call UnitRemoveAbility(u, LoadInteger(udg_MDC_Hashtable, GetHandleId(u), 0))
Custom script: call GroupAddUnit(udg_MDC_Group, u)
Custom script: call SetUnitOwner(u, Player(15), false)
Custom script: call PauseUnit(u, true)
Custom script: endfunction
-------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
Custom script: function MDC_GetDummyUnit takes nothing returns unit
Custom script: if FirstOfGroup(udg_MDC_Group)==null then
Custom script: set udg_MDC_DummyCaster = CreateUnit(Player(15), udg_MDC_DummyID, 0, 0, 0)
Custom script: call UnitRemoveAbility(udg_MDC_DummyCaster, 'Amov')
Custom script: else
Custom script: set udg_MDC_DummyCaster = FirstOfGroup(udg_MDC_Group)
Unit Group - Remove MDC_DummyCaster from MDC_Group
Custom script: endif
Custom script: return udg_MDC_DummyCaster
Custom script: endfunction
-------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
Custom script: function MDC_Evaluate takes nothing returns nothing
Custom script: set udg_MDC_DummyCaster = MDC_GetDummyUnit()
Unit - Unpause MDC_DummyCaster
Unit - Add MDC_AbilityID to MDC_DummyCaster
Unit - Set level of MDC_AbilityID for MDC_DummyCaster to MDC_Level
Animation - Change MDC_DummyCaster flying height to MDC_Height at 0.00
Custom script: call SaveInteger(udg_MDC_Hashtable, GetHandleId(udg_MDC_DummyCaster), 0, udg_MDC_AbilityID)
Custom script: if udg_MDC_Location==null then
Custom script: call MDC_RefreshDummy(udg_MDC_DummyCaster)
Custom script: call MDC_Reset()
Custom script: call DisplayTextToPlayer(udg_MDC_Player, 0, 0, "[MDC_Location] ERROR: Location is null")
Custom script: return
Custom script: else
Custom script: call SetUnitPositionLoc(udg_MDC_DummyCaster, udg_MDC_Location)
Custom script: endif
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MDC_CastType Equal to MDC_Cast
Then - Actions
Custom script: call IssueImmediateOrderById(udg_MDC_DummyCaster, udg_MDC_OrderID)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MDC_CastType Equal to MDC_CastPoint
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MDC_PointToPointCast Equal to True
Then - Actions
Custom script: call IssuePointOrderByIdLoc(udg_MDC_DummyCaster, udg_MDC_OrderID, udg_MDC_ProjectileAnglePoint)
Custom script: call RemoveLocation(udg_MDC_ProjectileAnglePoint)
Else - Actions
Custom script: call IssuePointOrderByIdLoc(udg_MDC_DummyCaster, udg_MDC_OrderID, udg_MDC_Location)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MDC_CastType Equal to MDC_CastTarget
Then - Actions
-------- Target Unit has a fail-safe in case there is a null unit --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MDC_Target Equal to No unit
Then - Actions
Custom script: call MDC_RefreshDummy(udg_MDC_DummyCaster)
Custom script: call MDC_Reset()
Custom script: call DisplayTextToPlayer(udg_MDC_Player, 0, 0, "[MDC_Target] ERROR: Attempt to cast to a null unit")
Else - Actions
Custom script: call IssueTargetOrderById(udg_MDC_DummyCaster, udg_MDC_OrderID, udg_MDC_Target)
Else - Actions
Custom script: call MDC_Reset()
[/trigger]
[trigger]
MDC OffCast
Events
Unit - A unit Finishes casting an ability
Conditions
(Unit-type of (Triggering unit)) Equal to MDC_DummyID
Actions
Custom script: local unit u = GetTriggerUnit()
Custom script: call UnitRemoveAbility(u, LoadInteger(udg_MDC_Hashtable, GetHandleId(u), 0))
Custom script: call GroupAddUnit(udg_MDC_Group, u)
Custom script: call SetUnitOwner(u, Player(15), false)
Custom script: set u = null
[/trigger]
[/tab]
[tab=Sample Trigger]
[B][COLOR="Yellow"][SIZE="3"]NOTE:[/SIZE][/COLOR][/B]
The TestLocation and TestAngle is NOT related to the system, so you may delete it from the variable editor
[trigger]
CastSelf
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Set TestLocation = (Center of (Playable map area))
Set MDC_AbilityID = Thunder Clap
Set MDC_OrderID = 852096
Set MDC_Location = (TestLocation offset by 600.00 towards TestAngle degrees)
Set MDC_CastType = MDC_Cast
Set MDC_Level = 1
Trigger - Run MDC OnCast <gen> (ignoring conditions)
Set TestAngle = (TestAngle + 60.00)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TestAngle Greater than 360.00
Then - Actions
Set TestAngle = 0.00
Else - Actions
Custom script: call RemoveLocation(udg_TestLocation)
[/trigger]
[trigger]
CastPointChannel
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Set TestLocation = (Center of (Playable map area))
Set TestAngle = 0.00
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
-------- it doesnt matter which order you will place the MDC's as long as the MDC_OnCast is last --------
Set MDC_AbilityID = Flame Strike (Neutral Hostile)
Set MDC_OrderID = 852488
Set MDC_Player = Player 1 (Red)
Set MDC_CastType = MDC_CastPoint
Set MDC_Location = (TestLocation offset by 400.00 towards TestAngle degrees)
Trigger - Run MDC OnCast <gen> (ignoring conditions)
Set TestAngle = (TestAngle + 60.00)
Custom script: call RemoveLocation(udg_TestLocation)
[/trigger]
[trigger]
CastTarget
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Set TestLocation = (Center of (Playable map area))
Set TestAngle = 0.00
Unit Group - Pick every unit in (Units within 1500.00 of TestLocation matching ((Owner of (Matching unit)) Equal to Neutral Hostile)) and do (Actions)
Loop - Actions
Set MDC_AbilityID = Firebolt (Neutral Hostile)
Set MDC_OrderID = 852231
Set MDC_Target = (Picked unit)
Set MDC_Player = Player 1 (Red)
Set MDC_CastType = MDC_CastTarget
Set MDC_Location = (Center of (Playable map area))
-------- if you want to change the height --------
Set MDC_Height = 200.00
Trigger - Run MDC OnCast <gen> (ignoring conditions)
Custom script: call RemoveLocation(udg_TestLocation)
[/trigger]
[trigger]
CastPointToPoint
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Set TestLocation = (Center of (Playable map area))
Set TestAngle = 0.00
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
-------- it doesnt matter which order you will place the MDC's as long as the MDC_OnCast is last --------
Set MDC_AbilityID = Carrion Swarm (Neutral Hostile)
Set MDC_OrderID = 852218
Set MDC_Player = Player 1 (Red)
Set MDC_CastType = MDC_CastPoint
Set MDC_Location = (Center of (Playable map area))
-------- In case you want to see a point cast and control the projectile direction --------
Set MDC_PointToPointCast = True
-------- You need to set the offset from here --------
Set MDC_ProjectileAnglePoint = (MDC_Location offset by 100.00 towards TestAngle degrees)
Trigger - Run MDC OnCast <gen> (ignoring conditions)
Set TestAngle = (TestAngle + 60.00)
Custom script: call RemoveLocation(udg_TestLocation)
[/trigger]
[/tab]
[tab=Notes]
- The dummy spell must have 0 mana
- The cast range of the spell must be greater than the cast point (Location)
- The target unit must be targetable, else this will bug
[/tab]
[tab=Bugs]
- For unknown reasons the MDC_Cast or no target cast cannot run under a loop like the rest,
if you spot the solution you will be credited
[/tab]
[/tabs]
[box=Variable Definition]
[b]MDC_AbilityID[/b] = this is the ability type, see the sample trigger
[b]MDC_PointToPointCast[/b] = boolean, if you want to see a projectile traveling in you desired angle, set it to true, see the CastPointToPoint trigger
[b]MDC_CastType[/b] = how you want your spell to be casted?, uses MDC_Cast, MDC_CastPoint, MDC_CastTarget
[b]MDC_Level[/b] = level of the spell
[b]MDC_OrderID[/b] = the order of the spell
[b]MDC_Player[/b] = the owning player of the spell
[b]MDC_Location[/b] = the point where the dummy is created or placed
[b]MDC_ProjectileAnglePoint[/b] = this is the offset where you want to see the projectile is traveling, used only by MDC_CastPoint, see the CastPointToPoint trigger
[b]MDC_Height[/b] = sets the height of the dummy unit in case you want to see a projectile traveling from above
[b]MDC_Target[/b] = oviously the spell target, must be reachable or in range with the dummy spell, else this will bug
[/box]
[hidden=Credits]
-
[/hidden]
[hidden=Changelogs]
v1.1
- Minor changes for the OnCast for faster execution
- Error messages changed
[/hidden]