Passive Taunt Spell

TideOfChaos

New Member
Reaction score
25
I am making a passive ability for a Warrior, which gives an 1% chance that a nearby allied unit is attack, it will switch targets to the Warrior.

Would it be MUI?
If not, why, and how can I fix it?

Trigger:
  • Taunt
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Taunt ) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set _TempUnit = (Picked unit)
          • Unit Group - Pick every unit in (Units within 600.00 of (Position of (Picked unit)) matching ((Attacking unit) Equal to (Matching unit))) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Attacking unit)) is an enemy of (Owner of _TempUnit)) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Equal to 1
                    • Then - Actions
                      • Unit - Order (Picked unit) to Attack _TempUnit
                    • Else - Actions
                • Else - Actions
 

jig7c

Stop reading me...-statement
Reaction score
123
Taunt
Events
Unit - A unit Is attacked
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Taunt ) Equal to True)) and do (Actions)
Loop - Actions
Set _TempUnit = (Picked unit)
(add a new action line from here)
Unit Group - Pick every unit in (Units within 600.00 of (Position of (TempUnit)) matching ((Attacking unit) Equal to (Matching unit))) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of (Attacking unit)) is an enemy of (Owner of _TempUnit)) Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Equal to 1
Then - Actions
Unit - Order (Picked unit) to Attack _TempUnit
Else - Actions
Do nothing

and no, its not MUI
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
No, it is not MUI. Jass is easiest way to let you achieve MUI. And also, create a timer that constantly order group to attack Warrior. :)
 

jig7c

Stop reading me...-statement
Reaction score
123
what if two units become TempUnit at the same time... dont' you need an integer or an array???
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> Would it be MUI?

Yes, it is.

However, it leaks tremendously. Several groups and points.
And, given "is attacked" tends to happen rather often...
Find some memory leak tutorial.


> (Attacking unit) Equal to (Matching unit)

This is either not what you're looking for, or completely pointless as you already know what unit that will be.
 

TideOfChaos

New Member
Reaction score
25
Firstly, this spell is only intended for use aganist creeps. :p

I understand why it isn't MUI, so how can I change it?
I played around with UnitGroups, but that gets a bit messy, any suggestions. (And no, I don't know JASS)

Also, I updated the Trigger again.

Edit:
@AceHeart
Really? Awesome
I understand it leaks, I normally remove memory leaks last. (habbit)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
On a related note:
> Unit - A unit Is attacked
> Unit - Order (Picked unit) to Attack _TempUnit

Make very sure that your trigger can not call itself... by turning it off before ordering for example.
 

TideOfChaos

New Member
Reaction score
25
Will a Trigger still finish Running it has been turned off?
If so, do I Turn the Trigger back on once it is finished running?
 

jig7c

Stop reading me...-statement
Reaction score
123
Taunt
Events
Unit - A unit Is attacked
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Taunt ) Equal to True)) and do (Actions)
Loop - Actions
Set _TempUnit = (Picked unit)

Unit Group - Pick every unit in (Units within 600.00 of (Position of (Picked unit)) matching ((Attacking unit) Equal to (Matching unit))) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of (Attacking unit)) is an enemy of (Owner of _TempUnit)) Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Equal to 1
Then - Actions
Unit - Order (Picked unit) to Attack _TempUnit
Else - Actions
Else - Actions


for the bolded part, doesn't he have to make it an array/integer...

set TempGroup = all the units that have buff equal to taunt equal to true
For each Interger A from 1 to (Number of Units in (TempGroup)) - Pick every unit in TempGroup and do (Actions)
Loop - Actions
Set _TempUnit(Integer A) = (Picked unit)

something like that???
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> Will a Trigger still finish Running it has been turned off?
> If so, do I Turn the Trigger back on once it is finished running?

Trigger - Turn OFF (This trigger)
Unit - Order ...
Trigger - Turn ON (This trigger)

Turning a trigger off prevents the events from running, nothing else.
It will not stop the current run.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Hmmm.... I am not familiar wif GUI, since I use Jass for 1 year more... Forget about GUI... But, I can made it in Jass wif MUI. GUI doesn't have "FirstOfGroup", which is an important function in most AoE spell.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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