magique
Full Member
Posts: 194
Posts: 194
|
Post by magique on Dec 25, 2016 21:46:21 GMT
I can't find details on how to handle wave completion custom events. On one of my waves I have checked the option for Wave Completion Custom Events and assigned a custom event that I added by clicking the Create New Event button in the Custom Events section. The listener that works for WaveSyncroPrefabSpawner is the WaveSyncroSpawnerListener. So I created my own subclass of that and attached it to the spawner. But there are no handlers for custom events in that listener. There is an EliminationWaveCompleted handler, but my wave is not elimination type. Is it assumed that it has to be Elimination type because it's also possible to complete a wave that's Timed. In any case, EliminationWaveCompleted isn't the same as a custom event that I have named. So, the whole thing is confusing me.
|
|
|
Post by DarkTonic Dev on Dec 25, 2016 23:19:14 GMT
You should probably take a look at the Custom Events section in the readme, it covers all this. Here's the short version.
The numerous "Listener" classes do not have anything to do with Custom Events, except the interface I mention below.
Custom Events can only be listened to by classes that implement the ICGKCustomEventListener interface. You don't need to write your own class if Triggered Spawner does what you want, because it does implement that interface. Just choose "Custom Event" from the "Event To Activate" dropdown, then choose the Custom Event by name, and set up your wave to spawn.
About the last question you asked, as I said above, the Listener classes have nothing to do with Custom Events, so that's irrelevant.
-Brian
|
|
magique
Full Member
Posts: 194
Posts: 194
|
Post by magique on Dec 25, 2016 23:37:46 GMT
OK, it sort of make more sense now. I added a TriggeredSpawner and set it to point to my custom event. However, it spawned the prefab at 0,0,0 instead of where the last wave item was despawned. How can I make it spawn the item where the last wave item despawned?
|
|
|
Post by DarkTonic Dev on Dec 26, 2016 0:26:42 GMT
Actually you can't. The custom event origin point isn't known by the listeners at all.
Unless you can put the triggered spawned on the same game object?
|
|
magique
Full Member
Posts: 194
Posts: 194
|
Post by magique on Dec 26, 2016 0:33:54 GMT
I was afraid of that. I'll have to think of a clever way to solve this.
|
|
magique
Full Member
Posts: 194
Posts: 194
|
Post by magique on Dec 26, 2016 0:44:56 GMT
Actually, maybe there is another way to do what I'm trying. I might be trying to use the wrong approach. Basically, what I want to do is spawn a powerup item if the player destroys all enemies in a wave. Is there some other way to determine if a wave item dying is the last item in the wave?
|
|
|
Post by DarkTonic Dev on Dec 26, 2016 3:50:06 GMT
And you want to spawn it from the position of the last enemy right? Hmm...
There's a variable in the spawner code called _itemsToCompleteWave, which is private. If you make it Public, it can tell you (from the _spawnedFromObject field of the Killable). If itemsToCompleteWave == 0, then that's the last item (for that spawner anyway). You'd need a Killable subclass or Killable Listener to have a hook to write the code though.
That's about the easiest way I can think of. Let me know if it works for you.
|
|
|
Post by DarkTonic Dev on Dec 26, 2016 3:58:25 GMT
I misspoke. Apparently the Custom Event's origin is transmitted to the Custom Event Receiver. But there's no way to use it as the spawn position right now. I think I should add that under Position Settings.
Will add to roadmap.
Although that alone won't help you with what you're trying to do...
|
|
magique
Full Member
Posts: 194
Posts: 194
|
Post by magique on Dec 26, 2016 6:12:43 GMT
Thanks for the advice. I'll try to work out a way to do this and let you know if I have any success.
|
|
|
Post by DarkTonic Dev on Dec 26, 2016 6:47:53 GMT
Ok sounds good.
|
|
|
Post by DarkTonic Dev on Dec 26, 2016 19:45:56 GMT
I thought of another idea which may kind of help. You can use a Prefab Pool in your spawner where you have 2 prefabs in it that look the same, but one of them has a different Death Prefab (your power up). That would mean whenever you kill that guy, you get the weapon, although it may not necessary be the very last one you kill. Just trying to think of ways to do it without coding.
|
|
magique
Full Member
Posts: 194
Posts: 194
|
Post by magique on Dec 26, 2016 19:58:20 GMT
Yeah, I've thought about that idea for other scenarios, but it won't work for this one. Thanks for trying to help solve it.
|
|
|
Post by DarkTonic Dev on Dec 28, 2016 17:48:45 GMT
Ok.
|
|
|
Post by gearedgeek on Feb 24, 2017 12:35:41 GMT
I have set up a Wave Completion Bonus where it adds x amount to the score. I would like to add a GUI effect where it says "Bonus Scored" when the Wave Completion Bonus is achieved. But I'm not sure how to achieve this. I'm using playmaker for all the scripting. I'm using Get Property from the LevelWaveSettings to find when the Wave Completion Bonus is fired.
Also is there any settings that I can change with the Wave Completion Bonus like changing the time frame on how long the player can achieve the bonus?
|
|
|
Post by DarkTonic Dev on Feb 24, 2017 16:31:00 GMT
You can use the PlaymakerLevelSettingsListener class. There's an event called WaveCompleteBonusesStart that you should hook into your FSM to make the GUI effect. You don't need to use the "get property" to find out when it happens.
I'm not what you're asking with the 2nd question, please give more detail. How long what?
|
|