Picking from Picked Instances

0 favourites
  • 10 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • CAPX: sugarsync.com/pf/D6025908_4317202_6992586

    === PLEASE SKIP DOWN BELOW TO THE UPDATE ===

    Starting at line 3 on the "ES Enemy" event sheet, I'm attempting to set up conditions that tell the Enemy instance to find the nearest PatrolNode within the NodeZone (so that it doesn't try to find a Node outside the proper patrol zone even if that other Node is closer) and then follow the patrol routes I've defined.

    The enemy will go through a series of statuses:

    1. Normal - within each NodeZone, follow the patrol routes setup by the PatrolNodes within that zone.

    2. Chase - the enemy will chase the player...

    3. Alert - the enemy will randomly search for the player within a range from the last point it saw the player.

    4. Resume - Return the the enemy's assign NodeZone and resume the patrol as defined by the Nodes in that zone.

    But at present all I can get to work is the chase, alert, and resume statuses. The enemy will not even select a Node to seek out. Can anyone see what I'm missing?

    ===========================================================

    UPDATE: Related issue but not quite the same as before.

    In the "ES Enemy" event sheet, line 12, I'm trying to pick those patrol nodes that are within a particular zone.

    The enemy and the nodes are assigned the zone's IID - it's "home base". This way, after a chase, it can return to its original patrol area and not just any patrol path.

    So, after a chase...

    • Pick all patrol nodes which have an HomeZone instance variable value equal to the HomeZone instance variable value of the enemy.

    -- From those patrol nodes that are picked, further pick the nearest one to the enemy.

    -- Find path.

    Everything works up to event line 12. But for some reason the enemy will not return to the node it's closest to within its own zone.

    Also check out the "ES Setup" event sheet, lines 4 and 5. That's where I assigned the IID of each patrol zone to the HomeZone variables.

  • OpPASS v1-1-4-3 enemy redo_BHT.capx

    I changed a number of things. You'll have to decide if they are for the better.

  • Thanks, :D I'll check it out...

  • blackhornet - Okay, so here's where I stand with your changes...

    Event: Your changes

    Action: Set MyMind to "blown"

    I never once thought to look into using the Browser object. CLEARLY I have some research to do!

    In the meantime, can you give me a summary of what's actually going on with the use of the Browser object, please? Like, amongst other things, what's all the "Log in console" about?

    Thank you so much! You've just helped me complete the final piece to what's been a three-month headache!!! lol

  • "Log in console" writes messages to the browsers Console window. I prefer Chrome for debugging, so if you run your game and press F12, you'll get the Developer Tools window popup. On the Console tab, you'll see all of the messages there. This was invaluable to finding your problems as I just added messages at appropriate places and I could see which code was being called, and which wasn't. Most of the logging is actually gone now, as I changed things around.

  • blackhornet - I think I understand. So it won't hurt anything if I were to delete such Browser events/actions? (I'm gonna read up on the manual before I change anything, though.)

    I noticed a couple of things, though, when I repositioned the patrol zones.

    CAPX: sugarsync.com/pf/D6025908_4317202_6971329

    1. The enemy does not automatically begin his patrol at the start of the game.

    2. When the enemy approaches the upper-left Node, it seems to stutter.

    3. I didn't change anything in my PatrolRoutes event sheet, but when the enemy approaches the upper-right Node, it never takes the occasional downward trip to the bottom-right Node. (I'm considering altering this set-up anyway - removing the random nature in which way the enemy will go when it reaches a junction.)

    What can you see in light of these issues?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • a) You haven't set up the HomeZone values on all of the objects. NodePatrols are 1, Enemy is -1, and NodeZone is 0. They need to match.

    b) You need to figure out your NodePatrol pattern. I made several assumptions. 1) that the Origin is in the middle, but you've moved some, (top-left) so the Enemy stops without overlapping, but the code that picks the next NodePatrol picks the non-overlapping items to pick next, which will include the top-left which it just arrived at. 2) (not in this code, but my previous sample) I was just picking the farthest node, but there where only two at the time.

    Once you figure out how to pick the next node, then you can code the steps appropriately.

    a) You haven't set up the HomeZone values on all of the objects. NodePatrols are 1, Enemy is -1, and NodeZone is 0. They need to match.

    b) You need to figure out your NodePatrol pattern. I made several assumptions. 1) that the Origin is in the middle, but you've moved some, (top-left) so the Enemy stops without overlapping, but the code that picks the next NodePatrol picks the non-overlapping items to pick next, which will include the top-left which it just arrived at. 2) (not in this code, but my previous sample) I was just picking the farthest node, but there where only two at the time.

    Once you figure out how to pick the next node, then you can code the steps appropriately.

    You can delete the browser object at any time. It's just logging for debugging.

  • Thank you, once again, I'll look it over and see what I can work out. I'm probably gonna scrap my Patrol system (during Normal status) and try to simplify it... May I petition you for further help in the future?

  • Happy to help.

  • More help, please? (See the UPDATE to the original post.)

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