A couple more problems (Involving AI)

This forum is currently in read-only mode.
From the Asset Store
A collection of various characters spritesheets for creating a 2D top down, RPG, tower defense, or other similar game.
  • Hello again. I have decided to make a Pixel Art game to practice more in construct, and I have some problems with the AI of enemy ships.

    1. - All ships choose the same Way-point

    I don't know how to tell the ships to choose their own way-points and stop being such hogs.

    2. - The bullets only come from one of the ships

    When the bullet shot from the enemy is created, it only comes from the first created ship, not from the one that want's to shoot me.

    3. - I don't know how to change the angle of the enemy ships when they are going left/right (I.e. player)

    How would I get the ships to look left when going left? Or vise-versa?

    .cap file: http://www.megaupload.com/?d=08UA0ZIY

    Please help where possible.

  • 1. - All ships choose the same Way-point

    I don't know how to tell the ships to choose their own way-points and stop being such hogs.

    First I thought it was just a matter of maybe putting a For each loop somewhere in there and indeed some of your events didn't look like they were doing the picking quite right, but on further investigation it seems there's something messed up with the RTS behavior. It either just moves the first created object or picks them all it seems in some cases.

    One case being doing the action at start of layout:

    Recreated it in a simple cap (Start of layout -> RTS move to object Target) and it still only moves 1 instance.

    Other than that putting a Delay condition in there seems to break the picking again. It will move all instances... quite annoying.

    Well, I hacked your cap a little. Got rid of the Wait object, replaced it with a private variable. Also couldn't use Start of layout for the first move action. That's also fixed by setting that private variable to 0 at start. Guess you'll have to look into it.

    http://dl.dropbox.com/u/2306601/RTSthing.cap

    2. - The bullets only come from one of the ships

    When the bullet shot from the enemy is created, it only comes from the first created ship, not from the one that want's to shoot me.

    Can't say I'm an expert for this since I haven't used LOS for anything so far. But what I can tell you is that you should spawn your bullets from the object directly. So don't use System create, but try the Spawn object action of the ship sprite itself.

    I changed it a bit accordingly. All of the ships are shooting. But for some reason the LOD seems still off. It seems hardly predictable when ships will actually shoot. Somebody else might know how to handle this better, or maybe I'll find out once I fiddle around with it.

    3. - I don't know how to change the angle of the enemy ships when they are going left/right (I.e. player)

    How would I get the ships to look left when going left? Or vise-versa?

    That one is quite easy. You should check "rotate object" under RTS behavior. Then go down to your object's angles and select N angles. Set the number of angles to 2. Be sure to have auto mirror checked too, and you'll have the plane facing left when going left and right when going right.

  • 1.

    On the AI event sheet change event 4 change "Start of Layout" to "Timer equal to 0" and add a "For each npc_zefi_tier1ship" condition.

    + System: Timer is Equal to 0
    + System: For each npc_zefi_tier1ship
    + npc_waypoint_generic: Pick one at random
    -> npc_zefi_tier1ship: Move to npc_waypoint_generic 
    [/code:2vp89ioj]
    Also on event 7 remove the "Delay 2000 ms" condition as it causes all the enemy ships to be picked.
    
    2.
    The fixes for 1 pretty much fix 2.
    
    3.
    What PixelRebirth said.
  • Thank you guys so much! This helped a lot.

    EDIT: Erm, I have a new problem.

    <img src="http://img222.imageshack.us/img222/7579/errorp.png">

    Something about the event that makes enemies shoot. Which is important, so I cant just ditch it.

    What do?

    http://www.megaupload.com/?d=B6RHQIZS

  • PixelRebirth and R0J0hound already answered your questions, but I don't want to throw it away, maybe you'll use something

    http://dl.dropbox.com/u/10457408/Constr ... rogame.cap

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Uncheck the Application property "Enable Scripting", unless you are using python scripts.

  • Uncheck the Application property "Enable Scripting", unless you are using python scripts.

    That worked. Thank you!

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