HolidayExplanation's Forum Posts

  • A cosmonaut character that I'm soon about to implement into my C3 project.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Damn, your files are quite mindblowing how it all gets spread, it's flawless. Thank you so much R0j0. Only thing is, I'm not sure how to apply it exactly to having a generator that produces the power (I guess you did it with source Nodes) and machines that consume it, for this to work for me I can't be able to connect multiple generators to the same network, because then I can't track what generator is producing power for what machines and how much power they consume on a specific generator.

    I tried transforming the source nodes to act as a generator that can be turned on/off, but how can I pass around the the id of the power generator through the wires and nodes network?

    Because then at the last node of a network, which has a type that is a machine, I can find the source generator for the network by the generator id which was passed through the network to the last nodes which have the type of "machine". And then we save the machine_id and other value into the generator's container array and display to player which machines are connected to a generator and how much power they consume.

    Please tell me if I'm understanding something completely wrong...

    Could you maybe take a look at it in the file of yours i edited?

    easyupload.io/erascr

    p.s. thanks for making your plugins available publicly back in the day, used a few of them in c2 (:

  • What you are describing sounds swell, but trying to implement it gives other problems that I cannot find a way to solve;

    • Removing a cable works
    • Connecting the objects numerically initially works

    If two cables are disconnected from the line and you connect one back or turn on the generator -> it will set active all that have a bigger ID than the one reconnected, even though there's one cable missing in the line. If e.g. cable of ID 2, 5, 9, 11 are disconnected and I connect 9 back, I can't just give power to all cables with ID > 9 and frankly I haven't found a way around it, am probably too stupid.

    If one relay has 2 cables each going in a different direction, they both have the id of let's say 4 (because they are being created from relay number 3), if I disconnect the cable line left, the cable line on the right will also get disconnected even though it's on a different line and no cables are missing.

    As said, your system may work, I don't know if it does, I tried my best implementing what you said, but without any success, because while doing so a lot of other issues turn up that I can't manage to solve. Thanks for your time.

  • Sorry, this should work, you can do the same kind of logic for going up/down

  • To avoid this I recommend you set up a Github for storing multiple versions and in Construct settings an automatic Google Drive backup every couple minutes, so that if it does happen you can revert to an older file easily and then just add back the code from the new versions. Also if you are using Google Drive to save your file online, right clicking it you have a "Manage Versions" option, there you can download an earlier version of your project that still works...

  • Actually, after trying to implement the second part (removing cables) this morning, it just can't work. If your global loop of setting all cables hasPower=true when connected to running Generator, then setting hasPower=false to all cables after it to hasPower=false too, does nothing as you can expect (it can work with 1 cable being disconnected, but with 2 it doesn't work, and when reconnecting when more than 2 have been disconnected causes trouble and even when turning on machines since it would give power again to all cables).

    I again had to try and do it with functions but it's just way too complicated, at least for me, if you know how to actually make a system that works, then id appreciate you doing it in a file, otherwise I'll be giving up on this since I can't take spending an hour again and have already spent too much time trying to make something work that I know I can't, it seems impossible to do...

  • Again you use the data that you made yourself, you have a route of numbered nodes. If you disconnect a cable then you set to inactive all cables that are in the same route (same gen ID) and have a higher number in the path.

    That's so simple that it's ingenious. I finally got it all working with your method.. Can't thank you @lions_ and @Radiowaves enough for all your elaborate contributions =] When I release my game on Steam I'll find a way to send you guys a key, the least I could do. This "electricity question with cables" gets posted quite a lot on the net without any apply-able answers, will finish my file, clean it up and upload it in my post as a solution for others to use. Thanks again (:

  • I would set variable/boolean "hasPower" for each Cable, Relay and Generator.

    Generator would have power set 1 by default.

    If Cable overlaps Generator & Generator hasPower==1, set Cable hasPower 1.

    If Cable overlaps Relay & Cable hasPower==1 & Relay hasPower==0, set Relay hasPower 1.

    If Cable overlaps Relay & Cable hasPower==0 & Relay hasPower==1, set Cable hasPower 1.

    Things get problematic when you want to add shorts:

    If Cable overlaps Relay & Cable hasPower==1 & Relay hasPower==1, run function "ElectricShort".

    This would be set immeadetly when unpowered Cable is overlapping with powered Relay. To tackle this, power cable could be split in two + & - side and check for those instead.

    If you do not want to run this all the time, put it into function and set it for each Cable.

    But in this case the function has to run from cable starting from generator first!

    Haven't tested it, but this is how I would start making it.

    Yeah, that's pretty much the problem, if I knew how to make a cable have +/- I would've had it working with my system 2 months ago, how I have it each cable has 2 relays and each relay has 2 cables, i tried tackling the +/- with cable_num being incremented like you can see in the diagram, each in the line has a greater cable_num by one... But it doesn't work, couldn't find a different way for detecting that yet

  • Yes the simple solution you kind of began then went for overlap checks. It's all about data and the gen ID is all you need. If the gen is down, you find all cables that have the gen ID and they are inactive. They are linked with IDs for this purpose, no need for checking overlap of objects.

    Why I went for overlap checks is because just powering all cables/relays depending on if generator with the id is running or not, is because if I only have data and disconnect a cable from a relay, it won't turn off all other cables but they will be active because generator is on. That's why I'm using overlaps to check for physical connections

  • Active true/false means that the cable/relay is connected to a generator that is turned on/off. The active doesn't change on cables/relays/machines without the recalculate_connections function, I tried that by checking overlaps every tick between cables, relays and machines. I might be making this more difficult than it actually is, I don't know, there might be an insanely simple system which could work and I'm not seeing. But, all the simple stuff I tried didn't work for me either...

  • C3 File: https://easyupload.io/vtbbr6

    What I'm trying to do:

    I'm trying to send electricity from generator via cables that can be connected to relays to extend the range and then be connected to machines that consume power.

    How I approached it:

    I need to recalculate_connections between generator, cables, relays and machines when a cable is created or a cable is destroyed and a generator is turned on/off.

    Each cable gets assigned the ID of the generator (gen_id) when created, when connected to a relay or machine it gets assigned the gen_id via cable reference. At creation of the cable on the generator (the first cable for that generator), it gets assigned cable_num of 0, when connected to a relay the relay then has cable_num of Cable.cable_num + 1, and when creating cable from relay cable gets cable_num of Relay.cable_num + 1.

    When I turn on the generator, function recalculate_connections runs to calculate which cables and relays are connected to the generator and are receiving power. It goes through the cables and relays checking for overlays and passing active = true. Then for each machine that overlaps a cable that has active = true, machine gets consuming_power = true.

    *Relays are the Component object with type instance variable = "relay" in the file.

    Problem:

    The ID assigning works, as well as passing the power until the cable of the second relay, then the cable remains active = false.

    I don't know how to solve this. If you know of a fix or a completely new system for this, I would appreciate it greatly since I'm stuck on this for months now and had tried around 15 different systems, none of which worked.

    Tagged:

  • I remember a couple years ago the only way to mod (as far as I knew) was TetroniMike's plugin for modding. I haven't yet used scripts in C3, is there a better, or even a way at all nowadays to do this with scripts or any other way?

    Tagged:

  • You do not have permission to view this post

  • That's exactly right and just what I needed! Thank you!