• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Meathook Problem

Status
Not open for further replies.
Level 8
Joined
Dec 16, 2007
Messages
252
I'm making a Meathook spell by emijl3r MUI but it didn't go so well. (I can't use the JASS versions).

To thoose who don't know what the spell does, it throws a chain and when it hits a unit the hitten unit will get pulled back. But when I tried to make the Meat Hook MUI this happens.

The spell is thrown.
A chain is created towards the targeted unit.
The chain stops in front of the unit and are ready to pull it back to the caster.
But the chain only pulls the unit one step and the chain remains.

Here's the triggers, I think the third one is the problem.

EDIT: ADDED THE MAP BELOW SO YOU CAN SEE WHAT HAPPENS!

  • MH Cast
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Meat Hook
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MH_CustomValue Less than 1000
        • Then - Actions
          • Set MH_CustomValue = (MH_CustomValue + 1)
        • Else - Actions
          • Set MH_CustomValue = 1
      • Set MH_Level = (Level of Meat Hook for (Triggering unit))
      • Set MH_Unit[MH_CustomValue] = (Triggering unit)
      • Set MH_UnitPoint[MH_CustomValue] = (Position of MH_Unit[MH_CustomValue])
      • Set MH_TargetPoint[MH_CustomValue] = (Target point of ability being cast)
      • Set MH_Angle[MH_CustomValue] = (Angle from MH_UnitPoint[MH_CustomValue] to MH_TargetPoint[MH_CustomValue])
      • Unit - Create 1 Footman for (Owner of MH_Unit[MH_CustomValue]) at (Center of Region 000 <gen>) facing Default building facing degrees
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Set the custom value of (Last created unit) to MH_CustomValue
      • Unit Group - Add (Last created unit) to MH_Group
  • MH Extend
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
      • (Number of units in MH_Group) Greater than 0
    • Actions
      • Unit Group - Pick every unit in MH_Group and do (Actions)
        • Loop - Actions
          • Set MH_CustomValue2 = (Custom value of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MH_Links Less than 30
            • Then - Actions
              • Set MH_Links = (MH_Links + 1)
              • Unit - Create 1 Chain Link for (Owner of MH_Unit[MH_CustomValue2]) at (MH_UnitPoint[MH_CustomValue2] offset by (Real((40 x MH_Links))) towards MH_Angle[MH_CustomValue2] degrees) facing MH_Angle[MH_CustomValue2] degrees
              • Set MH_Link[MH_Links] = (Last created unit)
              • Set Temp_Group = (Units within 115.00 of (Position of MH_Link[MH_Links]) matching (((Matching unit) is alive) Equal to True))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • MH_Links Greater than 3
                • Then - Actions
                  • Set MH_Target[MH_CustomValue2] = (Random unit from Temp_Group)
                  • Custom script: call DestroyGroup(udg_Temp_Group)
                  • Custom script: set udg_Temp_Group = null
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (MH_Target[MH_CustomValue2] belongs to an ally of (Owner of MH_Unit[MH_CustomValue2])) Equal to False
                    • Then - Actions
                      • Unit - Cause MH_Unit[MH_CustomValue2] to damage MH_Target[MH_CustomValue2], dealing (100.00 x (Real(MH_Level))) damage of attack type Chaos and damage type Normal
                      • -------- PERRRRRRRRRRRRFFFFFEEEEEECTTTTT --------
                    • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • MH_Target[MH_CustomValue2] Not equal to No unit
                • Then - Actions
                  • Unit - Set the custom value of MH_Unit[MH_CustomValue2] to MH_CustomValue2
                  • Unit Group - Add MH_Unit[MH_CustomValue2] to MH_Group2
                  • Unit - Kill (Picked unit)
                • Else - Actions
            • Else - Actions
              • Unit - Set the custom value of MH_Unit[MH_CustomValue2] to MH_CustomValue2
              • Unit Group - Add MH_Unit[MH_CustomValue2] to MH_Group2
              • Unit - Kill (Picked unit)
  • MH Retract
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
      • (Number of units in MH_Group2) Greater than 0
    • Actions
      • Unit Group - Pick every unit in MH_Group2 and do (Actions)
        • Loop - Actions
          • Set MH_CustomValue3 = (Custom value of (Picked unit))
          • Unit - Move MH_Target[MH_CustomValue3] instantly to (Position of MH_Link[MH_Links])
          • Unit - Remove MH_Link[MH_Links] from the game
          • Set MH_Links = (MH_Links - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MH_Links Equal to 0
            • Then - Actions
              • Game - Display to (All players) for 2.00 seconds the text: Worked a bit
              • Custom script: call RemoveLocation(udg_MH_UnitPoint[udg_MH_CustomValue])
              • Custom script: call RemoveLocation(udg_MH_TargetPoint[udg_MH_CustomValue])
              • Custom script: set udg_MH_Target[udg_MH_CustomValue3] = null
              • Custom script: set udg_MH_Unit[udg_MH_CustomValue3] = null
              • Unit - Kill (Picked unit)
            • Else - Actions
 

Attachments

  • MEAT HOOK MUI.w3x
    32.7 KB · Views: 42
Last edited:
Level 5
Joined
Jan 15, 2007
Messages
199
That isn't MUI, its MPI.

Meaning only one unit from each player can use this ability at once.

MUI means that any player can use the ability as many times as he/she desires at the same time without bugs

Edit: Scratch that ^^, i just read your trigger more thouroughly, read my new post

Also, what happens if no units are hit?

Edit: Oh, it happens because when the MH_Links drops below 30 from the triggers, it will try to extend then retract over and over
 
Last edited:
Level 8
Joined
Dec 16, 2007
Messages
252
Why? I already used the action kill Picked Unit, won't it stop the meat hook spell from extend and just retract?

Nvm: Just found out that killing the unit doesn't remove it from the group.

Btw ty +rep.

But why, it's still not MUI/MPI :(. I want it to be at least MPI but it's none of them. Help :D?
 
Last edited:
Level 5
Joined
Jan 15, 2007
Messages
199
What does nulling do? Since the original spell is not made by me I think it's better to not mess around with it so I didn't remove it. Isn't it like DestroyGroup etc but in JASS?


Nulling is fairly pointless with Globals because they are reused after, and should only be used if you are checking if the variable has a unit in it sometime after. Also, because you used the 'Custom Value' thing this is almost MUI (Multi Unit Instanceable) except for the 'MH_Level' and 'MH_Links' variables which are not arrays. A BIG problem with doing it with the arrays going up to 1000 like this is you will use up the maximum amount of arrays very fast (I think).
 
Status
Not open for further replies.
Top