Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I got some of it
#1
I want to change the way you pick the exp and health. I went to change to scroll bars. Right now i got the scroll bars working but it still wants to use the formula. How do i change this
Reply
#2
Search for this:

Calculate exp to give

and you should find the places that you need to change it to.
Reply
#3
I searched for that and could not find it
Reply
#4
Press Ctrl+F and type that in exactly. It should show up in two spots, maybe more I am not sure but it's there. Should look something like this:

Code:
' Calculate exp to give attacker
        STR = Npc(NpcNum).Stat(Stats.Strength)
        DEF = Npc(NpcNum).Stat(Stats.Defense)
        Exp = STR * DEF * 2
Reply
#5
I am really lost. I am using ms4 and cant find where to do this at. Please help me
Reply
#6
It is there in MS4 also, you must not be searching the whole project. It is in modPlayer, sub AttackNpc
Reply
#7
Server Side.
Reply
#8
I change it but when i attack npc he dont have hp or exp so he wont die. So i decided to wait
Reply
#9
did you make sure to delete your NPC files? It may not work properly until you do.
Reply
#10
no i did not but I think i will wait
Reply
#11
hey ^^ well skills you have to delet your npcs in order for this to work correctly.

here the ho/EXP thing for ya

http://web.miragesource.com/forums/viewt...?f=75&t=97
Reply
#12
I like how we are attracting so many uber pro coders to the community lately. Yeeeehaaaaaar
Reply
#13
Quote:[16:52] Skillzalot: i cant figure this out
[16:57] Jacob: I cant either
[16:57] Skillzalot: what are you trying to do
[16:57] Jacob: how to get away with murder
[16:57] Jacob: you?
[16:57] Skillzalot: lol
[16:58] Skillzalot: im trying to change the calculations for npc hp and exp
[16:58] Skillzalot: that way they run off of scroll bars
[16:58] Jacob: well do you have variables to hold those values?
[16:59] Skillzalot: no
Reply
#14
viewtopic.php?f=75&t=97

It's made for MS1 but use your brain and it should be easy to figure out.
Reply
#15
I change it but i got a problem.
Code:
' :::::::::::::::::::::
' :: Edit npc packet ::
' :::::::::::::::::::::
Sub HandleEditNpc(ByRef Parse() As String)
Dim n As Long

     n = CLng(Parse(1))
    
     ' Update the npc
     Npc(n).Name = Parse(2)
     Npc(n).AttackSay = Parse(3)
     Npc(n).Sprite = CInt(Parse(4))
     Npc(n).SpawnSecs = CLng(Parse(5))
     Npc(n).Behavior = CByte(Parse(6))
     Npc(n).Range = CByte(Parse(7))
     Npc(n).DropChance = CInt(Parse(8))
     Npc(n).DropItem = CByte(Parse(9))
     Npc(n).DropItemValue = CInt(Parse(10))
     Npc(n).Stat(Stats.Strength) = CByte(Parse(11))
     Npc(n).Stat(Stats.Defense) = CByte(Parse(12))
     Npc(n).Stat(Stats.SPEED) = CByte(Parse(13))
     Npc(n).Stat(Stats.Magic) = CByte(Parse(14))
     Npc(n).Quest = CByte(Parse(15))
     Npc(n).MaxHP = CByte(Parse(16))
     Npc(n).ExpGiven = CByte(Parse(17))
    
     ' Initialize the npc editor
     Call NpcEditorInit
End Sub

It highlights Npc(n).ExpGiven = CByte(Parse(17)) and says subscript out of range
ive been playing withg it for 10 mins and cant figure it out
Reply
#16
Still get subscript out of range
Reply
#17
Yeah, I've been playing with it for a bit too and can't get it to work. it gives me a subscript out of range message on
Code:
Npc(n).Hp = CByte(Parse(16))
When I scroll over the Npc(n).Hp ith shows = 0, but when I scroll over the CByte(Parse(16)) it shows = Subscript out of range. I'm not sure what I'm Missing in the code. I haven't even tried to make the 2 values do anything yet, just save.
Reply
#18
Its not difficult, just make sure you are parsing all the values in the packet in exactly the same order client and server side.

From the nature of the error though (you aren't getting far enough for the above to be a problem), you are doing something very stupid like declaring the MaxHP and ExpGiven in a private event procedure. In fact, I'll bet you a tenner its something along those lines.

Either that, you are forcing too many values into the packet (you haven't constructed your sendsavenpc event proc properly), or, as I don't use ms4, there is some unforeseen but obvious complication.

Hell, are you even populating the variables at all client side? (MaxHP and ExpGiven) - could be you are trying to pull in a var that hasn't actually been populated yet, but I think vb6 defaults blank vars to 0 (false), or vbnullstring in the case of a string (since vb seems to have no concept of null, or protects us from it at least). Have you deleted your NPC's so your client isn't falling over when its trying to get information about an NPC? At what point does this blow up? Upon attempting to run the client, upon going onto a map with an npc, upon sending the npc editor...

DON'T JUST SKIM READ WHAT I SAID AND ONLY COME BACK WITH "oh it blows up when I run the client". Check everything I just said, it will either be the variable can't be reached, or you are forcing too many variables into your sendsavenpc method, I'm pretty confident its one or the other.
Reply
#19
Code:
Npc(n).Hp = CByte(Parse(16))

Are you sure you're sending 16 different pieces in that packet?
Reply
#20
Dugor yes 16 things.

Yes i deleted my npcs. It fails when i try to open the npc editor
Reply
#21
According to that tutorial, the HP and EXP are longs. You are trying to convert to Bytes, try to use CLng instead.
Reply
#22
actual it highlight Npc(n).ExpGiven = CLng(Parse(17)) and says subscript out of range
Reply
#23
It's still failing when you type /editnpc? Mine fails after I click on an NPC to edit and send. Yes Fox, I did add everything to both sides. I planned on making a tutorial for this for MS4 if I had gotten it to work, I'll post it below, it shows exactly what I've done with it. As for forcing to many variables into it, how is that possible? I'm still pretty new, but I thought I'd had gotten a few of the basics down.

And I didn't look at the tutorial that was posted, everything that I did, I tried to do myself. I'll go back and take a look at it later though. What I was writing up wasn't done at all, it was done as far as adding the variables into the NPC file, not using them yet. I always make sure the variable is added in before I use it for anything.

[spoiler]First add s scrollbars to your frmNpcEditor, and rename them scrlExp and scrlHp. Make sure you keep the lblStartHp
and lblExpGiven, and set them next to your scrollbars to show you the value. Make sure you set the minimum value at 1.
Next in frmNpcEditor find these 3 subs

Code:
Private Sub scrlStrength_Change()
    lblStrength.Caption = CStr(scrlStrength.Value)
    lblStartHP.Caption = CStr(scrlStrength.Value * scrlDefense.Value)
    lblExpGiven.Caption = CStr(scrlStrength.Value * scrlDefense.Value * 2)
End Sub

Private Sub scrlDefense_Change()
    lblDefense.Caption = CStr(scrlDefense.Value)
    lblStartHP.Caption = CStr(scrlStrength.Value * scrlDefense.Value)
    lblExpGiven.Caption = CStr(scrlStrength.Value * scrlDefense.Value * 2)
End Sub

Private Sub scrlSpeed_Change()
    lblSpeed.Caption = CStr(scrlSpeed.Value)
    lblExpGiven.Caption = CStr(scrlStrength.Value * scrlDefense.Value * 2)
End Sub


And Replace with

Code:
Private Sub scrlStrength_Change()
    lblStrength.Caption = CStr(scrlStrength.Value)
End Sub

Private Sub scrlDefense_Change()
    lblDefense.Caption = CStr(scrlDefense.Value)
End Sub

Private Sub scrlSpeed_Change()
    lblSpeed.Caption = CStr(scrlSpeed.Value)
End Sub

Next add these 2 subs to your frmNpcEditor

Code:
Private Sub scrlExp_Change()
    lblExpGiven.Caption = scrlExp.Value
End Sub

Private Sub scrlHp_Change()
    lblStartHP.Caption = scrlHp.Value
End Sub

In Sub NpcEditor, underneath
Code:
frmNpcEditor.scrlMagic.Value = Npc(EditorIndex).Stat(Stats.Magic)


Add

Code:
frmNpcEditor.scrlExp.Value = Npc(EditorIndex).Exp
frmNpcEditor.scrlHp.Value = Npc(EditorIndex).Hp

Now in Sub NpcEditorOK beneath
Code:
Npc(EditorIndex).Stat(Stats.Magic) = frmNpcEditor.scrlMagic.Value

add
Code:
Npc(EditorIndex).Exp = frmNpcEditor.scrlExp.Value
Npc(EditorIndex).Hp(Stats.Magic) = frmNpcEditor.scrlHp.Value

Now in sub HandleUpdateNpc, beneath
Code:
Npc(n).Stat(Stats.Magic) = 0

add

Code:
Npc(n).Exp = 0
Npc(n).Hp = 0

Now in Sub HandleEditNpc, underneath
Code:
Npc(n).Stat(Stats.Magic) = CByte(Parse(14))
add
Code:
Npc(n).Exp = CInt(Parse(15))
     Npc(n).Hp = CInt(Parse(16))

Now in Type NpcRec, add

Code:
Hp as integer
Exp as Integer

Now in sub SendSaveNpc before
Code:
& END_CHAR
add

Code:
& SEP_CHAR & .Exp & SEP_CHAR & .Hp

Now we are done Client Side. Now for SERVER side.


In Sub HandleSaveNpc add in

Code:
Npc(n).Exp = Val(Parse(15))
    Npc(n).Hp = Val(Parse(16))

In Sub SendEditNpcTo add

Code:
& SEP_CHAR & Npc(NpcNum).Exp & SEP_CHAR & Npc(NpcNum).Hp

Now in Type NpcRec, add

Code:
Hp as integer
Exp as Integer
[/spoiler]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)