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

[Trigger] Hook ability makes the unit locust

Status
Not open for further replies.

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
  • trigger
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Ballista
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Killing unit) is Mechanical) Equal to True
          • ((Killing unit) is alive) Equal to True
          • (Unit-type of PlayerBoat[(Player number of (Owner of (Triggering unit)))]) Equal to Cruiser
        • Then - Actions
          • Set TempPoint2 = (Position of PlayerBoat[(Player number of (Owner of (Triggering unit)))])
          • Unit - Create 1 DummyBoat (Caster) for (Owner of (Triggering unit)) at TempPoint2 facing Default building facing degrees
          • Unit - Add Hookshot (Dummycaster) to (Last created unit)
          • Unit - Set level of Hookshot (Dummycaster) for (Last created unit) to (Level of Hookshot (Back) for PlayerBoat[(Player number of (Owner of (Triggering unit)))])
          • Unit - Order (Last created unit) to Human Dragonhawk Rider - Aerial Shackles (Killing unit)
          • Custom script: call RemoveLocation(udg_TempPoint2)
        • Else - Actions
  • Hookshot Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hookshot (Dummycaster)
    • Actions
      • Trigger - Turn on Hookshot Movement System <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (PlayerBoat[(Player number of (Owner of (Triggering unit)))] is alive) Equal to False
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
          • Skip remaining actions
        • Else - Actions
      • Set TempPoint1 = (Position of PlayerBoat[(Player number of (Owner of (Triggering unit)))])
      • Set TempPoint2 = (Position of (Triggering unit))
      • Set Distance = (Distance between TempPoint1 and TempPoint2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Distance Greater than or equal to 100.00
        • Then - Actions
          • Unit - Move (Triggering unit) instantly to TempPoint1
          • Unit - Order (Triggering unit) to Human Dragonhawk Rider - Aerial Shackles (Target unit of ability being cast)
        • Else - Actions
          • Unit Group - Add (Target unit of ability being cast) to Move
          • Unit Group - Add (Target unit of ability being cast) to HookedGroup
      • Set HookDummyCaster[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • Set OwnerOfHookshot[(Player number of (Owner of (Target unit of ability being cast)))] = (Player number of (Owner of (Triggering unit)))
      • Set HookCasterPlayer = (Player number of (Owner of (Triggering unit)))
      • Set UnitBeingHooked[(Player number of (Player((Player number of (Owner of (Triggering unit))))))] = (Target unit of ability being cast)
      • Custom script: call RemoveLocation(udg_TempPoint1)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Wait (0.43 + (0.17 x (Real((Level of Hookshot (Back) for PlayerBoat[(Player number of (Owner of (Triggering unit)))]))))) seconds
      • Unit Group - Remove UnitBeingHooked[(Player number of (Owner of (Triggering unit)))] from Move
      • Unit Group - Remove UnitBeingHooked[(Player number of (Owner of (Triggering unit)))] from HookedGroup
      • Set UnitBeingHooked[(Player number of (Owner of (Triggering unit)))] = No unit

  • Hookshot Movement System
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Move and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in HookedGroup) Equal to True
            • Then - Actions
              • Set TempPoint1 = (Position of (Picked unit))
              • Set TempPoint2 = (Position of HookDummyCaster[(Player number of (Player(OwnerOfHookshot[(Player number of (Owner of (Picked unit)))])))])
              • Set HookCasterPlayer = OwnerOfHookshot[(Player number of (Owner of (Picked unit)))]
              • Set TempPoint3 = (Position of PlayerBoat[HookCasterPlayer])
              • Set RandomAngle = (Angle from TempPoint1 to TempPoint2)
              • Unit - Make (Picked unit) face RandomAngle over 0.00 seconds
              • Set TempPoint2 = (Position of PlayerBoat[(Player number of (Player((Integer A))))])
              • Set Distance = (Distance between TempPoint3 and TempPoint2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance Greater than or equal to 100.00
                • Then - Actions
                  • Unit - Order HookDummyCaster[HookCasterPlayer] to Stop
                  • Unit Group - Remove (Picked unit) from Move
                • Else - Actions
              • Set Distance = (Distance between TempPoint3 and TempPoint1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance Greater than or equal to 100.00
                • Then - Actions
                  • Unit - Order HookDummyCaster[HookCasterPlayer] to Stop
                  • Unit Group - Remove (Picked unit) from Move
                • Else - Actions
              • Custom script: call RemoveLocation(udg_TempPoint1)
              • Custom script: call RemoveLocation(udg_TempPoint2)
              • Custom script: call RemoveLocation(udg_TempPoint3)
            • Else - Actions

JASS:
function Trig_Unit_Move_Code_Enum takes nothing returns nothing
    local unit u = GetEnumUnit()
    call SetUnitPosition(u, GetUnitX(u)+45.0*Cos(GetUnitFacing(u)*0.01745), GetUnitY(u)+45.0*Sin(GetUnitFacing(u)*0.01745))
    set u = null
endfunction

function Trig_Unit_Move_Code_Enum_Fast takes nothing returns nothing
    local unit u = GetEnumUnit()
    call SetUnitPosition(u, GetUnitX(u)+60.0*Cos(GetUnitFacing(u)*0.01745), GetUnitY(u)+60.0*Sin(GetUnitFacing(u)*0.01745))
    set u = null
endfunction

function Trig_Unit_Move_Code_Enum_Slow takes nothing returns nothing
    local unit u = GetEnumUnit()
    call SetUnitPosition(u, GetUnitX(u)+30.0*Cos(GetUnitFacing(u)*0.01745), GetUnitY(u)+30.0*Sin(GetUnitFacing(u)*0.01745))
    set u = null
endfunction

function Trig_Unit_Move_Code_Actions takes nothing returns nothing
    call ForGroup(udg_Move, function Trig_Unit_Move_Code_Enum)
    call ForGroup(udg_MoveFast, function Trig_Unit_Move_Code_Enum_Fast)
    call ForGroup(udg_MoveSlow, function Trig_Unit_Move_Code_Enum_Slow)
endfunction

//===========================================================================
function InitTrig_Unit_Move_Code takes nothing returns nothing
    set gg_trg_Unit_Move_Code = CreateTrigger()
    call TriggerAddAction(gg_trg_Unit_Move_Code, function Trig_Unit_Move_Code_Actions)
    call TriggerRegisterTimerEvent(gg_trg_Unit_Move_Code, 0.05, true)
endfunction

Using Arial Shackles as spell


The problem with this trigger, is that the target unit for some very odd reason instantly drop from the group and become unselectable and immune to damage after being hit by the hook. I can't understand why the unit get this weird ability, even it's not given locust or crow form or anything at all?

It's not given locust at all in any triggers, but still the target unit gets such similar locust conditions... :sad:
 
Status
Not open for further replies.
Top