• 🏆 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] Discussion "Trigger - Add to (This trigger) the event"

Status
Not open for further replies.
Level 9
Joined
May 30, 2008
Messages
430
Read the text in green before you proceed

1. Please don't spam in this thread things about hashtables because i don't like them.
2. Please don't tell do it in JASS it's a lot more easy because i am not asking for it and i don't care about JASS.
3. I know that i can test it out my self but let's first make the theory part i will do the practice later if the theory is good enough



Because we all know very good the problems related to Recylcing, Indexing and a lot of Movement Systems made in GUI are very hard to do and it may bug i was wondering few things.
For example we have this trigger:
  • Trigger - Add to Empty Event Trigger <gen> the event (Unit - StoredInVariableUnit[VariableCount]'s mana becomes Greater than 200)
Basically this trigger is firing an actions when the unit's "StoredInVariableUnit[VariableCount]" mana became more than 200. But as you know every new unit that enter the map must be stored in this very same trigger so after a time the trigger may get kinda full with Events and i don't think this is good (prove me wrong if i am). Damage Detection systems in guy have the very same problem.
So the question:
If i make system that is detecting the free slots (dead units) among the variable "StoredInVariableUnit[VariableCount]" will the new stored unit in this index replace the unit stored with
  • Trigger - Add to Empty Event Trigger <gen> the event (Unit - StoredInVariableUnit[VariableCount]'s mana becomes Greater than 200)
or the trigger will refer to the dead unit.
Basically i am asking if the Event's stored with Variables respond to the Variable or to the unit stored inside the Variable.
Hope you guys get the things i am trying to ask you if not ask me to explain again
 
Level 13
Joined
Mar 24, 2010
Messages
950
its to the unit stored inside the var, once its placed in that trigger that var will be replaced again the sec another unit is stored to it later on.

In that new trigger "with all those unit event dealing with mana" you'll then use triggering unit to refer to the units in that trigger.
 
Level 12
Joined
Jul 11, 2010
Messages
422
Once you have added the event, you can't clear it if you don't destroy the trigger. Since you can't use dynamic triggers in GUI, you're traped :at:.
And the unit for which you have registered the event is unalterable : it is not linked to the variable or anything else. GUI just has limits and what you want to do is behind them.

However, that's not like if you leaked tones of memory (it's mainly a leak problem : you still use some memory to register an event with a dead unit). You probably don't create enough units for it to be a real problem. Besides, events are maybe automatically cleared when a unit is removed from the game (I don't think so but I never tested).

PS. : it's a kind of recurrent question, you should use the search tool...
 
Level 9
Joined
May 30, 2008
Messages
430
So the game is refering to the unit not to the variable. This mean if i store new unit in same variable when the first one is dead the trigger won't work for the new unit. Well this sux. If there aren't any other opinions i will test it in game tommorow. Thanks for the opinions guys
 
Level 13
Joined
Mar 24, 2010
Messages
950
lol they werent opinions what i said is truth.

the trigger will work for the new units as long as you also add that units event to the trigger via that variable. If you want that units to stay in that variable even after death until the bodies gone then dont reuse that same variable again, use an array or something if thats what your doing.
 
Level 9
Joined
May 30, 2008
Messages
430
Dude do i look like tetard to you:vw_wtf: Read the topic and tell me what is not clear or stop spaming shits. I am not asking how this is working i am asking if it's working. And you don't seem familiar with this sort of things at all so thank you but i don't need your help. But i will be gentleman and will say it once more for ya.
If i Store a unit into a variable and add this variable to the even't of a trigger using the Add event to trigger line in GUI, and the stored unit die then i store new unit under this variable without adding it to the trigger, will the trigger work for the new unit the way it worker for the old one. But whatever i will have to test it out my self:vw_unimpressed:
AND BEFORE YOU TYPE SOME MORE BULLSHITS READ THIS DEFINITION ABOUT THE MEANING OF THIS THREAD. I AM NOT ASKING FOR ANYTHING AT ALL TO BE CREATED
 
Level 13
Joined
Mar 24, 2010
Messages
950
Oh ok yeah i already answered this for you the first time. you just felt the need to keep rewording the question for no reason.

lmao and i know i was aware nothing here needed to be created was just answering you.

and heres your answer again:

if you add a unit event to that trigger via a variable with a unit stored in it and its dead, that event is still there but it will never trigger again becuz the units dead obviously.

and NO the trigger will not work if you store another unit under that same variable without adding it to the trigger.
you can not have a unit variable as a event only the unit itself. when you "added that unit event to that trigger via that variable it just added that unit it did nothing at all with that variable.

Your welcome..
 
Don't get so angry. Bond009 is just trying to help. And he's right. You have to re-add another event for a stored unit. You can add a condition like 'Unit is Alive = True' or something, or you can destroy the trigger using 'call DestroyTrigger(GetTriggeringTrigger)' to clear the events.

EDIT: You can use this.
  • Empty Event Trigger
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • -------- All you gotta do is set the Unit variables and this trigger will automatically check for you --------
      • For each (Integer A) from 1 to MaxVariableCount, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of StoredInVariableUnit[(Integer A)]) Greater than 200.00
            • Then - Actions
              • -------- Your actions --------
            • Else - Actions
 
Level 9
Joined
May 30, 2008
Messages
430
Well i am geting pissed of from people all over the forums typing not related to the thread subject things. I know what else can i use but the point of map making is to make a map trigger optimized as much as possible when they are maded in GUI. I know i can destroy a trigger but the problem is i can't create new one with actions later so basicaly i have to create them my self. Every x Seconds triggers must be avoided they are taking way to much memory especialy if it's moving or picking trigger. So there is no point to post less efficen't ways in order to help + it's not related to my question if i can use periodic trigger to do it. Thanks for your opinions guys, whatever the thread remain open for new ones as long as they are not spam please. And if some JASS-er can make tutorial how to create new trigger and add simple GUI actions to him will be more than appriciated thanks.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
sure you can create and destroy triggers
custom script is part of GUI :p
  • Trigger
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Evaluation count of (This trigger)) Equal to 1
        • Then - Actions
          • Hashtable - Create a hashtable
          • Set H = (Last created hashtable)
          • -------- Save triggeractions on first run --------
          • Custom script: call SaveTriggerActionHandle(udg_H, 0, 0, TriggerAddAction(gg_trg_Trigger, function Trig_Trigger_Actions))
        • Else - Actions
      • Custom script: call TriggerRemoveAction(gg_trg_Trigger, LoadTriggerActionHandle(udg_H, 0, 0))
      • Custom script: call DestroyTrigger(gg_trg_Trigger)
      • Custom script: set gg_trg_Trigger = CreateTrigger()
      • Custom script: call TriggerRegisterTimerEventPeriodic(gg_trg_Trigger, 0.1)
      • Custom script: call TriggerAddAction(gg_trg_Trigger, function Trig_Trigger_Actions)
      • Custom script: set udg_i = GetHandleId(gg_trg_Trigger)
      • Game - Display to (All players) the text: (String(i))
this might not be the best way to destroy or create triggers
it's just an example to show that it works fine

but I really don't know why everyone is whining about event leaks
they only cause trouble if you got millions of them and to archive that you would need millions of units which would be a far greater problem
 

Attachments

  • Trigger.w3x
    12.6 KB · Views: 98
Status
Not open for further replies.
Top