Atlas_Grey's Forum Posts

  • Yeah but it'll get messy with many different descriptions using many different variables. I'd have to add in events that check which description and what variables to substitute for each one.

  • I've managed this before by using Replace(), check the manual. So if you say "Fireball does %dam% damage" in the array, on the mouseover/set text events you can replace %dam% with the damage variable.

    That's a good suggestion. It won't really work for how I've set things up though, I'd need to create events for every different description which is what I was trying to avoid. It would be nice if there was a feature to turn a string from an array back into code.

    I'll keep this method in mind for my next game, thanks!

    Edit: I stumbled across stringsub() thanks to your suggestion. Again, it would work the same as your replace method but might be a bit easier to manage. I might give it a go. Thanks again.

  • I have a tooltip window that pulls a description from an array depending on which upgrade button the mouse is hovering over. I'd like to combine variables with the text so that different values can be returned however I seem to only be able to return a string.

    For example, if I had two variables, var_damage and var_duration, and wanted the text to say "Fireball does 5 damage over 10 seconds" I'd set the text to something like -

    "Fireball does "&var_damage&" damage over "&var_duration&"seconds"

    However if I store it in an array and use ARRAY.at(x,y) to retrieve it then it comes out looking like the text above and doesn't insert the variable values.

    Is there a way to do store/retrieve this info from an array so it reads correctly?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > when these timers trigger it randomly makes the wrong ones begin an action meant for a different boat.

    What action? Events 20-21 look good to me, you need "For each" there. The hooks should be created and attached to each boat correctly - you can check this in the debugger.

    Perhaps some other events ignore the fishing state?

    Some names on your screenshots are truncated. Is there only one "crew_b..." family?

    Can you share the project file?

    I've figured out the issue! For event 27 I added "For each sprite_crew_hook" and it works correctly now. I guess without that detail it was attributing random hooks and their "crew_boat_vessel_fam" parents.

    Thanks for your help. I would have continued to have issues without the "for each" on the On Timer events that would have prevent me from finding where I was going wrong here. Much appreciated, I hope you have a wonderful day!

  • That's why I asked to post a screenshot of the code :) The forum always makes a mess of it.

    yeah I just reread your post and realised that's what you asked for haha. My bad! I added it to the previous post.

    So there's a few timers there. One to stop a boat going off the edge of screen, one to stop it to begin fishing for the first time, one to begin fishing every time after and a timer to pause the boat for a second after fishing before it starts moving again.

  • Sorry I don't know how to format the code in the post correctly either, my apologies

  • These boats in the background are supposed to stop moving, drop a line straight down and reel it back in before they move again, however when these timers trigger it randomly makes the wrong ones begin an action meant for a different boat. Thanks for your help so far by the way, I greatly appreciate you're taking the time to have a look at this.

  • Yes, "On timer" can trigger for multiple instances, if their timers expire at the same moment. The easiest solution is to add "For each" condition.

    Where do I add the "for each" condition? It doesn't seem to make a difference if I add it to the "On Timer" condition or the event that starts the timer.

  • I have a family of (boat) sprites using the timer behaviour to control their individual movement. The boats are supposed to independently move on their own timer, stop, cast a fishing line and then resume movement when the line has returned.

    The problem I am experiencing however is that the boats are moving before their line has returned, and the only thing I can think is causing it is that the wrong boat is triggering off another boat's timer instead of each instance being separate. Is that possible? And is it possible to have a family of sprites act independently off their own timers?

  • That's likely your keyboard. Try this test:

    https://www.mechanical-keyboard.org/key-rollover-test/

    Hey wow you're right. Seems this keyboard can register 6-9 keypresses correctly, but has a conflict with shift+up for whatever reason. Tested it on another keyboard and it works just fine.

    Thanks for the help!

  • EDIT - SOLVED: My keyboard has an error registering keypresses alongside shift+up

    Hi.

    Im trying to create a sprint ability using 8 direction movement by increasing the maxspeed when shift is down, however I think I've discovered a conflict with the shift key and up arrow during this event.

    Trying to sprint upwards with shift down ignores the left and right keys until either the up arrow or shift is released. This means I can't move right or left until released and diagonally upwards at all.

    I retried with wasd & shift and it works fine, and I tried it with arrow keys & the F key and it also works fine. So it seems like there's some conflict specifically between shift and up arrow when it comes to 8 directional movement.

  • > I think the problem is that you are picking a random spawner first, and then checking if it has not spawned a key. If the first condition picked the spawner which has already spawned a key, the whole event won't run. You need to swap the order of these conditions in every event.

    Worked perfectly, thanks for your help.

  • I think the problem is that you are picking a random spawner first, and then checking if it has not spawned a key. If the first condition picked the spawner which has already spawned a key, the whole event won't run. You need to swap the order of these conditions in every event.

    Also, "Wait for previous action" should not be used like that - you need to remove them or replace with "Wait 0" if you want to wait to the end of the tick.

    Thanks very much for your response, I'll test it in the morning. Always happy to learn more about using construct! The wait for previous actions were something I was trying to see if it made a difference, thanks for clearing that up too.

  • ** sorry ignore that 'spawn score' in the first 'on start of layout event, I forgot I added that when I was testing other solutions. **

  • Hi. I have a level setup that spawns items like keys and coins, but for some reason it doesn't always spawn the coins when the action (or function) is called. Custom actions work for spawning the keys everytime but not the coins... is it because there are too many of them (450+) so it fails to execute?

    When I spawn the coins using "on start of layout" they spawn every time without fail, but I would like to have confidence that I can rely on actions and functions to work correctly so I want to know if I'm doing something wrong. Thanks.

    * scene_controller action 'Spawn Score'

    ----+ System: Pick all Score_Spawner

    -----> Score_Spawner: Spawn obj_coin on layer "a_objects" (image point 0, create hierarchy: False)

    Edit: It seems to happen because I start the 'Spawn Score' action at the end of another action (in a chain of actions). Calling the custom action from 'on start of layout' seems to work fine too.

    Here's the full group for reference -

    [Item Spawning]

    ----* scene_controller action 'Spawn Gold Key'

    --------+ System: Pick a random Object_Spawner instance

    --------+ Object_Spawner: [X] Is Key_Spawned

    ---------> Object_Spawner: Spawn Key_Gold on layer "a_objects" (image point 0, create hierarchy: False)

    ---------> Object_Spawner: Set Key_Spawned to True

    ---------> System: Wait for previous actions to complete

    ---------> scene_controller: Spawn Silver Key

    ----* scene_controller action 'Spawn Silver Key'

    --------+ System: Pick a random Object_Spawner instance

    --------+ Object_Spawner: [X] Is Key_Spawned

    ---------> Object_Spawner: Spawn Key_Silver on layer "a_objects" (image point 0, create hierarchy: False)

    ---------> Object_Spawner: Set Key_Spawned to True

    ---------> System: Wait for previous actions to complete

    ---------> scene_controller: Spawn Bronze Key

    ----* scene_controller action 'Spawn Bronze Key'

    --------+ System: Pick a random Object_Spawner instance

    --------+ Object_Spawner: [X] Is Key_Spawned

    ---------> Object_Spawner: Spawn Key_Bronze on layer "a_objects" (image point 0, create hierarchy: False)

    ---------> Object_Spawner: Set Key_Spawned to True

    ---------> System: Wait for previous actions to complete

    ---------> scene_controller: Spawn Coins

    ----* scene_controller action 'Spawn Coins'

    --------+ System: Pick all Object_Spawner

    --------+ Object_Spawner: [X] Is Key_Spawned

    ---------> Object_Spawner: Spawn obj_coin on layer "a_objects" (image point 0, create hierarchy: False)

    ---------> System: Wait for previous actions to complete

    ---------> scene_controller: Spawn Score

    ----* scene_controller action 'Spawn Score'

    --------+ System: Pick all Score_Spawner

    ---------> Score_Spawner: Spawn obj_coin on layer "a_objects" (image point 0, create hierarchy: False)