erkro1 Posted August 1, 2011 Author Share Posted August 1, 2011 **[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 Suberrorhandler: 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 clsBufferDim Msg As StringDim npcNum As LongSet Buffer = New clsBufferBuffer.WriteBytes Data()Msg = Buffer.ReadStringnpcNum = Buffer.ReadLongIf 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 IffrmMain.picSpeech.Visible = TruefrmMain.lblSpeech.Caption = "" & Msg & ""frmMain.lblSpeech.Visible = TruefrmMain.picSpeechClose.Visible = TruefrmMain.picSpeechFace.Visible = TrueEnd 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 More sharing options...
evilbunnie Posted August 1, 2011 Share Posted August 1, 2011 Simple but useful. Good job. Link to comment Share on other sites More sharing options...
erkro1 Posted August 1, 2011 Author Share Posted August 1, 2011 Thanks, I forgot to say that you need to add Face as Long on server side too.**Updated tutorial** Link to comment Share on other sites More sharing options...
tsuki Posted August 1, 2011 Share Posted August 1, 2011 Great tutorial. Simple but very helpful. Link to comment Share on other sites More sharing options...
juvanio Posted August 1, 2011 Share Posted August 1, 2011 Great Job Erwin! As said by Captain Wabbit, Simple but Useful ;)Have you implemented this already on WLW? Link to comment Share on other sites More sharing options...
shadowdeath Posted August 1, 2011 Share Posted August 1, 2011 Thanks man, I appreciate it. :D Link to comment Share on other sites More sharing options...
erkro1 Posted August 1, 2011 Author Share Posted August 1, 2011 To all, thanks I dont need credits for it, to Juvanio, no, the numbers goes fine for me, would be a pain in the ass to add face number to every NPC and I dont think its worth it. Link to comment Share on other sites More sharing options...
erkro1 Posted October 3, 2011 Author Share Posted October 3, 2011 Updated it so it also works with the conversation system in CS:DE. Link to comment Share on other sites More sharing options...
RyokuHasu Posted October 3, 2011 Share Posted October 3, 2011 you should also update the title with the CS:DE tag then too =D Link to comment Share on other sites More sharing options...
erkro1 Posted October 3, 2011 Author Share Posted October 3, 2011 @Ryoku:> you should also update the title with the CS:DE tag then too =DDone :P Link to comment Share on other sites More sharing options...
Prince Posted October 3, 2011 Share Posted October 3, 2011 wow.. really cool Link to comment Share on other sites More sharing options...
erkro1 Posted October 3, 2011 Author Share Posted October 3, 2011 @Prince:> wow.. really coolThanks, its an easy edit so I don't need credits ;) Link to comment Share on other sites More sharing options...
spytim Posted October 12, 2011 Share Posted October 12, 2011 Nice Erwin. good job! Link to comment Share on other sites More sharing options...
erkro1 Posted October 13, 2011 Author Share Posted October 13, 2011 @spytim:> Nice Erwin. good job!Thanks, I've also updated the tutorial, it does now work with a scrollbar (much easier and safer) 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