Making My Meat Hook MUI

CrackUps

New Member
Reaction score
7
Ok I've created a meat hook that will track it's target if you've targetted a unit or just travel normally if you target the ground. What i want to do now is make it MUI but am pretty unsure on how to do this. It is entirely coded with GUI and would preferably like to keep it like that if possible as I wanted to make it into a hook for GUI coders to use. If it's too hard to make MUI in GUI i'm fine with it being in Jass but then it'll be for my own use (not vJass though please). Could somebody please help me with this.

Map and triggers attached.

Code:
Cast
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to (==) Meat Hook [GUI] 
    Actions
        Custom script:   local location TempLoc = GetSpellTargetLoc()
        Set Caster = (Triggering unit)
        Set TargetUnit = (Target unit of ability being cast)
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                TargetUnit Equal to (==) No unit
            Then - Actions
                Unit - Create 1 Dummy Target for (Owner of Caster) at (TempLoc) facing Default building facing (270.0) degrees
                Set TargetUnit = (Last created unit)
            Else - Actions
        Set Angle = (Angle from (Position of Caster) to (Position of TargetUnit))
        Set DistanceCoveredMax = (((Level of (Ability being cast) for Caster) x 1000) + 0)
        Trigger - Turn on Create <gen>
        Custom script:   call RemoveLocation(TempLoc)
Code:
Create
    Events
        Time - Every 0.04 seconds of game time
    Conditions
    Actions
        Custom script:   local location TempLoc1 = GetUnitLoc(udg_Caster)
        Custom script:   local location TempLoc2 = GetUnitLoc(udg_Joint[1])
        Custom script:   local location TempLoc3 = GetUnitLoc(udg_TargetUnit)
        Custom script:   local location TempLoc4 = GetUnitLoc(udg_Joint[udg_NumberOfJoints])
        Custom script:   local location TempLoc5
        Custom script:   local location TempLoc6
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in PotentialTargets) Equal to (==) 0
            Then - Actions
                 Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        DistanceCoveredCurrent Greater than or equal to (>=) DistanceCoveredMax
                    Then - Actions
                        Trigger - Turn on Retract <gen>
                        Trigger - Turn off Create <gen>
                    Else - Actions
                         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                NumberOfJoints Equal to (==) 0
                            Then - Actions
                                Unit - Create 1 Joint for (Owner of Caster) at ((TempLoc1) offset by 80.00 towards Angle degrees) facing Angle degrees
                                Set DistanceCoveredCurrent = (DistanceCoveredCurrent + 80)
                                Set NumberOfJoints = (NumberOfJoints + 1)
                                Set Joint[NumberOfJoints] = (Last created unit)
                                Custom script:   call RemoveLocation(TempLoc1)
                            Else - Actions
                                 Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Unit-type of TargetUnit) Equal to (==) Dummy Target
                                    Then - Actions
                                        Unit - Move Joint[1] instantly to ((TempLoc2) offset by 40.00 towards (Facing of Joint[1]) degrees), facing (Facing of Joint[1]) degrees
                                        Set DistanceCoveredCurrent = (DistanceCoveredCurrent + 40)
                                        Custom script:   call RemoveLocation(TempLoc2)
                                        Custom script:   call RemoveLocation(TempLoc3)
                                    Else - Actions
                                        Unit - Move Joint[1] instantly to ((TempLoc2) offset by 40.00 towards (Angle from (TempLoc2) to (TempLoc3)) degrees), facing (Angle from (TempLoc2) to (TempLoc3)) degrees
                                        Set DistanceCoveredCurrent = (DistanceCoveredCurrent + 40)
                                        Custom script:   call RemoveLocation(TempLoc2)
                                        Custom script:   call RemoveLocation(TempLoc3)
                                Unit - Create 1 Joint for (Owner of Caster) at ((TempLoc1) offset by 40.00 towards (Angle from (TempLoc1) to (TempLoc4)) degrees) facing (TempLoc4)
                                Custom script:   call RemoveLocation(TempLoc1)
                                Custom script:   call RemoveLocation(TempLoc4)
                                Set NumberOfJoints = (NumberOfJoints + 1)
                                Set Joint[NumberOfJoints] = (Last created unit)
                                 Do Multiple ActionsFor each (Integer A) from 2 to NumberOfJoints, do (Actions)
                                    Loop - Actions
                                        Custom script:   set TempLoc5 = GetUnitLoc(udg_Joint[GetForLoopIndexA()])
                                        Custom script:   set TempLoc6 = GetUnitLoc(udg_Joint[( GetForLoopIndexA() - 1 )])
                                        Unit - Move Joint[(Integer A)] instantly to ((TempLoc5) offset by 40.00 towards (Angle from (TempLoc5) to (TempLoc6)) degrees), facing (TempLoc6)
                                        Custom script:   call RemoveLocation(TempLoc5)
                                        Custom script:   call RemoveLocation(TempLoc6)
            Else - Actions
                Set Snagged = True
                Animation - Change Joint[1]'s animation speed to 0.00% of its original speed
                 Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Target belongs to an ally of (Owner of Caster)) Equal to (==) True
                    Then - Actions
                    Else - Actions
                        Unit - Cause Caster to damage Target, dealing ((Real((Level of Meat Hook [GUI]  for Caster))) x 100.00) damage of attack type Normal and damage type Normal
                        Special Effect - Create a special effect attached to the chest of Target using Objects\Spawnmodels\Human\HumanBlood\HeroBloodElfBlood.mdl
                        Special Effect - Destroy (Last created special effect)
                Unit - Turn collision for Target Off
                Trigger - Turn on Retract <gen>
                Trigger - Turn off Create <gen>
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of TargetUnit) Equal to (==) Dummy Target
            Then - Actions
                Set PotentialTargets = (Units within 120.00 of (Position of Joint[1]) matching ((Matching unit) Not equal to (!=) Caster))
                Set Target = (First unit of group PotentialTargets)
            Else - Actions
                Set PotentialTargets = (Units within 120.00 of (Position of Joint[1]) matching ((Matching unit) Equal to (==) TargetUnit))
                Set Target = (First unit of group PotentialTargets)
Code:
Retract
    Events
        Time - Every 0.04 seconds of game time
    Conditions
    Actions
        Custom script:   local location TempLoc1 = GetUnitLoc(udg_Joint[1])
        Custom script:   local location TempLoc2 = GetUnitLoc(udg_Joint[2])
        Custom script:   local location TempLoc3 = GetUnitLoc(udg_Caster)
        Custom script:   local location TempLoc4 = GetUnitLoc(udg_Joint[udg_NumberOfJoints - 1])
        Custom script:   local location TempLoc5
        Custom script:   local location TempLoc6
        Custom script:   local location TempLoc7
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                NumberOfJoints Equal to (==) 0
            Then - Actions
                Set DistanceCoveredCurrent = 0
                Set Snagged = False
                Unit - Turn collision for Target On
                Custom script:   call DestroyGroup(udg_PotentialTargets)
                Set Target = No unit
                Trigger - Turn off Retract <gen>
            Else - Actions
                 Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Snagged Equal to (==) True
                    Then - Actions
                    Else - Actions
                         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Unit-type of TargetUnit) Equal to (==) Dummy Target
                            Then - Actions
                                Set PotentialTargets = (Units within 120.00 of (Position of Joint[1]) matching ((Matching unit) Not equal to (!=) Caster))
                                Set Target = (First unit of group PotentialTargets)
                            Else - Actions
                                Set PotentialTargets = (Units within 120.00 of (Position of Joint[1]) matching ((Matching unit) Equal to (==) TargetUnit))
                                Set Target = (First unit of group PotentialTargets)
                 Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        NumberOfJoints Greater than (>) 1
                    Then - Actions
                         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Number of units in PotentialTargets) Not equal to (!=) 0
                            Then - Actions
                                Set Snagged = True
                                Animation - Change Joint[1]'s animation speed to 0.00% of its original speed
                                Unit - Move Target instantly to ((TempLoc1) offset by 40.00 towards (Facing of Joint[1]) degrees), facing (Facing of Target) degrees
                                Custom script:   call RemoveLocation(TempLoc1)
                            Else - Actions
                        Unit - Move Joint[1] instantly to (TempLoc2), facing Angle degrees
                        Custom script:   call RemoveLocation(TempLoc1)
                        Custom script:   call RemoveLocation(TempLoc2)
                    Else - Actions
                        Unit - Remove Joint[1] from the game
                Unit - Move Joint[NumberOfJoints] instantly to ((TempLoc3) offset by 40.00 towards (Angle from (TempLoc3) to (TempLoc4)) degrees), facing (TempLoc4)
                Custom script:   call RemoveLocation(TempLoc3)
                Custom script:   call RemoveLocation(TempLoc4)
                 Do Multiple ActionsFor each (Integer A) from ((NumberOfJoints - 1) x -1) to -2, do (Actions)
                    Loop - Actions
                        Custom script:   set TempLoc5 = GetUnitLoc(udg_Joint[(GetForLoopIndexA() *-1)])
                        Custom script:   set TempLoc6 = GetUnitLoc(udg_Joint[( ( GetForLoopIndexA() * -1 ) + 1 )])
                        Custom script:   set TempLoc7 = GetUnitLoc(udg_Joint[( ( GetForLoopIndexA() * -1 ) - 1 )])
                        Unit - Move Joint[((Integer A) x -1)] instantly to ((TempLoc6) offset by 40.00 towards (Angle from (TempLoc6) to (TempLoc5)) degrees), facing (TempLoc7)
                        Custom script:   call RemoveLocation(TempLoc5)
                        Custom script:   call RemoveLocation(TempLoc6)
                        Custom script:   call RemoveLocation(TempLoc7)
                Unit - Remove Joint[NumberOfJoints] from the game
                Set NumberOfJoints = (NumberOfJoints - 1)
 

Attachments

  • Tracking Meat Hook [GUI] Non-MUI No Leaks.w3x
    23.5 KB · Views: 132

Viikuna

No Marlo no game.
Reaction score
265
I dont really know how to make things MUI in GUI, but I have seen some MUI GUI tutorial here, maybe you should search for it?

Anyways, it is really cool spell, so I think you should just learn Jass. Jass is cool and vJass makes everything so nice and smoot.
 

Viikuna

No Marlo no game.
Reaction score
265
Normal Jass really sucks, try to do something with it without losing your mind. vJass is must have. Unless you are a mac user, you should really use vJass.
 

Cheddar

This is the way it was meant to be.
Reaction score
126
Rough idea on how to make it MUI:

Change all of these variables to arrays (stay with me). Create a new Integer variable called "MeatHookCastNumber".

Now, when a unit casts, add 1 to MeatHookCastNumber. The initial cast gives it a value of 1.

When you set all of your variables in the first trigger, set them to things like "DistanceCoveredMax[MeatHookCastNumber]". When it gets to the other triggers, use the function "For each Integer A from 1 to (MeatHookCastNumber) so each person who has their hook set fires it.

If I have 5 people who have ever casted the ability (even if there is a half-hour Meat Hook drought period), MeatHookCastNumber will stay at 5 until there is another cast.

Rough and untested, but I hope it serves as a bit of a pavement to the future.
 

CrackUps

New Member
Reaction score
7
Well i don't want it in vJass as i can't code in vJass so it's pretty useless for me i woulda just used the Meat Hook that has already been made then
 

Cheddar

This is the way it was meant to be.
Reaction score
126
The only JASS I know is RemoveLocation and DestroyGroup.

I'm talking about GUI here
 

Kazuga

Let the game begin...
Reaction score
110
Cheddar, he's talking about mine and Vilkuna's post.

Well you say you don't know vJass, do you know Jass then? vJass is exactly like Jass but you have some more tools etc that you're able to use, for example structs. But making your spell MUI in GUI isn't that hard, do what Cheddar told you and you will do just fine.
 

CrackUps

New Member
Reaction score
7
This is as far as I got (the ???? is placed in spots where I don't know what to put in as i don't know how to use the local unit from one trigger in another)

Code:
function NotCasterCheck takes nothing returns boolean
    local unit Caster = ????
    return ( GetFilterUnit() != Caster )
endfunction

function IsTargetUnitCheck takes nothing returns boolean
    local unit TargetUnit = ????
    return ( GetFilterUnit() == TargetUnit )
endfunction

//===========================================================================
function Extend takes nothing returns nothing
    local trigger c = CreateTrigger()
    local timer RetractTimer = CreateTimer()
    local boolean Snagged = false
    local group PotentialTargets
    local integer DistanceCoveredCurrent
    local integer NumberOfJoints
    local unit Caster = ????
    local unit TargetUnit = ????
    local unit Target
    local unit array Joint
    local integer DistanceCoveredMax = ( GetUnitAbilityLevel( Caster, 'A000' ) * 1000 )
    local location TempLoc1 = GetUnitLoc(Caster)
    local location TempLoc2 = GetUnitLoc(Joint[1])
    local location TempLoc3 = GetUnitLoc(TargetUnit)
    local location TempLoc4 = GetUnitLoc(Joint[NumberOfJoints])
    local location TempLoc5
    local location TempLoc6
    if CountUnitsInGroup(PotentialTargets) == 0 then
        if DistanceCoveredCurrent >= DistanceCoveredMax then
            call StoreInteger( udg_Cache, "Hook", "NumberOfJoints", NumberOfJoints )
            call StoreInteger( udg_Cache, "Hook", "DistanceCoveredCurrent", DistanceCoveredCurrent )
            
            call TimerStart( RetractTimer, 0.04, true, null )
            call TriggerRegisterTimerExpireEvent( c, RetractTimer )
            call DestroyTimer( ExtendTimer )
        else
            if NumberOfJoints == 0 then
                call CreateUnitAtLoc( GetOwningPlayer(Caster), 'h002', PolarProjectionBJ( TempLoc1, 80.00, udg_Angle), udg_Angle )
                set DistanceCoveredCurrent = ( DistanceCoveredCurrent + 80 )
                set NumberOfJoints = ( NumberOfJoints + 1 )
                set Joint[NumberOfJoints] = bj_lastCreatedUnit
                call RemoveLocation(TempLoc1)
            else
                if GetUnitTypeId(TargetUnit) == 'h001' then
                    call SetUnitPositionLoc(Joint[1], PolarProjectionBJ( TempLoc2, 40.00, GetUnitFacing(Joint[1])))
                    call SetUnitFacing(Joint[1], GetUnitFacing(Joint[1]))
                else
                    call SetUnitPositionLoc(Joint[1], PolarProjectionBJ( TempLoc2, 40.00, AngleBetweenPoints( TempLoc2, TempLoc3)) ) 
                    call SetUnitFacing( Joint[1], AngleBetweenPoints( TempLoc2, TempLoc3) )
                endif
                set DistanceCoveredCurrent = ( DistanceCoveredCurrent + 40 )
                call RemoveLocation(TempLoc2)
                call RemoveLocation(TempLoc3)
                call CreateNUnitsAtLocFacingLocBJ( 1, 'h000', GetOwningPlayer(Caster), PolarProjectionBJ( TempLoc1, 40.00, AngleBetweenPoints( TempLoc1, TempLoc4)), TempLoc4 )
                call RemoveLocation(TempLoc1)
                call RemoveLocation(TempLoc4)
                set NumberOfJoints = ( NumberOfJoints + 1 )
                set Joint[NumberOfJoints] = bj_lastCreatedUnit
                set bj_forLoopAIndex = 2
                set bj_forLoopAIndexEnd = NumberOfJoints
                loop
                    exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
                    set TempLoc5 = GetUnitLoc(Joint[bj_forLoopAIndex])
                    set TempLoc6 = GetUnitLoc(Joint[( bj_forLoopAIndex - 1 )])
                    call SetUnitPositionLoc( Joint[bj_forLoopAIndex], PolarProjectionBJ( TempLoc5, 40.00, AngleBetweenPoints( TempLoc5, TempLoc6)))
                    call SetUnitFacing( Joint[bj_forLoopAIndex], AngleBetweenPoints( GetUnitLoc(Joint[bj_forLoopAIndex]), TempLoc6 ) )
                    call RemoveLocation(TempLoc5)
                    call RemoveLocation(TempLoc6)
                    set bj_forLoopAIndex = bj_forLoopAIndex + 1
                endloop
            endif
        endif
    else
        set Snagged = true
        call SetUnitTimeScale( Joint[1], 0.00 )
        if IsUnitAlly(Target, GetOwningPlayer(Caster)) == true then
        else
            call AddSpecialEffectTarget( "Objects\\Spawnmodels\\Human\\HumanBlood\\HeroBloodElfBlood.mdl", Target, "chest" )
            call DestroyEffect( bj_lastCreatedEffect )
        endif
        call SetUnitPathing( Target, false )
        call StoreInteger( udg_Cache, "Hook", "NumberOfJoints", NumberOfJoints )
        call StoreInteger( udg_Cache, "Hook", "DistanceCoveredCurrent", DistanceCoveredCurrent )
        
        call TimerStart( RetractTimer, 0.04, true, null )
        call TriggerRegisterTimerExpireEvent( c, RetractTimer )
        call DestroyTimer( ExtendTimer )
    endif
    if GetUnitTypeId(TargetUnit) == 'h001' then
        set PotentialTargets = GetUnitsInRangeOfLocMatching(120.00, GetUnitLoc(Joint[1]), Condition(function NotCasterCheck))
    else
        set PotentialTargets = GetUnitsInRangeOfLocMatching(120.00, GetUnitLoc(Joint[1]), Condition(function IsTargetUnitCheck))
    endif
    set Target = FirstOfGroup(PotentialTargets)
endfunction

//===========================================================================
function BeginHook takes nothing returns nothing
    local trigger b = CreateTrigger()
    local timer ExtendTimer = CreateTimer()
    local unit Caster = GetTriggerUnit()
    local unit TargetUnit = GetSpellTargetUnit()
    local location TempLoc = GetSpellTargetLoc()
    
    if TargetUnit == null then
        call CreateUnitAtLoc( GetOwningPlayer(Caster), 'h001', TempLoc, 270 )
        set TargetUnit = bj_lastCreatedUnit
    else
    endif
    set udg_Angle = AngleBetweenPoints(GetUnitLoc(Caster), GetUnitLoc(TargetUnit))
    
    call TimerStart( ExtendTimer, 0.04, true, null )
    call TriggerRegisterTimerExpireEvent( b, ExtendTimer )
    call TriggerAddAction( b, function Extend )
    call RemoveLocation(TempLoc)    
endfunction

//===========================================================================
function AbilityCheck takes nothing returns boolean
    if GetSpellAbilityId() == 'A000' then
        call BeginHook()
        return true
    endif
    return false
endfunction

//===========================================================================
function InitTrig_Cast takes nothing returns nothing
    local trigger a = CreateTrigger(  )
    local integer i = 0
    loop
        call TriggerRegisterPlayerUnitEvent( a, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null )
        set i = i + 1
        exitwhen i == bj_MAX_PLAYERS
    endloop
    call TriggerAddCondition( a, Condition( function AbilityCheck ) )
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top