Adblock breaks this site

Vb6 HP calc forumla help needed

Discussion in 'Programming General' started by vash2341, May 6, 2009.

  1. vash2341

    vash2341 Newcomer

    Joined:
    Mar 13, 2007
    Posts:
    5
    Referrals:
    0
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    well for like a week now i have been trying code after code to attempt to calculate HP level in RSC format..anyone have a formula/code source they can show me or help me with?..i have the formula and code to calculate combat level..
     
  2. Blupig

    Blupig BEEF TOILET
    $5 USD Donor

    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant
    Vb6 HP calc forumla help needed

    What other variables are there?
     
  3. vash2341

    vash2341 Newcomer

    Joined:
    Mar 13, 2007
    Posts:
    5
    Referrals:
    0
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    Code:
    'gets level for melee based chars
    If Val(txtRange.Text) * 1.5 < Val(txtAttack.Text) + Val(txtStrength.Text) _
    Then lblLevel.Caption = Val(txtAttack.Text) / 4 + Val(txtDefense.Text) / 4 + Val(txtStrength.Text) / 4 + Val(txtHits.Text) / 4 + _
    Val(txtPrayer.Text) / 8 + Val(txtMagic.Text) / 8
    
    'Chooses range or melee based.
    If Val(txtRange.Text) * 1.5 > Val(txtAttack.Text) + Val(txtStrength.Text) _
    Then lblLevel.Caption = Val(txtDefense.Text) / 4 + Val(txtHits.Text) / 4 + _
    Val(txtPrayer.Text) / 8 + Val(txtMagic.Text) / 8 + Val(txtRange.Text) * 0.375
    that gets you the combat level for bolth based chars..now what i need to get is the way to calculate the HP level based off of the att, def, str level..to do this your going to need to convert the att, def, str levels to EXP like

    Code:
    0, 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333, 111945, 123660, 136594, 150872, 166636, 184040, 203254, 224466, 247886, 273742, 302288, 333804, 368599, 407015, 449428, 496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895, 1096278, 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818, 2421087, 2673114,2951373, 3258594, 3597792, 3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614, 8771558, 9684577, 10692629, 11805606, 13034431, 14391160
    these are the exp levels it starts with 2 0s because level 0 and 1 are 0 exp...HP starts at 10 so EXP 1154 is what you will start at..if you can convert the att, def, str levels to a EXP number from above required to get the input level from the user then this format will calculate the HP level in EXP.. then you need to convert it back to a base level from the EXP you get..

    Code:
    (Val(txtAttack.Text) + (Val(txtDefense.Text)) + (Val(txtStrength.Text)) / 3) + 1151
    any more help :)
     
  4. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    Code:
    Level(1) = 0
    Level(2) = 83
    Level(3) = 174
    Level(4) = 276
    Level(5) = 388
    Level(6) = 512
    Level(7) = 650
    Level(8) = 801
    Level(9) = 969
    Level(10) = 1154
    Level(11) = 1358
    Level(12) = 1584
    Level(13) = 1833
    Level(14) = 2107
    Level(15) = 2411
    Level(16) = 2746
    Level(17) = 3115
    Level(18) = 3523
    Level(19) = 3973
    Level(20) = 4470
    Level(21) = 518
    Level(22) = 5624
    Level(23) = 6291
    Level(24) = 728
    Level(25) = 7842
    Level(26) = 8740
    Level(27) = 9730
    Level(28) = 10824
    Level(29) = 12031
    Level(30) = 13363
    Level(31) = 14833
    Level(32) = 16456
    Level(33) = 18247
    Level(34) = 20224
    Level(35) = 22406
    Level(36) = 24815
    Level(37) = 27473
    Level(38) = 30408
    Level(39) = 33648
    Level(40) = 37224
    Level(41) = 41171
    Level(42) = 45529
    Level(43) = 50339
    Level(44) = 55649
    Level(45) = 61512
    Level(46) = 67983
    Level(47) = 75127
    Level(48) = 83014
    Level(49) = 91721
    Level(50) = 101333
    Level(51) = 111945
    Level(52) = 123660
    Level(53) = 136594
    Level(54) = 150872
    Level(55) = 166636
    Level(56) = 184040
    Level(57) = 203254
    Level(58) = 224466
    Level(59) = 247886
    Level(60) = 273742
    Level(61) = 302288
    Level(62) = 333804
    Level(63) = 368599
    Level(64) = 407015
    Level(65) = 449428
    Level(66) = 496254
    Level(67) = 547953
    Level(68) = 605032
    Level(69) = 668051
    Level(70) = 737627
    Level(71) = 814445
    Level(72) = 899257
    Level(73) = 992895
    Level(74) = 1096278
    Level(75) = 1210421
    Level(76) = 1336443
    Level(77) = 1475581
    Level(78) = 1629200
    Level(79) = 1798808
    Level(80) = 1986068
    Level(81) = 2192818
    Level(82) = 2421087
    Level(83) = 2673114
    Level(84) = 2951373
    Level(85) = 3258594
    Level(86) = 3597792
    Level(87) = 3972294
    Level(88) = 4385776
    Level(89) = 4842295
    Level(90) = 5346332
    Level(91) = 5902831
    Level(92) = 6517253
    Level(93) = 7195629
    Level(94) = 7944614
    Level(95) = 8771558
    Level(96) = 9684577
    Level(97) = 10692629
    Level(98) = 11805606
    Level(99) = 13034431
    
    AttackXP = Level(Text1.Text)
    DefenseXP = Level(Text2.Text)
    StrengthXP = Level(Text3.Text)
    MagicXP = Level(Text4.Text)
    RangedXP = Level(Text5.Text)
    
    TotalXP = (AttackXP + DefenseXP + StrengthXP + RangedXP) * 1.33 / 4 + (MagicXP * 0.38 / 2)
    Hitpoints = Str(XP2Level(TotalXP + 1155).xx)
    
    I just went through stuff I've coded and found this in a hitpoints calculator I wrote ages ago. It should be enough to keep you going where you've gotten stuck. Any questions, feel free to ask.

    EDIT: If you're wondering why the array isn't in shorter format (Level = { 0, 83, ... } ) it's because I had written a script to output it for me anyway so it took all of 2 seconds, not sure why I chose the long format though.
     
  5. vash2341

    vash2341 Newcomer

    Joined:
    Mar 13, 2007
    Posts:
    5
    Referrals:
    0
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    thanks very much thats very useful..


    edit: comes up with a a error:

    Sub or Function not defined.

    while pointing to the first level(1)
     
  6. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    Oh, you need to declare the variable Level in order to use it.

    Code:
    Dim Level(0 To 100) As Long
    
     
  7. vash2341

    vash2341 Newcomer

    Joined:
    Mar 13, 2007
    Posts:
    5
    Referrals:
    0
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    yea ha i looked up and saw it wasn't there and added it :)

    thanks you have been a huge help..now XP2Level won't execute.
     
  8. jdsfighter

    jdsfighter Forum Addict
    Visual Basic Programmers

    Joined:
    Jan 21, 2007
    Posts:
    603
    Referrals:
    0
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    Here is a little function to get the xp without listing them all.

    Code:
    Function GetXPNeeded(ByVal Level As Integer) As Double
        Dim iCount As Integer
        For iCount = 1 To Level - 1
            GetXPNeeded = GetXPNeeded + Fix(iCount + 300 * 2 ^ (iCount / 7))
        Next iCount
        GetXPNeeded = Fix(GetXPNeeded / 4)
    End Function
     
  9. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    Ah, nice where did you find the formula? Also, pulling them out of an array is better performance-wise though :p
     
  10. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    Vb6 HP calc forumla help needed

    Dynamically allocate an array then, rather than declaring the elements one by one.
     
  11. Darthatron

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    Indeed Swan.
    Code:
        Dim lLevel(0 to 99) As Long
        Dim iCount As Integer
        For iCount = 1 To 99
            lLevel(iCount) = lLevel(iCount - 1) + Fix(iCount + 300 * 2 ^ (iCount / 7))
            lLevel(iCount) = Fix(lLevel(iCount) / 4)
        Next iCount
    TADA!
     
  12. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    Vb6 HP calc forumla help needed

    You made a mistake there; you forgot to initialize the first element, considering that you are referring to the element before every time the code loops.
     
  13. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    Yerr I wasn't so smart long ago to have dynamically allocated like that apparently. It was probably enough at the time that I wrote some PHP to give me that output haha.
     
  14. wafelonia

    wafelonia Newcomer

    Joined:
    Apr 4, 2009
    Posts:
    5
    Referrals:
    0
    Sythe Gold:
    0
    Vb6 HP calc forumla help needed

    hi guys, i dunno things bout programming ...
    but i do know 1 thing...
    making a hp calculator doesnt make much sense because if you use xp lamps uu dun get hp xp, if u use soul wars u dont get hp xp afnd i u use pc u dont get hp xp..
     
< [Source] Half-Finished Reflection Bot [Source] | selling cheap intellij keys!!! >


 
 
Adblock breaks this site