ChefSeth's Forum Posts

  • Ok so I realized my issue was that I was assigning the nicknames used to access each item with a for loop and the for loop wasn't assigning the names properly. The for loop looks like this

    For every item in the family, I assign it a nickname based on an instance variable called name that stores its name as a string. I don't know exactly what it was assigning the nicknames as, but I think it gave them all the same one because it seemed random as to what item would drop when you picked up a new one. Anyone know what's wrong with this for loop?

  • So the item the player currently has is saved with a string variable in the player object. If the player already has an item, when they pick up a new one I need the old item to drop next to them. My setup currently looks like this

    If the player doesn't have an item, it sets the item to the player, if they DO have an item, it spawns the item then sets the new item to the player. For some reason this doesn't work consistently, sometimes it spawns the correct item and sometimes it spawns the item I just picked up. Does anyone know why? Or a different setup that will work consistently?

  • Thank you! It was exactly what I needed

  • I need to spawn a weapon at the player's feet as if it was dropped, and since I'm going to have quite a few weapons I'd like to have the weapon name stored as a variable in the player then in code just say;

    Spawn Player.Weapon at Player.ImagePointX etc, etc,

    But objects can only be chosen by a drop down menu. Does anyone know of a work around for this, or some other way to set up this system?

  • Hm, when I used the simplified one it also didn't spawn there every time. It must be a problem somewhere else, thanks for testing this out with me I'm sure I can find the problem now

  • Here's the simplified one with only the platforming spawning stuff. Thank you, I hope you can help!

  • I'll share a simplified one, hang on

  • Yeah that did nothing, any other ideas?

  • Well flooring just makes it always round down, I'll try it, but I don't see how it'd help.

  • So I have the floor of my level preset in the layout, it's made up of small rectangle segments and each segment has the chance to spawn a platform above it. For some reason the first segment ALWAYS spawns a platform above it and the last few NEVER do. There are sometimes a few in between, those seem pretty random, but the last couple and the first are as far as I can tell guaranteed to have the same outcome.

    My setup looks like this:

    On ground created:

    random(0,100) <= 15, spawn platform

    I don't know why it would be so guaranteed for some of it but not all, is it something to do with Construct's random algorithm? Hopefully someone can help.

  • I did this a while back with bullet physics, setting the acceleration and deceleration based on a timer and the angle of motion based on where the player hit them from, it worked pretty well for a top down game

  • No Im not actually leaving double quotes on lol that was just to distinguish them from the rest of it

    EDIT: I figured out what was wrong, the values I was trying to access were being overridden by the family's default value so it came out blank, I got it fixed though. Thanks for everyone's help!

  • Ok so I tried dictionaries, and the setup I have looks like this

    -> on collision with PassiveItems (PassiveItems is a family)

    ->Set key "PassiveItems.Stat" to "Dictionary.Get(PassiveItems.Stat) + PassiveItems.Value"

    It doesn't work. If I manually type in the name of the stat and the value, it works fine, but for some reason when I ask it to look for it like this, it does nothing. Anyone know why?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, I'll look into dictionaries, thanks!

    EDIT: Are dictionaries global? If I switch layouts, will it remember the values I gave them?

  • So basically I need some code that when the player touches an item, it figures out what stats that item affects and what values to give it. I have instance variables for each item representing the stat and it's value, but I need a more efficient way to apply those to the character. The roadmap for the code is

    1. Get the name and value of the variables in the instance

    2. Apply the values to the stats of the appropriate name to the character

    I don't see a way to just find a variable based on name, it's all selected by a dropdown menu, am I missing something? If I could choose which variable to edit by name I can make the name a check for whatever stat I need to change something like

    pseudo code

    ->in player, set variable "ItemsFamily.Variables[0].Name" to "ItemsFamily.Variables[0]"

    Any way to do this?