![]() |
[General] Adding new Stats - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13) +------ Thread: [General] Adding new Stats (/showthread.php?tid=2109) |
[General] Adding new Stats - Jacob - 17-09-2008 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 When you add in a new stat make sure to add it is above this: Quote:' Make sure Stat_Count is below everything elseIf 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 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 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) 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. Re: Adding new Stats - William - 17-09-2008 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 Code: ' Stats Re: Adding new Stats - Jacob - 17-09-2008 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. Re: Adding new Stats - William - 17-09-2008 Ah, I just looked some more on your code and noticed that you had: Code: ByVal Stat As Stats |