Discussions

SmileBASIC Community

**********DarkRevengeOf319

01/04/2016 4:34 PM ·Spoilers

Open Closed

How can I randomize damage?

I want to make an RPG, but I'm not sure how to randomize the damage an enemy/the player will take when an attack is used. Can anybody help me out?

Advertisement

Comment

This post has no comments.

  • Define a chance of the attack hitting the target. This can be modified by the attacker's & defender's fighting skill levels. Define the minimum and maximum damage the attacker's weapon can inflict. This can be modified by the attacker's strength and the defender's armour. Then use the SmileBASIC random number function to pick numbers within those ranges.

    Yeahs2
    Played
  • Can you show me that in code?

    Yeahs0
  • Honestly, it's just my idea of how a battle could work. Others will have different ideas. The key for Random_Battle is in the screenshot. The code seems to work for me, but there could be mistakes or bugs in it. Modify the player & weapon data and attack & defense formulas and observe the results.

    Yeahs0
    Played

Add a Comment

You must sign in to post a comment.

Sign in using a Nintendo Network ID to connect to users around the world by writing posts and comments and by giving Yeahs to other people's posts. You can create a Nintendo Network ID using your Wii U console or your system in the Nintendo 3DS family.

Use of Miiverse Details about Miiverse

Report Violation to Miiverse Administrators

You are about to report a post with content which violates the Miiverse Code of Conduct. This report will be sent to Nintendo's Miiverse administrators and not to the creator of the post.

Violation Type:

Post ID: 3DB-NBL7-BXM-ZM97-96H-4B36

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: