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

NPC's freeze when a player dies


igloo9
 Share

Recommended Posts

In my game, when a player gets killed by a monster or something, this is what happens:

All of the NPC's freeze.  Then, the server gives me this error:

TYPE: Subscript out of range
LINE: 10
COLUMN: 0
CODE:

I hit OK, and it pops back up.  I hit OK a second time, and it pops back up.  After the third time, the message goes away.  However, the server stays online, and then the NPC's start moving again.

The above process repeats any time someone dies.  How do I fix this?  It's gonna make it easy for the players if I'm not at home, and someone dies, because then everyone can fight frozen NPC's that don't fight back.

Help. D:
Link to comment
Share on other sites

I don't think.  I mean, here's what happened:

I used Eclipse Stable for my game.  Everything worked fine.  Then, I got a new client with some changes in the source (To display player's HP as well as hide names under fringe.)

Since I couldn't use the new client with my game, I just had to transfer all of the server folders over, such as accounts, etc.  I added the same scripts and everything.

Basically, I transferred my game from an older Eclipse Stable to a new one.

And now this happens.
Link to comment
Share on other sites

Kind of.  It goes like this…

Your client.exe that you gave me, with the source edits.
New Eclipse Stable file/server/scripts/etc.
Old folders and stuff such as NPC's, Items, Exp, etc. from my game.
Custom scripts from the old game transferred over into the new scripts folder.
Link to comment
Share on other sites

@Ballie:

> It's in the scripts. The client would crash if it was a client issue. You're using Stable, and have scripting errors set to 1\. For a simple fix, turn off error messages. For a more permanent fix, let me see your OnNPCDeath sub.

Well, the server doesn't really "crash."  It just displays an error message which freezes the NPCs.  When I "OK" out of it, the NPCs are normal again.

If I turn off error messages, wouldn't that still freeze them but without giving me the error?

Here's my OnNPCDeath sub-

```
Sub OnNPCDeath(Index, Map, NPC, MapNPC)
Call BattleMsg(Index, "You killed a " & GetNPCName(NPC) & ".", BRIGHTRED, LEFT)
End Sub
```
Edit: Wait, wouldn't it be playerdeath and not NPCdeath?  Because it happens when you die, not the NPC.
Link to comment
Share on other sites

@Ballie:

> Oh…Well, I can pinpoint a problem, but I can't read. xD  Bring me the other sub!
>
> And I know the server doesn't crash. The server pauses, but the client doesn't. The server waits for input on the error message. If there is no error message, there is no pause.

What other sub do you need?

And just in case it doesn't work, how do I cancel or disable error messages?
Link to comment
Share on other sites

@Igloo9:

> @Ballie:
>
> > Oh…Well, I can pinpoint a problem, but I can't read. xD  Bring me the other sub!
> >
> > And I know the server doesn't crash. The server pauses, but the client doesn't. The server waits for input on the error message. If there is no error message, there is no pause.
>
> What other sub do you need?
>
> And just in case it doesn't work, how do I cancel or disable error messages?

Havent used stable but i believe in your data.ini changed scriptingerrors = 1 to = 0
Link to comment
Share on other sites

Cool, that worked Marsh.  Thanks :)  And Ballie yeah here is the sub:  (Just in case)

```
Sub OnDeath(Index)
If GetMapBootMap(Index) > 0 Then
Call PlayerWarp(Index, GetMapBootMap(Index), GetMapBootX(Index), GetMapBootY(Index))
Else
Map = CInt(GetVar("Classes\Class" & GetPlayerClass(Index) & ".ini", "CLASS", "Map"))
X = CInt(GetVar("Classes\Class" & GetPlayerClass(Index) & ".ini", "CLASS", "x"))
Y = CInt(GetVar("Classes\Class" & GetPlayerClass(Index) & ".ini", "CLASS", "y"))

Call PlayerWarp(Index, Map, X, Y)
End If

Call SetPlayerHP(Target, GetPlayerMaxHP(Target))
Call SetPlayerMP(Target, GetPlayerMaxMP(Target))
Call SetPlayerSP(Target, GetPlayerMaxSP(Target))
Call SendPlayerData(Target)
End Sub
```
Link to comment
Share on other sites

```
Call SetPlayerHP(Target, GetPlayerMaxHP(Target))
  Call SetPlayerMP(Target, GetPlayerMaxMP(Target))
  Call SetPlayerSP(Target, GetPlayerMaxSP(Target))
  Call SendPlayerData(Target)
```
This is the issue. Target is not defined. Plus, whenever OnDeath is called from the source, it already restores health. You might consider eliminating this altogether, or just switching to indices. Regardless, SendPlayerData is not needed. The SetPlayerHP/MP/SP commands auto-update themselves.

```
Call SetPlayerHP(index, GetPlayerMaxHP(index))
  Call SetPlayerMP(index, GetPlayerMaxMP(index))
  Call SetPlayerSP(index, GetPlayerMaxSP(index))
```
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...