Greetings,
I'm working on a conversation event that eventually leads to battle with the NPC in the conversation using the Start Battle event node at the end of the Game Event. I can get the event to work just fine IF the event is set to AutoStart. If I set the event to Trigger Enter with a sphere collider, the battle event does not work. Conversation works fine, NPCs spawn. But nothing happens after that, the event just ends after the conversation. There is however a 'dummy' battle event created in the scene Hierarchy. But it does not do anything. It's named _Battle and has the battle spots etc.. Almost like the event didn't know what to do so it made a place holder? Not sure there :)
The way I have the event's game object set up in the scene is as follows:
I have an empty GameObject with an Event Interaction component with the ORK game event file set and set to AutoStart at the moment. Secondly I have a Combatant Spawner component to spawn my NPCs set to AutoStart. And lastly I have added the Battle Component. Like I said, it works great with AutoStart but not using a Trigger Enter.
Thanks once again :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Everything is on one GameObject: The Event Interaction component, the Combatant Spawner component, and the Battle Component.
All of them, under Variable Settings > General Condition Settings do have Auto Destroy enabled by default. I've tired disabling Auto Destroy on the all of the components and that didn't make any difference. I hope that info. helps :)
First of all, the combatant spawner on the game object will spawn a combatant as a separate game object, i.e. the event doesn't have access to it (unless you e.g. set it up as an actor with the find object settings).
Due to that, the event will use the battle component, which would need to be set up correctly (i.e. have a combatant/group of an enemy faction added to it).
The general mechanic works fine on my end, you have to make sure that either the battle component is set up correctly or you're using the actual combatant you want to fight.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
The battle component does have the group faction set to enemy and added to it correctly. And it does work on AutoStart just fine. Does a triggered event cause the other components to 'fire' at the same time? Mabye it destroys the battle component before I can call the Start Battle node? I'm totally stabbing in the dark here :)
I'm guessing I just need to find another way to do this? Any suggestions? Should I spawn the combatants for the conversation with a spawn node in the event? Though that's not where I'm having the problem.
Anyway, any advice would be most helpful. Thanks you!
Also, I keep forgetting to ask this, so I'll add my question as an addendum to this post: Is it possible to call other events from an event? I would like encapsulate some of the events I use over and over and then just call x or y event when needed. I see I can call a Global Event. But does that mean that event continues to live on with a global scope once called and couldn't be called again? Or how does that work?
however you can create and event and leave it inactive until a specific variable is called.
or
you can create a global event and set the type to call, this way it will not activate until you call it.
the event will stop when the event ends. the only ones that "live on" are the ones that are set to "auto". they will auto-check for an ending and will start after ending (which is good for time and date stuff)
Chillback Digital | web page | Itch.io page | Youtube Page | Made With Unity Page
In case it's the combatants - you don't need the Battle component, unless you use it in the combatant spawner for setting up the battle (e.g. position or start/end events).
In that case I'd recommend to change your setup - have the Battle component as a separate game object, set the start type to None and disable using scene ID.
It might also be better to separate the combatant spawner from the event as well.
Regarding events starting in events - that's where you'd use global events. They're basically game events that can be called at any time.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
@GiL - I'll try your suggestions and see how that works out. Separating out the various components would make sense.
As far as which game object has the Start Battle node, in simple terms, I have one object with ALL the components on it. I created an empty game object and added the Event Interaction component, which has the Start Battle node as part of the event. The GameObject also has the Combatant Spawner component on it and it has the Battle Component added to it as well. All in one, all on the same GameObject. I hope that helps :)
The combatants are spawned by the Combatant Spawner, not the event, for the sake of the conversation. I have the Battle Component set up to use a group of 2 of the same type of combatants. Also, I'm using combat in a different scene, so that works well for this type of set up, at least me. :)
Thanks for explaining global events. I was thinking that was what they were for. @skwiggs1983 added some good information that was really helpful as well.
Thanks guys :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!