1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] Trigger Help

Discussion in 'Triggers & Scripts' started by HeretoDLstuff, Jun 29, 2008.

  1. HeretoDLstuff

    HeretoDLstuff

    Joined:
    Feb 27, 2007
    Messages:
    2,093
    Resources:
    4
    Models:
    3
    Maps:
    1
    Resources:
    4
    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: Jun 29, 2008
  2. raft_pl

    raft_pl

    Joined:
    May 27, 2006
    Messages:
    496
    Resources:
    1
    Maps:
    1
    Resources:
    1
    [trigger][/trigger] tags plax
     
  3. HeretoDLstuff

    HeretoDLstuff

    Joined:
    Feb 27, 2007
    Messages:
    2,093
    Resources:
    4
    Models:
    3
    Maps:
    1
    Resources:
    4
    Sorry, was use to a site that didn't have 'em! :D
     
  4. raft_pl

    raft_pl

    Joined:
    May 27, 2006
    Messages:
    496
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I have no idea what could be wrong, but if the trigger doesnt display the PlayerScore's name, it means that no one is the PlayerScore...
     
  5. HeretoDLstuff

    HeretoDLstuff

    Joined:
    Feb 27, 2007
    Messages:
    2,093
    Resources:
    4
    Models:
    3
    Maps:
    1
    Resources:
    4
    Ah, but when the last target is alive, it seems work..
     
  6. raft_pl

    raft_pl

    Joined:
    May 27, 2006
    Messages:
    496
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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...
     
  7. Huurka

    Huurka

    Joined:
    May 6, 2008
    Messages:
    1,607
    Resources:
    0
    Resources:
    0
    Oh, it's spelt Ogre not oger.
     
  8. HeretoDLstuff

    HeretoDLstuff

    Joined:
    Feb 27, 2007
    Messages:
    2,093
    Resources:
    4
    Models:
    3
    Maps:
    1
    Resources:
    4
    Thanks. I still need help with the trigger, though.

    raft_pl: Possibly, that wont fix the problem though, as it happends before all but the last unit is dead.
     
  9. raft_pl

    raft_pl

    Joined:
    May 27, 2006
    Messages:
    496
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I dont know what could be wrong, really... Try luring Poot down here, maybe he'll know how to fix this trigger :p
     
  10. HeretoDLstuff

    HeretoDLstuff

    Joined:
    Feb 27, 2007
    Messages:
    2,093
    Resources:
    4
    Models:
    3
    Maps:
    1
    Resources:
    4
    I'll start baking cookies now.
     
  11. Huurka

    Huurka

    Joined:
    May 6, 2008
    Messages:
    1,607
    Resources:
    0
    Resources:
    0
    Poot is in spain.
     
  12. HeretoDLstuff

    HeretoDLstuff

    Joined:
    Feb 27, 2007
    Messages:
    2,093
    Resources:
    4
    Models:
    3
    Maps:
    1
    Resources:
    4
    Eh. I'll have to ship the cookies, and then they would get stale..


    Blargh, I hope this gets fixed soon, Its for my map in the hives mingame contest!!
     
  13. spiwn

    spiwn

    Joined:
    Apr 27, 2008
    Messages:
    1,228
    Resources:
    0
    Resources:
    0
    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.
     
  14. HeretoDLstuff

    HeretoDLstuff

    Joined:
    Feb 27, 2007
    Messages:
    2,093
    Resources:
    4
    Models:
    3
    Maps:
    1
    Resources:
    4
    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!
     
  15. spiwn

    spiwn

    Joined:
    Apr 27, 2008
    Messages:
    1,228
    Resources:
    0
    Resources:
    0
    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).
     
  16. HeretoDLstuff

    HeretoDLstuff

    Joined:
    Feb 27, 2007
    Messages:
    2,093
    Resources:
    4
    Models:
    3
    Maps:
    1
    Resources:
    4
    ..................................................... . . . . ...
    (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.
     
  17. spiwn

    spiwn

    Joined:
    Apr 27, 2008
    Messages:
    1,228
    Resources:
    0
    Resources:
    0
    Wtf ...
    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").
    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.
     
  18. raft_pl

    raft_pl

    Joined:
    May 27, 2006
    Messages:
    496
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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.
     
  19. HeretoDLstuff

    HeretoDLstuff

    Joined:
    Feb 27, 2007
    Messages:
    2,093
    Resources:
    4
    Models:
    3
    Maps:
    1
    Resources:
    4
    NO! I want to find the last unit the ogre was targeting before the one he just killed!! NOT THE LAST LIVING UNIT.
     
  20. raft_pl

    raft_pl

    Joined:
    May 27, 2006
    Messages:
    496
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Umm, like ogre kills first red, then blue, teal and purple, and you want the trigger to display teals name, not purples?