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

Set Spawn From class.ini


Scott
 Share

Recommended Posts

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

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

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

  • 1 month later...
  • 9 months later...
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).UpperBound

Call NPCCache_Create(index, Player(index).Map, PetMapCache(Player(index).Map).Pet(j))

Next

End If
Link to comment
Share on other sites

  • 5 months later...
  • 1 year later...
> 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

It 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

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