Post by cursedereaper on Feb 3, 2019 5:47:24 GMT
Hey everybody.
I just worked myself through all the tutorials regarding the AI-System. And the AI won't work 100 % as I want it.
Keywords: Message Receiver, Game Object.SetActive, vNoiseObject.TriggerNoise.; AI NoiseObject "Trigger On Start"
My Question would be:
Can the vNoiseObject.TriggerNoise even activate a noise of an object or a component (because in my project it does)?
Related to my "1st approach" see below.
Is the "Trigger on Start" actually only on Runtime or is it like the Audio Source characteristic "Play on Awake" (at least it doesn't work the same in my project)?
Related to my "2nd approach" see below.
The reason for my questions is my current Send Message AI System that modifed the FSM_MELEE into a FSM that uses Send Messages to trigger a call for help (making noise which other enemies will hear and move to) when a patroling or fleeing enemy sees the player (I didnn't wanted the Enemey to call for help when they switch between Chase and Combat that actually worked but caused all my Enemies to gather at one point and opposed the goals of my stealthy game design)
I tried different approaches and each time something won't work.
1st approach. I created three Send Messages from the AI FSM to the Enemy. One was used to play the sound by "AudioSouce.enable" a "Play on Awake Audio file) and use a "v.NoiseObject.TriggerNoise" when the enemy saw the player by adding a State in front of chase and one in front of combat which directly transited into those states. Then Chase and Combat deactivated the Object that had the Noise component on it and Patrol and Flee activated the component again and deactivated the sound object.
The Send Message worked and the objects hide and unhide as planned but the "v.NoiseObject.TriggerNoise" even triggered when the object with the Noise Object component was deactivated.
2nd approach: I deactivated a sound with "Play on Awake" during and when entering Patrol. That way I can activate it when entering the state Chase to play the "Help" sound (that is basicly an addition to the debugger to check if I triggered an alarm)
I also deactivate the object that Included the Noise Object on start. Activated the Noise Object when the Enemy saw the player which caused the "Play on Start" to trigger. Then I deactivated the Object with the "Noise Object" when the Enemy entered Fleeing or Patrolling.
3rd approach was similar to the second but instead of creating an object that had a Noise Object I used a component on my enemy which I deactivated and activated while using "Trigger on Start". Same Problem as 2nd approach. So it made no difference if I tried to deactivate the Component or the Object both times it only triggered once like it should and after that never again.
I also checked if the object and/or components were actually deactivated and activated so the Send Message AI System did what it should. It just didn't worked as I tought it would.
Is there another approach than those three or the 1st approach with deactivating components instead of objects or is there something that will be fixed in regards of the "Play on Start" characteristic?
I still work on this FSM AI and hope that I can come up with a solution but if someone has an idea which could help I'd be greatful.
I just worked myself through all the tutorials regarding the AI-System. And the AI won't work 100 % as I want it.
Keywords: Message Receiver, Game Object.SetActive, vNoiseObject.TriggerNoise.; AI NoiseObject "Trigger On Start"
My Question would be:
Can the vNoiseObject.TriggerNoise even activate a noise of an object or a component (because in my project it does)?
Related to my "1st approach" see below.
Is the "Trigger on Start" actually only on Runtime or is it like the Audio Source characteristic "Play on Awake" (at least it doesn't work the same in my project)?
Related to my "2nd approach" see below.
The reason for my questions is my current Send Message AI System that modifed the FSM_MELEE into a FSM that uses Send Messages to trigger a call for help (making noise which other enemies will hear and move to) when a patroling or fleeing enemy sees the player (I didnn't wanted the Enemey to call for help when they switch between Chase and Combat that actually worked but caused all my Enemies to gather at one point and opposed the goals of my stealthy game design)
I tried different approaches and each time something won't work.
1st approach. I created three Send Messages from the AI FSM to the Enemy. One was used to play the sound by "AudioSouce.enable" a "Play on Awake Audio file) and use a "v.NoiseObject.TriggerNoise" when the enemy saw the player by adding a State in front of chase and one in front of combat which directly transited into those states. Then Chase and Combat deactivated the Object that had the Noise component on it and Patrol and Flee activated the component again and deactivated the sound object.
The Send Message worked and the objects hide and unhide as planned but the "v.NoiseObject.TriggerNoise" even triggered when the object with the Noise Object component was deactivated.
2nd approach: I deactivated a sound with "Play on Awake" during and when entering Patrol. That way I can activate it when entering the state Chase to play the "Help" sound (that is basicly an addition to the debugger to check if I triggered an alarm)
I also deactivate the object that Included the Noise Object on start. Activated the Noise Object when the Enemy saw the player which caused the "Play on Start" to trigger. Then I deactivated the Object with the "Noise Object" when the Enemy entered Fleeing or Patrolling.
3rd approach was similar to the second but instead of creating an object that had a Noise Object I used a component on my enemy which I deactivated and activated while using "Trigger on Start". Same Problem as 2nd approach. So it made no difference if I tried to deactivate the Component or the Object both times it only triggered once like it should and after that never again.
I also checked if the object and/or components were actually deactivated and activated so the Send Message AI System did what it should. It just didn't worked as I tought it would.
Is there another approach than those three or the 1st approach with deactivating components instead of objects or is there something that will be fixed in regards of the "Play on Start" characteristic?
I still work on this FSM AI and hope that I can come up with a solution but if someone has an idea which could help I'd be greatful.