Hi, i have a problem.

I have a player, he Can hide in closet (when player interact with closet, I'm changing the player position to under ground and changing camera to be inside closet).

When enemy don't chase player, it works fine. But when enemy see player and player wants to hide in closet, enemy is running to this closet and standing there... I know, he knows the last player position, when he stands in front of closet. That's fine. But i'm trying to change this enemy's Move AI Mode to Flee from Player, changing Player faction to "Enemy", but enemy is still have in "Target Combatant" my Player. I'm using "Change Movie AI Mode" in my "Hide in Closet Event".

What Can I do? How to delete Player from enemy's target? I want my enemy to stand in front of closet, and when he don't see player, he just go away and hunting again.

Please for help :)
  • edited November 2018
    Try destroying the player's game object instead of placing it under ground.
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ok. So when I spawn player again, he will have all equipped weapons and inventory? Which Game Event I need to use?
  • Yes, the player's state (status, inventory, equipment, etc.) isn't bound to the game object, so you can destroy or spawn it as needed.

    Use a Destroy Object node (Add > Game Object > Game Object) to destroy the game object and a Spawn Player node (Add > Game > Player) to spawn the player.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • This is not working :( So I delete player gameobject using Destroy Object when I'm hiding. Then I spawn player after unhide.

    This image shows Move AI Component when i'm hiding and after unhide. I don't know why the enemy just stop and don't do anything.

    https://imgur.com/a/cmr8FXS

    Hide event looks like this:

    Block Player Control/Camera/Input -> destroy object "Player(Clone)" -> Play Sound "HidingSound" -> Change Camera Rotation and Position to "InSofinerCamPoint" -> Show dialogue with "E - stop hiding" button -> click on button = Unblock Player Control/Camera/Input -> spawn player
  • Ah, yeah ... check the Move AI Range in Battle System > Battle Settings, or if this is in battle, in the settings of the battle system you're using.

    If the player is destroyed, the player is out of range of everything, so only allowing the move AI within a certain range of the player will fail - disable using range to prevent this.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Now the enemy just stand and do nothing.

    I disable Using Range in Movie AI in Battle System > Battle Settings and in Real Time Battle Settings. When i'm hiding and enemy don't see me - it's working. But when I'm hiding and he saw me before, he just stand in one place and his animations don't start.

    What else I Can do with it?
  • edited January 11
    He can't flee from player if the player is deleted. So instead you need to set up a behavior where he goes back to patrolling/following waypoints whenever he's not hunting.

    So he needs to explore waypoints by default, then he chases the player when in view (sounds like that part works already) and then have an idle behavior when the player isn't seen anymore to go back to exploring waypoints.

    That's my guess. Essentially the AI doesn't have anything to do other than hunt the player.
    Post edited by Wrofir on
  • I don't know why, but everything makes my enemy stand in place when player is hidden.

    I make a lot of Events for Idle Behaviour, but nothing works. I use Change Move AI Mode, Change Move AI and others. I can't find something like "Is Player Avaible" or something. I don't know which step I need to use to check if player is seen, Can you help me find it?

    I'm sure that Change Move AI worked... I think. When I'm hiding in closet, enemy stand in place, but when I'm unhide, the enemy just flee from the player, so something works. But now there is a problem - he stand in place, when player is hiding. And this is the worst :P
  • Well, it's hard tell like that - could you send me a small Unity test project with your setup (where I can hide/unhide) to check it out? E.g. upload it somewhere like dropbox and send me the link to contact@orkframework.com :)
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I send to you link to this project. I just copy/paste events to new Project and create something similar to original. There is Closet (click on it from front), a enemy MouthMonster with waypoints and player.
  • Alright, thanks - will check it out tomorrow.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Oh, and I'm working on Unity 2017.1.0f3. I buy ORK Framework in 2017-10-14 so I'm working on version 2.14.1, this is the last version I downloaded from Asset Store before you do ORK Update Policy Changes.
  • Checked out your test project. Your issue is the move AI's behaviour when the game object is destroyed (which pretty much just waits for the target). I'll change that in the next update, so that destroying the target will have the move AI return to idle/waypoint mode.

    However, you can also solve this in your current version by setting the move AI's target with the waypoint mode:
    - add an actor that finds all MoveAIComponent components (e.g. within a defined range)
    - use a Set Move AI Target node using the Waypoint movement mode on that actor (the target object can be ignored in that case)
    Best set the move AI target after a small wait after destroying the player, e.g. following the camera position change.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Yeah, it works! Thanks!

    After hiding in closet, the enemy goes to Waypoint. He Can now hunt player if he see him.

    Another question - how Can I tell my enemy to go back to following waypoints? Or to follow other group of waypoints? I try to use "Set Move AI Waypoints" with MoveAIComponent, but nothing happend. Is there a way to do this?
  • It's probably due to the enemy detecting the player again. Try using a Change Move AI Mode node and use the Idle mode.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.