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

Help with "Amulet of Recall" ability

Status
Not open for further replies.
Level 8
Joined
Jun 26, 2019
Messages
318
Hello all. Familiar with the item called "Mass Teleport"? I need help to make a build a trigger that I want it to be working exactly like mass teleport, but I want clickable at target without requiring the units to click target, and I want it to be included with allied units, allied players, enemy units, and enemy players altogether, to the current location of casting player. I want 2 seconds cast to be success cast before teleporting the units to the current location of casting player, like "Mass Teleport" ability from Archmage.
 

Attachments

  • upload_2020-6-9_20-26-40.png
    upload_2020-6-9_20-26-40.png
    252.4 KB · Views: 41
Last edited:
@Daffa
This dark summoning works exact same as amulet of recall. I just want trigger system to work exact like dark summoning, for me to be able to make it work on all units within range, enemy or allies.

Have you tried just changing the Targets Allowed Field to include Enemy?
 
Level 13
Joined
May 10, 2009
Messages
868
Here's a simple triggered amulet of recall. It's not perfect at all, but it should get the job done.


  • Recall Settings
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set CRSet_Ability = Assemble!
      • Set CRSet_Clustering = False
      • Set CRSet_AoE = 600.00
      • -------- SFXs --------
      • Set CRSet_SFX_Caster = Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set CRSet_SFX_Target_Point = Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set CRSet_SFX_Target_Move = Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Set CRSet_SFX_Target_Destination = Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
      • -------- Table --------
      • Hashtable - Create a hashtable
      • Set CRecall_Table = (Last created hashtable)
  • Recall Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to CRSet_Ability
    • Actions
      • Set CRecall_Caster = (Triggering unit)
      • Custom script: set udg_CRecall_Key = GetHandleId(udg_CRecall_Caster)
      • -------- -------- --------
      • Set tmp_point = (Target point of ability being cast)
      • Special Effect - Create a special effect attached to the origin of CRecall_Caster using CRSet_SFX_Caster
      • -------- -------- --------
      • Hashtable - Save Handle Oftmp_point as 0 of CRecall_Key in CRecall_Table
      • Hashtable - Save Handle Of(Last created special effect) as 1 of CRecall_Key in CRecall_Table
      • Special Effect - Create a special effect at tmp_point using CRSet_SFX_Target_Point
      • Hashtable - Save Handle Of(Last created special effect) as 2 of CRecall_Key in CRecall_Table
  • Recall Finishes
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to CRSet_Ability
    • Actions
      • Set CRecall_Caster = (Triggering unit)
      • Custom script: set udg_CRecall_Key = GetHandleId(udg_CRecall_Caster)
      • -------- -------- --------
      • Set tmp_point = (Load 0 of CRecall_Key in CRecall_Table)
      • -------- tmp_point = (Target point of ability being cast) from Recall Cast --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within CRSet_AoE of tmp_point) and do (Actions)
        • Loop - Actions
          • Set CRecall_Target = (Picked unit)
          • -------- TARGETS NOT ALLOWED --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (CRecall_Target is A structure) Equal to False
              • (CRecall_Target is dead) Equal to False
              • CRecall_Target Not equal to CRecall_Caster
            • Then - Actions
              • -------- Not a structure, not dead, isn't the caster = can be teleported --------
              • Set tmp_point2 = (Position of CRecall_Target)
              • Special Effect - Create a special effect at tmp_point2 using CRSet_SFX_Target_Move
              • Special Effect - Destroy (Last created special effect)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CRSet_Clustering Equal to True
                • Then - Actions
                  • Set tmp_point = (Position of CRecall_Caster)
                  • Unit - Move CRecall_Target instantly to tmp_point
                  • Custom script: call RemoveLocation(udg_tmp_point)
                • Else - Actions
                  • Set tmp_point = (Load 0 of CRecall_Key in CRecall_Table)
                  • Set CRecall_Distance = (Distance between tmp_point and tmp_point2)
                  • Set CRecall_Angle = (Angle from tmp_point to tmp_point2)
                  • Custom script: call RemoveLocation(udg_tmp_point2)
                  • -------- -------- --------
                  • Set tmp_point = (Position of CRecall_Caster)
                  • Set tmp_point2 = (tmp_point offset by CRecall_Distance towards CRecall_Angle degrees)
                  • Unit - Move CRecall_Target instantly to tmp_point2
                  • Special Effect - Create a special effect at tmp_point2 using CRSet_SFX_Target_Destination
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_tmp_point)
              • Custom script: call RemoveLocation(udg_tmp_point2)
            • Else - Actions
  • Recall Stops
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to CRSet_Ability
    • Actions
      • Set CRecall_Caster = (Triggering unit)
      • Custom script: set udg_CRecall_Key = GetHandleId(udg_CRecall_Caster)
      • -------- -------- --------
      • Custom script: call RemoveLocation(LoadLocationHandle(udg_CRecall_Table, udg_CRecall_Key, 0))
      • Special Effect - Destroy (Load 1 of CRecall_Key in CRecall_Table)
      • Special Effect - Destroy (Load 2 of CRecall_Key in CRecall_Table)
      • -------- -------- --------
      • Hashtable - Clear all child hashtables of child CRecall_Key in CRecall_Table

I seriously don't like the idea of using a whole table just for it, though I'm running out of time (gotta go to work soon lol). Also, I discourage using CRSet_Clustering as False because units might get stuck on trees and cliffs.


EDIT: I've talked to Mechanic on discord, and updated the code to take care of cliffs and "unwalkable" paths when Clustering flag is set to false. Also, there's now a limit of maximum units that can be teleported.

  • Recall Settings
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set CRSet_Ability = Amulet of Recall
      • Set CRSet_Clustering = False
      • Set CRSet_AoE = 600.00
      • Set CRSet_MaxUnits = 3
      • -------- SFXs --------
      • Set CRSet_SFX_Caster = Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set CRSet_SFX_Target_Point = Abilities\Spells\Human\MassTeleport\MassTeleportTo.mdl
      • Set CRSet_SFX_Target_Move = Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
      • Set CRSet_SFX_Target_Destination = Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
      • -------- Table --------
      • Hashtable - Create a hashtable
      • Set CRecall_Table = (Last created hashtable)
      • -------- Item for path-checking --------
      • Set tmp_point = (Center of (Playable map area))
      • Item - Create Phat Lewt at tmp_point
      • Set CRecall_Item = (Last created item)
      • Item - Make CRecall_Item Invulnerable
      • Item - Hide CRecall_Item
      • Custom script: call RemoveLocation(udg_tmp_point)
      • Custom script: call DestroyGroup(udg_CRecall_Group)
      • -------- Thanks, Bribe! --------
      • Custom script: endfunction
      • Custom script: function CRecall_IsTerrainWalkable takes real x, real y returns boolean
      • Custom script: local real xa
      • Custom script: local real ya
      • Custom script: call SetItemPosition(udg_CRecall_Item, x, y)
      • Custom script: set xa = x - GetItemX(udg_CRecall_Item)
      • Custom script: set ya = y - GetItemY(udg_CRecall_Item)
      • Custom script: call SetItemVisible(udg_CRecall_Item, false)
      • Custom script: return xa * xa + ya * ya < 5625 and (not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY))
  • Recall Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to CRSet_Ability
    • Actions
      • Set CRecall_Caster = (Triggering unit)
      • Custom script: set udg_CRecall_Key = GetHandleId(udg_CRecall_Caster)
      • -------- -------- --------
      • Set tmp_point = (Target point of ability being cast)
      • Special Effect - Create a special effect attached to the origin of CRecall_Caster using CRSet_SFX_Caster
      • -------- -------- --------
      • Hashtable - Save Handle Oftmp_point as 0 of CRecall_Key in CRecall_Table
      • Hashtable - Save Handle Of(Last created special effect) as 1 of CRecall_Key in CRecall_Table
      • Special Effect - Create a special effect at tmp_point using CRSet_SFX_Target_Point
      • Hashtable - Save Handle Of(Last created special effect) as 2 of CRecall_Key in CRecall_Table
  • Recall Finishes
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to CRSet_Ability
    • Actions
      • Set CRecall_Caster = (Triggering unit)
      • Custom script: set udg_CRecall_Key = GetHandleId(udg_CRecall_Caster)
      • -------- -------- --------
      • -------- 0 of CRecall in Table = (Target point of ability being cast) from Recall Cast trigger --------
      • Set CRecall_Group = (Units within CRSet_AoE of (Load 0 of CRecall_Key in CRecall_Table))
      • Unit Group - Pick every unit in CRecall_Group and do (Actions)
        • Loop - Actions
          • Set CRecall_Target = (Picked unit)
          • -------- TARGETS ALLOWED --------
          • -------- Filter out units --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (CRecall_Target is A structure) Equal to False
              • (CRecall_Target is dead) Equal to False
              • CRecall_Target Not equal to CRecall_Caster
            • Then - Actions
              • -------- Not a structure, not dead, not caster = unit can be teleported; keep it in this group. --------
            • Else - Actions
              • -------- Anyone else should be removed from this group --------
              • Unit Group - Remove CRecall_Target from CRecall_Group
      • -------- -------- --------
      • -------- Pick a random unit from the previous group and take into account the maximum number of units we can teleport --------
      • For each (Integer CRecall_Counter) from 1 to CRSet_MaxUnits, do (Actions)
        • Loop - Actions
          • Set CRecall_Target = (Random unit from CRecall_Group)
          • -------- -------- --------
          • Custom script: exitwhen (udg_CRecall_Target == null) // Group is empty; break out of this loop
          • Unit Group - Remove CRecall_Target from CRecall_Group
          • -------- -------- --------
          • Set tmp_point2 = (Position of CRecall_Target)
          • Special Effect - Create a special effect at tmp_point2 using CRSet_SFX_Target_Move
          • Special Effect - Destroy (Last created special effect)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CRSet_Clustering Equal to True
            • Then - Actions
              • Set tmp_point = (Position of CRecall_Caster)
              • Unit - Move CRecall_Target instantly to tmp_point
              • Custom script: call RemoveLocation(udg_tmp_point)
            • Else - Actions
              • Set tmp_point = (Load 0 of CRecall_Key in CRecall_Table)
              • Set CRecall_Distance = (Distance between tmp_point and tmp_point2)
              • Set CRecall_Angle = (Angle from tmp_point to tmp_point2)
              • Custom script: call RemoveLocation(udg_tmp_point2)
              • -------- -------- --------
              • Set tmp_point = (Position of CRecall_Caster)
              • Set tmp_point2 = (tmp_point offset by CRecall_Distance towards CRecall_Angle degrees)
              • -------- if point2 isn't a walkable place, then move target to caster's position --------
              • Custom script: if CRecall_IsTerrainWalkable(GetLocationX(udg_tmp_point2), GetLocationY(udg_tmp_point2)) then
              • Unit - Move CRecall_Target instantly to tmp_point2
              • Custom script: else
              • Unit - Move CRecall_Target instantly to tmp_point
              • Custom script: endif
              • Special Effect - Create a special effect attached to the origin of CRecall_Target using CRSet_SFX_Target_Destination
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_tmp_point)
          • Custom script: call RemoveLocation(udg_tmp_point2)
      • Custom script: call DestroyGroup(udg_CRecall_Group)
  • Recall Stops
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to CRSet_Ability
    • Actions
      • Set CRecall_Caster = (Triggering unit)
      • Custom script: set udg_CRecall_Key = GetHandleId(udg_CRecall_Caster)
      • -------- -------- --------
      • Custom script: call RemoveLocation(LoadLocationHandle(udg_CRecall_Table, udg_CRecall_Key, 0))
      • Special Effect - Destroy (Load 1 of CRecall_Key in CRecall_Table)
      • Special Effect - Destroy (Load 2 of CRecall_Key in CRecall_Table)
      • -------- -------- --------
      • Hashtable - Clear all child hashtables of child CRecall_Key in CRecall_Table
 

Attachments

  • Custom Amulet of Recall.w3x
    20.7 KB · Views: 19
  • Custom Amulet of Recallv1.1.w3x
    23.5 KB · Views: 18
Last edited:
Level 8
Joined
Jun 26, 2019
Messages
318
@BloodSoul Nice work! It's beautiful! Just one more thing. Need to add random 3 units within range. Not all units. Because this happens and the one of peasants got stuck on edge. Or, I will have to add pathing blockers to all cliffs and edges...

EDIT1: Nevermind. Yeah. I will have to add pathing blockers to all cliffs, edges, and no units zones. All good. But, I still would want 3 or 5 random units within range, instead of all units. :)

EDIT2: Ugh. After I filled the cliifs, edges, and no units zones with pathing blockers, and tested it again, and got one peasants stuck on cliff... grrr. But, I know one of trigger systems on this WC3 Hive that keeps units away from cliffs, edges, and no units zones. It's a jump ability, and this jump ability's trigger system keeps me away from water and cliffs. I was wondering if you can add that too, though?

upload_2020-6-10_17-10-33.png
 
Last edited:
Status
Not open for further replies.
Top