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

Run attack spell

Status
Not open for further replies.
Level 12
Joined
Mar 23, 2008
Messages
942
I want to make a spell that after you cast, you run to the enemy at max speed and them attack him dealing a bonus damage.
But I don't know how to:

1- Make the player unable to control the hero in the middle of the spell
2- Return the speed to normal after the spell end
3- Detect if the enemy has out of sight and them stop running
4- Detect if its impossible to walk to the opponent and stop (wall or whatever)

Someone can help me?
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
1- losing control hmm thats a thing
2- just use a speed increasing buff (give it rune of speed) and remove it when stops
3- You can detect if a player can see someone
4- possible but that will own you
 
Level 10
Joined
Sep 6, 2007
Messages
440
1-You can pause.
2-Unit-Set speed or something. Set the normal speed a variable and then make it for example X ( the speed before the spell ) and when you start it you make it X+n( where n is the desired bonus ). At the end you can set it to X again.
3-If distance between you and the target > N stop casting. To do that, you can make a trigger run when you cast a spell where it's even it every X second and actions that check distance. ( I suggest N is the sight of the unit in A range of target. I think you can pick the sight range of the A range unit and use it for the spell.)
4-Well you can pause the hero at the start of the spell and then Issue it to attack by triggers.

Kinda complicated I know. I may not be able to do this sight thing but the rest would be ok for me. If you are so desperate on the sight thing, just make the hero stop if the distance between them is higher than something.
 
Level 11
Joined
Apr 6, 2008
Messages
760
1-You can pause.
2-Unit-Set speed or something. Set the normal speed a variable and then make it for example X ( the speed before the spell ) and when you start it you make it X+n( where n is the desired bonus ). At the end you can set it to X again.
3-If distance between you and the target > N stop casting. To do that, you can make a trigger run when you cast a spell where it's even it every X second and actions that check distance. ( I suggest N is the sight of the unit in A range of target. I think you can pick the sight range of the A range unit and use it for the spell.)
4-Well you can pause the hero at the start of the spell and then Issue it to attack by triggers.

1-that will make the unit uncontrollable
2-this wont help if u pause the unit
3-wont work if a friendly unit see's it
4-paused units cant attack...

best thing imo had been to run a timer that order the unit too attack the target like every 0.1sec (will look buggy if u order the unit to do something else but still the best option imo), or u could pause the caster and move it with move unit instanly blah blah polarprojection(unit position of caster offset xx towards angle(which is the angle betwin the target and the caster)) but with that the caster can get to the target where ever he are
 
Level 11
Joined
Apr 6, 2008
Messages
760
1- I was thinking I could make a channel spell with infinite time and if you stop channeling the spell stops.

problem with this is that u cant order the unit to move coz that will end the channel

1 thing u can do is cast a single target spell and order the unit to move too the target and then u detect if the unit gets an other order(move order, attack order ect ect) and stop the spell
 
Level 12
Joined
Mar 23, 2008
Messages
942
problem with this is that u cant order the unit to move coz that will end the channel

1 thing u can do is cast a single target spell and order the unit to move too the target and then u detect if the unit gets an other order(move order, attack order ect ect) and stop the spell
Like:

Order unit to attack
call detecttrigger

-----

If order equal to attack is false
remove speed blablabla

?
 
Level 11
Joined
Apr 6, 2008
Messages
760
ur doing it jass or gui?

if jass

JASS:
function Charge_acts takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local unit t = GetSpellTargetUnit()
    local trigger trig = CreateTrigger()
    
    call UnitShareVision(t,GetOwningPlayer(c),true)
    //your actions blahblah    

    call TriggerRegisterUnitEvent(trig,c,EVENT_UNIT_ISSUED_ORDER)
    call TriggerRegisterUnitEvent(trig,c,EVENT_UNIT_ISSUED_POINT_ORDER)
    call TriggerRegisterUnitEvent(trig,c,EVENT_UNIT_ISSUED_TARGET_ORDER)
    call TriggerRegisterUnitEvent(trig,c,EVENT_UNIT_DEATH)
    call TriggerRegisterUnitEvent(trig,t,EVENT_UNIT_DEATH)

     //your actions blahblah
    
    call UnitShareVision(t,GetOwningPlayer(c),false)
    
    set c = null
    set t = null
    call DestroyTrigger(trig)
    set trig = null
endfunction

function Charge_Init takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t,Condition(function Charge_conds))
    call TriggerAddAction(t,function Charge_acts)
endfunction

dunno if u need

JASS:
call TriggerRegisterUnitEvent(trig,c,EVENT_UNIT_SPELL_CAST)
 
Level 11
Joined
Apr 6, 2008
Messages
760
the jass code translated in to GUI :>
  • Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to "Your spell"
    • Actions
      • Set Caster = (GetTriggerUnit)
      • Trigger - Turn on End <gen>
      • Your Actions
  • End
    • Events
      • Unit - A Dies
      • Unit - A Unit Is issued an order targeting an object
      • Unit - A Unit Is issued an order targeting a point
      • Unit - A Unit Is issued an order with no target
    • Conditions
      • (Triggering Unit) equal to Caster
    • Actions
      • Your Actions
Off Topic: shit didnt remember that GUI was that limited ^^
 
Level 10
Joined
Sep 6, 2007
Messages
440
Hmm also you could make a trigger run when you cast a spell. The event should be, Issued order.
And then condition can be Order equal to ( x )
Actions
.
.
.
Don't know what to do if you order to cast a spell. Maybe messing with variables with arrays can help. Also you can make it a channel spell too. That would make things less complicated. Noticed a cool and useful thing on thehelper forums. A function that detects pathable points.
http://www.thehelper.net/forums/showthread.php?t=86765
 
Level 3
Joined
Apr 26, 2008
Messages
31
this is simple just do the trigger like this
event
map inialization
cond
action
set playershero to (ur unit)

playershero is a unit variable
also caster is a unit variable
next trigger

event
unit starts effect of ability
cond
ability being casted equal to (ur ability goes here)
action
set caster to unit of ability being casted
wait .05 sec
unit-pause playershero
unit-increase movement speed to (whatever) (whatever) (whatever)
wait .05 sec
unit-order playershero to move to target
animation-play playershero attack animation using rare only
unit-damage unit using playershero damageing target by (i forget how this trigger is written just find it,its somewhere in the units trigger section)
wait .05 sec
unit-unpause playershero
(and then i forget how to lower the units speed well find that out and then ta-da ur move works )
(oh yea no need to give me cred if u use this)
 
Last edited:
Level 12
Joined
Apr 27, 2008
Messages
1,228
There is a standart function for setting a units speed to its default.
But you can make the spell when activated to give a specific buff to the unit, increase it's movement speed and damage.
Order the caster to attack the target.
Unselect the casting unit.
Make a trigger when a unit with this buff attacks - remove the buff.
Make a trigger when a unit with the buff is selected by it's owner, all or people who can control it - unselect it.
Ain't sure what exactly that check passability functions does: check if you can stand on one point or if you can reach a point :D
Anyways this is better. But still will check if a point is standable, not reacheble(link found in the mentioned thread).
 
Level 11
Joined
Apr 6, 2008
Messages
760
wait .05 sec

waits can be minimun 0.27 seconds well sure u can set them to be .05 sec but in game they get 0.27

this is simple just do the trigger like this
unit-pause playershero
unit-increase movement speed to (whatever) (whatever) (whatever)
wait .05 sec
unit-order playershero to move to target
unit-damage unit using playershero damageing target by (i forget how this trigger is written just find it,its somewhere in the units trigger section)
wait .05 sec
unit-unpause playershero

now tell me how u gonna move him? paused units can't walk
 
Level 12
Joined
Mar 23, 2008
Messages
942
For some reason this crashes the game...

  • Chidori Off Detect
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Chidori (hand effect) for (Ordered unit)) Equal to 1
      • (Issued order) Not equal to (Order(attack))
    • Actions
      • Unit - Order (Ordered unit) to Stop
      • Unit - Remove Chidori (hand effect) from (Ordered unit)
      • Trigger - Turn off (This trigger)
And how can I make a unit play a animation that cannot be canceled? I tried everything, but when the unit starts to move it play the normal walk animation instead of my Spell Run.
 
Level 12
Joined
Mar 23, 2008
Messages
942
WoW... I need? (Lazzy)

okay...

  • Chidori Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chidori (based in Channel)
      • (Level of Chidori (hand effect) for (Casting unit)) Equal to 0
    • Actions
      • Set SpellPoint[0] = (Position of (Casting unit))
      • Animation - Play (Casting unit)'s Spell Channel animation
      • Unit - Add Chidori (hand effect) to (Casting unit)
      • Special Effect - Create a special effect at SpellPoint[0] using Abilities\Spells\Items\AIlb\AIlbSpecialArt.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Order (Casting unit) to Attack (Target unit of ability being cast)
      • Animation - Play (Casting unit)'s Spell Run animation
      • Trigger - Turn on Chidori Off <gen>
      • Trigger - Turn on Chidori Attack <gen>
      • Trigger - Run Chidori Off <gen> (ignoring conditions)
      • Trigger - Turn on Chidori Off Detect <gen>
      • Custom script: call RemoveLocation(udg_SpellPoint[0])
  • Chidori Off
    • Events
    • Conditions
    • Actions
      • Wait 10.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Chidori (hand effect) for (Casting unit)) Equal to 1
        • Then - Actions
          • Unit - Order (Casting unit) to Stop
          • Unit - Remove Chidori (hand effect) from (Casting unit)
        • Else - Actions
      • Trigger - Turn off (This trigger)
  • Chidori Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Chidori (hand effect) for (Attacking unit)) Equal to 1
    • Actions
      • Set SpellPoint[0] = (Position of (Attacked unit))
      • Set tempunit[0] = (Attacking unit)
      • Set tempunit[1] = (Attacked unit)
      • Set tempinteger[0] = (400 + (100 x (Level of Rasengan (based in war stomp) for (Attacking unit))))
      • Set tempinteger[1] = (Integer((Facing of (Attacking unit))))
      • Set tempinteger[2] = 2
      • Animation - Play (Attacking unit)'s Spell Hit animation
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Chidori (based in Channel) for (Attacking unit)) Equal to 1
        • Then - Actions
          • Special Effect - Create a special effect at SpellPoint[0] using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at SpellPoint[0] using Abilities\Weapons\Bolt\BoltImpact.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call Knockback(udg_tempunit[1], udg_tempinteger[0], udg_tempinteger[1] * bj_DEGTORAD, udg_tempinteger[2])
          • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing 300.00 damage of attack type Spells and damage type Normal
          • Unit - Remove Chidori (hand effect) from (Attacking unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Chidori (based in Channel) for (Attacking unit)) Equal to 2
            • Then - Actions
              • Special Effect - Create a special effect at SpellPoint[0] using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
              • Special Effect - Destroy (Last created special effect)
              • Special Effect - Create a special effect at SpellPoint[0] using Abilities\Weapons\Bolt\BoltImpact.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call Knockback(udg_tempunit[1], udg_tempinteger[0], udg_tempinteger[1] * bj_DEGTORAD, udg_tempinteger[2])
              • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing 480.00 damage of attack type Spells and damage type Normal
              • Unit - Remove Chidori (hand effect) from (Attacking unit)
            • Else - Actions
              • Special Effect - Create a special effect at SpellPoint[0] using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
              • Special Effect - Destroy (Last created special effect)
              • Special Effect - Create a special effect at SpellPoint[0] using Abilities\Weapons\Bolt\BoltImpact.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call Knockback(udg_tempunit[1], udg_tempinteger[0], udg_tempinteger[1] * bj_DEGTORAD, udg_tempinteger[2])
              • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing 600.00 damage of attack type Spells and damage type Normal
              • Unit - Remove Chidori (hand effect) from (Attacking unit)
      • Animation - Reset (Attacking unit)'s animation
      • Trigger - Turn off (This trigger)
      • Custom script: call RemoveLocation(udg_SpellPoint[0])
  • Chidori Off Detect
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Chidori (hand effect) for (Ordered unit)) Equal to 1
      • (Issued order) Not equal to (Order(attack))
    • Actions
      • Unit - Order (Ordered unit) to Stop
      • Unit - Remove Chidori (hand effect) from (Ordered unit)
      • Trigger - Turn off (This trigger)
Bugs:
When you start to move the "Spell Run" animation is interrupted.
If you do anything else while you is doing the spell the game closes without any error messages.
 
Level 11
Joined
Apr 6, 2008
Messages
760
ok solved it

  • Chidori Off Detect
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Chidori (hand effect) for (Ordered unit)) Equal to 1
      • (Issued order) Not equal to (Order(attack))
    • Actions
      • Unit - Remove Chidori (hand effect) from (Ordered unit)
      • Trigger - Turn off (This trigger)
 
Last edited:
Level 11
Joined
Apr 6, 2008
Messages
760
by doing them the hard way but i didnt need all of them to fix it :p

and strange that
  • Unit - Order (Ordered unit) to Stop
did crash the game

one more thing

  • Chidori Off
    • Events
    • Conditions
    • Actions
      • Wait 10.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Chidori (hand effect) for (Casting unit)) Equal to 1
        • Then - Actions
          • Unit - Order (Casting unit) to Stop
          • Unit - Remove Chidori (hand effect) from (Casting unit)
        • Else - Actions
        • Trigger - Turn off (This trigger)
(Casting unit) dont work here u have to save the caster in a varible
 
Last edited:
Level 12
Joined
Mar 23, 2008
Messages
942
I have an idea, maybe ordering my unit to stop make the trigger be initiated infinite times, maybe doing this can solve the problem:

  • Chidori Off Detect
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Chidori (hand effect) for (Ordered unit)) Equal to 1
      • (Issued order) Not equal to (Order(attack))
    • Actions
      • Unit - Remove Chidori (hand effect) from (Ordered unit)
      • Unit - Order (Ordered unit) to Stop
      • Trigger - Turn off (This trigger)
I will test and edit this
 
Level 11
Joined
Apr 6, 2008
Messages
760
I have an idea, maybe ordering my unit to stop make the trigger be initiated infinite times, maybe doing this can solve the problem:

  • Chidori Off Detect
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Chidori (hand effect) for (Ordered unit)) Equal to 1
      • (Issued order) Not equal to (Order(attack))
    • Actions
      • Unit - Remove Chidori (hand effect) from (Ordered unit)
      • Unit - Order (Ordered unit) to Stop
      • Trigger - Turn off (This trigger)
I will test and edit this

dont think so but really from what i can see ordering the unit to stop wont do a diffrence... since the spell get stoped and get unit do the order it have been ordered so imo remove
  • Unit - Remove Chidori (hand effect) from (Ordered unit)
 
Level 12
Joined
Mar 23, 2008
Messages
942
Yes it worked! It was just a infinite loop because of the order.
I'm a genius :3

And ciebron, I can't remove that thing because if I do that the spell will continue if the unit attack other guy.

ARG, HOW DO I MAKE MY UNIT PLAY SPELL RUN ANIMATION!!! I order it to play but as soon it start moving it change back to walk animation ¬¬
 
Level 12
Joined
Mar 23, 2008
Messages
942
I still don't know how can I make my unit play "Spell Run" animation instead of walk...

EDIT: *Solved*

Changed animation name to "Spell Walk"
Gave "Spell" animation tag to unit ^^
 
Last edited:
Status
Not open for further replies.
Top