Replicating Dice Odds w/ Damage

informedstudiosinformedstudios Member Posts: 18
edited November -1 in Working with GS (Mac)
Hey everyone,

So we are working on creating a game that is based off of a pen and paper game. In the paper game, there is the use of a 20 sided die in order to determine if you hit somebody and a 6 sided die to determine damage.

I have been working on the game a lot in Game Salad to get the mechanics down but this part is puzzling to me. What has to happen is the player clicks a button depending on what kind of attack he is going to do. It has to be then calculated if he hit and how much damage it will do. I just can't seem to figure this out on my own.

I know Game Salad has the feature to use random that I can have it go between 1 and 20 and 1 and 6. I just don't know how to tie this in to an arrow spawning and either hitting or missing the other actor and causing damage based on that.

Has anybody done anything similar or have advice?

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    You could try this:

    Have a boolean variable (or 'attribute') called 'Hit'.

    Make another boolean variable called 'Damage'

    Make an integer variable and call it "DamagePoints"

    Now, when you press the button have a rule that says:

    Change attribute 'Hit' to random(1,20)

    In a control actor have a rule:

    If "Hit" >10 then "damage" = true

    Otherwise damage "=False"

    (you can change the value 10 to whatever you want of course).

    Then you need another rule:

    If "Damage" = true
    Change attribute "DamagePoints" to random(1,6)

    That should get you started I hope!

    Good luck!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • informedstudiosinformedstudios Member Posts: 18
    I'll try that now. I don't know any programming so I didn't know what boolean was. Yeah that is pretty close to how the system works. For instance...

    If the attack roll is greater than 15, it is full damage 1-6
    If the attack roll is between 10-15, it is half damage 1-6 / 2

    Thanks!
    Let's see how it goes
  • quantumsheepquantumsheep Member Posts: 8,188
    Best of luck!

    Booleans are just a type of variable/attribute. They can be true or false. You can read up a bit about attributes here:

    http://cookbook.gamesalad.com/#question=4d9e10a05e76e16053000326

    I like to liken attributes to 'states'.

    I've used this example before, but if you think of water, it has three states - Frozen, liquid and Steam.

    If you assign a number to each of those you can do different things.

    For example:

    If water = 1 then attribute frozen is true
    If water = 2 then attribute Liquid is true
    If water = 3 then attribute steam is true

    Then you can do stuff with that. Say you wanted to drink the water. You'd have to check that its attribute is 2, or 'Liquid'.

    So in a rule, you'd check 'If attribute drinking is true, AND water = 2, then drink water'

    Otherwise 'Don't!' :D

    Hope that helps somehow and that it's not too confusing!

    Good luck!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.