0 Favourites

Random values in chests

This forum is currently in read-only mode.
  • Hey guys

    So it's my 2nd game I'm trying to do (as the first one is a Brick Breaker, I don't know much about Construct but the basics

    (Ex : cash x2, +100$, cash²)

    I want the game to be different EACH TIME it starts. So this way, there could be high scores and stuff like that.

    I know it sounds like a boring game but I just wanna learn.

    If you could also explain me how to set up a highscore sheet that would be nice, as I don't know how to use memory with Construct.

    Thanks

  • Here is a way of randomized rewards that will never be collected more than once per reward: https://dl.dropboxusercontent.com/u/471 ... werups.cap

    Hope that helps!

  • Thanks,

    but just to be clear, what you sent me creates a Sprite ''anywere'' on the map except on my main character, but what if i want them in the chests. I might need some more explanations than just the final result to totally get it. But it did give me some help.

  • No problem Flex, here's some more description:

    The yellow powerup objects are just images that the player touches to trigger collection of an item from the array, so instead of "On collision between Player and PowerupObj" you can just trigger the event when a chest is opened/touched.

    The global variable (In the project tab on the right) is how many different values there can be.

    The first event under Start Of Layout just fills the array with "Powerup" and a number, eg: "Powerup1", "Powerup2", and so on.

    You could just store a cash number in each of the slots instead, and then when the player reaches in to a chest it will return one of the cash values that was not already picked up before.

  • Oh ok I get it !

    I'll try it and get back soon with news.

    Thanks a lot for your comprehension

  • Well for a random value, use random(x) for a number from 0 to x, or use random(x,y) for a number from x to y.

    I have no idea about high scores and stuff.

  • The issue there is that there's multiple KIND of values... Some multiplying, some adding, some will be substracting... I can't just put : random(1,10)... Of course I could make something out of it but what I'm really looking for is the formula to put all these formulas in a big pool and they get mixed at the beginning of each game. That's the formula I actually need

    But hey, thanks

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Oh right. Have you tried 'choose()'? It randomly picks one of the values between the brackets, e.g. choose("Yes","No","Maybe") could give 'Yes', 'No' or 'Maybe'.

  • Hey Flex, please don't post several duplicates of the very same topic, keep them to a single topic that's the best way to keep consistent and have all the informations you need.

  • Sorry Kyatric it was my first post and I estimated I didnt post it at the right palce the first time... Won't happen again.

    Thanks Sam that might help... May I post formulas in-between the parenteses?

    Ex : 2"Score", "Score"²...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
random bugs and suggestions
90 4,513
Tom's avatar
Tom Construct Team Founder
Unread hot topic
0 Favourites
Rep is very random...
73 17,904
allavett's avatar
allavett
Unread hot topic
48 6,097
androidtimo's avatar
androidtimo