Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Spawn Points


Bonk
 Share

Recommended Posts

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 :P

Okay, I added this to the ModConstants

```
' Default starting location [Server Only]
Select Case Player(index).Class = 1
Public Const START_MAP As Long = 1
Public Const START_X As Long = 11
Public Const START_Y As Long = 11
End If

Select Case Player(index).Class = 2
Public Const START_MAP As Long = 1
Public Const START_X As Long = 5
Public Const START_Y As Long = 5
End 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

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. Say

If YouNeedToLearnSomething Then
YouLearnIt
End if
In this case, if you want to use select case, it should be this:

Select Case Player(Index).class
Case 1
Something something something

Case 2
something something something

End Select

and you need to put it in a Sub, too. Good luck.
Link to comment
Share on other sites

Okay, I blabbered it about into two cases. It now looks like this:

```
Select Case Player(index).Class

Case 1
Public Const START_MAP As Long = 1
Public Const START_X As Long = 11
Public Const START_Y As Long = 11

Case 2
Public Const START_MAP As Long = 5
Public Const START_X As Long = 11
Public Const START_Y As Long = 11

End 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

I did… And:

```
Public Sub SpawnPoint()
Select Case Player(index).Class

Case 1
Public Const START_MAP As Long = 1
Public Const START_X As Long = 5
Public Const START_Y As Long = 5

Case 2
Public Const START_MAP As Long = 2
Public Const START_X As Long = 5
Public Const START_Y As Long = 5

End Select
End 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

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 sub

In modDatabase find the addChar sub

replace

```
        Player(index).Map = START_MAP
        Player(index).x = START_X
        Player(index).y = START_Y
```
with something like

```
Select Case Player(index).Class

Case 1
        Player(index).Map = 1
        Player(index).x = 2
        Player(index).y = 3

Case 2
        Player(index).Map = 4
        Player(index).x = 3
        Player(index).y = 2

End Select
```
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...