System GTrigger Event System

Kenny

Back for now.
Reaction score
202
Ahh, okay. Thats what I did. I just thought you may have meant something else.

I have this:

JASS:
// Unit target orders.
call GT_AddTargetOrderAction(function Move_actions,ORDER_MOVE)
call GT_AddTargetOrderAction(function Move_actions,ORDER_SMART)
call GT_AddTargetOrderAction(function Move_actions,ORDER_ATTACK)    

// Point target orders.
call GT_AddPointOrderAction(function Move_actions,ORDER_MOVE)
call GT_AddPointOrderAction(function Move_actions,ORDER_SMART)
call GT_AddPointOrderAction(function Move_actions,ORDER_ATTACK)

// Learns ability for leveling.
call GT_AddLearnsAbilityAction(function Learn_conditions,LEARN_ID)


It works perfectly, and shaved about 20+ lines from the script.

I'm pretty sure this will get approved. It may just take some time, as mods can be pretty busy.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Yeah, understood.

>It works perfectly, and shaved about 20+ lines from the script.

Wonderful. :D

Edit: Actually, although that works (and works fine), you're better off using GT_RegisterXEvent in that situation in theory... The reason is because internally GT_AddXAction makes a new trigger, but if you just registered the events on the one trigger stored in a local variable, the trigger would be reused. It doesn't really make a difference to anything, just 6 handles instead of one, really. Up to you.
 

Kenny

Back for now.
Reaction score
202
About your edit, so you mean something like this:

JASS:
// Unit target orders.
call TriggerAddCondition(GT_RegisterTargetOrderEvent(trig,ORDER_MOVE),Condition(function Move_actions))
call TriggerAddCondition(GT_RegisterTargetOrderEvent(trig,ORDER_SMART),Condition(function Move_actions))
call TriggerAddCondition(GT_RegisterTargetOrderEvent(trig,ORDER_ATTACK),Condition(function Move_actions))
    
// Point target orders.
call TriggerAddCondition(GT_RegisterPointOrderEvent(trig,ORDER_MOVE),Condition(function Move_actions))
call TriggerAddCondition(GT_RegisterPointOrderEvent(trig,ORDER_SMART),Condition(function Move_actions))
call TriggerAddCondition(GT_RegisterPointOrderEvent(trig,ORDER_ATTACK),Condition(function Move_actions))

// Learns ability for leveling.
call GT_AddLearnsAbilityAction(function Learn_conditions,LEARN_ID)


Just making sure im using it right.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Nup. That would add the conditions 6 times.

This:
JASS:
//local trigger trig=CreateTrigger() // Make sure there&#039;s a trigger. <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />
call TriggerAddCondition(trig, Condition(function Move_actions))
// Unit target orders.
call GT_RegisterTargetOrderEvent(trig,ORDER_MOVE)
call GT_RegisterTargetOrderEvent(trig,ORDER_SMART)
call GT_RegisterTargetOrderEvent(trig,ORDER_ATTACK)
    
// Point target orders.
call GT_RegisterPointOrderEvent(trig,ORDER_MOVE)
call GT_RegisterPointOrderEvent(trig,ORDER_SMART)
call GT_RegisterPointOrderEvent(trig,ORDER_ATTACK)

Roar! :D

The shortcuts aren't always appropriate. For multiple events, this is how you do it. :)

Edit: Don't forget your other thing... ;)
JASS:
// Learns ability for leveling.
call GT_AddLearnsAbilityAction(function Learn_conditions,LEARN_ID)
 

Kenny

Back for now.
Reaction score
202
Haha, yeah i figured it out after reading through the documentation again. What was a thinking :p

Anywho, thanks for your help with it, its working perfectly. And funnily enough, when using a handle counter, there as less handles when using the system (by ~50 or so). Not sure if that has any significance, but hey.

This rawks! :D
 

Romek

Super Moderator
Reaction score
963
Remember that when reviewing things mods need to see what the system does, look through the code, see if there are any imperfections. We also need to understand what the system does, as well as what the code is doing.
It's tough, especially when there are a lot of resources waiting to be reviewed, or when moderators are busy.

I won't review this for now, I'm busy. :p (Spell Contest and Life)
 

Jesus4Lyf

Good Idea™
Reaction score
397
>there as less handles when using the system
Wha? You mean... less handles? By 50? That makes sense, because previously you'd spawn a handle for each of 16 events! Thats one of the great things about GTrigger. However, if you get more when you first add GTrigger to a map with only 1 spell, that's because it carries a certain number of handles itself, naturally.

>Remember that when reviewing things mods need to see what the system does, look through the code, see if there are any imperfections. We also need to understand what the system does, as well as what the code is doing.

Crap. This system is doomed to kick around here for ages. No one will ever understand its code! :(
Lol. =/
I'll rep the mod who understands it... Not that mods care about that...
 

Romek

Super Moderator
Reaction score
963
> No one will ever understand its code!
Don't underestimate the mods.
It just takes a good looking through the code.

I'll start reviewing resources once I'm done with spells.

> I'll rep the mod who understands it... Not that mods care about that...
Indeed. So trying to bribe mods with rep isn't going to get you far. :)
 

Sim

Forum Administrator
Staff member
Reaction score
534
I'd like to see this with Unit is attacked event.

As for the system itself, I still haven't found a single bug or flaw...

Anybody tested it enough to notice an important flaw?

EDIT: Concerning order events, how it's designed is quite unusual. The way blizzard does it is different but makes it more useful. For example, if I wanted to code Berserker's Call in DotA (Which prevents units from doing anything BUT attacking Axe), the blizzard event registration say (along with conditions): Register any order event, and cancel anything not equal to "Attack Axe". Your event registration go like this: Register x order event. register y order event. register z event, and so on, until you've done them all. Keep only attack.

It's a bit complex but what I mean is that it's less usefull to use your system than blizzard events when toying with order events.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Interesting point. The idea was if you issue a specific order, you can trigger off it. For things like Berserker's Call, wouldn't you use specific unit events, instead of "any unit is issued any order" and then filter whether or not they have the buff? Depends how evil you think dynamic triggers are, I suppose.

Kenny seemed to find a use for specific orders. I can make two events, one for on specific order issueing, and one for any order issued. I'll find time to do that at some point, perhaps. :thup: Thoughts?

Aside from that, would data attachment be useful in GTrigger?
Quite seriously, I could write an extremely efficient mechanism for attaching data to a GT event. Much more efficient than any other trigger attaching mechanism ever written. But only if people think it may be of some use. (Of course, it would be completely optional to use. :))
 

emjlr3

Change can be a good thing
Reaction score
395
considering that spell may trigger once every 15s or so, creating a few dozen dynamic triggers that you just disable at the end, to make things easier, really doesn't matter
 

Sim

Forum Administrator
Staff member
Reaction score
534
> Quite seriously, I could write an extremely efficient mechanism for attaching data to a GT event.

That would be nice. Attaching to triggers requires tables and stuff, at least that's what I use, and I don't like it.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Mmm. My question, I suppose, is how useful is GTrigger for dynamic triggers in the first place?

Of course, I could make it more useful by adding "AnyX" style events, instead of filtering... And then data attachment may be more useful... How would you use GTrigger with attaching? What sort of situations?

Wouldn't it be for unit-specific events? And GTrigger isn't going to be appropriate for those any time too soon, I think.
 

Sim

Forum Administrator
Staff member
Reaction score
534
Anyone has anything to input before I approve this?

I tested it in many angles and means possible, and it's working great.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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