Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [HELP] Randomizing

[HELP] Randomizing

Posts 1–12 of 12 · Page 1 of 1
tempta43
tempta43
[HELP] Randomizing
Hey, i'm making an RPG game.
And I want for the button where it says "BATTLE"
to randomize which monster you fight.
Also, I want it to randomize the damage you do.
Can anyone help me? Thanks.
#1 · 16y ago
Zoom
Zoom
You can use select case?
#2 · 16y ago
Lolland
Lolland
Code:
Dim rand as random
Select case rand.next(1,*whatever number here*)
Case 1
monster 1
case 2
monster 2
end select
Off the top of my head, there may be some errors of some sort.
#3 · 16y ago
Shark23
Shark23
rand.next? Not familiar with that.

Code:
Public Function Rand(ByVal Low As Long, _
                     ByVal High As Long) As Long
  Rand = Int((High - Low + 1) * Rnd) + Low
End Function
Then call
Code:
Monster = Rand(MIN#, MAX#)
Example
Code:
Monster = Rand(1, 10)
Returns a number between 1 and 10
#4 · 16y ago
MvRouC12
MvRouC12
Id go with lolland and say use case 1, case 2 etc.
#5 · 16y ago
Shark23
Shark23
^
He would still need to randomize.
#6 · 16y ago
Hassan
Hassan
Lolland's way is the best way. Id go with that !!
#7 · 16y ago
NextGen1
NextGen1
Numerous ways to randomize, most effective and used (IMO) is Select Case, however it really depends on what you are trying to attempt. Not sure randomizing a monster fight with Select Case is the optimum choice, but functional.
#8 · 16y ago
tempta43
tempta43
None of those worked for me, the monsters they fight are different forms, I want to know how to randomize your forms.
#9 · 16y ago
Jason
Jason
Just use the select case and instead of just putting

"Monster 2" for case 2 put:

[php]Monster2Form.Show()[/php] or some such code (monster2form is the name of the monster's form
#10 · 16y ago
tempta43
tempta43
Quote Originally Posted by J-Deezy View Post
Just use the select case and instead of just putting

"Monster 2" for case 2 put:

[php]Monster2Form.Show()[/php] or some such code (monster2form is the name of the monster's form
I find the
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
        Dim RandomClass As New Random()
        Dim i As Integer
        i = RandomClass.Next(1, 3) 'this will make 'i' either 1 or 2.'
        If i = Val(1) Then
            TextBox1.Text = "I iz pro"
        Else : TextBox1.Text = "I iz newb"
        End If
Works well for this situation as well.

End Sub [/CODE]
#11 · 16y ago
Jason
Jason
Quote Originally Posted by tempta43 View Post
I find the
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
        Dim RandomClass As New Random()
        Dim i As Integer
        i = RandomClass.Next(1, 3) 'this will make 'i' either 1 or 2.'
        If i = Val(1) Then
            TextBox1.Text = "I iz pro"
        Else : TextBox1.Text = "I iz newb"
        End If
Works well for this situation as well.

End Sub [/CODE]
Haha yes I suppose it would. But if you have a lot of monsters it will get messy with lots of "Elseif i = val(214) then".... etc haha. There is a cleaner method I'll post in a sec when i make sure it works

EDIT: I think select case is your best option rather than elseif + elseif all the time. Makes it easier to find what it going wrong.

do something like this

[php]
Dim RandomNumber as New Random
Dim i as Integer
i = RandomNumber.Next(1, xx) 'with xx being then number of monsters you have +1'

Select Case i

Case 1
'do something here'
Case 2
'do something'
Case 3
'Blahhhhh'
End Select
[/php]

I think that'd be the best option
#12 · edited 16y ago · 16y ago
Posts 1–12 of 12 · Page 1 of 1

Post a Reply

Similar Threads

  • [Help] random letterBy noobi4life in Visual Basic Programming
    4Last post 18y ago
  • [Help]random selections ComboBoxBy ppl2pass in Visual Basic Programming
    4Last post 16y ago
  • [Help]Random Color Background[Solved]By zmansquared in Visual Basic Programming
    19Last post 16y ago
  • [Help]Random Number[Solved]By tremaster in Visual Basic Programming
    5Last post 16y ago
  • [Help]Random LettersBy tremaster in Visual Basic Programming
    4Last post 16y ago

Tags for this Thread

None