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

[Trigger] Trigger Help

Status
Not open for further replies.
This one:
  • Me Chase
    • Events
      • Time - Every 0.15 seconds of game time
    • Conditions
    • Actions
      • Set P1 = (Position of Oger 0009 <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Target[2] Not equal to Target[1]
        • Then - Actions
          • Set Target[3] = Target[2]
        • Else - Actions
      • Set Target[2] = Target[1]
      • Set TargetRange = 1000000000.00
      • Set G = (Units within 1000000.00 of P1 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to Oger 0009 <gen>))))
      • Unit Group - Pick every unit in G and do (Actions)
        • Loop - Actions
          • Set P2 = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer((Distance between P1 and P2))) Less than (Integer(TargetRange))
            • Then - Actions
              • Set TargetRange = (Distance between P1 and P2)
              • Set Target[1] = (Picked unit)
            • Else - Actions
          • Custom script: call RemoveLocation (udg_P2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Target[1] Not equal to Target[2]
        • Then - Actions
          • Unit - Order Oger 0009 <gen> to Attack Target[1]
          • Sound - Play OgreWarcry1 <gen>
          • Game - Display to (All players) the text: (The oger is chasing + ((Name of (Owner of Target[1])) + !))
        • Else - Actions
      • Custom script: call RemoveLocation (udg_P1)
      • Custom script: call DestroyGroup (udg_G)
^ Sets Target[1] To the nearest unit, And target[2] to be target one. If target 1 and 2 are the same, then the trigger doesnt do anything. If they are NOT the same, it runs the trigger and sets Target[3] to target[2].
Target[1] = Current target, current closest unit.
Target[2] = The closest unit the last time the trigger ran. Can be the same as 1.
Target[3] = The last target, but not the closest target of the last time the trigger ran, so it can't be the same as 1#. Its the last acuall target.

This trigger:
  • Me Smash
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to Oger
    • Actions
      • Set PlayerScore = (Owner of Target[3])
This just sets PlayerScore (A player variable. Its the player that will get the score) to owner of target[3]. What its suppose to do is set playerscore to be a plain old player. Not a owner of a unit, becuase if the units dead, it shows nothing. Its suppose to be, anyways, allthough it is problably not doing it. This is probably whats wrong.

This one:
  • Me Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Killing unit) Equal to Oger
      • (Unit-type of (Dying unit)) Equal to Paladin
    • Actions
      • Game - Display to (All players) the text: (The Oger has |cffff0000Pulverized|r + ((Name of (Owner of (Dying unit))) + 's paladin!))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Dying unit)) Not equal to PlayerScore
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of PlayerScore) + was the last target! He gets credit for making the oger swich to targeting him.)
        • Else - Actions
Should be pretty clear!

Thanks in advance.

The problem? If the last target is dead, it displays a blank string where the last player should be..Might be other bugs too.
 
Last edited:
Level 9
Joined
May 27, 2006
Messages
498
Im not sure if this will solve the problem, but you could disable the Me Smash trigger when there is only one target left. I think, that when the unit dies, this trigger runs and it finds Target[3] variable empty... Or something...
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
The problem is here:
(Owner of (Dying unit)) Not equal to PlayerScore
This will make a lot of units to be the last unit :D
You have to put all of the possible targets in an unit group.
Then in the me kill you should remove the dieing unit from the unit group.
You should check how many units are left in that group.
If it is 1, than display the name of the owner of that unit.
A faster way(better performance) would be if you have a counter, to prevent counting of units in the group.
 
The problem is here:
(Owner of (Dying unit)) Not equal to PlayerScore
This will make a lot of units to be the last unit :D
You have to put all of the possible targets in an unit group.
Then in the me kill you should remove the dieing unit from the unit group.
You should check how many units are left in that group.
If it is 1, than display the name of the owner of that unit.
A faster way(better performance) would be if you have a counter, to prevent counting of units in the group.
Dude. Its a mini game. Theres only 4 units, somtimes a few summons.

Besides, what you said made less then zero sense. It, in NO WAY makes a lot of units be the last unit. It only makes it one. You don't understand the trigger at all, I guess. Thanks for trying to help, though!
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
No, dude.
Think!
(Owner of (Dying unit)) Not equal to PlayerScore (and all the other triggering)
does not make sure there is only one unit left(the only situation it would, would be if you had only 2 units).
 
No, dude.
Think!
(Owner of (Dying unit)) Not equal to PlayerScore (and all the other triggering)
does not make sure there is only one unit left(the only situation it would, would be if you had only 2 units).
..................................................... . . . . ...
(Owner of (Dying unit)) Not equal to PlayerScore just checks to see if its not giving, for a example, player red score for killing himself.


Why in the world does making sure only one unit left matter when my problem is it displays a blank string when giving credit for kills if the last unit is dead? What your saying doesn't really make sense; the varibles CAN'T be set to more then one unit.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Wtf ...
HeretoDLstuff said:
((Name of PlayerScore) + was the last target! He gets credit for making the oger swich to targeting him.)
was the last target!
Do you not want to find which was the last living unit? What I quoted really makes me think you do( I wonder why, maybe because it says "last target").
HeretoDLstuff said:
(Owner of (Dying unit)) Not equal to PlayerScore just checks to see if its not giving, for a example, player red score for killing himself.
You may have wanted it to do so, but it does not.
Say, did you copy that from some map you came across or did you make that yourself?
I am begging to doubt you know what your trigger does. The trigger(s) orders an unit("oger") that I presume should be neutral hostile or some other npcp, to attack the closest enemy unit and orders it to do so repeatedly until there is only one unit left.
There are no player kill scores here, as the kill me trigger is fired only when the "oger" kills a unit, not when a player owned unit kills some other unit.
P.s. Group variables can have more than 1 "thing"/object of their type.
So do arrays, but that is a different story.
 
Level 9
Joined
May 27, 2006
Messages
498
I think i found solution.
The problem is that you made whole me smash trigger in bad way. As far as i understood, it's only task is to set the last player to a variable.
This trigger works:
  • Blah
    • Events
      • Unit - A unit dies
    • Conditions
      • (Unit-type) of (Triggering unit) Equal to [unit]
      • (Number of units in (Units of type [unit])) Equal to 1
    • Actions
      • Set PlayerScore = (Owner of (Triggering unit))
I tested it and it was always displaying the name of last player killed.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
You know, people are not psychid. They cannot guess these things - you should say what you want your triggers to do.
Rather simple:
  • Me Kill
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Killing unit) Equal to Oger
    • (Unit-type of (Dying unit)) Equal to Paladin
  • Actions
    • Game - Display to (All players) the text: (The Oger has |cffff0000Pulverized|r + ((Name of (Owner of (Dying unit))) + 's paladin!))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • PlayerScore Not equal to Player 15
      • Then - Actions
        • Game - Display to (All players) the text: ((Name of PlayerScore) + was the last target! He gets credit for making the oger swich to targeting him.)
      • Else - Actions
    • set PlayerScore to Owner of triggering unit
I am writing this so I have missed a few brackets.
Player 15 is an example, it is just a starting value(you must set it to that before everything begins). It could also be No player.
P.s. the other trigger is useless(the second one in your first post).
 
You know, people are not psychid. They cannot guess these things - you should say what you want your triggers to do.
Rather simple:
  • Me Kill
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Killing unit) Equal to Oger
    • (Unit-type of (Dying unit)) Equal to Paladin
  • Actions
    • Game - Display to (All players) the text: (The Oger has |cffff0000Pulverized|r + ((Name of (Owner of (Dying unit))) + 's paladin!))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • PlayerScore Not equal to Player 15
      • Then - Actions
        • Game - Display to (All players) the text: ((Name of PlayerScore) + was the last target! He gets credit for making the oger swich to targeting him.)
      • Else - Actions
    • set PlayerScore to Owner of triggering unit
I am writing this so I have missed a few brackets.
Player 15 is an example, it is just a starting value(you must set it to that before everything begins). It could also be No player.
P.s. the other trigger is useless(the second one in your first post).
I did explain it:
^ Sets Target[1] To the nearest unit, And target[2] to be target one. If target 1 and 2 are the same, then the trigger doesnt do anything. If they are NOT the same, it runs the trigger and sets Target[3] to target[2].
Target[1] = Current target, current closest unit.
Target[2] = The closest unit the last time the trigger ran. Can be the same as 1.
Target[3] = The last target, but not the closest target of the last time the trigger ran, so it can't be the same as 1#. Its the last acuall
Closest unit = target, last closest unit = last target.
Ect. But if you missunder stood me I can understand that, it is kinda confusing.

And yes, its setting it to nothing. I made it create a unit for that player, and it does not create a unit, I presume that means playerscore = nothing. Still not sure WHY though.
 
Status
Not open for further replies.
Top