Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NPC Movement Frequency
#1
This will add a scroll bar to control the frequency of npc movement. This was only tested on MSE1.

Difficulty: 1/5

::Server Side::
modGeneral
Sub GameAi Search for
Code:
i = Int(Rnd * 5)
Replace with
Code:
i = Int(Rnd * Npc(NpcNum).Movement) + 1

modTypes
NpcRec add:
Code:
Movement As Byte

modDatabase
Sub LoadNpcs add:
Code:
Npc(i).Movement = Val(GetVar(FileName, "NPC" & i, "Movement"))

Sub SaveNpc add:
Code:
Call PutVar(FileName, "NPC" & NpcNum, "Movement", Trim$(Npc(NpcNum).Movement))

modServerTcp
sub SendEditNpcTo add and the end of the packet
Code:
Npc(NpcNum).Movement

modHandleData
find "savenpc" add
Code:
Npc(N).Movement = Val(Parse$(15))


::Client Side::
modHandleData
find "updatenpc" add
Code:
Npc(n).Movement = 0

find "editnpc" add
Code:
Npc(n).Movement = Val(Parse$(15))

modTypes
find NpcRec add
Code:
Movement as Byte

modGameLogic
Sub NpcEditorInit add
Code:
frmNpcEditor.scrlMovement.Value = Npc(EditorIndex).Movement

sub NpcEditorOk add
Code:
Npc(EditorIndex).Movement = frmNpcEditor.scrlMovement.Value

modClientTCP
sub sendsavenpc Add to the end of the packet
Code:
.Movement

Add a scroll bar in frmNpcEditor for the movement
Add a label for displaying the movement number
Add
Code:
Private Sub scrlMovement_Change()
    lblMovement.Caption = (scrlMovement.Value)
End Sub

If there any errors please let me know.
Reply
#2
any max for the scroll bar ? and can you define frequency ?
Reply
#3
I would assume how often they move.
Reply
#4
I put a max of 254 on my scroll bar. Perfekt is right about frequency.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)