Mirage Source http://www.miragesource.net/forums/ |
|
[General] Adding new Stats http://www.miragesource.net/forums/viewtopic.php?f=183&t=4342 |
Page 1 of 65 |
Author: | Jacob [ Wed Sep 17, 2008 12:29 pm ] |
Post subject: | [General] Adding new Stats |
Just a basic overview of the stats. You can also refrence http://web.miragesource.com/forums/viewtopic.php?f=5&t=3988 where i outline the original idea. modEnumerations Code: ' Stats used by Players, Npcs and Classes Public Enum Stats Strength = 1 Defense Speed Magic ' Make sure Stat_Count is below everything else Stat_Count End Enum The enum will automatically increment each item in the list. Starting at Strength = 1 so Stat_Count would equal 5. When you add in a new stat make sure to add it is above this: Quote: ' Make sure Stat_Count is below everything else If Stat_Count isn't the last in the enum, it will create problems for you. The way the current stat system works , in the PlayerRec we have Code: ' Stats Stat(1 To Stats.Stat_Count - 1) As Byte So it will automatically setup how many stats you have. If you have any accounts and edit the Stat Enums, you will have to delete your accounts or create a converter tool. Now to access your stats we have: Code: Public Function GetPlayerStat(ByVal Index As Long, ByVal Stat As Stats) As Long GetPlayerStat = Player(Index).Char(TempPlayer(Index).CharNum).Stat(Stat) End Function This function can get any stat you have. Code: GetPlayerStat(Index, Stats.NewStat) VB6 has a little bit of intellisense and should automatically show a list of the Stat enums for you. To set a stat we have Code: Public Sub SetPlayerStat(ByVal Index As Long, ByVal Stat As Stats, ByVal Value As Long) Player(Index).Char(TempPlayer(Index).CharNum).Stat(Stat) = Value End Sub A common use: Code: SetPlayerStat(Index, Stats.NewStat, GetPlayerStat(Index, Stats.NewStat + 5)) Let me know if you don't understand anything, or if i left something out. |
Author: | William [ Wed Sep 17, 2008 5:38 pm ] |
Post subject: | Re: Adding new Stats |
Why not make Strength = 0, instead of Strength = 1. If you make it equal 0, your Stat_Count would stand for the amount of stats you have. Instead of standing for the amount of stats you have +1. And also your: Code: ' Stats Stat(1 To Stats.Stat_Count - 1) As Byte Could then be: Code: ' Stats Stat(1 To Stats.Stat_Count) As Byte Just a little simpler and better looking in my opinion. |
Author: | Jacob [ Wed Sep 17, 2008 5:55 pm ] |
Post subject: | Re: Adding new Stats |
Because it would cause errors. When you call GetPlayerStat(index, Stats.Strength) it would be the same as GetPlayerStat(Index, 0). Since the array doesn't start with 0 this would cause errors. Then all the other stats would be 1 number off. |
Author: | William [ Wed Sep 17, 2008 6:06 pm ] |
Post subject: | Re: Adding new Stats |
Ah, I just looked some more on your code and noticed that you had: Code: ByVal Stat As Stats It's actually better this way because now 1 will equal Strength in both the Stat Array and the Stats Enum. |
Author: | wanai [ Sun Dec 26, 2021 9:48 am ] |
Post subject: | Re: [General] Adding new Stats |
Obse |
Author: | wanai [ Sun Dec 26, 2021 9:49 am ] |
Post subject: | Re: [General] Adding new Stats |
32.3 |
Author: | wanai [ Sun Dec 26, 2021 9:50 am ] |
Post subject: | Re: [General] Adding new Stats |
Bett |
Author: | wanai [ Sun Dec 26, 2021 9:51 am ] |
Post subject: | Re: [General] Adding new Stats |
Bett |
Author: | wanai [ Sun Dec 26, 2021 9:52 am ] |
Post subject: | Re: [General] Adding new Stats |
Troi |
Author: | wanai [ Sun Dec 26, 2021 9:53 am ] |
Post subject: | Re: [General] Adding new Stats |
Ashl |
Author: | wanai [ Sun Dec 26, 2021 9:54 am ] |
Post subject: | Re: [General] Adding new Stats |
Like |
Author: | wanai [ Sun Dec 26, 2021 9:56 am ] |
Post subject: | Re: [General] Adding new Stats |
Jerz |
Author: | wanai [ Sun Dec 26, 2021 9:57 am ] |
Post subject: | Re: [General] Adding new Stats |
Busi |
Author: | wanai [ Sun Dec 26, 2021 9:58 am ] |
Post subject: | Re: [General] Adding new Stats |
Erns |
Author: | wanai [ Sun Dec 26, 2021 9:59 am ] |
Post subject: | Re: [General] Adding new Stats |
Acid |
Author: | wanai [ Sun Dec 26, 2021 10:00 am ] |
Post subject: | Re: [General] Adding new Stats |
Drin |
Author: | wanai [ Sun Dec 26, 2021 10:01 am ] |
Post subject: | Re: [General] Adding new Stats |
colo |
Author: | wanai [ Sun Dec 26, 2021 10:02 am ] |
Post subject: | Re: [General] Adding new Stats |
Ever |
Author: | wanai [ Sun Dec 26, 2021 10:03 am ] |
Post subject: | Re: [General] Adding new Stats |
Oxyg |
Author: | wanai [ Sun Dec 26, 2021 10:04 am ] |
Post subject: | Re: [General] Adding new Stats |
Inte |
Author: | wanai [ Sun Dec 26, 2021 10:06 am ] |
Post subject: | Re: [General] Adding new Stats |
Orie |
Author: | wanai [ Sun Dec 26, 2021 10:07 am ] |
Post subject: | Re: [General] Adding new Stats |
Geis |
Author: | wanai [ Sun Dec 26, 2021 10:08 am ] |
Post subject: | Re: [General] Adding new Stats |
Cisc |
Author: | wanai [ Sun Dec 26, 2021 10:09 am ] |
Post subject: | Re: [General] Adding new Stats |
Opti |
Page 1 of 65 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |