1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  7. 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.

[JASS] What to do with triggers?

Discussion in 'Triggers & Scripts' started by Marcelo Hossomi, Feb 18, 2009.

  1. Marcelo Hossomi

    Marcelo Hossomi

    Joined:
    Dec 31, 2005
    Messages:
    710
    Resources:
    3
    Models:
    2
    Spells:
    1
    Resources:
    3
    Hello :p

    I've read around here that destroying triggers or timers is not good.
    So, what do I do with local triggers created when I need a missile to go boom when they hit a unit? Let it leak?

    Thanks already!
    Hossomi
     
  2. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,101
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Try and recycle the triggers as much as possiable. In the end some destruction is going to be needed but try and reduce it to a minimum as destroying triggers can cause a game crash some times. Letting triggers leak is also bad so it is not reccomended to do that as well.

    Timers on the other hand you can destroy pretty safely generally. However if they are preodic they can result in the running of a function an extra time. Try and use eithor a constant timer for a system or else a timer recycle system as both of these eliminate the problem. You can also just destroy the timer but that is up to you.
     
  3. Akolyt0r

    Akolyt0r

    Joined:
    Dec 20, 2008
    Messages:
    53
    Resources:
    3
    Icons:
    3
    Resources:
    3
    you dont need such triggers at all except for damage detection systems...

    just periodically enum units around your projectile ...and if the target is in range .....do your stuff
     
  4. Marcelo Hossomi

    Marcelo Hossomi

    Joined:
    Dec 31, 2005
    Messages:
    710
    Resources:
    3
    Models:
    2
    Spells:
    1
    Resources:
    3
    Isn't that lag friendly?
    I thought about that, but I guessed it was not viable...
     
  5. Akolyt0r

    Akolyt0r

    Joined:
    Dec 20, 2008
    Messages:
    53
    Resources:
    3
    Icons:
    3
    Resources:
    3
    No not really ...depends on the implementation.
    But you should use one system for all your custom projectile spells... something like example xe ...
     
  6. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    I dont have a problem with destroying triggers
    as I cant actually remove an event I have to destroy the trigger
    and Im happy with it ^_^
    you should be too

    And checking units in 10000 range every milisecond wont lag
     
  7. Deaod

    Deaod

    Joined:
    Nov 18, 2007
    Messages:
    805
    Resources:
    12
    Maps:
    1
    Spells:
    11
    Resources:
    12
    Well, you should. Theres a reason why DestroyTrigger() was banned, you know. And unless you can ensure your code doesnt destroy triggers that are still running, you might blow up everything (Note: this only refers to known bugs, there might be other bugs that are not uncovered yet).

    Another thing: if you are using dynamic triggers (triggers, whose data is modified during runtime) for anything else than damage detection, youre doing it wrong.
     
  8. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,101
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Deaod, I have no idea what you mean.
    The actual problem is a handle allocation bug which causes a game crash, however it occurs seldomly as long as you minimise the ammout of trigger destruction.
     
  9. Akolyt0r

    Akolyt0r

    Joined:
    Dec 20, 2008
    Messages:
    53
    Resources:
    3
    Icons:
    3
    Resources:
    3
    It doesnt have to cause a crash, at all ...it could just fuck up some triggers of your map, eventually make some spells malfunction...dependant on the maps code (and luck) it may of course cause a crash.

    But deaod is right, why risk to fuck up your map, when there are better ways to do this, without any risk of causing bugs ?!

    The only thing what you cant achieve without dynamic triggers is damage detection .... unless you have a unit recylcing system ..but such a system would be really unpractical
     
  10. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    you have no idea what you are talking about
    shut up and DO NOT EVER try to teach me something again

    P.S. I Always keep Any Unit Takes Damage system in my maps
    Actually I have my master system with many systems in it and I use it in my ALL maps and never got any problems with it
     
  11. Deaod

    Deaod

    Joined:
    Nov 18, 2007
    Messages:
    805
    Resources:
    12
    Maps:
    1
    Spells:
    11
    Resources:
    12
    @Need_O2: go ask Rising_Dusk about dynamic triggers. I believe he had some ... interesting experiences with them in AotZ.

    You really should learn to listen, perhaps you can learn something new (to you). If youre using dynamic triggers, go ahead. I can't stop you. But i can tell you, that there are almost always ways around dynamic triggers (except for damage detection, e.g.). And destroying triggers does cause bugs, so you should NEVER do it. Leaking a few events is an adequate price for avoiding fatal bugs.

    Btw: Telling me i dont have a clue what im talking about isn't exactly smart, you know. I know for a fact that destroying triggers CAN cause bugs.
     
  12. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    I know to listen to PEOPLE WHO KNOWS SOMETHING
    Im sick of people that doesnt even have a clue of what they are talking about but they try to teach me something

    Yes YOU ARE ABSOLOUTLY RIGHT
    Removing units ? no problem
    Removing Destructables ? no problem
    Removing Weather Effects ? no problem
    etc etc etc...
    Removing Triggers ? OH NOOOO

    So why removing every type of handle in warcraft is fine but triggers
    I dont even care about what Rising_Dusk thinks
    I dont even care about what you say
    None of you made Warcraft III
    none of you have a CONVINCING proof

    Yes sure Fatal bugs
    Which Ive never encountered

    Suggestion: go play your Need for Speed and Fifa and stay out of my business
     
  13. Deaod

    Deaod

    Joined:
    Nov 18, 2007
    Messages:
    805
    Resources:
    12
    Maps:
    1
    Spells:
    11
    Resources:
    12
    You forgot about timers and groups.

    I suggest you try to search for those bugs, before you say they dont exist. They do exist.
     
  14. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    I forgot timers and groups ? OMG
    rect, region, camerasetup, fogmodifier, quest, gamecache, dialog, boolexpr, filterfunc, location, item and more I cant remember
    and "etc etc etc..." was for other handles

    Can someone tell this guy to stay out of my business please ?

    Edit: Why do I even care...
     
  15. Deaod

    Deaod

    Joined:
    Nov 18, 2007
    Messages:
    805
    Resources:
    12
    Maps:
    1
    Spells:
    11
    Resources:
    12
    bah, you have no idea.

    Wc3campaigns - View Single Post - Known bugs in JASS

    Maybe i didnt express myself correctly:

    Destroying timers and groups also can cause bugs (in the case of timers) or leaks (in the case of groups).

    Edit:
    @Need_O2: If you still haven't followed that link, do it. You asked for evidence, and there it is. You tell me i have no idea and when i give proof for my claims, you say you dont care in the first place, ignoring my proof. Well, youre fucking with your map, and not mine. I dont care. But dont tell me i have no idea.
     
  16. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    so it says
    If you destroy a trigger inside it while it has remaining actions and wait(0) 2 times (one after another) and create 2 groups at same time those groups will be same...
    what a bug....

    I was expecting something like if you create/destroy a trigger 100000 times in a game, game will crush
    or destroying a trigger causes some quests to change their texts
    or destroying too many triggers causes a random unit to lose life
    or destroying soo many triggers kicks someone from game

    Simply go away please
     
  17. Akolyt0r

    Akolyt0r

    Joined:
    Dec 20, 2008
    Messages:
    53
    Resources:
    3
    Icons:
    3
    Resources:
    3
    you are a pretty dumb ignorant Need_O2 really ...think about what this bug may cause ...

    Its not only for groups, the bug will happen for ALL Handles ...it might even mix them up ..and maybe some timer you create becomes a unit handle instead ...no tell me that wouldnt fuck up your map (also there are THOUSANDS other possible bugs that might happen).

    And it doesnt have to have those waits in it .... thats only the easiest way to make this bug happen on purpose.
     
  18. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    I do not require to destroy my trigger inside it while its running and wait(0) 2 times (one after another)

    You know what is buggy here ?
    its TriggerSleepAction

    JUST TELL ME SOMETHING THAT ONLY BE CAUSED BY DestroyTrigger()
    no "The most buggy and unaccureate function" TriggerSleepAction inside it
    and nothing else
    Just a bug by DestroyTrigger()

    if you cant shut up

    Edit: No answers ? Thought so
     
  19. Deaod

    Deaod

    Joined:
    Nov 18, 2007
    Messages:
    805
    Resources:
    12
    Maps:
    1
    Spells:
    11
    Resources:
    12
    No, they wont be the same. Their ID will be the same, but the actual objects are distinct from each other.

     
  20. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    None of these things show that DestroyTrigger bugs

    I knew TriggerSleepAction is buggy already...
    so what Ive learned ?
    Using it 2 times is buggy too ^_^

    I assume you wont show me a bug of it without another buggy functions such as TSA
    cya in another thread

    BTW: if you were joking whole time its not april yet :/