99Instances2Go's Forum Posts

  • There is no problem in your way. It just selects no objects. The action > destroy needs selected objects to do its magic on.

  • Do you use a system > Compare two values maybe ?

    You have to use a pick condition to pick those ...

    System > conditions > Pick by comparison > Object = the family / Expression = Family.Health / <= / value = 0

    Action > Family > destroy

    I hope you made that variable on the familie.

  • Yeah but, her numbers start counting at 1, and the frames start counting at zero (zero based).

    Suppose that has her confused.

    https://drive.google.com/open?id=0B1SSu ... zZwc3lrU00

  • PixelPower, dude, you would find this so dang interresting. Because, this will pontential grow to a very nice game.

    This is gonna evoluate in a hell of job to pick the right instances. You have problems allready.

    Let me (to my best knowledge) show you the problems in 2 events.

    Event 27.

    https://drive.google.com/open?id=0B1SSu ... EdFOFJVMk0

    Instance variable Animal is the UID of the cell array.

    Every instance pinned to a certain animal has that variable. Wich is great. You planned picking.

    I feel that Cell > (action) > pick by UID ... UID = Eater.animal is easyer , but that is taste, i guess.

    I am not sure if the conditions you used has to be true to make the event true. I never used it that way.

    But.

    The conditions pick (when there is only 1 collision happening, and that is a very risky assuming)

    1 Eater

    1 Food

    & the Cell that goes with the Eater.

    The actions.

    Destroy the picked food (perfecty)

    Then Add 30 to the instance variable of a unreferenced AnimalContainer.

    Unreferenced ? Well it has no pick condition, so it is unreferenced.

    When you run an action on an unreferenced object, that action runs on all instances of that object.

    There will be 30 added to the instance variable of ALL AnimalContainer.

    Add the condition >> AnimalContainer >> pick by UID >> UID = Eater.Animal, to include/pick the right AnimalContainer.

    I am not sure why you picked the Cell. No actions adress the Cell. Did you forget something to do in that Array ?

    Or did you start with using a Container to pick all those instances and keep them togheter.

    Wich is a great way to do this stuff.

    But, you had to change your mind because each animal can have more Eaters and more Brains. In that case Containers indeed not gonna work out fine.

    But your code still seems to be acounting for containers.

    Event 28.

    https://drive.google.com/open?id=0B1SSu ... GtEek5uS0U

    Pick all sensors, picks them all.

    The pick by evaluate picks from those sensors the one who's UID = a certain Brain.UID.

    But, again, Brain is unreferenced. Therefor you feed it all Brains. Yet you forced it to chose 1.

    So, it compares to the Brain with IID=the first on in the list.

    Result: It picks the first created Sensor that goes with the first created Brain. 1 Sensor.

    The actions.

    Again. Brainsignals is unreferenced. So it sets the locations for every Brainsignals to zero.

    Event 29, the subevent.

    Subevents pick from the objects that are picked in its top event.

    So it checks if that 1 sensors is overlapping Food. Food is unreferenced, so in this case that is fine.

    It checks if that 1previous picked sensor overlaps with any of the Food.

    If there is a overlap, that sensor (still the wrong sensor, anywayz) stays in the picklist. Else the picklist for sensors wil be empty. (that does not make them unreferenced)

    Brain is unreferenced. So it compares all Brain to find one with the UID of the picked sensor.

    I dont think you have a Brain with UID = 0, luckely.

    So if that 1 (weird picked) sensor overlaps food AND if it finds a brain that goes with it, then it will (action) set location 0 of all BrainSignals to 1.

  • I believe you are looking for something close to this.

    https://

    drive.google.com/open?id=0B1SSuCVV8v74SXJhNmRWaGp4TUU

  • When NaN gets displayed it usaly means that you tried to assign a wrong type of value to something.

    But i dont see that in de your code. I dont see see anything wrong in storing/getting.

    There is one thing more i can suggest. Assign a 'Clear storage" to a key press. Run it. Press the key. Quit it. Try again.

    This will heal a corrupt local storage. We all code with try and error. With each version the local storage gets weird. This will also clear a full local storage.

    Hope that helps you out.

  • Try to set text to "some text"&str(variable)

  • blackhornet what confuses me is that C2 breaks one rule that programming languages follow:

    1.if myVar=true:

    2. dothis()

    3. myVar=false

    4. doThat()

    in traditional programming doThat() will never execute, becase myVar was set to false on line 3 and doThat is after that.

    But in construct2 everything seems to execute to the end. DoThat will do it's thing.

    Thank you for the examples. I very much appreciate them!

    There is only a 'if myVar = true .. doThis()' event possible when there are no objects involved in that event.

    Wich is rarely and totaly not the scope of c2.

    Read this : https://www.scirra.com/manual/75/how-events-work

    Understand that an event is much more then, and very rarely a pure 'if this/then that' situation.

    If the condition is true ... it runs its actions.

    If the condition picked objects AND if the conditon is true ... It runs its actions on the picked objects. (zero picked objects = no action that actual does something)

    If the conditon is true ... AND the action is adressed to a unreferenced object, all instances of that object are adressed.

    Sub picking conditon always start with the in the top level event previous picked objects.

    Previous picked objects will be forgotten in each top level event.

    Refering to programming languages is pointless. Got to forget and read the manual.

  • No arrays, just pure carefull picking and some timemanagement.

    No comments in the capx. You look closely to the events and learn, or you ask again for someone to make your code.

    Either way i am fine and happy.

    https://drive.google.com/open?id=0B1SSu ... XNPWXVyams

    Since its touch, it cant work with only a mouse.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here you go

    https://

    drive.google.com/open?id=0B1SSuCVV8v74ZkI4RGFGUkd1ekU

  • Are there differend 'sprites' in the 'humans' family ? And therefor you can't pick the nearest by its 'instance name' (instead of using the family name as you do now) ?

    Anyway. Its a bit of a dirty trick anywayz. I wanted to show you how to go for a 'distance map' solution.

    But, if youre humans family contains differend sprites (not just a family of one sprite) then i have to retink this. Probaly need two familes.

    The nearest family member (or instance) to the postition of a member (or instance) is that member on that position. Got to work arround something that is in base totaly logic. And its not that much work.

  • Based on pick nearest.

    https://

    drive.google.com/open?id=0B1SSuCVV8v74RTZ1dlloN0lTelE

    Maybe later i make you one based on distance.

  • xpired

  • Can you upload a capx ? So we (someone) can confirm. Must be reported as a bug then.