CJacobsSA's Recent Forum Activity

  • That does sound like a good idea since the player will be able to save the game etc, but what do you mean by incrementing and decrementing the cell values? Do you just mean making an event that sets it to "(whatever it's at)+1" upon picking up the power-up and then another for "(whatever it's at)-1" when it wears off?

  • Hello, I'm having an issue sorting out the logic with making a power-up for my game. Basically, when the player collects the power-up, a bar is filled that slowly empties. What I want to have happen is, while the bar is not empty (i.e. has a width greater than zero), the player has 1 point added to one of their stats. I'd like to do it this way so that the bonus does not stack if they collect the same power-up multiple times, therefore it only applies once while true.

    This seems like it would be pretty simple but it's turning out to be kind of hard to wrap my head around, namely because I don't know how to do truly temporary additions to variables- as in, not using two different events to add the bonus stat point and then subtract it again when the bonus runs out. If that's the only reasonable way, feel free to let me know how to do that, but I'd like if there were a more elegant solution that only took one event.

  • Ah, I figured out where I was going wrong. The button's 'upgradetoadd' variable was a number, not text. Upon changing it to text, Magistross' clarification works just fine. Thank you both for the help!

  • The dictionary thing does seem like a better idea, but I can't get it to work as you suggest.

    When I do this, it won't allow me, saying that the key value has to be a string... but it can't be a string because then it won't work for referencing the value of the button's variable, it will literally reference the string "obj_button.var_upgradetoadd". I'm not sure how to make it function in the way you've suggested.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi! I've got a problem that has pretty much stumped me and I feel like I'm missing something obvious. In my game, the player clicks buttons to purchase permanent upgrades (governed by a global variable that says 'yes, they have this upgrade'). That sounds pretty simple, but what I can't figure out is how to make it so that the specific button gives the specific upgrade.

    I've done this...

    ...with the buttons, where 'UpgradeToAdd' governs which upgrade to give the player. Where I am stumped is, I don't know a quick and easy way to translate this to the corresponding global variable ('Upgrade_x') being set from 0 to 1. Basically, what I want to have happen is this:

    When the player clicks the button (and can afford the price) -> The upgrade that is called the same as 'var_UpgradeToAdd' is set to '1'.

    But I can't do that using 'Set value' from what I can figure out because 'Set value' requires you to pick one variable specifically. What am I missing?

  • Wow, that's awesome! You really went above and beyond. Thanks, this is great!

  • Ah ok, I did not notice the edit, sorry. You are using array.indexof(0) to find the empty right? Also a valid way to do it, never thought of it. Anyway I have some suggestions as to the solution. I will give you two solutions actually, the first one is applicable in your case since you store type at index y=0. The second is more general if you need to check things at other y indexes.

    Thank you for the continued help, I appreciate it. That said, I think I still have no idea what I'm doing. I definitely get what you're saying, but I've got no clue how to put it into practice. Your explanation is fine, I guess the problem is I'm having trouble wrapping my head around putting it into Construct. Maybe running through it step by step would help?

    https://www.dropbox.com/s/d6nuv9fzqyd61 ... .capx?dl=0

    Here's the updated capx file in case you want to just show me what the finished product would look like (a la your favorite daytime TV cooking show) instead because that might be easier. I wouldn't blame you <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz">.

  • Would that solve the problem, though? It seems like that would leave me with the same issue but done via a different method. How would I make it so that happens unless the object being picked up is of a type the player already has?

    I managed to do this with the system I currently have, but I don't know how to make it check if the object being picked up has the same 'type' variable as any in the inventory (line 45), and then just not do anything if that's not the case.

  • Hi, I have a pretty simple question (at least I hope it's simple).

    I'd like this event to only occur if the inventory (Array_Inventory) is not full. The problem is that I noticed there's no action to check if an array has a value in every slot. How would I go about doing such a thing?

    EDIT: I've figured out how to check if the inventory is full using a variable and the "IndexOf" expression, but now the problem is that you can't collect multiples of the same block if there's a block in every slot. It's so close, but I have no idea how to fix that!

    https://www.dropbox.com/s/d6nuv9fzqyd61 ... .capx?dl=0

    Here is the cap file, line 42 is the one that deals with my question.

  • That's close, but it's not quite what I'm looking for, and I don't know how to adapt it to my own code. I think it might be better if I just dump the whole capx file on you and let you poke around:

    https://www.dropbox.com/s/3o5xykpvzy974 ... .capx?dl=0

    The function code I'm using to handle adding/removing things from the inventory is from this tutorial, I even adapted the comments so I wouldn't forget what everything does. I really just cannot wrap my head around how to make arrays do things.

    Down at the bottom of the event sheet you can see where I tried my own prototype tinkering to get it to work, feel free to just delete all that.

  • Hi, this is a followup question to another topic I made the other day. I realized I had another question but it's a bit bigger than the other and so I think it requires its own thread.

    I'm stuck on the next step of the process. I want to be able to find a specific item ID in the array, but I can't do "Array contains value" because the X and Y values can appear multiple times or be the same number. What I need is a way to compare ONLY the X axis or ONLY the Y axis, but I can't figure that out either. I need your help again, fellow Construct 2 users!

    In addition, if anyone can help me figure out how to make the item craftable (as in, how to search for the value again upon clicking the craft button, then remove 1 of the item and give the new item) that would be much appreciated. But I realize that's possibly a little more in-depth than you may want to go.

    The basic process would be like this:

    1. Search for the appropriate item only in the first row and its amount only in the second row.

    2. If it is found and the player has enough, display the craft button. In the doodle, the stuff required to craft a new item would be 8 of whatever Item #2 is.

    3. When the player clicks the craft button, remove the required amount (and the item itself if the resulting value leaves the player with 0 of it).

    4. After doing this, add the new item and the specified amount of it to the array wherever the next blank space is.

  • edit: moved my question to a new thread because it's a bit more in-depth than this one.

CJacobsSA's avatar

CJacobsSA

Member since 26 Sep, 2014

None one is following CJacobsSA yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies