kibbelz Posted October 19, 2010 Author Share Posted October 19, 2010 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 randomiserDim rate As Longrate = Npc(MapNpc(MapNum).Npc(MapNpcNum).Num).raterandomiser = Int((Int(rate) + 1) * Rnd) + 0If 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 More sharing options...
GammaÃâžÂ Posted October 19, 2010 Share Posted October 19, 2010 bump for our game o.o Link to comment Share on other sites More sharing options...
Robin Posted October 19, 2010 Share Posted October 19, 2010 You can't just add something into the UDT and expect it to work. Add it into the engine properly. Link to comment Share on other sites More sharing options...
kibbelz Posted October 19, 2010 Author Share Posted October 19, 2010 LOL I was about to do the same, Gamma you sneaky xDProperly? I have done it just like in djmaxus tutorial. but edited it just to fit me. Link to comment Share on other sites More sharing options...
DJMaxus Posted October 19, 2010 Share Posted October 19, 2010 First off, what are you trying to do? Also, what tutorial are you talking about. Have you added the same variables to NpcRec Clientside as well? Link to comment Share on other sites More sharing options...
kibbelz Posted October 20, 2010 Author Share Posted October 20, 2010 client sideHere 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 addedPrivate Sub rate_Change()Npc(EditorIndex).rate = rate.textEnd SubThen in npc recrate As Longbefore the end type (both client and server)then in npceditorint.recruitrate.text = Npc(EditorIndex).rate after.txtEXP.text = Npc(EditorIndex).EXPthen in the server side when the npc diesDim randomiserDim rate As Longrate = Npc(MapNpc(MapNum).Npc(MapNpcNum).Num).raterandomiser = Int((Int(rate) + 1) * Rnd) + 0If randomiser = 1 Then#my code#Thats all i have done. What do i have to add? Link to comment Share on other sites More sharing options...
DJMaxus Posted October 20, 2010 Share Posted October 20, 2010 You still haven't told me what you're trying to do. Link to comment Share on other sites More sharing options...
Robin Posted October 20, 2010 Share Posted October 20, 2010 Post the line that errors. Link to comment Share on other sites More sharing options...
kibbelz Posted October 20, 2010 Author Share Posted October 20, 2010 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 randomiserDim rate As Longrate = Npc(MapNpc(MapNum).Npc(MapNpcNum).Num).raterandomiser = Int((Int(rate) + 1) * Rnd) + 0If randomiser = 1 Thenwhen i kill an npc. Link to comment Share on other sites More sharing options...
kibbelz Posted October 20, 2010 Author Share Posted October 20, 2010 *bump* Link to comment Share on other sites More sharing options...
Robin Posted October 20, 2010 Share Posted October 20, 2010 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 More sharing options...
kibbelz Posted October 20, 2010 Author Share Posted October 20, 2010 Done that the same, When I compile it I get this error:![](http://i54.tinypic.com/2ronv6g.jpg)and when I click debug it highlights over this:Result = Compress(tempBuffer(0), Size, Buffer(0), tempSize) in the compressbuffer sub. Link to comment Share on other sites More sharing options...
Robin Posted October 20, 2010 Share Posted October 20, 2010 lul. Sort out your zlib. Link to comment Share on other sites More sharing options...
GammaÃâžÂ Posted October 20, 2010 Share Posted October 20, 2010 Yeah i already told him what to do. :P i had the same. Link to comment Share on other sites More sharing options...
kibbelz Posted October 20, 2010 Author Share Posted October 20, 2010 Thanks robin & gamme i can now run the server in vb6 i have been trying to fix that for a while x3, Now i can find the line properly :D the line is:rate = Npc(MapNpc(MapNum).Npc(MapNpcNum).Num).rateAny suggestions? Link to comment Share on other sites More sharing options...
Robin Posted October 20, 2010 Share Posted October 20, 2010 When you get the error it should highlight in yellow.Hover your mouse over the different parts till you find the bit which is erroring. Link to comment Share on other sites More sharing options...
kibbelz Posted October 20, 2010 Author Share Posted October 20, 2010 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 More sharing options...
Robin Posted October 20, 2010 Share Posted October 20, 2010 Npcs are bound early, so I don't see why they wouldn't be initialised.Make sure MapNum is > 0 and MapNpcNum is > 0. Link to comment Share on other sites More sharing options...
DJMaxus Posted October 20, 2010 Share Posted October 20, 2010 @kibbelz:> Private Sub rate_Change()> Npc(EditorIndex).rate = rate.text> End Sub> > then in npceditorint> .recruitrate.text = Npc(EditorIndex).rateThose don't match up. Link to comment Share on other sites More sharing options...
kibbelz Posted October 21, 2010 Author Share Posted October 21, 2010 @ robin I have done that same error@djmaxus fixed thank you, but im still getting the error. Link to comment Share on other sites More sharing options...
GammaÃâžÂ Posted October 21, 2010 Share Posted October 21, 2010 Bumping for our game! :) Link to comment Share on other sites More sharing options...
kibbelz Posted October 22, 2010 Author Share Posted October 22, 2010 *Bump* 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