Rable's Forum Posts

  • Let me tell you something. You absolutely ROCK!

    I tried your solution exactly as you proposed it, and everything works wonder! Now both effects are implemented nicely into the game, and my code is cleaner and shorter than it was before, also thanks to the advice of other people in the first replies, which also have my gratitude. But best thing is that I learned a lot.

    Thanks for your kind words about my game. If you like the mobile version, chances are you will like the PC version I'm working on. The mana bar is now placed in the center bottom, but it's not as important as it won't be touch-based anymore and you shouldn't have your thumb before the screen. But I keep your feedback in mind for the next mobile update.

  • Wow, thanks a lot for your time and explanations! I think your solutions should work.

    I'll try it tonight and let you know how it goes.

  • It will surely work if you copy health to health2. You can leave all your conditions as they are and use health2 variable only to pick the lowest health alive.

    Actually, once I picked the lowest health character alive in the family, I still don't see how I can modify the health of the object's instance variable... Is this possible?

    I mean, health2 would be the family instance variable, and the family member will be selected, but how can I add health to the object instance variable without knowing which object it is, even if there is only one object picked?

    As far as I know, it is not possible to modify "health" to the family object picked if "health" is not a family instance variable, even though all the object in the family have such an instance variable defined.

  • Oh that's awesome, I wasn't aware of this "pick lowest value" in a family condition. I checked for it in system conditions but was unable to find it. Great! Thanks!

    Hmm, yes I'm tempted to do the leap and remove all my "health" object instance variable by a "health2" family instance variable. But, let's face it, I have more than 25000 events in my game right now, working on it for more than one year, and as the game is "Healer Quest" I let you imagine how often I am referencing to the "health" variable... ^^' Probably thousands of times...

    Is there any way to do the job more quickly than creating "health2" as a family instance variable and edit manually ALL instance of the "health" variable to "health2"?

    At first I was thinking about copying health to health2 every tick... but I need to use health2 for the effect we are talking about (the effect will be to make the character gain life), so I doubt it will be of any use. :/

  • Thanks for the message. To reply your questions I have most of the time 4 characters to manage. They are all separate objects (but together in a family, though all instance variable are object-based (see EDIT above)). Furthermore, they may die and come back to life later in the same stage.

    I'm sorry to say that I probably don't have enough knowledge to fully understand your proposal. I can sure create such a dictionnary, but I have a hard time understanding how it could relate to picking one character at random, even more since the characters are 4 different object. Could I ask you to ellaborate a little bit further?

  • Thanks a lot for the solutions! It will be quite easy to put in place.

    EDIT : not so easy actually, as each instance variable of my characters are implemented as object instance variable, not family instance variable. The problem now is that I can select the correct character using the "character" family, but how can I impact the health of the selected object instead of the health of the family member selected? (the Family has no "health instance variable, only objects).

    I tried to delete the object instance variable and recreate it in the family, but deleting it would delete all actions and conditions, and thus not be possible. Is there any solution? Rewriting my code and put all health and other object instance variables to family instance variable is not an option at this stage.

    Now I also would like to create another effect in the same vein, but this time, instead of picking an instance at random, I would like to select the alive character which has the lowest health.

    I could start the same way by selecting the characters who have their "alive" value to 1, but then I don't see how I can compare the values of their current healths in order to pick the lowest one. Is there a way to do so efficiently?

    I thought I would be able to do so with "pick by evaluate", but it seems like it could only compare different values between them, not picking the instance which has the lowest value of one family instance variable.

    Another way would be to not use families, but the way I described in the first post and do :

    min(char1.health, char2.health, char3.health, char4.health) but only taking into account the values which are higher than 0 (otherwise it means the character is dead).

    Any idea how I could do one of these?

  • Hi,

    I would like to know how I can exclude numbers from a "choose" expression based on what happens in my game. Here is what I want to achieve :

    I have 4 characters and I want an effect to apply to one of them at random. Very easily I wrote

    set Value to floor(random(4))

    Value = 0 --> apply to character 1

    Value = 1 --> apply to character 2

    etc...

    Now I would like to apply the effect only to characters who are alive. Here it gets more complicated. I really can't find a way to do this efficiently.

    I planned to use "choose" but then I need a way to exclude the values corresponding to a dead character...

    Any idea how I can achieve this?

    Thanks a lot!

  • Haha! Thanks anyway!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Indeed, and looking into this template I was able to figure out the problem : the event I used was "on key pressed", while it should have been "key is down". So it was logical that the jump sustain couldn't be taken into account.

    Thanks a lot for your help!

  • Hi,

    I'm working on a platformer, and would like to use simulate control "jump" with another key (object > simulate platform pressing jump)

    But I'm using the jump sustain property, and with the simulated control, only the small jump can be played, while using the up arrow I can make higher jumps.

    Any idea how I can make the jump sustain to work with simulated controls?

  • Hi,

    I tried to implement a more complete Save/Load system into my game, using the system actions "Save" and "Load". I was previously using Webstorage with good result, but as I am developping a much more complete desktop version, I would like to change the way the game saves.

    Up to now, I have very mitigated success with the Save/Load system actions. the game loads at the right place, but when I launch a level afterward, enemies are not attacking... for the complete game!

    This is a bug I never have when playing the game normally, so I wonder how this could happen and how I can resolve it.

    I checked this tutorial, which states that the only things that are not saved are :

    • Input state (i.e. mouse position, or whether the player was holding keys or touches)
    • AJAX requests
    • WebSocket connections
    • The XML object
    • User Media video or audio feeds
    • Facebook login
    • WebStorage state
    • CocoonJS/Windows 8 state
    • Any in-app purchases on any platform
    • Anything with the 'No Save' behavior

    But I don't think my problem could be related to any of these. I tried to save my game at different times, on 3 different layouts and it wasn't better. I thought it could be due to Save not getting the groups in the right state (activated/deactivated) so I copied my "group management" group (putting each group correct at the beginning of a layout) before loading the game, but it didn't change anything (thus I suppose each group state is loaded).

    I save and load on the same computer and same game version (I just play 2 minutes, then try to load)

    Could it be due to the fact that I was previewing the game inside Construct 2?

    Any idea of what I may do wrong?

  • Problem fixed! Indeed "Global" was set to yes. I've set it to No, and it fixed everything!

    Thanks a lot!

  • Hi everyone,

    I'm experiencing a very weird "bug" (though probably a mistake on my part) with an object. Here is the simplified situation :

    I have a layout1 and a layout2. and I have to pass from one to another. When doing so, one object does not disappear. Always the same object, and only this one.

    Concretely, this object appears on the layout 2, but is never created, spawned or something else on layout 1. Still, when switching from layout 2 to layout 1, the object stays there, at the same size and same position than it was on layout 2. I tried to create multiple instances of this object on layout 2 and they all appear on layout 1.

    Even more surprising, if I destroy this object at the start of layout 1 (which was my only solution), it is also destroyed on layout 2 !

    I already had the same problem with the same object when going from layout 0 to layout 1.

    EDIT : I foud a solution to my problem : I destroy Object 1 at the start of Layout 1, and destroy it also at the start of layout 2, then recreates a new object just afterwards. But this sounds like a workaround. Does someone have an explanation of what's happening?

  • nimos100

    It worked out! Thanks a lot, it really helps + I learned a lot!

    Instance variable in families is definitely something I will use in the future.

  • nimos100

    Thanks for the reply!

    [quote:32bvka2k]If you just need to select a random enemy on the your combat screen you can use "Pick random instance" from the system tab, and then you of course just choose the family as being the object.

    Yes it could work, but there is one subtility : there are (up to) 3 enemies on the front line, and up to 3 enemies in the back line. So I'm selecting a number between 0 an 2 and the ally attacks the line of enemies corresponding to this number. If the enemy on the first row of this line is already dead, the ally attacks the back line enemy of this same row instead. Now if I'm selecting an instance at random, the allies won't attack enemies on the back line before every enemies on the front line are dead, and that's a problem.

    I probably misexplained myself, as I never need to select an enemy type at random. This will be based on the current level. However what I need to do is to select one given instance of an enemy type, based upon a predefined instance variable which is equal to 0, 1 or 2 (the "number" variable, which defines the row number, so that the ally could attack the back line enemy sharing this number with the front line enemy, if the front line enemy is dead).

    So it can't be an instance at random, I'm afraid.