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

[EO/CS:DE] Add face option to NPC Editor


erkro1
 Share

Recommended Posts

**[EO2] Add a face option to the npc editor**

Alright, my first tutorial, not a big one but I think it would help some people.
In this tutorial i'll let you see how to add a face option to the npc editor, so you can choose which face you want for your npc without renaming him.

* * *

**Broojo's NPC Speech Box with NPC Face tutorial is required for this tutorial**
http://www.touchofdeathforums.com/smf/index.php/topic,68317.0.html

**Go to the bottom of this post to see the instructions for the CS:DE conversation system**

**All Client Side**

First, **add a scrollbar (scrlFace) and a label (lblFace) on frmEditor_NPC** (you can also download the .frm I've included and add it in your project.
Like this:

>! [![](http://www.freemmorpgmaker.com/files/imagehost/pics/8dfb26348149ec081b460675df746e31.bmp)](http://www.freemmorpgmaker.com/files/imagehost/#8dfb26348149ec081b460675df746e31.bmp)

Name the scrollbar **scrlFace**

Double click on the scrollbar and add this:
```
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If scrlFace.Value > 0 Then
        lblFace.Caption = "Face: " & scrlFace.Value
    Else
        lblFace.Caption = "Face: None"
    End If

    NPC(EditorIndex).Face = scrlFace.Value

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "scrlFace_Change", "frmEditor_Resource", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
```
Now, go to **modGameEditors**, in **NpcEditorInit** add below:
```
.txtDamage.text = Npc(EditorIndex).Damage
```
This:
```
.scrlFace.Max = numFaces
```
Next, go to **modTypes** and add this **at the bottom of NpcRec**:
```
Face As Long
```
**Do it also server side**

In **NpcEditorInit** (modGameEditors) add under```
.txtDamage.text = Npc(EditorIndex).Damage
```this:
```
.scrlFace = Npc(EditorIndex).Face
```
And thats it for the NPC Editor, now we need to edit the face displaying in speechbox.

In **modHandleData** change **HandleSpeechWindow** to this:
```
Private Sub HandleSpeechWindow(ByVal Index As Long, ByRef Data() As Byte, ByVal EditorIndex As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim Msg As String
Dim npcNum As Long
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()

Msg = Buffer.ReadString
npcNum = Buffer.ReadLong

If Not FileExist(App.Path & "\data files\graphics\faces\" & (NPC(npcNum).Face) & ".bmp", True) Then
    frmMain.picSpeechFace.Picture = LoadPicture(App.Path & "\data files\graphics\faces\" & "default.bmp")
    Else
    frmMain.picSpeechFace.Picture = LoadPicture(App.Path & "\data files\graphics\faces\" & (NPC(npcNum).Face) & ".bmp")
End If

frmMain.picSpeech.Visible = True
frmMain.lblSpeech.Caption = "" & Msg & ""
frmMain.lblSpeech.Visible = True
frmMain.picSpeechClose.Visible = True
frmMain.picSpeechFace.Visible = True
End Sub
```
**If you want this for the conversation system from CS:DE do this:
in **modHandleData** in **HandleChatUpdate** change:
```
frmMain.picChatFace.Picture = LoadPicture(App.Path & GFX_PATH & "\faces\" & NPC(npcNum).Sprite & ".bmp")
```
To:
```
frmMain.picChatFace.Picture = LoadPicture(App.Path & GFX_PATH & "\faces\" & NPC(npcNum).Face & ".bmp")
```
And thats it, I haven't tested it out but it must work ;)
If you've any questions or suggestions, don't be afraid to reply to this topic or PM me ;)**
Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

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...