No announcement yet.

Question About Equipment System Setup

  • Filter
  • Time
  • Show
Clear All
new posts

    Question About Equipment System Setup

    Hey Guys, another probably stupid question from the resident top down learner.

    I have an item spawner that spawns an actor. It can be one of many actors that it spawns because it spawns a random item. I want my player to be able to walk over the item spawner, and pick up the item that the spawner has. I then need to pass in the randomly generated weapon data (which is a a variable on every weapon)

    My question is, is there any way to get around making a switch try to cast the weapon to every applicable weapon?

    In our weapon data struct, there's a weapon ID, and the only solution I can think is to add a weapondata struct to the item spawner itself, load the random values into that, then do an overlap check on the player with the item spawner, and read the ID from the item spawners weapon data which would be the spawned items weapon data.

    This would, however, still require me to make a switch for every single weapon as opposed to identifying it and then calling the "equip to player" function inside the weapon.

    Am I just being lazy and trying to avoid dozens and dozens of cases or is there something (probably easy and stupid) that I'm missing here?

    Thank you guys for all your help, this forum has been a god send for me.

    It sounds like each weapon should be parented to a generic Weapon blueprint, which has the various variables/functions you need, and you'd cast to the generalized Weapon. Then each specific weapon would just be variable overrides for the weapon's default values.


      That may be the move there. I will look into it and try out doing it that way.

      Thanks for the quick response!