AI Run Away and Lock on to target

  • Well I believe this is my first post... YAY!

    I have no idea what I am doing... I am building a space MMO (long term goal, keeping it simple right now, then building off that). What I need right now before I publish the basic game to my website or online is the following...

    • When player fly to a safe zone, AI will either (A) Stop and wait for player, then after X seconds will fly away and go back into roaming mode. (B) Ai will turn around and go back into roaming mode.

    Right now this is partially working, the AI comes toward the player at random directions, but when a player hits the safe zone the AI all fly LEFT.

    • Player should be able to lock onto AI by mouse click, and keep their ship facing the AI direction while being capable of flying in other directions (using this as a form of maneuvering away from additional hostile zones while in combat)

    There, of course, is other elements im working on, but i would like to see what I can find on them before crying 911 about them.

  • Hiya,

    1. That will likely be a picking issue, you can't really say AI do such a thing as it will apply to all AI at once. You need to give them states which can be done in variable form. Try 'waiting' or 'roaming' and say if AI is waiting do this, or if AI is roaming do this.

    2. You can select an AI with the mouse and then set a variable on the AI to true. While this variable is true you set the player angle toward the AI with condition where this variable is true.

  • That will likely be a picking issue, you can't really say AI do such a thing as it will apply to all AI at once. You need to give them states which can be done in variable form. Try 'waiting' or 'roaming' and say if AI is waiting do this, or if AI is roaming do this.

    Im sorry, but it doesn't seem like you gave me much help here? This waiting/roaming option is what I am trying to do, but how to do it is the problem. I just started messing with Construct a few weeks ago and some of the terminologies is still getting used to. The only "variable form" I am finding is the option to add Instance Variables, but that doesn't seem to be the option I want. the AI currently do roam freely, and each individually responds to the player when it is in range (moves in the players direction). I did just check the "Compare Two Values parameter i used for the "Fly to player when in range" function, but that doesnt seem like the right spot.

    2. You can select an AI with the mouse and then set a variable on the AI to true. While this variable is true you set the player angle toward the AI with condition where this variable is true.

    I have this option right now, currently, my mouse controls are as follow...

    • When left button is CLICKED on AI the player is angled to face the monster.

    • When left button is DOWN the player rotates toward mouse position, and finds path then moves along this path.

    I want my player to be able to use the mouse to move the character, but I also want the mouse to be an interactive control used to target enemy AI as well is pick up loot.

  • Im sorry, but it doesn't seem like you gave me much help here? This waiting/roaming option is what I am trying to do, but how to do it is the problem. I just started messing with Construct a few weeks ago and some of the terminologies is still getting used to. The only "variable form" I am finding is the option to add Instance Variables, but that doesn't seem to be the option I want. the AI currently do roam freely, and each individually responds to the player when it is in range (moves in the players direction). I did just check the "Compare Two Values parameter i used for the "Fly to player when in range" function, but that doesnt seem like the right spot.

    I have to make assumptions as there are no events posted, only a description of the issue that occurred. I also made an assumption on your skill level as you look to have implemented something already and mentioned you are making an MMO so I didn't go into detail with the specific how to, only the general. If you're sure that the picking is correct and it's not a problem with actual implementation then I can't help any more with this, it sounds like a bug. I would have to see a screenshot of the events or a shared C3 file to help debug the issue.

    I have this option right now, currently, my mouse controls are as follow...

    • When left button is CLICKED on AI the player is angled to face the monster.

    • When left button is DOWN the player rotates toward mouse position, and finds path then moves along this path.

    I want my player to be able to use the mouse to move the character, but I also want the mouse to be an interactive control used to target enemy AI as well is pick up loot.

    Potentially you could have the main character object that always rotates toward mouse position for movement then have a visual character object pinned to it that either faces an AI if selected or faces mouse position if AI not selected.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here is the dropbox link to the files of my game. I don't use Dropbox a lot to know for sure what I am doing, but from the looks of things, you should be able to download. You are welcome to mess around with it, though if you find what the problem is, either fix the issue or simply explain it and I will compare it to what I have to see what I have wrong.

    dropbox.com/s/mh2i1om8zmb67z3/Sol%20Surpremacy.c3p

    As for that pinning option you're talking about, from the time of this post, I'll see if I can manage to figure that out, it sounds like what I am trying to do.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)