Trigger Clean Up

irgan

New Member
Is there anything i should do to clean this trigger up and make it smoother?
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Bide
    • Actions
      • Set BideHealthStart = (Life of (Triggering unit))
      • Unit - Set (Triggering unit) movement speed to 0.00
      • Unit - Order (Triggering unit) to Special - Channel
      • Wait 10.00 seconds
      • Set BideHealthEnd = (Life of (Triggering unit))
      • Unit - Order (Triggering unit) to Neutral Pit Lord - Howl Of Terror
      • Special Effect - Create a special effect attached to the feet of (Triggering unit) using Units\NightElf\Wisp\WispExplode.mdl
      • Unit Group - Pick every unit in (Units within 700.00 of (Position of (Triggering unit)) matching (((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect attached to the body of (Picked unit) using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing ((BideHealthStart - BideHealthEnd) x 5.00) damage of attack type Chaos and damage type Normal
      • Unit - Set (Triggering unit) movement speed to (Default movement speed of (Triggering unit))


If you need to know what its supposed to do the name of the ability should give it away. You take damage over a set amount of time then if you don't die, you return the damage and then some more.
 

Accname

2D-Graphics enthusiast
First of all your trigger leaks heavily. Points and unitgroups and special effects.
If you dont know what a memory leak is, search for it and remove them properly.

Next thing is, this trigger will bug, imagine the caster is getting killed / cancels the channel / is stunned before the wait is finished. The effects will still take place.
Better split it up into 2 separate triggers, one trigger to set things up when he starts channeling and one trigger when he successfully finishes channeling.

Another thing to note is that this trigger is not MUI nor MPI, dont even try to make 2 units cast this spell at the same time. It will not work.
 

irgan

New Member
Yeah i know what memory leaks are. I'll do all the custom scripts to remove those later (copy paste :D)

And alright, 2 triggers would be a better idea, didnt think about that thanks.

And 2 units WONT be casting it at the same time xD so i think it's fine
 

NBalfa

New Member
your trigger leaks greatly first of all you should make 2 triggers
secondly the damage to the hero should be dealt trough the trigger
finally the best way to deal with this trigger is with hashtables if you don't know about how to use hashtables then have a quick search on the hive workshop. there is a good tutorial about hashtables, check it out and after finishing with this trigger of yours you wont imagine how easily you will be able to handle with hashtables
 

Accname

2D-Graphics enthusiast
your trigger leaks greatly first of all you should make 2 triggers
secondly the damage to the hero should be dealt trough the trigger
finally the best way to deal with this trigger is with hashtables if you don't know about how to use hashtables then have a quick search on the hive workshop. there is a good tutorial about hashtables, check it out and after finishing with this trigger of yours you wont imagine how easily you will be able to handle with hashtables
why would anybody need hashtables for this?
 

ultimate11

Active Member
It`s hand written i hope it help you a little more



Trigger:
  • Map init
    • Events
    • Map initializations
    • Conditions
    • Actions
    • Hastable - create a hashtable
    • Set - Hashtable = last created hashtable



Trigger:
  • Untitled Trigger 001
    • Events
    • Unit - A unit Begins channeling an ability
    • Conditions
    • (Ability being cast) Equal to Bide
    • Actions
    • Set Caster = triggering unit
    • Set Temp_point = ((Position of (Caster))
    • Set Check = Load 1 of 1 ((Key(triggering unit)) from Hashtable
    • If then Else
      • If Conditions
        • Check = 0
        • Then Actions
          • Hashtable Save 1 as 1 of ((key(triggering unit)) in Hashtable
          • Trigger - Add (triggering unit take damage) new event to trigger (Damage)
          • Set Speed = Base movement speed of (Caster)
          • Hashtable Save Speed as 2 of ((key(triggering unit)) in Hashtable
          • Unit - Set (Caster) movement speed to 0.00
    • Unit - Order (Caster) to Special - Channel
    • Wait 10.00 seconds
    • Unit - Order (Caster) to Neutral Pit Lord - Howl Of Terror
    • Special Effect - Create a special effect attached to the feet of (Caster) using Units\NightElf\Wisp\WispExplode.mdl
    • Special Effect = Destroy Last created special effect
    • Set Spell_group = (Units within 700.00 of (Temp_point) matching (((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
    • Unit Group - Pick every unit in Spell_group) and do (Actions)
    • Loop - Actions
    • Special Effect - Create a special effect attached to the body of (Picked unit) using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
    • special Effect - Destroy las created special effect
    • Unit - Cause (Caster) to damage (Picked unit), dealing ((Load 3 of ((key(triggering unit) from my hashtable) x 5.00) damage of attack type Chaos and damage type Normal
    • Unit - Set (Caster) movement speed to (Load 2 of ((key(triggerin unit) from Hashtable)
    • Hashtable Clear all child hastble of ((key(triggering unit))
    • Custom Script - call RemoveLocation (udg_Temp_point)
    • Custom Script - call DestroyGroup (udg_Spell_group)
    • Else
      • Hastable Save 0 as 3 of ((key(triggering unit)) in Hashtable
    • Set Speed = Base movement speed of (Caster)
      • Hashtable Save Speed as 2 of ((key(triggering unit)) in Hashtable
      • Unit - Set (Caster) movement speed to 0.00
    • Unit - Order (Caster) to Special - Channel
    • Wait 10.00 seconds
    • Unit - Order (Caster) to Neutral Pit Lord - Howl Of Terror
    • Special Effect - Create a special effect attached to the feet of (Caster) using Units\NightElf\Wisp\WispExplode.mdl
    • Special Effect = Destroy Last created special effect
    • Set Spell_group = (Units within 700.00 of (Position of (Triggering unit)) matching (((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
    • Unit Group - Pick every unit in Spell_group) and do (Actions)
    • Loop - Actions
    • Special Effect - Create a special effect attached to the body of (Picked unit) using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
    • special Effect - Destroy las created special effect
    • Unit - Cause (Caster) to damage (Picked unit), dealing ((Load 3 of ((key(triggering unit) from my hashtable) x 5.00) damage of attack type Chaos and damage type Normal
    • Unit - Set (Caster) movement speed to (Load 2 of ((key(triggerin unit) from Hashtable)
    • Hashtable Clear all child hastble of ((key(triggering unit))
    • Custom Script - call RemoveLocation (udg_Temp_point)
    • Custom Script - call DestroyGroup (udg_Spell_group)


Trigger:
  • Damage
    • Event
    • Conditions
    • Actions
    • Set check = Load 1 of ((key(triggering unit))
    • If Then Else
      • If Conditions
        • Check = 1
      • Actions
        • Hashtable Save (Load 3 of ((key(triggering unit) from myHashtable) + (Damage Taken)) of (key(triggering unit))
 

Smitty

Member
That trigger won't work. Unless temp_point isn't used in any other trigger. Also you're leaking at least one unit group.
 

ultimate11

Active Member
Smitty dude read again Temp_point isn`t useless,if u dont know dont talk and I garantee you that the trigger work .
Is not look as It should be becouse is hand written.
So next time take your time to read and then post

The trigger contain only 1 unit group that is destroyed isn`t leaking in unit group.
I told you if you dont know dont replay !!!!

Set Spell_group = (Units within 700.00 of (Temp_point) matching (((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))

Custom Script - call DestroyGroup (udg_Spell_group)
 

Accname

2D-Graphics enthusiast
@ultimate:
Those triggers are terrible as well. Its not MUI, its leaking, and its even worse as the original trigger in the first post.

here is a demo map. Check it out and see how easy this spell is:
http://www.2shared.com/file/osB0ax3V/ZBide.html

Here are the triggers:
Trigger:
  • Spell Bide Start
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to#Normal Bide
    • Actions
      • Set Spell_Bide_CasterInitHP = (Life of (Triggering unit))


Trigger:
  • Spell Bide End
    • Events
      • Unit - A unit ends casting an ability
    • Conditions
      • (Ability being cast) Equal to #Normal Bide
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Set Temp_Group = (Units within 512.00 of Temp_Point matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is a building) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Spell_Bide_CasterInitHP - (Life of (Triggering unit))) damage of attack type Normal and damage type Normal
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Custom script: call DestroyGroup (udg_Temp_Group)
 

ultimate11

Active Member
Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Spell_Bide_CasterInitHP - (Life of (Triggering unit))) damage of attack type Normal and damage type Normal
Accame this not represent the damage that has taken in that specific interval of time.
Maybe that unit in the 10 seconds can restore back his life (for ex. using potions etc) so think again man (no offense)
Second can you shoow me the line that is leaking please in my trigger ...i`m so damn currious !
 

Smitty

Member
Smitty dude read again Temp_point isn`t useless,if u dont know dont talk and I garantee you that the trigger work .
Is not look as It should be becouse is hand written.
So next time take your time to read and then post
So the variable temp_point isn't a local variable? Then why not give it a name? Usually variables with names like temp_point are locals used in multiple triggers. Your trigger is confusing in that regard at least. In this issue, leaks aside, your triggers need revision. Maybe you should read through again before you assume I'm wrong :)
 

ultimate11

Active Member
I had used Temp_point over and over in my map and I have 225 trigger most of them skill in hashtable with verry fast periodic event and I never saw a bit of frame even in full house so teoreticlly may be like you say, practiclly is like me.If that variable should be a leak then i supposed to see memory leak or skills that have mallfunction or create lag.None of them happened ever.
 

Accname

2D-Graphics enthusiast
Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Spell_Bide_CasterInitHP - (Life of (Triggering unit))) damage of attack type Normal and damage type Normal
Accame this not represent the damage that has taken in that specific interval of time.
Maybe that unit in the 10 seconds can restore back his life (for ex. using potions etc) so think again man (no offense)
Second can you shoow me the line that is leaking please in my trigger ...i`m so damn currious !
I copied the trigger in the first post, if you look at it, he does it the same way.
 

ultimate11

Active Member
yea he does it in same way but is wrong and isn`t represent the real amount of damage taken.
whatever i dont care how will do it,i will not replay any,ore
 

Accname

2D-Graphics enthusiast
yea he does it in same way but is wrong and isn`t represent the real amount of damage taken.
whatever i dont care how will do it,i will not replay any,ore
maybe thats the effect he wants to have? who are you to know whether what he likes is right or wrong?
I personally like this version more, it give the spell a little twist. Because you dont want to get healed while you channel this spell, it would decrease the effectivity. but you dont want to die either. its much more interesting and balanced this way.
 

irgan

New Member
oh jesus, there was like a small battle going on in my post o.o thanks for all your help guys, but i had already created/cleaned up my own trigger and it turned out to be pretty close to accname's :p i'll pretend i got it from him and give him the rep

The only thing wrong with accname's triggers is that he didnt account really for any of my special effects.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • tom_mai78101 tom_mai78101:
    Labor Day vacation is the best.
    +1
  • tom_mai78101 tom_mai78101:
    Make sure you keep checking out my news..
    +2
  • Jesus4Lyf Jesus4Lyf:
    Man, I made this account 15 years ago? Wild. :)
  • Ghan Ghan:
    Seeing J4L is definitely a blast from the past.
  • Jesus4Lyf Jesus4Lyf:
    Oh hey Ghan! Long time. :)
    +1
  • jonas jonas:
    J4L! What has happened in your life
  • Jesus4Lyf Jesus4Lyf:
    Hmm, how to summarize... Moved to the USA and got married. Became a professional software engineer and solution lead. Learning Godot for game dev. :)
  • jonas jonas:
    So you are pursuing game dev as a hobby? What industry is your dayjob in?
  • jonas jonas:
    FAANG?
  • Jesus4Lyf Jesus4Lyf:
    Not quite FAANG, less pay for a less hours/stress. Yeah, game dev as a hobby.
  • jonas jonas:
    makes sense. Do we have a hobby game dev subforum to showcase some work?
  • Blackveiled Blackveiled:
    Happy Thursday
    +1
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    TGIF!
  • The Helper The Helper:
    hey tom_mai please do not archive anymore news
  • Ghan Ghan:
    AMD Ryzen 7000 next week :D
    +1
  • The Helper The Helper:
    noice!
  • tom_mai78101 tom_mai78101:
    "hey tom_mai please do not archive anymore news" ----> Got it. What should we do with the "News Archive" subforum?
  • The Helper The Helper:
    I think leave it for real old news that cannot be sorted the reason we had it in the first place was a server issue that we do not have anymore. I don't want to get rid of the archive just not put anything in it for now until we figure it out more
  • The Helper The Helper:
    The side chat has nothing on the discord. it is not possible but the biggest thing on my wish list right now is a sidechat channel on the disord that hooks up to this...
  • Ghan Ghan:
    I've been selected for the Diablo IV beta.
    +1
  • Ghan Ghan:
    Woo!
    +1
  • The Helper The Helper:
    that is so cool
  • V-SNES V-SNES:
    Eh just noticed the new discord section on the side. Looks great!

    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