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

[Trigger] Am I cleaning this up right?

Status
Not open for further replies.
Level 15
Joined
Sep 3, 2006
Messages
1,738
Like the title says, am I cleaning this leak right? If not, can someone tell me the proper way?

  • Double Kill Activate
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) is in TempGroup2) Equal to False
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
      • ((Dying unit) is A Hero) Equal to True
      • (Player number of (Owner of (Killing unit))) Greater than 0
      • (Player number of (Owner of (Killing unit))) Less than or equal to 12
    • Actions
      • Set TempGroup = (All players matching ((Owner of (Killing unit)) Equal to (Matching player)))
      • Wait 0.00 seconds
      • Trigger - Turn on Double Kill <gen>
      • Trigger - Turn off (This trigger)
      • Wait 16.00 seconds
      • Trigger - Turn on (This trigger)
  • Double Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) is in TempGroup2) Equal to False
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
      • ((Owner of (Killing unit)) is in TempGroup) Equal to True
      • ((Dying unit) is A Hero) Equal to True
      • (Player number of (Owner of (Killing unit))) Greater than 0
      • (Player number of (Owner of (Killing unit))) Less than or equal to 12
    • Actions
      • Trigger - Turn off (This trigger)
      • Sound - Play Double_Kill <gen>
      • Player - Add 200 to (Owner of (Killing unit)) Current gold
      • Quest - Display to Players the Hint message: ((|c00FF0000Double Kill! - + PlayerNames[(Player number of (Owner of (Dying unit)))]) + ( has been killed by + (PlayerNames[(Player number of (Owner of (Killing unit)))] + for an additional 200 Gold.)))
      • Set TempGroup2 = (All players matching ((Owner of (Killing unit)) Equal to (Matching player)))
      • Player Group - Remove (Owner of (Killing unit)) from TempGroup
      • Custom script: call DestroyForce(udg_TempGroup)
  • Triple Kill Activate
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) is in TempGroup) Equal to False
      • ((Owner of (Killing unit)) is in TempGroup2) Equal to True
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
      • ((Dying unit) is A Hero) Equal to True
      • (Player number of (Owner of (Killing unit))) Greater than 0
      • (Player number of (Owner of (Killing unit))) Less than or equal to 12
    • Actions
      • Trigger - Turn on Triple Kill <gen>
      • Trigger - Turn off (This trigger)
      • Wait 14.00 seconds
      • Trigger - Turn on (This trigger)
  • Triple Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
      • ((Owner of (Killing unit)) is in TempGroup2) Equal to True
      • ((Dying unit) is A Hero) Equal to True
      • (Player number of (Owner of (Killing unit))) Greater than 0
      • (Player number of (Owner of (Killing unit))) Less than or equal to 12
    • Actions
      • Trigger - Turn off (This trigger)
      • Sound - Play Triple_Kill <gen>
      • Player - Add 200 to (Owner of (Killing unit)) Current gold
      • Quest - Display to Players the Hint message: ((|c00FF0000Triple Kill! - + PlayerNames[(Player number of (Owner of (Dying unit)))]) + ( has been killed by + (PlayerNames[(Player number of (Owner of (Killing unit)))] + for an additional 200 Gold.)))
      • Wait 0.00 seconds
      • Set TempGroup3 = (All players matching ((Owner of (Killing unit)) Equal to (Matching player)))
      • Player Group - Remove (Owner of (Killing unit)) from TempGroup2
      • Custom script: call DestroyForce(udg_TempGroup2)
  • Monster Kill Activate
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) is in TempGroup) Equal to False
      • ((Owner of (Killing unit)) is in TempGroup2) Equal to False
      • ((Owner of (Killing unit)) is in TempGroup3) Equal to True
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
      • ((Dying unit) is A Hero) Equal to True
      • (Player number of (Owner of (Killing unit))) Greater than 0
      • (Player number of (Owner of (Killing unit))) Less than or equal to 12
    • Actions
      • Trigger - Turn on Monster Kill <gen>
      • Trigger - Turn off (This trigger)
      • Wait 12.00 seconds
      • Trigger - Turn on (This trigger)
  • Monster Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
      • ((Owner of (Killing unit)) is in TempGroup3) Equal to True
      • ((Owner of (Killing unit)) is in TempGroup2) Equal to False
      • ((Owner of (Killing unit)) is in TempGroup) Equal to False
      • ((Dying unit) is A Hero) Equal to True
      • (Player number of (Owner of (Killing unit))) Greater than 0
      • (Player number of (Owner of (Killing unit))) Less than or equal to 12
    • Actions
      • Trigger - Turn off (This trigger)
      • Sound - Play Monster_Kill <gen>
      • Player - Add 200 to (Owner of (Killing unit)) Current gold
      • Quest - Display to Players the Hint message: ((|c00FF0000Monster Kill! - + PlayerNames[(Player number of (Owner of (Dying unit)))]) + ( has been killed by + (PlayerNames[(Player number of (Owner of (Killing unit)))] + for an additional 200 Gold.)))
      • Set TempGroup4 = (All players matching ((Owner of (Killing unit)) Equal to (Matching player)))
      • Player Group - Remove (Owner of (Killing unit)) from TempGroup3
      • Custom script: call DestroyForce(udg_TempGroup3)
  • Holy Shit Activate
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) is in TempGroup) Equal to False
      • ((Owner of (Killing unit)) is in TempGroup2) Equal to False
      • ((Owner of (Killing unit)) is in TempGroup3) Equal to False
      • ((Owner of (Killing unit)) is in TempGroup4) Equal to True
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
      • ((Dying unit) is A Hero) Equal to True
      • (Player number of (Owner of (Killing unit))) Greater than 0
      • (Player number of (Owner of (Killing unit))) Less than or equal to 12
    • Actions
      • Wait 0.00 seconds
      • Trigger - Turn on Holy Shit <gen>
      • Trigger - Turn off (This trigger)
      • Wait 10.00 seconds
      • Trigger - Turn on (This trigger)
  • Holy Shit
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
      • ((Owner of (Killing unit)) is in TempGroup4) Equal to True
      • ((Owner of (Killing unit)) is in TempGroup3) Equal to False
      • ((Owner of (Killing unit)) is in TempGroup3) Equal to False
      • ((Owner of (Killing unit)) is in TempGroup2) Equal to False
      • ((Owner of (Killing unit)) is in TempGroup) Equal to False
      • ((Dying unit) is A Hero) Equal to True
      • (Player number of (Owner of (Killing unit))) Greater than 0
      • (Player number of (Owner of (Killing unit))) Less than or equal to 12
    • Actions
      • Trigger - Turn off (This trigger)
      • Sound - Play Holy_Shit <gen>
      • Player - Add 200 to (Owner of (Killing unit)) Current gold
      • Quest - Display to Players the Hint message: ((|c00000000Holy Shit! - + PlayerNames[(Player number of (Owner of (Dying unit)))]) + ( has been killed by + (PlayerNames[(Player number of (Owner of (Killing unit)))] + for an additional 200 Gold.)))
      • Player Group - Remove (Owner of (Killing unit)) from TempGroup4
      • Custom script: call DestroyForce(udg_TempGroup4)
I'd also like to say this: They work the way they are. But my question is: Am I cleaning this up right?
 
Last edited:
Level 21
Joined
Aug 21, 2005
Messages
3,699
I do not understand why you're using a force... There can only be ONE player that is the owner of killing unit, right? So you simply use a player variable instead of a force, which doesn't need to be destroyed anyway. Then ofcourse you'll still have to make a force to be able to display a text message to a playerforce, but then I suggest you use the custom script DisplayTextToPlayer()...

Anyway, I think you better put the "call DestroyForce" BEFORE the 10 seconds wait. And I think it'll still leak if the trigger runs multiple times.
 
Level 15
Joined
Sep 3, 2006
Messages
1,738
Actually, I was tooling around with it last night to add on extra streaks (Triple Kill, Monster Kill, Holy Shit) and I found a way that works. I also removed the Waits from each trigger (except for the activation trigger).

Also, I use Player Groups because if a player does get the kill, he's added to the Player Group. That way as long as you're in a single Group you can get the single bonus.
 
Level 16
Joined
Feb 22, 2006
Messages
960
holy shit, this is much to complicated :O
try to make it like this:
event - a unit dies
conditions - dying unit is a hero equal to true
actions
set owner = playernumber(owner of killing unit)
set spree[owner] = spree[owner] + 1
if
spree[owner] equal to 3
then
play sound killing spree
.
.
.
.
and so on for every other "spree" too
 
Status
Not open for further replies.
Top