CJD's Forum Posts

  • When the loop ends yeah, Would me switching from a for every ( loop )

    to a pick one with that characteristic not close that loop?

    In my head it would be, and correct me if I'm wrong;

    For every ViewRange...

    Pick an AIHolder who does not equal the owner of that ViewRange.

    So in otherwords, if another AI sees another AI, pick an AI in its view range that isn't itself.

    Again, this is an Interceptor AI, so it needs to know where its buddy is, and where the player is.

    If its buddy is engaging another target, jump in and attack the player.

    Maybe it would be better if I switched that for every to a pick single ViewRange because it would apply to every AI holder thats true to anyway,

    But this is the only way that worked for me so far so no chance that idea would actually work.

  • I cannot set it to true else it'll always be true for all that applies within those conditions.

    So if true means it'll follow the player, it will follow the player.

    If it isn't true it will not follow the player.

    Even if the opposite is true for either of these at some other point in time, it will still favor the first result.

    Which is why I'm forced to use a toggle since it seems to get around this issue.

    Also, I assume C2-3 read from the top down with sub events happening every other tick, don't see why a else after a loop is a bad thing.

    When I loop through all the view range instances, I close that loop by then picking one out of all of them with those characteristics.

    The reason why I don't skip the first step is because I want this to individually apply for every AI instance.

    But you did mention something interesting, what do you mean by it isn't defined and how would I better define it?

  • No ideas on eliminating random Boolean triggers?

    Because currently what I'm doing to get around this is kinda messy, I mean, anyone reading this post can see what I mean,

    All of this is to make sure the boolean is set to false when it needs to be false, and toggled if it meets certain conditions to true.

    I can't eliminate all of these and simply have an elseif statement immediately trigger something false or true,

    It just doesn't work, and I have no clue why.

    So instead, its abunch of comparisons with set false,

    And only one toggle to set to true.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It did not work, and I'm gonna chop that up to I don't know how even after doing research into it.

    However, good news, I came up with my own solution, it isn't perfect but it does exactly what I want it to, doesn't change my code, and works for each instance of the same object.

    Doesn't use families, Doesn't use unique objects, Doesn't use LOS.

    Well, technically it does use a unique object, but this unique object is pared with my AI anyway lol.

    Its VisionRange, which is a sprite that acts as my own custom LOS.

    Then I used a boolean, which I had to fidget with to get working, again, it isn't perfect and it tends to flip true/false on random occasions,

    But I managed to eliminate as much of it as possible.

    This whole thing is so jank but I don't mind it at all, specially considering I couldn't find these answers on any forum post, always suggesting the easy route which ever it may be,

    And trust me I've seen all kinds of methods to differentiate instances of the same object.

    Id love to post how I made this later in the forums, I don't mind sharing this tech since once it goes into a final product, it wont be recognizable.

    Here's a picture of what I did, feel free to suggest any more methods of eliminating that random boolean swapping nonsense it tends to do:

  • Each AI instance actually has room for option 2, but I didn't think I'd ever need to utilize this as a method to get it to work.

    Each AIHolder has a Variable "Entity ID" or EID, which it would use to spawn a sprite according to that EID.

    I won't be doing the keep each AI instance as a unique one, because thats not the direction I'd like to take.

    Its the easy path out and although attractive Id have to make a unique instance for every AI Id implement, and likely copy and paste code for each.

    So long run, not optimal, also not as customizable as it would first seem.

    I'll first try the family method then try the dummy sprite method ( since there is room for it and it was technically planned, kinda ).

    Thanks for the reply, I'll be back with you if it is or isn't the solution.

  • This isn't relevant to the problem but it does show in action how all of this works.

    These are gifs of my AI in action.

    Interceptor ( when it sort of works )

    i.gyazo.com/fe2823c08cc625c7cd208861d2144937.gif

    Aggressor

    i.gyazo.com/f5f8930650db6a83490a6764fc3d174d.gif

    Self-Preservation

    i.gyazo.com/dc5e3e126ff960110c22a78fdd6fd162.gif

    So this is proof of concept that this does work, but I have to fix it after adding something new just about everytime.

    And yes this does still hold up when there are multiples of the same instance, I make sure of it with condtions and variables narrowing it down, this thankfully still works even at the current version of this project.

    This also works without families, and If possible I'd like to keep it that way.

  • The idea for this custom AI behavior is an Interceptor,

    If me the player is busy with dealing with AI #1,

    AI #2 will jump in when I'm in engagement distance of AI #1.

    I previously had gotten this to work, but every time I add a new AI Module/behavior, it breaks, or something breaks, Bit tired of Construct's Path finding behavior and if this keeps up I'll just have to make my own, which ive seen people suggest doing in the forums.

    I don't want to do this because I've already broken through so many hurdles people usually give up on with this path finding behavior and I would love to share what I found to finally give people answers that traditionally, forums go inactive due to not having a solid answer for.

    I'll send picture of the project file, I know I'm going to get questions as to why its messy or, why I'm using so many "unnecessary events", which will give me extra to read into so when you get a hold of this picture, try to refrain from mentioning it;

    Now because I agree that these questions are valid, know that I can always minimize my project later on.

    Also, everything in this picture is required for the AI to function,

    This is a test bed project so everything is very minimalistic.

    So although I doubt it'll be brought up, just incase, try not to divert your focus; We cannot solve this without your 100%.

    The picture will show the structure of how events should play out in order and what most of the relevant ones ( to this problem ) do.

  • This works! With some modifications.

    ( I had already thought of this part )

    I made a library/table for the possible connections and exceptions, integrating that with this connection system ( with modifications being that I have it move to invisible sprites named "Receiver" and "Sender"; Sender being where it starts and Receiver being where it ends. ) These invisible sprites always position themselves with a function kinda like an image point.

    This way I don't have to copy and paste this whole thing over and over for each function.

    For communication I have a group referencing everything in the library/table using event triggers, then a variable in each function to confirm the connection was correct.

    It runs a script in the background that gives the function its functionality, I plan on doing this to objects in my game, there will be the fake coding system you can see with the rest being handled by a script in the background ;)

    I had always thought of how Id approach it, but upon tinkering with the connection part; It seemed to have been abit more of a challenge than initially thought.

    Weird too because I thought giving each function functionality would be the hard part.

    Definitely crediting you for this! You have no idea how frustrating it was for me when I have everything else done but this small little detail!

  • I'm legitimately considering using the Javascripting service to get around this problem because at the current moment I don't have the brain power to understand how Id use the code-blocks C3 offers to make what I'm trying to make.

    I suppose I should explain what it is I'm making:

    I am making a simplified, dumbed down coding interface for a game I wanna make.

    But I need some way to get every expression/variable the player uses to interact with each other and send data so that the player can make their own "script".

    The way I was planning on going about this was, I have a variable ( those "and", "Function", "OBJ", "Then", etc etc sprites you see on screen ) Then by clicking on one variable and another, you make a link.

    This link sends information which is then processed by the system to get a read on what the player is writing for example:

    IF > OBJ( Door ) > MEM( Closed ) Then > MEM( Open )

    Super simple; Causes a door to open if its closed, and it gives my game something unique I can build puzzles around.

    I think Id be done by now if I could reference objects using variables but C3 simply won't allow it and trust me I've looked up and down and read paragraphs worth of stuff on their system expressions & variables help page for an alternative way of doing it.

  • Pardon the late response: This method *works* but there are acouple problems I've had with it.

    Firstly, I obviously can't move the object I make a connection to otherwise the link will break ( I mean by using a drag and drop behavior ).

    Secondly, when it comes time to connect different objects together; They actually won't connect unless I make a variable for every possible connection.

    ( Which I won't do because I value time quite abit. )

    This gif shows both problems in motion:https://i.gyazo.com/9113f1d48c56c5b87e151cf839f6ce31.gif

  • Can't seem to get that to work,

    I might just have "CurrentSelected" do what it already does and simply use it to store data on what I have selected.

    Have a group store every possible connection referenced by two instances of CurrentSelected,

    Then have two instance variables on the link beam ( link 1 and link 2 )

    Along with a third called "Data" to return the type of connection made based on the name.

  • lionz So for reference I have a Global variable " CurrentSelected " I set that to the UID Of the last object I clicked before clicking the second object and making a beam between the two?

    I'll try it, sounds like it might actually just work.

  • So, I want to make a beam from an object I selected to another object I select later.

    I represent that object I selected with a global variable.

    Now obviously when I do this, I get an error "'CurrentSelected' is not an object. "

    Because it's obviously not an object:

    But this is frustrating because in other game engines I can do this just fine as long as I wait for the game to create that instance of that object with something like " waitforchild("Childname") " The child's name being stored using a global variable.

    I can't do this in Construct 3 the traditional way, so how would I do it the funky construct 3 way?

  • Interesting, it's a good thing I have reason for it, and it isn't just because I don't know how to compact it.

    Even if I didn't there is plenty of room for finding out.

    But either way I consider this topic closed as I ended up figuring out what the problem(s) were on my own whilst showing how it was done.

    As stated in my finished post I may show how you'd go about doing this and by then adjustments would be made.

    Some are quick to assume that it was a beginner issue, and I was kinda hoping to avoid that by asking to get straight to the point which didn't happen until I explained the problem further, which led me to the answer, which was literally a button click away, wheeze.

  • Why additional events, waits, trigger once etc.? Just spawn the bullet in the same event you set the "fire" animation and adjust its angle of motion. And give it "Destroy outside layout" behavior, so it would be destroyed automatically.

    The reason being I can interact with each individual part; general rule of thumb is to inflate a project before compacting it.

    That plus I like individuality and I may come up with a unique way to tackle a problem in the process.

    Can't always do that if I'm doing what everyone else does.

    But yeah, your definitely right; I will compact it in the future when the game releases as it'll be critical when I want to add more firearms.