HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

triggeraction, triggercondition, GetTriggerEventId

08-25-2009, 12:21 PM#1
Silvenon
Are triggeraction and triggercondition integer-based? Do I have to null them? When I'm checking if they exist, do I use ==nulll or ==0?

What is GetTriggerEventId? How do I use it?
08-25-2009, 12:34 PM#2
0zyx0
GetTriggerEventId returns an eventid, which is the type from which unitevent, playerevent, gameevent, etc. extends. There is no function except GetTriggerEventId that uses it as an argument, but you can use it in comparisons; If a trigger has two different events, you can detect which one of them was happening.

triggeraction and triggerconditions are handles, so you have to compare them to null, not 0. However, you shouldn't have to null them, since there shouldn't be any variables of those types, unless it is really necessary. The only way to use them is to make dynamic triggers, which should be avoided when possible, but at least destroying conditions and actions is better than destroying triggers.
08-26-2009, 02:40 PM#3
Silvenon
So like this?

if GetTriggerEventId() == EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER then

Why should dynamic triggers be avoided whenever possible? Also, conditions are better to use than actions, right?
08-26-2009, 02:50 PM#4
0zyx0
Conditions are faster than actions (most of the time), but you can't use waits within them.

About dynamic triggers:
*Destroying triggers may cause bugs.
*Most of the time, there are better options.
*They can sometimes make it harder to read the code.

And yes, that's how to use GetTriggerEventId()
08-26-2009, 08:31 PM#5
Pyrogasm
DestroyTrigger() doesn't bug out (or has a severely reduced chance of it) when the trigger has no ActionFuncs, so the argument is that if only ConditionFuncs are used, then DestroyTrigger() might be safe.