Private Variable Picking Problem

This forum is currently in read-only mode.
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • So I'm working on some enemy AI. I'm trying to streamline a lot of the movement so that I can cut back on events by using families, and using containers to pair up a collider/AI object with my graphic/Stat object so my enemies can have proper collision detection when navigating the environment.

    Enemy is in Family "Enemy"

    AI is in Family "Red"

    <img src="http://img256.imageshack.us/img256/9360/enemyaibugged.png" border="0" />

    The above is basically the template I plan on using to make my enemies perform various actions, up to deciding when to attack the player. The Enemies find their AI just fine, which is great. They stick to their coords and all that jazz.

    Unfortunately, nothing gets detected after that. Any action with a PV checking condition doesn't perform at all. It's not just with Family PV checking; checking the specific objects' PVs yield the same result.

    Moving the movement action outside to "Always" or "At Startup" does cause the enemy to move. Also moving the "Is moving" conditions and animation actions out of the PV check allows the enemy to animate.

    I've tried using "Pick by comparison" to evaluate the PVs, but it ends up picking every enemy who's State is set to "Idle", causing the enemies to try to change animations between their own movement states. It also eventually causes the game to crash when opening a layout with the enemies in it, with no other solution than to delete all events associated with the "Enemy" and "Red" Families. Really bizarre.

    I also tried to pick by adding an additional PV that would pair up the Enemy and the AI rather than using a container, but that didn't work either and just ran the actions for all instances as long as one instance fit the bill.

    A bit frustrating, to be sure.

  • Perhaps it would help to think of families as groups of different objects rather than a bunch of instances.

  • Well it's not an issue with the Families, but with PV picking. Like I said, even if I replaced the "Red" PV checking with the actual object, the results are the same.

  • Well families have always had issues using variables, but if instance's variables are not picking that would be something to do with getting the correct value.

    Might try something like value is greater than 0.

    Otherwise upload a cap, and someone can take a look at it.

  • Well, here's the cap:

    http://dl.dropbox.com/u/20459682/eclipse.cap

    The events in question are in the event sheet "Game Systems", they're the last group of events, so they should be easy to find. That's the only spot in the game where Enemies and AI are referenced.

    When you test it for the first time it should jump to fullscreen, which is inconvenient for debugging. You can go to options and mess with the screen settings and set it to Windowed mode. It'll save a config file after you select save settings and then refer to that to restore settings so you only have to set it to windowed once. Clicking and dragging on the screen will let you move it; it's a bit clumsy as I haven't finished that feature yet, but it works fine. You select menu options with the Action key, default mapping is Left Ctrl.

    When you get to the actual map just take a right and you'll see the enemies in question, and their corresponding AI objects (I have them visible for debugging purposes).

    I also highly recommend you "Debug All" rather than "Debug Layout". The game will not work properly otherwise, as it requires a number of arrays and objects and configurations created on startup.

    Hope someone can figure something out!

  • When using families a container will only pick the paired object type, the family the paired object belongs to won't be picked.

    Here's a solution:

    1. Add a variable to the enemy family and call it 'pair'.

    2. Add an action to "always" or "start of layout" to set Enemy('pair') to Red.UID.

    3. Then for all the events that need to pick the enemy paired with Red add these two conditions.

    + For each Red

    + Enemy 'pair' equal to Red.UID

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, that at least solved the issue of animating them separately, so cheers for that.

    I think what it might be is the PVs not being correctly evaluated. I just remembered a bug way back where testing out PVs on Families wasn't working right because the order in the object wasn't the same as in the Family? I thought that bug was squashed though.

    I found that once I put the "Set Red.Value('Timer') to Red.Value('Timer') - 1 * TimeDelta" into the "Always" position, it was modifying Red's "EnID" value, not "Timer".

    I did another attempt at "Pick by comparison" and input the values manually, and the checking worked. The setting of the PV didn't, but one workaround at a time, I guess.

  • So good news! I've solved it, for now.

    I opted to remove the Family completely, then reorder the AI object's PVs into alphabetical order. After that, when I re-added the family "Red" to the AI, when it put in the PVs it ended up in alphabetical order as well, and then they started matching up. It's a bit of a hackaround, but at least I've got it working now.

    Thanks for all the help lately, guys! I appreciate it!

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