22-01-2009, 02:22 AM
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
And Replace with
Next add these 2 subs to your frmNpcEditor
In Sub NpcEditor, underneath
Add
Now in Sub NpcEditorOK beneath
add
Now in sub HandleUpdateNpc, beneath
add
Now in Sub HandleEditNpc, underneath add
Now in Type NpcRec, add
Now in sub SendSaveNpc before add
Now we are done Client Side. Now for SERVER side.
In Sub HandleSaveNpc add in
In Sub SendEditNpcTo add
Now in Type NpcRec, add
[/spoiler]
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))
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
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