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

[Spell] Heyo! Loosing control of unit!

Status
Not open for further replies.
Level 8
Joined
Oct 26, 2008
Messages
387
Hey, i am working on a spell that is susposed to make the target loose control (if controled by player) and make him rune in random locations near him for some time. I tried to set a point random offset random angle, and order the target to move there, but it doesnt work.. any ideas of how to manage this?
 
Level 8
Joined
Oct 26, 2008
Messages
387
  • Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TargetsGroup and do (Actions)
        • Loop - Actions
          • Set Key2 = (Custom value of (Picked unit))
          • Set TickingClock[Key2] = (TickingClock[Key2] + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TickingClock[Key2] Equal to Duration
            • Then - Actions
              • Unit Group - Remove Target[Key2] from TargetsGroup
              • Special Effect - Destroy SpecialEffect[Key2]
            • Else - Actions
              • Set TargetLocMove[Key2] = ((Position of Target[Key2]) offset by 200.00 towards (Random angle) degrees)
              • Unit - Order Target[Key2] to Stop
              • Unit - Order Target[Key2] to Move To TargetLoc[Key2]
              • Unit - Set life of Target[Key2] to ((Life of Target[Key2]) - 100.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TargetsGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Do nothing


  • Set TargetLocMove[Key2] = ((Position of Target[Key2]) offset by 200.00 towards (Random angle) degrees)
    • Unit - Order Target[Key2] to Stop
    • Unit - Order Target[Key2] to Move To TargetLoc[Key2]
Something here bugs, but the command Stop works perfectly, the command move to doesnt, the enemy unit keeps attacking me. How to make it move out of control?
 
Level 9
Joined
Jul 10, 2011
Messages
562
to avoid attacking of the unit do

  • Custom script: call UnitAddAbility(udg_YourUnitVariable, 'Abun')
and to remove it again do

  • Custom script: call UnitRemoveAbility(udg_YourUnitVariable, 'Abun')
that disables the attack as long as the unit has the ability.


and just to know....why you order to stop and right after to move somewhere else? theres no need to stop the unit imo.

and remove the 'do nothing' that just takes memory for nothing ;D


oh and do you turn the trigger on again somewhere? i can just see you turn it off.
 
Level 8
Joined
Oct 26, 2008
Messages
387
to avoid attacking of the unit do

  • Custom script: call UnitAddAbility(udg_YourUnitVariable, 'Abun')
and to remove it again do

  • Custom script: call UnitRemoveAbility(udg_YourUnitVariable, 'Abun')
that disables the attack as long as the unit has the ability.


and just to know....why you order to stop and right after to move somewhere else? theres no need to stop the unit imo.

and remove the 'do nothing' that just takes memory for nothing ;D


oh and do you turn the trigger on again somewhere? i can just see you turn it off.

Hmm turning his attack off? This could be great in my case.. i orderd it to stop, so i could see if the trigger would go in that set of actions.. the other trigger (where it is turned on) is irrelevant to the problem thus it is not posted.


Edit:
  • Custom script: call UnitAddAbility(udg_YourUnitVariable, 'Abun')
  • Custom script: call UnitRemoveAbility(udg_YourUnitVariable, 'Abun')
As you might have noticed i use indexes, but this script bugs..
i used it as

  • Custom script: call UnitAddAbility(udg_Target[Key2], 'Abun')
But it fails
 
get rid of the do nothing function, you leak a point, also what's duration set to? it could be a simple mistake of having that set incorrectly, though assuming it's not that. it could be target[key2] not being set correctly? since it seems more apparently that none of the commands on it are working, including the stop, since it wouldn't move toward you to attack if it was (unless I'm mistaken and it does)
 
Level 8
Joined
Oct 26, 2008
Messages
387
get rid of the do nothing function, you leak a point, also what's duration set to? it could be a simple mistake of having that set incorrectly, though assuming it's not that. it could be target[key2] not being set correctly? since it seems more apparently that none of the commands on it are working, including the stop, since it wouldn't move toward you to attack if it was (unless I'm mistaken and it does)

Ok about the do nothing
Leaks not considered premature stage of the progress
duration - 15
found the problem testing on how it works now


Being ordered to move to TargetLoc, while you're setting TargetLocMove.

Noticed that not >< Embarassed i was coming right up to post..


If i pause the unit, will it be able to accept orders such as move?
Because if i just remove its attack, ok he wont be able to attack me, BUT the player controling it will still be able to move it arround, my main problem here as posted in first post, is to make the owner looose control of the unit while i move it arround..
 
Status
Not open for further replies.
Top