So I've discovered events are impossible in the trigger editor (unimplamented)
Have they been implamented, or has someone figured out the naming convention for events in scripts?
I'm writing a library and I'd like to have some events that users may attach triggers to.
You need to mark the Event Definition as Native (this causes the editor to not generate any code for the event). Then, make a new Custom Script (Right click on the left > New > Custom Script...) where you can define the event. You need to do this because Event Definitions have an implicit parameter which you can't declare with the GUI but it's possible.
Well, that's not really a custom event.. that's just a loop that adds a couple of native events to a trigger - using a lot of wickedly-named variables.
In short: We can't make our own events. We always have to use what Blizzard gave us.
Well, I'm pretty sure that's how far we'll ever get for creating events. I mean, when you create a Custom Action, you create one in terms of all the other Actions Blizzard gave you. Same thing for events: you create an event in terms of the Events Blizzard gave you. What I do suspect though, is that they'll probably improve the GUI for making events because at the moment its bugged and doesn't work.
Yes, but you can define and call a custom function or action etc (you can even define your own bitflags which I think is awesome... but I haven't tried yet)
You cannot register a new event with the event handler... which is unfortunate... Any one know of any good workarounds? I mean, it's not a critical thing, but it would make mine (and I'm sure a lot of other) libraries a WHOLE lot nicer looking and easier to use.
I'll probably have to include some sort of "fake event trigger" and just run it... but that means requiring users to actually modify your library which kinda defeats the purpose...
Are we SURE that the event handler is locked to Blizz only events???
I have tried several times at guessing the syntax and forcing the event to run in a custom script... but like caspersc says, I'm not getting anywhere without proper functions...
Right now, when you "define a new event" it registers it as a function (which makes sense), so then in it's actions, couldn't we manually add our event if we could figure out how the event handler works? I have little expperience with Blizz's policies with their editors, so I don't know if this is a speculation that should be made.
You can create custom events, you just have to be creative.
Make an array of trigger[123] or some reasonable number, then have your event save the callback in that array.
Repeat for any params the event may have.
I thought I had it, but I must have posted it in another thread...
I've got a repeating timer that uses a decrementing counter each loop, and then is paused when the counter reaches zero. This timer spawns a unit each tie the counter expires. I'd like to "throw an event" when this counter reaches zero so people using the library may use the event to build game logic around.
MotiveMe is actually quite right, shouldn't have posted before class as obviously there is a callback mechanic in Galaxy called triggers!
An 'Event' in the Trigger Editor is just the registration code, i.e TriggerAddEventPlayerLeft, which is called in the trigger initialization function.
Attached a quick example which checks the player status every 5 seconds to discover disconnects.
Sounds like it would be better and more logical to just expose the timer in a public api, any events we implement will be quite a bit slower than the ones provided by native compiled code.
The second method is primarily useful for signaling triggers from data, but it can also be used for signaling from triggers via the Create Effect action. This can be useful if you want to pass units as parameters, since it inherently supports both a target unit and a caster unit (which can have any semantics you wish.)
I've got a repeating timer that uses a decrementing counter each loop,
and then is paused when the counter reaches zero. This timer spawns a
unit each tie the counter expires. I'd like to "throw an event" when
this counter reaches zero so people using the library may use the event
to build game logic around.
I might not be understanding you correctly but here's what you're trying to do.
You have a Timer A that starts at a number, say 10. After 10 seconds, you spawn a unit and restart the timer at 9 this time. You repeat until you've hit 0.
Now, with some math you'll notice that if you start off from, say, 10, then you'll get to 0 after 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 (= 55) seconds (which is the series of natural numbers up to the initial counter).
So, when I start Timer A at 10, I'd make another timer B that expires after 55 seconds. All your library users have to do now is register for Timer B's expiration.
So it looks like, for now, we have to create our own event handler (aka using a looping timer, which I imagine gets a bit slow with heavy loads) or we piggy back if you will, our actions onto another one.
I've been working with Delegates in the XNA framework, and so I don't like the idea of having to create a loop... this event isn't going to fire very often, doesn't require any logic to fire (I'm just calling it), and I don't like adding the "cost" of 32 if statements a second (I know the engine can take it)... Ugh...
I've thought about stealing one of the built in events that doesn't ever fire, locking it out some how, and then simply using a force call to it, but I haven't seen a way to force an event either, other than creating a trigger that does what ever it takes to trigger that event. This may be the solution I use if I can find a couple events to highjack.
Thanks everyone for your input. Maybe Blizzard will stick events in the next content patch and we won't have to worry about this messy business.
The second method is primarily useful for signaling triggers from data, but it can also be used for signaling from triggers via the Create Effect action. This can be useful if you want to pass units as parameters, since it inherently supports both a target unit and a caster unit (which can have any semantics you wish.)
This is pure awesome and the perfect answer to a problem I've been trying to work around for a few days now (getting effects to trigger triggers), thank you!
Unit takes Lethal/Non-Lethal dmg from ability / effect
Unit Casts ability /progress of ability
Unit is created by ability / effect
Theres more but yeah Id need the specifics
Dunno what your really trying to pick up and do based off of an effect considering if your doing stuff in the data editor why do you need a trigger to detect it?
Aye its more the value of being able to one of those dummy damage effects anywhere you want really within another effect, behavior or ability that is the most appealing to me. The specific wants from the being able to call triggers is for instance I'm making a CTF game and want things to happen whenever a flag changes hands. The flags are essentially a behavior when they're on a unit or holder and only a unit when they're dropped through death of the carrier. So this really limited what all I could do to the game itself when any of these sorts of things happened. Now I can just trigger off a dummy damage whenever the flag behavior is added or removed from something and then take advantage of a trigger's much wider range of actions possible (like announcer voices, point calculations etc)
Item picked up ... Item dropped... could even add abilities to units to pass the flag to team mates ... I dont see why you would need to periodically check who has the flag other then when the flag
picked up
dropped
passed
Brought to Home region which in that case ... Unit enters region and triggering unit has item.....
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
To post a comment, please login or register a new account.
So I've discovered events are impossible in the trigger editor (unimplamented)
Have they been implamented, or has someone figured out the naming convention for events in scripts? I'm writing a library and I'd like to have some events that users may attach triggers to.
You need to mark the Event Definition as Native (this causes the editor to not generate any code for the event). Then, make a new Custom Script (Right click on the left > New > Custom Script...) where you can define the event. You need to do this because Event Definitions have an implicit parameter which you can't declare with the GUI but it's possible.
Actually there is no callback mechanics exposed to us so no, implementing events is not possible at this time.
Actually, you can with some sexy tricks. Here's my Event definition. I've changed its script name to be TriggerHeroStartsShoppingEvent, by the way.
Now, here's the custom script.
Any voila, you've got a custom event you can add to your triggers. :)
Well, that's not really a custom event.. that's just a loop that adds a couple of native events to a trigger - using a lot of wickedly-named variables.
In short: We can't make our own events. We always have to use what Blizzard gave us.
@s3rius: Go
Well, I'm pretty sure that's how far we'll ever get for creating events. I mean, when you create a Custom Action, you create one in terms of all the other Actions Blizzard gave you. Same thing for events: you create an event in terms of the Events Blizzard gave you. What I do suspect though, is that they'll probably improve the GUI for making events because at the moment its bugged and doesn't work.
@Klishu: Go
Yes, but you can define and call a custom function or action etc (you can even define your own bitflags which I think is awesome... but I haven't tried yet)
You cannot register a new event with the event handler... which is unfortunate... Any one know of any good workarounds? I mean, it's not a critical thing, but it would make mine (and I'm sure a lot of other) libraries a WHOLE lot nicer looking and easier to use.
I'll probably have to include some sort of "fake event trigger" and just run it... but that means requiring users to actually modify your library which kinda defeats the purpose...
Are we SURE that the event handler is locked to Blizz only events??? I have tried several times at guessing the syntax and forcing the event to run in a custom script... but like caspersc says, I'm not getting anywhere without proper functions...
Right now, when you "define a new event" it registers it as a function (which makes sense), so then in it's actions, couldn't we manually add our event if we could figure out how the event handler works? I have little expperience with Blizz's policies with their editors, so I don't know if this is a speculation that should be made.
@Anthius: Go
Tell us exactly what sort of event you would like to create.
You can create custom events, you just have to be creative. Make an array of trigger[123] or some reasonable number, then have your event save the callback in that array. Repeat for any params the event may have.
@Klishu: Go
I thought I had it, but I must have posted it in another thread...
I've got a repeating timer that uses a decrementing counter each loop, and then is paused when the counter reaches zero. This timer spawns a unit each tie the counter expires. I'd like to "throw an event" when this counter reaches zero so people using the library may use the event to build game logic around.
MotiveMe is actually quite right, shouldn't have posted before class as obviously there is a callback mechanic in Galaxy called triggers! An 'Event' in the Trigger Editor is just the registration code, i.e TriggerAddEventPlayerLeft, which is called in the trigger initialization function.
Attached a quick example which checks the player status every 5 seconds to discover disconnects.
@Anthius: Go
Sounds like it would be better and more logical to just expose the timer in a public api, any events we implement will be quite a bit slower than the ones provided by native compiled code.
I use two methods for faking custom events. The first is timers. The second is described here:
http://rileystarcraft.blogspot.com/2010/06/tutorial-create-custom-trigger-hooks.html
The second method is primarily useful for signaling triggers from data, but it can also be used for signaling from triggers via the Create Effect action. This can be useful if you want to pass units as parameters, since it inherently supports both a target unit and a caster unit (which can have any semantics you wish.)
I might not be understanding you correctly but here's what you're trying to do.
You have a Timer A that starts at a number, say 10. After 10 seconds, you spawn a unit and restart the timer at 9 this time. You repeat until you've hit 0.
Now, with some math you'll notice that if you start off from, say, 10, then you'll get to 0 after 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 (= 55) seconds (which is the series of natural numbers up to the initial counter).
So, when I start Timer A at 10, I'd make another timer B that expires after 55 seconds. All your library users have to do now is register for Timer B's expiration.
So it looks like, for now, we have to create our own event handler (aka using a looping timer, which I imagine gets a bit slow with heavy loads) or we piggy back if you will, our actions onto another one.
I've been working with Delegates in the XNA framework, and so I don't like the idea of having to create a loop... this event isn't going to fire very often, doesn't require any logic to fire (I'm just calling it), and I don't like adding the "cost" of 32 if statements a second (I know the engine can take it)... Ugh...
@RileyStarcraft: Go
I've thought about stealing one of the built in events that doesn't ever fire, locking it out some how, and then simply using a force call to it, but I haven't seen a way to force an event either, other than creating a trigger that does what ever it takes to trigger that event. This may be the solution I use if I can find a couple events to highjack.
Thanks everyone for your input. Maybe Blizzard will stick events in the next content patch and we won't have to worry about this messy business.
This is pure awesome and the perfect answer to a problem I've been trying to work around for a few days now (getting effects to trigger triggers), thank you!
@BumpInTheNight: Go
.... You can already make events that are triggered by effects..
@SouLCarveRR: Go
How would one do that then? I see no events that do anything like that available.
@BumpInTheNight: Go
Unit takes Lethal/Non-Lethal dmg from ability / effect
Unit Casts ability /progress of ability
Unit is created by ability / effect
Theres more but yeah Id need the specifics
Dunno what your really trying to pick up and do based off of an effect considering if your doing stuff in the data editor why do you need a trigger to detect it?
@SouLCarveRR: Go
Aye its more the value of being able to one of those dummy damage effects anywhere you want really within another effect, behavior or ability that is the most appealing to me. The specific wants from the being able to call triggers is for instance I'm making a CTF game and want things to happen whenever a flag changes hands. The flags are essentially a behavior when they're on a unit or holder and only a unit when they're dropped through death of the carrier. So this really limited what all I could do to the game itself when any of these sorts of things happened. Now I can just trigger off a dummy damage whenever the flag behavior is added or removed from something and then take advantage of a trigger's much wider range of actions possible (like announcer voices, point calculations etc)
@BumpInTheNight: Go
Why dont you make your flag an item?
Item picked up ... Item dropped... could even add abilities to units to pass the flag to team mates ... I dont see why you would need to periodically check who has the flag other then when the flag