Bonk Posted September 17, 2011 Author Share Posted September 17, 2011 Hey!Okay, so I'm trying to add new spawn points for each different class. Bear in mind I'm completely new to VB6, so don't laugh at my newbie skills :POkay, I added this to the ModConstants```' Default starting location [Server Only]Select Case Player(index).Class = 1Public Const START_MAP As Long = 1Public Const START_X As Long = 11Public Const START_Y As Long = 11End IfSelect Case Player(index).Class = 2Public Const START_MAP As Long = 1Public Const START_X As Long = 5Public Const START_Y As Long = 5End If```It highlights the index when I try compiling and goes to 'Invalid Outside Procedure". What have I messed up and how can I fix it?Much thanks :) Link to comment Share on other sites More sharing options...
Rithy58 Posted September 17, 2011 Share Posted September 17, 2011 Umm…You need to learn more about VB6 and probably programming logic, too.Everything that you added to modConstant is wrong.Sincerely,Rithy Link to comment Share on other sites More sharing options...
Jacquelinett Posted September 17, 2011 Share Posted September 17, 2011 I LOLed hard when i read this. Select case and with end if? Joy, you need to learn some programming, or at least some math. You only use end if if you are using if. SayIf YouNeedToLearnSomething ThenYouLearnItEnd ifIn this case, if you want to use select case, it should be this:Select Case Player(Index).classCase 1Something something somethingCase 2something something somethingEnd Selectand you need to put it in a Sub, too. Good luck. Link to comment Share on other sites More sharing options...
Bonk Posted September 17, 2011 Author Share Posted September 17, 2011 Hey, you two!@Bonk:> Bear in mind I'm completely new to VB6, so don't laugh at my newbie skills :PAnyway, thanks for the clarification, Tiana. I'm gonna keep at it. Link to comment Share on other sites More sharing options...
Bonk Posted September 17, 2011 Author Share Posted September 17, 2011 Okay, I blabbered it about into two cases. It now looks like this:```Select Case Player(index).ClassCase 1Public Const START_MAP As Long = 1Public Const START_X As Long = 11Public Const START_Y As Long = 11Case 2Public Const START_MAP As Long = 5Public Const START_X As Long = 11Public Const START_Y As Long = 11End Select```I'm guessing that now says (In English :D) there's two cases, in the first, you'll spawn on the first map, on the second you'll spawn on the second. Where do I add code that says, if the player is class one, use case one, if the player is class two, go through case two? Link to comment Share on other sites More sharing options...
Carim123 Posted September 17, 2011 Share Posted September 17, 2011 The Select Case IS that code. Link to comment Share on other sites More sharing options...
Bonk Posted September 17, 2011 Author Share Posted September 17, 2011 So that will work, then? :O Link to comment Share on other sites More sharing options...
Carim123 Posted September 17, 2011 Share Posted September 17, 2011 In theory. Rather than babbling on about it, go try it already? Link to comment Share on other sites More sharing options...
Bonk Posted September 17, 2011 Author Share Posted September 17, 2011 I did… And:```Public Sub SpawnPoint()Select Case Player(index).ClassCase 1Public Const START_MAP As Long = 1Public Const START_X As Long = 5Public Const START_Y As Long = 5Case 2Public Const START_MAP As Long = 2Public Const START_X As Long = 5Public Const START_Y As Long = 5End SelectEnd Sub```It highlights the (index) and says variable not defined. How do I go about defining the aforementioned variable? Link to comment Share on other sites More sharing options...
Scott Posted September 17, 2011 Share Posted September 17, 2011 1st off you can't re-assign a constant.IE. Remove the Const from it, but that's beyond the point wrong way of going about this.2nd I would put this in the character creation subIn modDatabase find the addChar subreplace``` Player(index).Map = START_MAP Player(index).x = START_X Player(index).y = START_Y```with something like```Select Case Player(index).ClassCase 1 Player(index).Map = 1 Player(index).x = 2 Player(index).y = 3Case 2 Player(index).Map = 4 Player(index).x = 3 Player(index).y = 2End Select``` Link to comment Share on other sites More sharing options...
Bonk Posted September 18, 2011 Author Share Posted September 18, 2011 Yay, it worked :DThanks for the help ;) 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