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

Why doesn't this condition work

Status
Not open for further replies.
Level 31
Joined
Jul 7, 2008
Messages
4,185
  • Whispering fingers repeat
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Finger of Death (Whispering Obelisk)
    • Actions
      • Wait 60.00 seconds
      • Set AllPlayers = (All players)
      • Set WhisperingObelisks = (Units of type Whispering Obelisk)
      • Player Group - Pick every player in AllPlayers and do (Actions)
        • Loop - Actions
          • Set obeliskvictims = (Random unit from (Units owned by (Picked player)))
          • Unit Group - Pick every unit in WhisperingObelisks and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of obeliskvictims) Not equal to Peon
                  • (Unit-type of obeliskvictims) Not equal to Mason
                  • (Unit-type of obeliskvictims) Not equal to Gan'arg Engineer
                  • (Unit-type of obeliskvictims) Not equal to Peasant
                  • (Unit-type of obeliskvictims) Not equal to Acolyte
                  • (Unit-type of obeliskvictims) Not equal to Wisp
                  • (Unit-type of obeliskvictims) Not equal to Mur'gul Slave
                  • (Unit-type of obeliskvictims) Not equal to Peon
                  • (Unit-type of obeliskvictims) Not equal to Draenei Laborer
                  • (Unit-type of obeliskvictims) Not equal to Gatherer
                  • (Unit-type of obeliskvictims) Not equal to Laborer
                  • (Unit-type of obeliskvictims) Not equal to Ley Weaver
                • Then - Actions
                  • Unit - Order (Picked unit) to Special Archimonde - Finger Of Death obeliskvictims
                • Else - Actions
                  • Do nothing
      • Custom script: call DestroyGroup (udg_WhisperingObelisks)
it still targets workers
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
1.
Set victim = Random unit

if victim is not a worker then
order every obelisk to use finger of death to the victim
if victim is a worker then do nothing

Imagine that random unit is a worker, then noone will be targeted.


2.
Use boolean comparison and check if the victim is of a unit classification of worker.


3.
Wait 60 seconds -> Wait 60 seconds of game-time


4.
Set WhisperingObelisks = (Units of type Whispering Obelisk)
That leaks... just a stupid native function.
Instead pick every unit and use a matching condition to filter the obelisks.


5.
Do nothing -> -------- do nothing --------
Do nothing is actually doing something. And that something is actually nothing.
Anyway it is eating your performance (a little) and has no effect so should never be used.
You can leave it empty or make a comment if you want to display some clarification.


6.
AllPlayers -> (All Players)
AllPlayers does not have to be in a variable because it is only used once and does not have to be destroyed afterwards (Player groups (force) must be destroyed if it is something else than (All Players))


7.
Set the victim to a random unit from units owned by player with a condition that is mentioned in point 2.



After that, the obelisks will only target a unit that is owned by the last player in the player group.
Also they will target allies too.
If player 1 has a unit and player 2 has a unit, the unit of player 1 is never a victim.
I don't know what the trigger is supposed to do but one thing is sure... it is not doing it.
 
Status
Not open for further replies.
Top