• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Turned of Triggers Run, if asked

Status
Not open for further replies.
Level 4
Joined
Jan 16, 2017
Messages
66
Hi,

is "turning off" a trigger only related to the triggers event? Meaning it only doesn't run by itself via event?

Because if I turn the trigger xxx off and use "trigger-run trigger xxx" it will always run, even though it's turned off.
 
Level 4
Joined
Jan 16, 2017
Messages
66
I know that it ignores the event and condition(depending on what you choose)

On a side not i'm not sure if you can run the trigger if you've unticked `Initialy On` in the trigger editor, without turning it on first.

this is the problem, the trigger is initially off but it will run via "run trigger" anyway. So it seems like turning the trigger off only ignores the event, nothing else :(
 
Level 4
Joined
Jan 16, 2017
Messages
66
yes a condition is a workarround, I just found it really sad that turning a trigger off only turns off the event actually.

I am trying to reduce process to keep my map well performing. So I'm turning off triggers that for example check for conditions on each "generic-unit is attacked event" until I really need them and turn them on. Just so that the condition doesn't have to be checked every time. I'm talking about my TD so I have a hilarious amount of attacks most of the time... but yes... checking a boolean is not much of a process I know.

However it is this kind of stuff... the thing above only requires to check an extra condition each wave now. Which isn't really anything but I wanted to get rid of it this way and it would be a nice tool if it wasn't only turning off the triggers event.

I just saw minor performance problems in lategame yesterday and so I'm cleaning my triggerwork a bit.

On this issue: I read that points(e.g. position of unit) leak, which is why I always define variables as points and then work with the variables. I am however not always using the custom script "call RemoveLocation (udg_MyPointVar)" to remove the point, because when I redefine "MyPointVar" all the time it shouldn't leak right? I think that points will only leak when I directly work with the points that I catch via GUI, but mb i'm wrong?

I mean I do: set MyPointVar = position of triggering unit
do action at MyPointVar

and next time the trigger runs it will do the same, so MyPointVar is always redefined so it doesn't store the old values. But I don't know if "position of triggering unit" still leaks.
I WOULD always use "call RemoveLocation (udg_MyPointVar)" but I also have point variables with arrays and I never figured which way I have to change the custom script that it can destroy a certain array position of a point. Please tell me if I should do a new topic :/
 
Level 4
Joined
Jan 16, 2017
Messages
66
so it totally doesn't work like a normal int which would be:
set intVar = 4
set intVar = 6

if the int would leak it would still store the old value (4) somewhere even though the variable is no array and should just rewrite the stored value.
So that is a problem of the type "point" in warcraft 3 i guess.

Can you tell me how to modify the script "call RemoveLocation (udg_MyPointVar)" if MyPointVar is an array -> MyPointVar(int)
because "call RemoveLocation (udg_MyPointVar(int))" doesn't work
 
Level 11
Joined
Jun 2, 2004
Messages
849
so it totally doesn't work like a normal int which would be:
set intVar = 4
set intVar = 6

if the int would leak it would still store the old value (4) somewhere even though the variable is no array and should just rewrite the stored value.
So that is a problem of the type "point" in warcraft 3 i guess.
Wc3 was made in a language without built in garbage collection. Were it made in java or something those unreferenced variables would be cleaned up eventually, but alas, we don't have modern conveniences.

For a bit more detail, point variables are pointers to objects in memory, whereas ints are just ints (they live inside the variable, whereas the point itself does not). So overwriting the int will overwrite it completely. Overwriting the point variable will merely overwrite the pointer, leaving the original object in existence. Every time you ask the game to generate a point for you (position of unit, center of region, etc), it's creating an entirely new point object which you will need to clean up yourself.
 
Level 4
Joined
Jan 16, 2017
Messages
66
yes, thanks for the info, I had a pointer on my mind for a moment but probably refused to think further and it's a while ago that i learned programming and barely used it since :/

Can you explain me again how to solve this the best way to get rid of the pointleaks?

Maybe you can tell me what exactly I have to write in the array field? I guess either I need a jass line for "Integer((current flying height of(triggering unit)))" or I put the value (integer((current flyy.....) into an extra integer variable "ScottyIndex" while the trigger performs.
Custom script - call RemoveLocation (udg_MyPointVar[bj_forLoopBIndex])

So then maybe Custom script - call RemoveLocation (udg_MyPointVar[ScottyIndex]) would work if I do it like stated above? I thought I tested that already but mb I didn't.

I am using flying height as ID for all my towers for their effects because the custom value is used elsewhere already. Saying however, all my point-arrays use casted flying heights as ints.

upload_2017-1-23_22-59-22.png


*i could also upgrade the waypoint question with a meaningfull way of if/then/elses i guess...
 

Attachments

  • upload_2017-1-23_22-56-59.png
    upload_2017-1-23_22-56-59.png
    260.7 KB · Views: 29
Status
Not open for further replies.
Top