• 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.

Custom spell for an npc?

Status
Not open for further replies.
Level 6
Joined
May 11, 2010
Messages
237
So I downloaded a Chain Hook spell, which pretty much drags a unit around dealing it damage. However, I want an npc to use it, but they wont as it's the channel spell. I'm not sure how to make a trigger so that it'll use it. I tried giving it the curse spell and just setting all of the data to 0 so it has no effect, but whenever it casts curse, order it to use the spell on the target curse was cast on, and I changed the order string of the spell to impale, but it still does not seem to work. here's the link to the spell I used, perhaps there's a different one which would better suit what im after?http://www.thehelper.net/forums/showthread.php?t=119550
 
Level 26
Joined
Aug 18, 2009
Messages
4,099
You cannot effectively edit the order string of an ability. It keeps the one it originally had, so it depends on which ability it was based off.

The channel spell however is an exception, there you got an extra field "base order id" (DataFX/Ncl6) which you can change to one of the elements in the list (shift + writing a custom identifier won't work). This element will be used as order string.

You can use this order then in "Unit - Issue An Order..."-trigger actions. Pay attention to the correct targeting type. If you picked one of the order strings that is not listed there, you may choose another one or switch to jass functions. In jass, you also have to possibility to run orders via a numeric id instead of the string one. Not every spell has a string order but all active abilities have a numeric one.
 
You cannot effectively edit the order string of an ability. It keeps the one it originally had, so it depends on which ability it was based off.

The channel spell however is an exception, there you got an extra field "base order id" (DataFX/Ncl6) which you can change to one of the elements in the list (shift + writing a custom identifier won't work). This element will be used as order string.

You can use this order then in "Unit - Issue An Order..."-trigger actions. Pay attention to the correct targeting type. If you picked one of the order strings that is not listed there, you may choose another one or switch to jass functions. In jass, you also have to possibility to run orders via a numeric id instead of the string one. Not every spell has a string order but all active abilities have a numeric one.

you can modify an order string of all spells, they have the field
"Order Sting - Use/Turn on" and the string there is the one you use for triggers... anyway there is no constant in GUI that calls the channel spell so if you retain the order string of channel then you must use a custom script...

Base orderId of channel is used to enable you to use multiple channel based spells on one unit by just making them have different BaseOrderIds...
 
Level 6
Joined
May 11, 2010
Messages
237
Okay so this is a late response as my campaign was corrupted and I had to rebuild from an older version, anyhow. The trigger I made for the npc to use the chain hook spell works fine, the only problem is that the chain hook spell can miss if the target is moving too fast. I tried changing the target type to unit target and the missle to homing etc, but I didn't think it'd work because the spell itself isn't the trigger. I"m unsure of how to modify the trigger so that it always hits.
 
Level 6
Joined
May 11, 2010
Messages
237
here it is

  • SetUp
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- NOTE: If you want this values to change per level, feel free to modify the CASTING TRIGGER by adding your formulas to this values. --------
      • Set Speed = 30.00
      • Set AbilityName = Chain Hook
      • Set PullsTheTarget = True
      • Set Duration = 40.00
      • -------- (Distance) x (Variable) x (Level) = damage dealt --------
      • Set DistanceDamageMultiplier = 0.05
      • -------- Damage dealt to the unit hooked. Increases with level --------
      • Set BaseDamage = 100.00
      • -------- Warning: Reach beyond 3000 might bug --------
      • Set Reach = 1400.00
  • ChainHook
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain Hook
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MUI Less than or equal to 50
        • Then - Actions
          • Set MUI = (MUI + 1)
        • Else - Actions
          • Set MUI = 1
      • Set MUICaster[MUI] = (Casting unit)
      • Set TempPoint = (Position of MUICaster[MUI])
      • Set TempPointArray[1] = (Target point of ability being cast)
      • Set MUIAngle[MUI] = (Angle from TempPoint to TempPointArray[1])
      • Unit - Create 1 ChainHook for (Owner of MUICaster[MUI]) at TempPoint facing MUIAngle[MUI] degrees
      • Unit Group - Add (Last created unit) to ChainHookDummyGroup
      • Set ChainHookDummys[((MUI x 100) - 99)] = (Last created unit)
      • Set ChainHookDummyCount[MUI] = 1
      • Unit - Set the custom value of (Last created unit) to MUI
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveLocation (udg_TempPointArray[1])
  • ChainHookSlide
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
      • (ChainHookDummyGroup is empty) Equal to False
    • Actions
      • Unit Group - Pick every unit in ChainHookDummyGroup and do (Actions)
        • Loop - Actions
          • Set TempInteger = (Custom value of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ChainHookCheck[TempInteger] Equal to False
              • MUITarget[TempInteger] Equal to No unit
            • Then - Actions
              • Set TempInteger2 = (((TempInteger x 100) - 100) + ChainHookDummyCount[TempInteger])
              • Set MUISlide[TempInteger] = (MUISlide[TempInteger] + Speed)
              • Set TempPointArray[1] = (Position of (Picked unit))
              • Set TempPoint = (TempPointArray[1] offset by Speed towards MUIAngle[TempInteger] degrees)
              • Custom script: call SetUnitX((GetEnumUnit()), GetLocationX(udg_TempPoint))
              • Custom script: call SetUnitY((GetEnumUnit()), GetLocationY(udg_TempPoint))
              • Unit - Make (Picked unit) face MUIAngle[TempInteger] over 0.00 seconds
              • Custom script: call RemoveLocation (udg_TempPoint)
              • Set TempPoint = (Position of MUICaster[TempInteger])
              • Custom script: call RemoveLocation (udg_TempPointArray[1])
              • Set TempPointArray[1] = (Position of ChainHookDummys[TempInteger2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between TempPoint and TempPointArray[1]) Greater than or equal to 45.00
                • Then - Actions
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • Set TempPoint = (Position of MUICaster[TempInteger])
                  • Set ChainHookDummyCount[TempInteger] = (ChainHookDummyCount[TempInteger] + 1)
                  • Set TempInteger2 = (((TempInteger x 100) - 100) + ChainHookDummyCount[TempInteger])
                  • Unit - Create 1 ChainHook for (Owner of MUICaster[TempInteger]) at TempPoint facing (Facing of ChainHookDummys[(TempInteger2 - 1)]) degrees
                  • Set ChainHookDummys[TempInteger2] = (Last created unit)
                  • Custom script: call RemoveLocation (udg_TempPoint)
                • Else - Actions
                  • Custom script: call RemoveLocation (udg_TempPoint)
              • Custom script: call RemoveLocation (udg_TempPointArray[1])
              • For each (Integer A) from 2 to ChainHookDummyCount[TempInteger], do (Actions)
                • Loop - Actions
                  • Set TempInteger2 = (((TempInteger x 100) - 100) + (Integer A))
                  • Set TempPointArray[1] = (Position of ChainHookDummys[TempInteger2])
                  • Set TempPointArray[2] = (Position of ChainHookDummys[(TempInteger2 - 1)])
                  • Set TempPoint = (TempPointArray[2] offset by 40.00 towards (Angle from TempPointArray[2] to TempPointArray[1]) degrees)
                  • Custom script: call SetUnitX((udg_ChainHookDummys[udg_TempInteger2]), GetLocationX(udg_TempPoint))
                  • Custom script: call SetUnitY((udg_ChainHookDummys[udg_TempInteger2]), GetLocationY(udg_TempPoint))
                  • Unit - Make ChainHookDummys[TempInteger2] face (Angle from TempPointArray[1] to TempPointArray[2]) over 0.00 seconds
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • Custom script: call RemoveLocation (udg_TempPointArray[1])
                  • Custom script: call RemoveLocation (udg_TempPointArray[2])
              • Set TempPoint = (Position of (Picked unit))
              • Set TempGroup = (Units within 90.00 of TempPoint)
              • Custom script: call RemoveLocation (udg_TempPoint)
              • Unit Group - Pick every unit in TempGroup and do (Actions)
                • Loop - Actions
                  • Set TempPointArray[1] = (Position of MUICaster[TempInteger])
                  • Set TempPointArray[2] = (Position of (Picked unit))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A structure) Equal to False
                      • ((Picked unit) is alive) Equal to True
                      • (Picked unit) Not equal to MUICaster[TempInteger]
                      • ((Picked unit) is in ChainHookTargetGroup) Equal to False
                      • (Distance between TempPointArray[1] and TempPointArray[2]) Greater than or equal to 150.00
                    • Then - Actions
                      • Set MUITarget[TempInteger] = (Picked unit)
                      • Unit - Cause MUICaster[TempInteger] to damage MUITarget[TempInteger], dealing BaseDamage damage of attack type Spells and damage type Normal
                      • Unit Group - Add (Picked unit) to ChainHookTargetGroup
                      • Unit - Turn collision for MUITarget[TempInteger] Off
                    • Else - Actions
                  • Custom script: call RemoveLocation (udg_TempPointArray[1])
                  • Custom script: call RemoveLocation (udg_TempPointArray[2])
              • Custom script: call DestroyGroup (udg_TempGroup)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • MUISlide[(Custom value of (Picked unit))] Greater than or equal to Reach
                      • ((Playable map area) contains (Picked unit)) Equal to False
                • Then - Actions
                  • Set ChainHookCheck[TempInteger] = True
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ChainHookCheck[TempInteger] Equal to True
                • Then - Actions
                  • Set TempInteger2 = (((TempInteger x 100) - 100) + ChainHookDummyCount[TempInteger])
                  • Set TempPointArray[1] = (Position of MUICaster[TempInteger])
                  • Set TempPointArray[2] = (Position of ChainHookDummys[TempInteger2])
                  • Set TempPointArray[3] = (Position of ChainHookDummys[(TempInteger2 - 1)])
                  • Set TempPoint = (TempPointArray[2] offset by Speed towards (Angle from TempPointArray[2] to TempPointArray[1]) degrees)
                  • Custom script: call SetUnitX((udg_ChainHookDummys[udg_TempInteger2]), GetLocationX(udg_TempPoint))
                  • Custom script: call SetUnitY((udg_ChainHookDummys[udg_TempInteger2]), GetLocationY(udg_TempPoint))
                  • Unit - Make ChainHookDummys[TempInteger2] face (Angle from TempPointArray[2] to TempPointArray[3]) over 0.00 seconds
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • Custom script: call RemoveLocation (udg_TempPointArray[1])
                  • Custom script: call RemoveLocation (udg_TempPointArray[2])
                  • For each (Integer A) from 1 to (ChainHookDummyCount[TempInteger] - 1), do (Actions)
                    • Loop - Actions
                      • Set TempInteger2 = (((TempInteger x 100) - 100) + (Integer A))
                      • Set TempPointArray[1] = (Position of ChainHookDummys[(TempInteger2 + 1)])
                      • Set TempPointArray[2] = (Position of ChainHookDummys[TempInteger2])
                      • Set TempPoint = (TempPointArray[2] offset by 20.00 towards (Angle from TempPointArray[2] to TempPointArray[1]) degrees)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Integer A) Equal to 1
                          • PullsTheTarget Equal to True
                        • Then - Actions
                          • Custom script: call SetUnitX((udg_MUITarget[udg_TempInteger]), GetLocationX(udg_TempPointArray[2]))
                          • Custom script: call SetUnitY((udg_MUITarget[udg_TempInteger]), GetLocationY(udg_TempPointArray[2]))
                        • Else - Actions
                      • Custom script: call SetUnitX((udg_ChainHookDummys[udg_TempInteger2]), GetLocationX(udg_TempPoint))
                      • Custom script: call SetUnitY((udg_ChainHookDummys[udg_TempInteger2]), GetLocationY(udg_TempPoint))
                      • Unit - Make ChainHookDummys[TempInteger2] face (Angle from TempPointArray[1] to TempPointArray[2]) over 0.00 seconds
                      • Custom script: call RemoveLocation (udg_TempPointArray[1])
                      • Custom script: call RemoveLocation (udg_TempPointArray[2])
                      • Custom script: call RemoveLocation (udg_TempPoint)
                  • Set TempInteger2 = (((TempInteger x 100) - 100) + ChainHookDummyCount[TempInteger])
                  • Set TempPoint = (Position of ChainHookDummys[TempInteger2])
                  • Set TempPointArray[1] = (Position of MUICaster[TempInteger])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between TempPoint and TempPointArray[1]) Less than or equal to (Speed / 2.00)
                    • Then - Actions
                      • Set ChainHookDummyCount[TempInteger] = (ChainHookDummyCount[TempInteger] - 1)
                      • Unit - Remove ChainHookDummys[TempInteger2] from the game
                    • Else - Actions
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • Custom script: call RemoveLocation (udg_TempPointArray[1])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ChainHookDummyCount[TempInteger] Equal to 0
                    • Then - Actions
                      • Set MUISlide[TempInteger] = 0.00
                      • Set MUITarget[TempInteger] = No unit
                      • Set ChainHookDistance[TempInteger] = 0.00
                      • Set ChainHookCheck[TempInteger] = False
                    • Else - Actions
                • Else - Actions
                  • Set TempInteger2 = (((TempInteger x 100) - 100) + ChainHookDummyCount[TempInteger])
                  • Set TempPointArray[1] = (Position of MUICaster[TempInteger])
                  • Set TempPointArray[2] = (Position of ChainHookDummys[TempInteger2])
                  • Set TempPoint = (TempPointArray[1] offset by 40.00 towards (Angle from TempPointArray[1] to TempPointArray[2]) degrees)
                  • Custom script: call SetUnitX((udg_ChainHookDummys[udg_TempInteger2]), GetLocationX(udg_TempPoint))
                  • Custom script: call SetUnitY((udg_ChainHookDummys[udg_TempInteger2]), GetLocationY(udg_TempPoint))
                  • Unit - Make ChainHookDummys[TempInteger2] face (Angle from TempPointArray[1] to TempPointArray[2]) over 0.00 seconds
                  • Custom script: call RemoveLocation (udg_TempPointArray[1])
                  • Custom script: call RemoveLocation (udg_TempPointArray[2])
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • Set ChainHookDistance[TempInteger] = (ChainHookDistance[TempInteger] + 0.03)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (MUICaster[TempInteger] belongs to an enemy of (Owner of MUITarget[TempInteger])) Equal to True
                    • Then - Actions
                      • Set TempPoint = (Position of ChainHookDummys[((TempInteger x 100) - 99)])
                      • Set TempPointArray[1] = (Position of MUITarget[TempInteger])
                      • Unit - Cause MUICaster[TempInteger] to damage MUITarget[TempInteger], dealing ((Distance between TempPoint and TempPointArray[1]) x (DistanceDamageMultiplier x (Real((Level of AbilityName for MUICaster[TempInteger]))))) damage of attack type Spells and damage type Normal
                      • Custom script: call RemoveLocation (udg_TempPoint)
                      • Custom script: call RemoveLocation (udg_TempPointArray[1])
                    • Else - Actions
                  • Set TempPoint = (Position of ChainHookDummys[((TempInteger x 100) - 99)])
                  • Set TempPointArray[1] = (Position of MUITarget[TempInteger])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between TempPoint and TempPointArray[1]) Greater than or equal to 1.00
                    • Then - Actions
                      • Custom script: call RemoveLocation (udg_TempPoint)
                      • Set TempInteger2 = ((TempInteger x 100) - 99)
                      • Set TempPoint = (Position of ChainHookDummys[TempInteger2])
                      • Unit - Move MUITarget[TempInteger] instantly to TempPoint
                      • Custom script: call RemoveLocation (udg_TempPoint)
                      • Set TempPoint = (Position of ChainHookDummys[TempInteger2])
                      • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
                      • Custom script: call RemoveLocation (udg_TempPoint)
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                      • Custom script: call RemoveLocation (udg_TempPoint)
                  • Custom script: call RemoveLocation (udg_TempPointArray[1])
                  • For each (Integer A) from 1 to (ChainHookDummyCount[TempInteger] - 1), do (Actions)
                    • Loop - Actions
                      • Set TempInteger2 = (((TempInteger x 100) - 100) + (Integer A))
                      • Set TempPointArray[1] = (Position of ChainHookDummys[(TempInteger2 + 1)])
                      • Set TempPointArray[2] = (Position of ChainHookDummys[TempInteger2])
                      • Set TempPoint = (TempPointArray[1] offset by 40.00 towards (Angle from TempPointArray[1] to TempPointArray[2]) degrees)
                      • Custom script: call SetUnitX((udg_ChainHookDummys[udg_TempInteger2]), GetLocationX(udg_TempPoint))
                      • Custom script: call SetUnitY((udg_ChainHookDummys[udg_TempInteger2]), GetLocationY(udg_TempPoint))
                      • Unit - Make ChainHookDummys[TempInteger2] face (Angle from TempPointArray[1] to TempPointArray[2]) over 0.00 seconds
                      • Custom script: call RemoveLocation (udg_TempPointArray[1])
                      • Custom script: call RemoveLocation (udg_TempPointArray[2])
                      • Custom script: call RemoveLocation (udg_TempPoint)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (MUICaster[TempInteger] is dead) Equal to True
                          • (MUITarget[TempInteger] is dead) Equal to True
                          • ChainHookDistance[TempInteger] Greater than or equal to (Duration + (Real((Level of AbilityName for MUICaster[TempInteger]))))
                    • Then - Actions
                      • Unit - Turn collision for MUITarget[TempInteger] On
                      • Unit Group - Remove MUITarget[TempInteger] from ChainHookTargetGroup
                      • Set ChainHookCheck[TempInteger] = True
                    • Else - Actions
 
Status
Not open for further replies.
Top