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

EO npc rec value


kibbelz
 Share

Recommended Posts

Hello there i have declared a variable called rate said as rate As long in the npcrec (server side)
and when a npc dies it runs this code:

Dim randomiser
Dim rate As Long
rate = Npc(MapNpc(MapNum).Npc(MapNpcNum).Num).rate
randomiser = Int((Int(rate) + 1) * Rnd) + 0
If randomiser = 1 Then
#my code#

I get the error 9 (server) subscript out of range when ever i kill a npc now i have added the right textbox on the client side npc editor for supporting this called rate. Any help?
Link to comment
Share on other sites

client side

Here is my npc editor the arrow is showing you my box called rate
![](http://i56.tinypic.com/qp44gm.jpg)
when i click on it heres what i added

Private Sub rate_Change()
Npc(EditorIndex).rate = rate.text
End Sub

Then in npc rec
rate As Long
before the end type (both client and server)

then in npceditorint
.recruitrate.text = Npc(EditorIndex).rate after
.txtEXP.text = Npc(EditorIndex).EXP

then in the server side when the npc dies
Dim randomiser
Dim rate As Long
rate = Npc(MapNpc(MapNum).Npc(MapNpcNum).Num).rate
randomiser = Int((Int(rate) + 1) * Rnd) + 0
If randomiser = 1 Then
#my code#

Thats all i have done. What do i have to add?
Link to comment
Share on other sites

When i boot up the server via source i get:
Result = Compress(tempBuffer(0), Size, Buffer(0), tempSize) in the compress buffer function, But i have never edited that function. but when i run it via server .exe it gets an error on:
Dim randomiser
Dim rate As Long
rate = Npc(MapNpc(MapNum).Npc(MapNpcNum).Num).rate
randomiser = Int((Int(rate) + 1) * Rnd) + 0
If randomiser = 1 Then

when i kill an npc.
Link to comment
Share on other sites

Don't run server.exe, press CTRL + F5 in the source code to do a full compile + run. Do this _all the time_. It's how you debug.

Delete all your npcs. The way I send packets is screwing up, which means your npc data isn't setup right. Deleting all your npcs means the server re-generates them all in the new UDT structure.

Make sure the UDT is the _exact same_ on both the client and server, as I use direct memory access to copy the data around. If there's a difference, you'll cause memory errors.
Link to comment
Share on other sites

When i click on rate = it says it = 0 So that is proberly where it is ducking up due to it is not being declared, and when i click on rate it says as the same with the npc after rate =. I don't know how this works due to im calling it and its saying 0
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...