Scott Posted December 8, 2011 Author Share Posted December 8, 2011 Since this was buried in another post in the questions sections I decided to re-post my solution here.Originally from: http://www.touchofdeathforums.com/smf/index.php/topic,73394.msg809052/boardseen.html#new//This section is from Rithy56 and slightly edited, credits to him.In modTypes, Private Type ClassRec, Under``` startSpellCount As Long StartSpell() As Long```Add``` StartMap As Long StartMapX As Long StartMapY As Long```In modDatabase, Sub LoadClasses(), Under``` ' continue Class(i).Stat(Stats.Strength) = Val(GetVar(filename, "CLASS" & i, "Strength")) Class(i).Stat(Stats.Endurance) = Val(GetVar(filename, "CLASS" & i, "Endurance")) Class(i).Stat(Stats.Intelligence) = Val(GetVar(filename, "CLASS" & i, "Intelligence")) Class(i).Stat(Stats.Agility) = Val(GetVar(filename, "CLASS" & i, "Agility")) Class(i).Stat(Stats.Willpower) = Val(GetVar(filename, "CLASS" & i, "Willpower"))```Add```Class(i).StartMap = Val(GetVar(filename, "CLASS" & i, "StartMap"))Class(i).StartMapX = Val(GetVar(filename, "CLASS" & i, "StartMapX"))Class(i).StartMapY = Val(GetVar(filename, "CLASS" & i, "StartMapY"))```In modDatabase, Sub SaveClasses() find```Call PutVar(filename, "CLASS" & i, "Willpower", STR(Class(i).Stat(Stats.Willpower)))```Under Add```Call PutVar(filename, "CLASS" & i, "StartMap", STR(Class(i).StartMap))Call PutVar(filename, "CLASS" & i, "StartMapX", STR(Class(i).StartMapX))Call PutVar(filename, "CLASS" & i, "StartMapY", STR(Class(i).StartMapY))```In modDatabase, Sub AddChar, Replace``` Player(index).Map = START_MAP Player(index).x = START_X Player(index).y = START_Y```With``` Player(index).Map = Class(Player(index).Class).StartMap Player(index).x = Class(Player(index).Class).StartMapX Player(index).y = Class(Player(index).Class).StartMapY```In modPlayer, Sub OnDeath(index), Find```Call PlayerWarp(Index, START_MAP, START_X, START_Y)```Replace with``` Call PlayerWarp(Index, Class(Player(index).Class).StartMap, Class(Player(index).Class).StartMapX, Class(Player(index).Class).StartMapY)``` Link to comment Share on other sites More sharing options...
guzmanm Posted December 8, 2011 Share Posted December 8, 2011 Nice tutorial Scott. Very explained and helpful.Though, my only concern is the following.In```Class(i).StartMap = Val(GetVar(filename, "CLASS" & i, "StartMap"))Class(i).StartMapX = Val(GetVar(filename, "CLASS" & i, "StartMapX"))Class(i).StartMapY = Val(GetVar(filename, "CLASS" & i, "StartMapY"))```wouldn't it be more like…```Class(i).StartMap = GetVar(filename, "CLASS" & i, "StartMap")Class(i).StartMapX = GetVar(filename, "CLASS" & i, "StartMapX")Class(i).StartMapY = GetVar(filename, "CLASS" & i, "StartMapY")```? Link to comment Share on other sites More sharing options...
Scott Posted December 8, 2011 Author Share Posted December 8, 2011 No the Val function stops reading a string if it encounters any non-numerical characters and since it's loading from an ini it is possible for the field to get input other than numbers this would prevent an error in that case. Link to comment Share on other sites More sharing options...
guzmanm Posted December 8, 2011 Share Posted December 8, 2011 Oh, my bad. Anyways, nice tutorial! Link to comment Share on other sites More sharing options...
seanmungo Posted January 28, 2012 Share Posted January 28, 2012 Thank You! =) Link to comment Share on other sites More sharing options...
Scott Posted January 28, 2012 Author Share Posted January 28, 2012 Glad it helped, thanks for the reply. Link to comment Share on other sites More sharing options...
Ganjika Posted November 24, 2012 Share Posted November 24, 2012 I followed this on dragon eclipse and now get a subscript out of range on modPlayer upon creation of a new character'View Current Pets on Map_If PetMapCache(Player(index).Map).UpperBound > 0 Then_For j = 1 To PetMapCache(Player(index).Map).UpperBoundCall NPCCache_Create(index, Player(index).Map, PetMapCache(Player(index).Map).Pet(j))NextEnd If Link to comment Share on other sites More sharing options...
Scott Posted November 26, 2012 Author Share Posted November 26, 2012 I can't imagine how this would mess with pets, it only edits the loadclass, saveclass and ondeath sub.Try removing it and seeing if the problem still exists. Link to comment Share on other sites More sharing options...
abhi2011 Posted November 27, 2012 Share Posted November 27, 2012 Hover over each variable and tell which is out of range. Link to comment Share on other sites More sharing options...
moktavz Posted May 23, 2013 Share Posted May 23, 2013 Nice tut, this is really usefull Link to comment Share on other sites More sharing options...
dmgpkk Posted April 20, 2015 Share Posted April 20, 2015 im new to vb6 and have a noob question is this script client side or server side and one more noob question does it load the player on the start map on every log in thanks in advance Link to comment Share on other sites More sharing options...
Justn Posted April 21, 2015 Share Posted April 21, 2015 > im new to vb6 and have a noob question is this script client side or server side and one more noob question does it load the player on the start map on every log in thanks in advanceIt is in the server side. On first login it will spawn to the class.ini points you put for the players class.then when a player dies and no map boot properties are set then it will spawn back to the original class spawn in the classes.ini Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now