Announcement

Collapse
No announcement yet.

TreasureGen.cpp

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • TreasureGen.cpp

    Found errors within the TreasureGen.cpp

    Currently, it generates one item for loot, but this is because, they check how many items should be generated, and they assign a random value to one variable as to the type of item returned. It seems to me there needs to be an array that loops through how many items need to be generated, collect that item and place it within your array or list, then loop through it again to return the item at the end of the function. This is not done.

    Also, treasure is currently black and cannot be picked up and I will be spending some time fixing these issues. I will leave data collection to those people that have a lot of time to play.
  • #2

    I created a card in Trello and assigned it to you.

    Comment

    • #3

      Last November for a programming project I made an AC-style loot generator script in JavaScript. I just used a recursive function that would call itself until the randomly generated number of loot pieces were 'created' (and pushed into an array for storage). Note for anyone unfamiliar with recursion: make sure your function has conditional logic with a counter in it (i.e. if the loot_counter is less than generated_loot_pieces, have loot_maker function call itself), otherwise your recursive function will turn into an infinite loop.

      Comment

      Working...
      X