Mirage Source
NPC Movement Frequency - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: NPC Movement Frequency (/showthread.php?tid=1619)



NPC Movement Frequency - Jacob - 15-03-2008

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.


Re: NPC Movement Frequency - Becoming - 15-03-2008

any max for the scroll bar ? and can you define frequency ?


Re: NPC Movement Frequency - Matt - 15-03-2008

I would assume how often they move.


Re: NPC Movement Frequency - Jacob - 15-03-2008

I put a max of 254 on my scroll bar. Perfekt is right about frequency.