gdog12356 Posted April 10, 2011 Author Share Posted April 10, 2011 Is it possible to have diffrent classes start on diffrent maps, and possibly a set x, and y position? Thanx. and before you ask , Yes i have vb6\. Thanks :) Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 10, 2011 Share Posted April 10, 2011 Yes.In Sub AddChar, find:``` Player(index).Map = START_MAP Player(index).x = START_X Player(index).y = START_Y```Use the code I gave you previously in your last request (GetPlayerClass(index)) to check if the player has a class, and if so, change the Map, X and Y. Link to comment Share on other sites More sharing options...
gdog12356 Posted April 11, 2011 Author Share Posted April 11, 2011 @Soul:> Yes.> > In Sub AddChar, find:> ```> Player(index).Map = START_MAP> Player(index).x = START_X> Player(index).y = START_Y> ```> Use the code I gave you previously in your last request (GetPlayerClass(index)) to check if the player has a class, and if so, change the Map, X and Y.soo,```If GetPlayerClass = 1 Then Player(index).Map = 1 Player(index).x = 4 Player(index).y = 4 If else Continue Player(index).Map = START_MAP Player(index).x = START_X Player(index).y = START_Y```would this work? I do not know what to put instead of else if. Basically im trying to say if it isnt equal to this continue. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 11, 2011 Share Posted April 11, 2011 Rules:1\. You must have an End If for every If unless the If is one statement long.2\. Use Else to go on if the first isn't true, and ElseIf if you want to check the statement. Google "vb6 if syntax" for more. Link to comment Share on other sites More sharing options...
gdog12356 Posted April 11, 2011 Author Share Posted April 11, 2011 @Soul:> Rules:> 1\. You must have an End If for every If unless the If is one statement long.> 2\. Use Else to go on if the first isn't true, and ElseIf if you want to check the statement. Google "vb6 if syntax" for more.```If GetPlayerClass = 1 Then Player(index).Map = 1 Player(index).x = 4 Player(index).y = 4 else Player(index).Map = START_MAP Player(index).x = START_X Player(index).y = START_Y```?? wat bout now? :D? Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 11, 2011 Share Posted April 11, 2011 Only problem with that is that it's like you're setting x to 1 and then setting x to 2\. What is x now? 2\.You want to use an Else instead of that End If and then move the End If under the .y = START_Y. Link to comment Share on other sites More sharing options...
gdog12356 Posted April 11, 2011 Author Share Posted April 11, 2011 @Soul:> Only problem with that is that it's like you're setting x to 1 and then setting x to 2\. What is x now? 2\.> > You want to use an Else instead of that End If and then move the End If under the .y = START_Y.``` If GetPlayerClass = 1 Then Player(index).Map = 1 Player(index).x = 4 Player(index).y = 4 else Player(index).Map = 2 Player(index).x = START_X Player(index).y = START_Y end if```what bout now? Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 11, 2011 Share Posted April 11, 2011 @βluΣ:> -code-> what bout now?Yes, that'll work if you only have two classes. If you want to have more than two, you need an ElseIf. Example:``` If GetPlayerClass(index) = 1 Then Player(index).Map = 1 Player(index).x = 4 Player(index).y = 4 ElseIf GetPlayerClass(index) = 2 Then Player(index).Map = 2 Player(index).x = START_X Player(index).y = START_Y ElseIf GetPlayerClass(index) = 3 Then ' code for class 3 here. End If```Also: I just realized you were missing the Index in GetPlayerClass. GetPlayerClass requires the identity of the player (or index, if you will) to be passed to it, so it knows which player's class to get. Link to comment Share on other sites More sharing options...
gdog12356 Posted April 11, 2011 Author Share Posted April 11, 2011 thank you :). It really helped that you guided me throught the coding process and explaining things to me, seeing as i have never coded before. thanks again! :). So should i replace the code in Sub AddChar without the changes, with the one that you guided me to make? Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 11, 2011 Share Posted April 11, 2011 @βluΣ:> thank you :). It really helped that you guided me throught the coding process and explaining things to me, seeing as i have never coded before. thanks again! :). So should i replace the code in Sub AddChar without the changes, with the one that you guided me to make?Yes, replace the old code in AddChar (this):``` Player(index).Map = START_MAP Player(index).x = START_X Player(index).y = START_Y```With the one that you made. Link to comment Share on other sites More sharing options...
Megarude Posted April 11, 2011 Share Posted April 11, 2011 I've tried this over and over but it won't work for me… Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 11, 2011 Share Posted April 11, 2011 Did you compile it? (VB6 > File > Make server.exe.) Link to comment Share on other sites More sharing options...
Megarude Posted April 14, 2011 Share Posted April 14, 2011 I tried and it keeps telling me that there's a compile error: variable not defined and it takes me to a word which doesn't seem to have anything wrong in it. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 14, 2011 Share Posted April 14, 2011 Have you followed all the steps as outlined [here](http://www.touchofdeathforums.com/smf/index.php/topic,68399.msg736833.html#msg736833)? Mainly the step where you install Visual Basic 6 Service Pack 6?Also, "the word doesn't seem to have anything wrong in it," yeah, no. That's not how programming works. When something doesn't work you post exactly what doesn't work. Link to comment Share on other sites More sharing options...
Sada Posted April 15, 2011 Share Posted April 15, 2011 A switch statement would probably be preferred here (select case in vb I believe?) if multiple classes are involved. 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