Guest Posted August 8, 2012 Share Posted August 8, 2012 first off, all credit goes to **Jcsnider** all i did was rip it into my own project. and make the tut.sorry for the multi posts. but i typed it 2x and both times it cut me off. on the 3rd try i wanted to be sure it would work.this may contain errors in the begining as its alot and i may have missed something. just post here or pm me and ill try to figure out whats missing if anything.there are a few things that you need to be aware of before you begin. 1.this is from the 2.3 download avalible on this website.2.this is the dx7 version.3.this will only compile in p-code (for now)4.for extra files needed please download the new 2.3 version of eclipse and take needed the files from it.**server side.**in mod database find **Sub SaveMap(ByVal mapnum As Long)**then add this at the top```Dim y As Long, z As Long, p As Long, w As Long```then below```Close #F ```add```'This is for event saving, it is in .ini files becuase there are non-limited values (strings) that cannot easily be loaded/saved in the normal manner. filename = App.Path & "\data\maps\map" & mapnum & "_eventdata.dat" PutVar filename, "Events", "EventCount", Val(Map(mapnum).EventCount) If Map(mapnum).EventCount > 0 Then For i = 1 To Map(mapnum).EventCount With Map(mapnum).Events(i) PutVar filename, "Event" & i, "Name", .Name PutVar filename, "Event" & i, "Global", Val(.Global) PutVar filename, "Event" & i, "x", Val(.x) PutVar filename, "Event" & i, "y", Val(.y) PutVar filename, "Event" & i, "PageCount", Val(.PageCount) End With If Map(mapnum).Events(i).PageCount > 0 Then For x = 1 To Map(mapnum).Events(i).PageCount With Map(mapnum).Events(i).Pages(x) PutVar filename, "Event" & i & "Page" & x, "chkVariable", Val(.chkVariable) PutVar filename, "Event" & i & "Page" & x, "VariableIndex", Val(.VariableIndex) PutVar filename, "Event" & i & "Page" & x, "VariableCondition", Val(.VariableCondition) PutVar filename, "Event" & i & "Page" & x, "VariableCompare", Val(.VariableCompare) PutVar filename, "Event" & i & "Page" & x, "chkSwitch", Val(.chkSwitch) PutVar filename, "Event" & i & "Page" & x, "SwitchIndex", Val(.SwitchIndex) PutVar filename, "Event" & i & "Page" & x, "SwitchCompare", Val(.SwitchCompare) PutVar filename, "Event" & i & "Page" & x, "chkHasItem", Val(.chkHasItem) PutVar filename, "Event" & i & "Page" & x, "HasItemIndex", Val(.HasItemIndex) PutVar filename, "Event" & i & "Page" & x, "chkSelfSwitch", Val(.chkSelfSwitch) PutVar filename, "Event" & i & "Page" & x, "SelfSwitchIndex", Val(.SelfSwitchIndex) PutVar filename, "Event" & i & "Page" & x, "SelfSwitchCompare", Val(.SelfSwitchCompare) PutVar filename, "Event" & i & "Page" & x, "GraphicType", Val(.GraphicType) PutVar filename, "Event" & i & "Page" & x, "Graphic", Val(.Graphic) PutVar filename, "Event" & i & "Page" & x, "GraphicX", Val(.GraphicX) PutVar filename, "Event" & i & "Page" & x, "GraphicY", Val(.GraphicY) PutVar filename, "Event" & i & "Page" & x, "GraphicX2", Val(.GraphicX2) PutVar filename, "Event" & i & "Page" & x, "GraphicY2", Val(.GraphicY2) PutVar filename, "Event" & i & "Page" & x, "MoveType", Val(.MoveType) PutVar filename, "Event" & i & "Page" & x, "MoveSpeed", Val(.MoveSpeed) PutVar filename, "Event" & i & "Page" & x, "MoveFreq", Val(.MoveFreq) PutVar filename, "Event" & i & "Page" & x, "IgnoreMoveRoute", Val(.IgnoreMoveRoute) PutVar filename, "Event" & i & "Page" & x, "RepeatMoveRoute", Val(.RepeatMoveRoute) PutVar filename, "Event" & i & "Page" & x, "MoveRouteCount", Val(.MoveRouteCount) If .MoveRouteCount > 0 Then For y = 1 To .MoveRouteCount PutVar filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Index", Val(.MoveRoute(y).index) PutVar filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data1", Val(.MoveRoute(y).Data1) PutVar filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data2", Val(.MoveRoute(y).Data2) PutVar filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data3", Val(.MoveRoute(y).Data3) PutVar filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data4", Val(.MoveRoute(y).data4) PutVar filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data5", Val(.MoveRoute(y).data5) PutVar filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data6", Val(.MoveRoute(y).data6) Next End If PutVar filename, "Event" & i & "Page" & x, "WalkAnim", Val(.WalkAnim) PutVar filename, "Event" & i & "Page" & x, "DirFix", Val(.DirFix) PutVar filename, "Event" & i & "Page" & x, "WalkThrough", Val(.WalkThrough) PutVar filename, "Event" & i & "Page" & x, "ShowName", Val(.ShowName) PutVar filename, "Event" & i & "Page" & x, "Trigger", Val(.Trigger) PutVar filename, "Event" & i & "Page" & x, "CommandListCount", Val(.CommandListCount) PutVar filename, "Event" & i & "Page" & x, "Position", Val(.Position) End With If Map(mapnum).Events(i).Pages(x).CommandListCount > 0 Then For y = 1 To Map(mapnum).Events(i).Pages(x).CommandListCount PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "CommandCount", Val(Map(mapnum).Events(i).Pages(x).CommandList(y).CommandCount) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "ParentList", Val(Map(mapnum).Events(i).Pages(x).CommandList(y).ParentList) If Map(mapnum).Events(i).Pages(x).CommandList(y).CommandCount > 0 Then For z = 1 To Map(mapnum).Events(i).Pages(x).CommandList(y).CommandCount With Map(mapnum).Events(i).Pages(x).CommandList(y).Commands(z) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Index", Val(.index) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Text1", .Text1 PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Text2", .Text2 PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Text3", .Text3 PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Text4", .Text4 PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Text5", .Text5 PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Data1", Val(.Data1) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Data2", Val(.Data2) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Data3", Val(.Data3) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Data4", Val(.data4) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Data5", Val(.data5) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "Data6", Val(.data6) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "ConditionalBranchCommandList", Val(.ConditionalBranch.CommandList) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "ConditionalBranchCondition", Val(.ConditionalBranch.Condition) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "ConditionalBranchData1", Val(.ConditionalBranch.Data1) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "ConditionalBranchData2", Val(.ConditionalBranch.Data2) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "ConditionalBranchData3", Val(.ConditionalBranch.Data3) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "ConditionalBranchElseCommandList", Val(.ConditionalBranch.ElseCommandList) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "MoveRouteCount", Val(.MoveRouteCount) If .MoveRouteCount > 0 Then For w = 1 To .MoveRouteCount PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "MoveRoute" & w & "Index", Val(.MoveRoute(w).index) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "MoveRoute" & w & "Data1", Val(.MoveRoute(w).Data1) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "MoveRoute" & w & "Data2", Val(.MoveRoute(w).Data2) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "MoveRoute" & w & "Data3", Val(.MoveRoute(w).Data3) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "MoveRoute" & w & "Data4", Val(.MoveRoute(w).data4) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "MoveRoute" & w & "Data5", Val(.MoveRoute(w).data5) PutVar filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & z & "MoveRoute" & w & "Data6", Val(.MoveRoute(w).data6) Next End If End With Next End If Next End If Next End If Next End If```in moddatabase find **Sub LoadMaps()**add this at the top of the sub```Dim y As Long, z As Long, p As Long, w As Long```then below this ```ClearTempTile i CacheResources i DoEvents Next``` add```For z = 1 To MAX_MAPS filename = App.Path & "\data\maps\map" & z & "_eventdata.dat" Map(z).EventCount = Val(GetVar(filename, "Events", "EventCount")) If Map(z).EventCount > 0 Then ReDim Map(z).Events(0 To Map(z).EventCount) For i = 1 To Map(z).EventCount With Map(z).Events(i) .Name = GetVar(filename, "Event" & i, "Name") .Global = Val(GetVar(filename, "Event" & i, "Global")) .x = Val(GetVar(filename, "Event" & i, "x")) .y = Val(GetVar(filename, "Event" & i, "y")) .PageCount = Val(GetVar(filename, "Event" & i, "PageCount")) End With If Map(z).Events(i).PageCount > 0 Then ReDim Map(z).Events(i).Pages(0 To Map(z).Events(i).PageCount) For x = 1 To Map(z).Events(i).PageCount With Map(z).Events(i).Pages(x) .chkVariable = Val(GetVar(filename, "Event" & i & "Page" & x, "chkVariable")) .VariableIndex = Val(GetVar(filename, "Event" & i & "Page" & x, "VariableIndex")) .VariableCondition = Val(GetVar(filename, "Event" & i & "Page" & x, "VariableCondition")) .VariableCompare = Val(GetVar(filename, "Event" & i & "Page" & x, "VariableCompare")) .chkSwitch = Val(GetVar(filename, "Event" & i & "Page" & x, "chkSwitch")) .SwitchIndex = Val(GetVar(filename, "Event" & i & "Page" & x, "SwitchIndex")) .SwitchCompare = Val(GetVar(filename, "Event" & i & "Page" & x, "SwitchCompare")) .chkHasItem = Val(GetVar(filename, "Event" & i & "Page" & x, "chkHasItem")) .HasItemIndex = Val(GetVar(filename, "Event" & i & "Page" & x, "HasItemIndex")) .chkSelfSwitch = Val(GetVar(filename, "Event" & i & "Page" & x, "chkSelfSwitch")) .SelfSwitchIndex = Val(GetVar(filename, "Event" & i & "Page" & x, "SelfSwitchIndex")) .SelfSwitchCompare = Val(GetVar(filename, "Event" & i & "Page" & x, "SelfSwitchCompare")) .GraphicType = Val(GetVar(filename, "Event" & i & "Page" & x, "GraphicType")) .Graphic = Val(GetVar(filename, "Event" & i & "Page" & x, "Graphic")) .GraphicX = Val(GetVar(filename, "Event" & i & "Page" & x, "GraphicX")) .GraphicY = Val(GetVar(filename, "Event" & i & "Page" & x, "GraphicY")) .GraphicX2 = Val(GetVar(filename, "Event" & i & "Page" & x, "GraphicX2")) .GraphicY2 = Val(GetVar(filename, "Event" & i & "Page" & x, "GraphicY2")) .MoveType = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveType")) .MoveSpeed = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveSpeed")) .MoveFreq = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveFreq")) .IgnoreMoveRoute = Val(GetVar(filename, "Event" & i & "Page" & x, "IgnoreMoveRoute")) .RepeatMoveRoute = Val(GetVar(filename, "Event" & i & "Page" & x, "RepeatMoveRoute")) .MoveRouteCount = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveRouteCount")) If .MoveRouteCount > 0 Then ReDim Map(z).Events(i).Pages(x).MoveRoute(0 To .MoveRouteCount) For y = 1 To .MoveRouteCount .MoveRoute(y).index = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Index")) .MoveRoute(y).Data1 = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data1")) .MoveRoute(y).Data2 = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data2")) .MoveRoute(y).Data3 = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data3")) .MoveRoute(y).data4 = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data4")) .MoveRoute(y).data5 = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data5")) .MoveRoute(y).data6 = Val(GetVar(filename, "Event" & i & "Page" & x, "MoveRoute" & y & "Data6")) Next End If .WalkAnim = Val(GetVar(filename, "Event" & i & "Page" & x, "WalkAnim")) .DirFix = Val(GetVar(filename, "Event" & i & "Page" & x, "DirFix")) .WalkThrough = Val(GetVar(filename, "Event" & i & "Page" & x, "WalkThrough")) .ShowName = Val(GetVar(filename, "Event" & i & "Page" & x, "ShowName")) .Trigger = Val(GetVar(filename, "Event" & i & "Page" & x, "Trigger")) .CommandListCount = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandListCount")) .Position = Val(GetVar(filename, "Event" & i & "Page" & x, "Position")) End With If Map(z).Events(i).Pages(x).CommandListCount > 0 Then ReDim Map(z).Events(i).Pages(x).CommandList(0 To Map(z).Events(i).Pages(x).CommandListCount) For y = 1 To Map(z).Events(i).Pages(x).CommandListCount Map(z).Events(i).Pages(x).CommandList(y).CommandCount = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "CommandCount")) Map(z).Events(i).Pages(x).CommandList(y).ParentList = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "ParentList")) If Map(z).Events(i).Pages(x).CommandList(y).CommandCount > 0 Then ReDim Map(z).Events(i).Pages(x).CommandList(y).Commands(Map(z).Events(i).Pages(x).CommandList(y).CommandCount) For p = 1 To Map(z).Events(i).Pages(x).CommandList(y).CommandCount With Map(z).Events(i).Pages(x).CommandList(y).Commands(p) .index = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Index")) .Text1 = GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Text1") .Text2 = GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Text2") .Text3 = GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Text3") .Text4 = GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Text4") .Text5 = GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Text5") .Data1 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Data1")) .Data2 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Data2")) .Data3 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Data3")) .data4 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Data4")) .data5 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Data5")) .data6 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "Data6")) .ConditionalBranch.CommandList = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "ConditionalBranchCommandList")) .ConditionalBranch.Condition = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "ConditionalBranchCondition")) .ConditionalBranch.Data1 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "ConditionalBranchData1")) .ConditionalBranch.Data2 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "ConditionalBranchData2")) .ConditionalBranch.Data3 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "ConditionalBranchData3")) .ConditionalBranch.ElseCommandList = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "ConditionalBranchElseCommandList")) .MoveRouteCount = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "MoveRouteCount")) If .MoveRouteCount > 0 Then ReDim .MoveRoute(1 To .MoveRouteCount) For w = 1 To .MoveRouteCount .MoveRoute(w).index = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "MoveRoute" & w & "Index")) .MoveRoute(w).Data1 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "MoveRoute" & w & "Data1")) .MoveRoute(w).Data2 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "MoveRoute" & w & "Data2")) .MoveRoute(w).Data3 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "MoveRoute" & w & "Data3")) .MoveRoute(w).data4 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "MoveRoute" & w & "Data4")) .MoveRoute(w).data5 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "MoveRoute" & w & "Data5")) .MoveRoute(w).data6 = Val(GetVar(filename, "Event" & i & "Page" & x, "CommandList" & y & "Command" & p & "MoveRoute" & w & "Data6")) Next End If End With Next End If Next End If Next End If Next End If``` Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2012 Share Posted August 8, 2012 at the bottom of moddatabase add```Sub SaveSwitches()Dim i As Long, filename As Stringfilename = App.Path & "\data\switches.ini"For i = 1 To MAX_SWITCHES Call PutVar(filename, "Switches", "Switch" & CStr(i) & "Name", Switches(i))NextEnd SubSub SaveVariables()Dim i As Long, filename As Stringfilename = App.Path & "\data\variables.ini"For i = 1 To MAX_VARIABLES Call PutVar(filename, "Variables", "Variable" & CStr(i) & "Name", Variables(i))NextEnd SubSub LoadSwitches()Dim i As Long, filename As Stringfilename = App.Path & "\data\switches.ini"For i = 1 To MAX_SWITCHES Switches(i) = GetVar(filename, "Switches", "Switch" & CStr(i) & "Name")NextEnd SubSub LoadVariables()Dim i As Long, filename As Stringfilename = App.Path & "\data\variables.ini"For i = 1 To MAX_VARIABLES Variables(i) = GetVar(filename, "Variables", "Variable" & CStr(i) & "Name")NextEnd Sub```in modgamelogic find **Public Sub SpawnNpc(ByVal mapNpcNum As Long, ByVal mapnum As Long)**below that sub add```Public Sub SpawnMapEventsFor(index As Long, mapnum As Long)Dim i As Long, x As Long, y As Long, z As Long, spawncurrentevent As Boolean, p As LongDim buffer As clsBuffer TempPlayer(index).EventMap.CurrentEvents = 0 ReDim TempPlayer(index).EventMap.EventPages(0) If Map(mapnum).EventCount <= 0 Then Exit Sub For i = 1 To Map(mapnum).EventCount If Map(mapnum).Events(i).PageCount > 0 Then For z = Map(mapnum).Events(i).PageCount To 1 Step -1 With Map(mapnum).Events(i).Pages(z) spawncurrentevent = True If .chkVariable = 1 Then If Player(index).Variables(.VariableIndex) < .VariableCondition Then spawncurrentevent = False End If End If If .chkSwitch = 1 Then If Player(index).Switches(.SwitchIndex) = 0 Then spawncurrentevent = False End If End If If .chkHasItem = 1 Then If HasItem(index, .HasItemIndex) = 0 Then spawncurrentevent = False End If End If If .chkSelfSwitch = 1 Then If Map(mapnum).Events(i).SelfSwitches(.SelfSwitchIndex) = 0 Then spawncurrentevent = False End If End If If spawncurrentevent = True Or (spawncurrentevent = False And z = 1) Then 'spawn the event... send data to player TempPlayer(index).EventMap.CurrentEvents = TempPlayer(index).EventMap.CurrentEvents + 1 ReDim Preserve TempPlayer(index).EventMap.EventPages(TempPlayer(index).EventMap.CurrentEvents) With TempPlayer(index).EventMap.EventPages(TempPlayer(index).EventMap.CurrentEvents) If Map(mapnum).Events(i).Pages(z).GraphicType = 1 Then Select Case Map(mapnum).Events(i).Pages(z).GraphicY Case 0 .Dir = DIR_DOWN Case 1 .Dir = DIR_LEFT Case 2 .Dir = DIR_RIGHT Case 3 .Dir = DIR_UP End Select Else .Dir = 0 End If .GraphicNum = Map(mapnum).Events(i).Pages(z).Graphic .GraphicType = Map(mapnum).Events(i).Pages(z).GraphicType .GraphicX = Map(mapnum).Events(i).Pages(z).GraphicX .GraphicY = Map(mapnum).Events(i).Pages(z).GraphicY .GraphicX2 = Map(mapnum).Events(i).Pages(z).GraphicX2 .GraphicY2 = Map(mapnum).Events(i).Pages(z).GraphicY2 Select Case Map(mapnum).Events(i).Pages(z).MoveSpeed Case 0 .movementspeed = 2 Case 1 .movementspeed = 3 Case 2 .movementspeed = 4 Case 3 .movementspeed = 6 Case 4 .movementspeed = 12 Case 5 .movementspeed = 24 End Select If Map(mapnum).Events(i).Global Then .x = TempEventMap(mapnum).Events(i).x .y = TempEventMap(mapnum).Events(i).y .Dir = TempEventMap(mapnum).Events(i).Dir .MoveRouteStep = TempEventMap(mapnum).Events(i).MoveRouteStep Else .x = Map(mapnum).Events(i).x .y = Map(mapnum).Events(i).y .MoveRouteStep = 0 End If .Position = Map(mapnum).Events(i).Pages(z).Position .eventID = i .pageID = z If spawncurrentevent = True Then .Visible = 1 Else .Visible = 0 End If .MoveType = Map(mapnum).Events(i).Pages(z).MoveType If .MoveType = 2 Then .MoveRouteCount = Map(mapnum).Events(i).Pages(z).MoveRouteCount ReDim .MoveRoute(0 To Map(mapnum).Events(i).Pages(z).MoveRouteCount) If Map(mapnum).Events(i).Pages(z).MoveRouteCount > 0 Then For p = 0 To Map(mapnum).Events(i).Pages(z).MoveRouteCount .MoveRoute(p) = Map(mapnum).Events(i).Pages(z).MoveRoute(p) Next End If End If .RepeatMoveRoute = Map(mapnum).Events(i).Pages(z).RepeatMoveRoute .IgnoreIfCannotMove = Map(mapnum).Events(i).Pages(z).IgnoreMoveRoute .MoveFreq = Map(mapnum).Events(i).Pages(z).MoveFreq .MoveSpeed = Map(mapnum).Events(i).Pages(z).MoveSpeed .WalkingAnim = Map(mapnum).Events(i).Pages(z).WalkAnim .WalkThrough = Map(mapnum).Events(i).Pages(z).WalkThrough .FixedDir = Map(mapnum).Events(i).Pages(z).DirFix End With GoTo nextevent End If End With Next End Ifnextevent: Next If TempPlayer(index).EventMap.CurrentEvents > 0 Then For i = 1 To TempPlayer(index).EventMap.CurrentEvents Set buffer = New clsBuffer buffer.WriteLong SSpawnEvent buffer.WriteLong i With TempPlayer(index).EventMap.EventPages(i) buffer.WriteString Map(GetPlayerMap(index)).Events(i).Name buffer.WriteLong .Dir buffer.WriteLong .GraphicNum buffer.WriteLong .GraphicType buffer.WriteLong .GraphicX buffer.WriteLong .GraphicX2 buffer.WriteLong .GraphicY buffer.WriteLong .GraphicY2 buffer.WriteLong .movementspeed buffer.WriteLong .x buffer.WriteLong .y buffer.WriteLong .Position buffer.WriteLong .Visible buffer.WriteLong Map(mapnum).Events(.eventID).Pages(.pageID).WalkAnim buffer.WriteLong Map(mapnum).Events(.eventID).Pages(.pageID).DirFix buffer.WriteLong Map(mapnum).Events(.eventID).Pages(.pageID).WalkThrough buffer.WriteLong Map(mapnum).Events(.eventID).Pages(.pageID).ShowName End With SendDataTo index, buffer.ToArray Set buffer = Nothing Next End IfEnd Sub```find in modgamelogic **Sub SpawnAllMapNpcs()**below this function add```Sub SpawnAllMapGlobalEvents() Dim i As Long For i = 1 To MAX_MAPS Call SpawnGlobalEvents(i) NextEnd SubSub SpawnGlobalEvents(ByVal mapnum As Long) Dim i As Long, z As Long If Map(mapnum).EventCount > 0 Then TempEventMap(mapnum).EventCount = 0 ReDim TempEventMap(mapnum).Events(0) For i = 1 To Map(mapnum).EventCount TempEventMap(mapnum).EventCount = TempEventMap(mapnum).EventCount + 1 ReDim Preserve TempEventMap(mapnum).Events(0 To TempEventMap(mapnum).EventCount) If Map(mapnum).Events(i).PageCount > 0 Then If Map(mapnum).Events(i).Global = 1 Then TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).x = Map(mapnum).Events(i).x TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).y = Map(mapnum).Events(i).y If Map(mapnum).Events(i).Pages(1).GraphicType = 1 Then Select Case Map(mapnum).Events(i).Pages(1).GraphicY Case 0 TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).Dir = DIR_DOWN Case 1 TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).Dir = DIR_LEFT Case 2 TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).Dir = DIR_RIGHT Case 3 TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).Dir = DIR_UP End Select Else TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).Dir = DIR_DOWN End If TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).active = 1 TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).MoveType = Map(mapnum).Events(i).Pages(1).MoveType If TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).MoveType = 2 Then TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).MoveRouteCount = Map(mapnum).Events(i).Pages(1).MoveRouteCount ReDim TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).MoveRoute(0 To Map(mapnum).Events(i).Pages(1).MoveRouteCount) For z = 0 To Map(mapnum).Events(i).Pages(1).MoveRouteCount TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).MoveRoute(z) = Map(mapnum).Events(i).Pages(1).MoveRoute(z) Next End If TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).RepeatMoveRoute = Map(mapnum).Events(i).Pages(1).RepeatMoveRoute TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).IgnoreIfCannotMove = Map(mapnum).Events(i).Pages(1).IgnoreMoveRoute TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).MoveFreq = Map(mapnum).Events(i).Pages(1).MoveFreq TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).MoveSpeed = Map(mapnum).Events(i).Pages(1).MoveSpeed TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).WalkThrough = Map(mapnum).Events(i).Pages(1).WalkThrough TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).FixedDir = Map(mapnum).Events(i).Pages(1).DirFix TempEventMap(mapnum).Events(TempEventMap(mapnum).EventCount).WalkingAnim = Map(mapnum).Events(i).Pages(1).WalkAnim End If End If Next End IfEnd Sub```in **modplayer** add```Function FindItem(ByVal index As Long, ByVal itemnum As Long) As Long Dim i As Long ' Check for subscript out of range If IsPlaying(index) = False Or itemnum <= 0 Or itemnum > MAX_ITEMS Then Exit Function End If For i = 1 To MAX_INV ' Check to see if the player has the item If GetPlayerInvItemNum(index, i) = itemnum Then FindItem = i Exit Function End If NextEnd Function``` Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2012 Share Posted August 8, 2012 at the bottom of **modgamelogic** add```Function CanEventMove(index As Long, ByVal mapnum As Long, x As Long, y As Long, eventID As Long, WalkThrough As Long, ByVal Dir As Byte, Optional globalevent As Boolean = False) As Boolean Dim i As Long Dim n As Long, z As Long ' Check for subscript out of range If mapnum <= 0 Or mapnum > MAX_MAPS Or Dir < DIR_UP Or Dir > DIR_RIGHT Then Exit Function End If CanEventMove = True Select Case Dir Case DIR_UP ' Check to make sure not outside of boundries If y > 0 Then n = Map(mapnum).Tile(x, y - 1).Type If WalkThrough = 1 Then CanEventMove = True Exit Function End If ' Check to make sure that the tile is walkable If n <> TILE_TYPE_WALKABLE And n <> TILE_TYPE_ITEM And n <> TILE_TYPE_NPCSPAWN Then CanEventMove = False Exit Function End If ' Check to make sure that there is not a player in the way For i = 1 To Player_HighIndex If IsPlaying(i) Then If (GetPlayerMap(i) = mapnum) And (GetPlayerX(i) = x) And (GetPlayerY(i) = y - 1) Then CanEventMove = False Exit Function End If End If Next ' Check to make sure that there is not another npc in the way For i = 1 To MAX_MAP_NPCS If (MapNpc(mapnum).Npc(i).x = x) And (MapNpc(mapnum).Npc(i).y = y - 1) Then CanEventMove = False Exit Function End If Next If globalevent = True Then If TempEventMap(mapnum).EventCount > 0 Then For z = 1 To TempEventMap(mapnum).EventCount If (z <> eventID) And (z > 0) And (TempEventMap(mapnum).Events(z).x = x) And (TempEventMap(mapnum).Events(z).y = y - 1) Then CanEventMove = False Exit Function End If Next End If Else If TempPlayer(index).EventMap.CurrentEvents > 0 Then For z = 1 To TempPlayer(index).EventMap.CurrentEvents If (TempPlayer(index).EventMap.EventPages(z).eventID <> eventID) And (eventID > 0) And (TempPlayer(index).EventMap.EventPages(z).x = TempPlayer(index).EventMap.EventPages(eventID).x) And (TempPlayer(index).EventMap.EventPages(z).y = TempPlayer(index).EventMap.EventPages(eventID).y - 1) Then CanEventMove = False Exit Function End If Next End If End If ' Directional blocking If isDirBlocked(Map(mapnum).Tile(x, y).DirBlock, DIR_UP + 1) Then CanEventMove = False Exit Function End If Else CanEventMove = False End If Case DIR_DOWN ' Check to make sure not outside of boundries If y < Map(mapnum).MaxY Then n = Map(mapnum).Tile(x, y + 1).Type If WalkThrough = 1 Then CanEventMove = True Exit Function End If ' Check to make sure that the tile is walkable If n <> TILE_TYPE_WALKABLE And n <> TILE_TYPE_ITEM And n <> TILE_TYPE_NPCSPAWN Then CanEventMove = False Exit Function End If ' Check to make sure that there is not a player in the way For i = 1 To Player_HighIndex If IsPlaying(i) Then If (GetPlayerMap(i) = mapnum) And (GetPlayerX(i) = x) And (GetPlayerY(i) = y + 1) Then CanEventMove = False Exit Function End If End If Next ' Check to make sure that there is not another npc in the way For i = 1 To MAX_MAP_NPCS If (MapNpc(mapnum).Npc(i).x = x) And (MapNpc(mapnum).Npc(i).y = y + 1) Then CanEventMove = False Exit Function End If Next If globalevent = True Then If TempEventMap(mapnum).EventCount > 0 Then For z = 1 To TempEventMap(mapnum).EventCount If (z <> eventID) And (z > 0) And (TempEventMap(mapnum).Events(z).x = x) And (TempEventMap(mapnum).Events(z).y = y + 1) Then CanEventMove = False Exit Function End If Next End If Else If TempPlayer(index).EventMap.CurrentEvents > 0 Then For z = 1 To TempPlayer(index).EventMap.CurrentEvents If (TempPlayer(index).EventMap.EventPages(z).eventID <> eventID) And (eventID > 0) And (TempPlayer(index).EventMap.EventPages(z).x = TempPlayer(index).EventMap.EventPages(eventID).x) And (TempPlayer(index).EventMap.EventPages(z).y = TempPlayer(index).EventMap.EventPages(eventID).y + 1) Then CanEventMove = False Exit Function End If Next End If End If ' Directional blocking If isDirBlocked(Map(mapnum).Tile(x, y).DirBlock, DIR_DOWN + 1) Then CanEventMove = False Exit Function End If Else CanEventMove = False End If Case DIR_LEFT ' Check to make sure not outside of boundries If x > 0 Then n = Map(mapnum).Tile(x - 1, y).Type If WalkThrough = 1 Then CanEventMove = True Exit Function End If ' Check to make sure that the tile is walkable If n <> TILE_TYPE_WALKABLE And n <> TILE_TYPE_ITEM And n <> TILE_TYPE_NPCSPAWN Then CanEventMove = False Exit Function End If ' Check to make sure that there is not a player in the way For i = 1 To Player_HighIndex If IsPlaying(i) Then If (GetPlayerMap(i) = mapnum) And (GetPlayerX(i) = x - 1) And (GetPlayerY(i) = y) Then CanEventMove = False Exit Function End If End If Next ' Check to make sure that there is not another npc in the way For i = 1 To MAX_MAP_NPCS If (MapNpc(mapnum).Npc(i).x = x - 1) And (MapNpc(mapnum).Npc(i).y = y) Then CanEventMove = False Exit Function End If Next If globalevent = True Then If TempEventMap(mapnum).EventCount > 0 Then For z = 1 To TempEventMap(mapnum).EventCount If (z <> eventID) And (z > 0) And (TempEventMap(mapnum).Events(z).x = x - 1) And (TempEventMap(mapnum).Events(z).y = y) Then CanEventMove = False Exit Function End If Next End If Else If TempPlayer(index).EventMap.CurrentEvents > 0 Then For z = 1 To TempPlayer(index).EventMap.CurrentEvents If (TempPlayer(index).EventMap.EventPages(z).eventID <> eventID) And (eventID > 0) And (TempPlayer(index).EventMap.EventPages(z).x = TempPlayer(index).EventMap.EventPages(eventID).x - 1) And (TempPlayer(index).EventMap.EventPages(z).y = TempPlayer(index).EventMap.EventPages(eventID).y) Then CanEventMove = False Exit Function End If Next End If End If ' Directional blocking If isDirBlocked(Map(mapnum).Tile(x, y).DirBlock, DIR_LEFT + 1) Then CanEventMove = False Exit Function End If Else CanEventMove = False End If Case DIR_RIGHT ' Check to make sure not outside of boundries If x < Map(mapnum).MaxX Then n = Map(mapnum).Tile(x + 1, y).Type If WalkThrough = 1 Then CanEventMove = True Exit Function End If ' Check to make sure that the tile is walkable If n <> TILE_TYPE_WALKABLE And n <> TILE_TYPE_ITEM And n <> TILE_TYPE_NPCSPAWN Then CanEventMove = False Exit Function End If ' Check to make sure that there is not a player in the way For i = 1 To Player_HighIndex If IsPlaying(i) Then If (GetPlayerMap(i) = mapnum) And (GetPlayerX(i) = x + 1) And (GetPlayerY(i) = y) Then CanEventMove = False Exit Function End If End If Next ' Check to make sure that there is not another npc in the way For i = 1 To MAX_MAP_NPCS If (MapNpc(mapnum).Npc(i).x = x + 1) And (MapNpc(mapnum).Npc(i).y = y) Then CanEventMove = False Exit Function End If Next If globalevent = True Then If TempEventMap(mapnum).EventCount > 0 Then For z = 1 To TempEventMap(mapnum).EventCount If (z <> eventID) And (z > 0) And (TempEventMap(mapnum).Events(z).x = x + 1) And (TempEventMap(mapnum).Events(z).y = y) Then CanEventMove = False Exit Function End If Next End If Else If TempPlayer(index).EventMap.CurrentEvents > 0 Then For z = 1 To TempPlayer(index).EventMap.CurrentEvents If (TempPlayer(index).EventMap.EventPages(z).eventID <> eventID) And (eventID > 0) And (TempPlayer(index).EventMap.EventPages(z).x = TempPlayer(index).EventMap.EventPages(eventID).x + 1) And (TempPlayer(index).EventMap.EventPages(z).y = TempPlayer(index).EventMap.EventPages(eventID).y) Then CanEventMove = False Exit Function End If Next End If End If ' Directional blocking If isDirBlocked(Map(mapnum).Tile(x, y).DirBlock, DIR_RIGHT + 1) Then CanEventMove = False Exit Function End If Else CanEventMove = False End If End SelectEnd FunctionSub EventDir(playerindex As Long, ByVal mapnum As Long, ByVal eventID As Long, ByVal Dir As Long, Optional globalevent As Boolean = False) Dim buffer As clsBuffer ' Check for subscript out of range If mapnum <= 0 Or mapnum > MAX_MAPS Or Dir < DIR_UP Or Dir > DIR_RIGHT Then Exit Sub End If If globalevent Then If Map(mapnum).Events(eventID).Pages(1).DirFix = 0 Then TempEventMap(mapnum).Events(eventID).Dir = Dir Else If Map(mapnum).Events(eventID).Pages(TempPlayer(playerindex).EventMap.EventPages(eventID).pageID).DirFix = 0 Then TempPlayer(playerindex).EventMap.EventPages(eventID).Dir = Dir End If Set buffer = New clsBuffer buffer.WriteLong SEventDir buffer.WriteLong eventID If globalevent Then buffer.WriteLong TempEventMap(mapnum).Events(eventID).Dir Else buffer.WriteLong TempPlayer(playerindex).EventMap.EventPages(eventID).Dir End If SendDataToMap mapnum, buffer.ToArray() Set buffer = NothingEnd SubSub EventMove(index As Long, mapnum As Long, ByVal eventID As Long, ByVal Dir As Long, movementspeed As Long, Optional globalevent As Boolean = False) Dim packet As String Dim buffer As clsBuffer ' Check for subscript out of range If mapnum <= 0 Or mapnum > MAX_MAPS Or Dir < DIR_UP Or Dir > DIR_RIGHT Then Exit Sub End If If globalevent Then If Map(mapnum).Events(eventID).Pages(1).DirFix = 0 Then TempEventMap(mapnum).Events(eventID).Dir = Dir Else If Map(mapnum).Events(eventID).Pages(TempPlayer(index).EventMap.EventPages(eventID).pageID).DirFix = 0 Then TempPlayer(index).EventMap.EventPages(eventID).Dir = Dir End If Select Case Dir Case DIR_UP If globalevent Then TempEventMap(mapnum).Events(eventID).y = TempEventMap(mapnum).Events(eventID).y - 1 Set buffer = New clsBuffer buffer.WriteLong SEventMove buffer.WriteLong eventID buffer.WriteLong TempEventMap(mapnum).Events(eventID).x buffer.WriteLong TempEventMap(mapnum).Events(eventID).y buffer.WriteLong Dir buffer.WriteLong TempEventMap(mapnum).Events(eventID).Dir buffer.WriteLong movementspeed If globalevent Then SendDataToMap mapnum, buffer.ToArray() Else SendDataTo index, buffer.ToArray End If Set buffer = Nothing Else TempPlayer(index).EventMap.EventPages(eventID).y = TempPlayer(index).EventMap.EventPages(eventID).y - 1 Set buffer = New clsBuffer buffer.WriteLong SEventMove buffer.WriteLong eventID buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).x buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).y buffer.WriteLong Dir buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).Dir buffer.WriteLong movementspeed If globalevent Then SendDataToMap mapnum, buffer.ToArray() Else SendDataTo index, buffer.ToArray End If Set buffer = Nothing End If Case DIR_DOWN If globalevent Then TempEventMap(mapnum).Events(eventID).y = TempEventMap(mapnum).Events(eventID).y + 1 Set buffer = New clsBuffer buffer.WriteLong SEventMove buffer.WriteLong eventID buffer.WriteLong TempEventMap(mapnum).Events(eventID).x buffer.WriteLong TempEventMap(mapnum).Events(eventID).y buffer.WriteLong Dir buffer.WriteLong TempEventMap(mapnum).Events(eventID).Dir buffer.WriteLong movementspeed If globalevent Then SendDataToMap mapnum, buffer.ToArray() Else SendDataTo index, buffer.ToArray End If Set buffer = Nothing Else TempPlayer(index).EventMap.EventPages(eventID).y = TempPlayer(index).EventMap.EventPages(eventID).y + 1 Set buffer = New clsBuffer buffer.WriteLong SEventMove buffer.WriteLong eventID buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).x buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).y buffer.WriteLong Dir buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).Dir buffer.WriteLong movementspeed If globalevent Then SendDataToMap mapnum, buffer.ToArray() Else SendDataTo index, buffer.ToArray End If Set buffer = Nothing End If Case DIR_LEFT If globalevent Then TempEventMap(mapnum).Events(eventID).x = TempEventMap(mapnum).Events(eventID).x - 1 Set buffer = New clsBuffer buffer.WriteLong SEventMove buffer.WriteLong eventID buffer.WriteLong TempEventMap(mapnum).Events(eventID).x buffer.WriteLong TempEventMap(mapnum).Events(eventID).y buffer.WriteLong Dir buffer.WriteLong TempEventMap(mapnum).Events(eventID).Dir buffer.WriteLong movementspeed If globalevent Then SendDataToMap mapnum, buffer.ToArray() Else SendDataTo index, buffer.ToArray End If Set buffer = Nothing Else TempPlayer(index).EventMap.EventPages(eventID).x = TempPlayer(index).EventMap.EventPages(eventID).x - 1 Set buffer = New clsBuffer buffer.WriteLong SEventMove buffer.WriteLong eventID buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).x buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).y buffer.WriteLong Dir buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).Dir buffer.WriteLong movementspeed If globalevent Then SendDataToMap mapnum, buffer.ToArray() Else SendDataTo index, buffer.ToArray End If Set buffer = Nothing End If Case DIR_RIGHT If globalevent Then TempEventMap(mapnum).Events(eventID).x = TempEventMap(mapnum).Events(eventID).x + 1 Set buffer = New clsBuffer buffer.WriteLong SEventMove buffer.WriteLong eventID buffer.WriteLong TempEventMap(mapnum).Events(eventID).x buffer.WriteLong TempEventMap(mapnum).Events(eventID).y buffer.WriteLong Dir buffer.WriteLong TempEventMap(mapnum).Events(eventID).Dir buffer.WriteLong movementspeed If globalevent Then SendDataToMap mapnum, buffer.ToArray() Else SendDataTo index, buffer.ToArray End If Set buffer = Nothing Else TempPlayer(index).EventMap.EventPages(eventID).x = TempPlayer(index).EventMap.EventPages(eventID).x + 1 Set buffer = New clsBuffer buffer.WriteLong SEventMove buffer.WriteLong eventID buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).x buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).y buffer.WriteLong Dir buffer.WriteLong TempPlayer(index).EventMap.EventPages(eventID).Dir buffer.WriteLong movementspeed If globalevent Then SendDataToMap mapnum, buffer.ToArray() Else SendDataTo index, buffer.ToArray End If Set buffer = Nothing End If End SelectEnd Sub```in modgeneral search for **Call SpawnAllMapNpcs**then add just below it```Call SetStatus("Spawning global events...") Call SpawnAllMapGlobalEvents```in modgeneral search for **Call LoadAnimations**then add just below it```call SetStatus("Loading switches...") Call LoadSwitches Call SetStatus("Loading variables...") Call LoadVariables```in modhandledata search for **HandleDataSub(CPartyLeave) = GetAddress(AddressOf HandlePartyLeave)**then add below it```HandleDataSub(CEventChatReply) = GetAddress(AddressOf HandleEventChatReply) HandleDataSub(CEvent) = GetAddress(AddressOf HandleEvent) HandleDataSub(CRequestSwitchesAndVariables) = GetAddress(AddressOf HandleRequestSwitchesAndVariables) HandleDataSub(CSwitchesAndVariables) = GetAddress(AddressOf HandleSwitchesAndVariables)```in modhandledata search for **Sub HandleMapData(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)**at the top add```Dim y As Long, z As Long, w As Long```then just below```For x = 1 To MAX_MAP_NPCS Map(mapnum).Npc(x) = buffer.ReadLong Call ClearMapNpc(x, mapnum) Next```add```'Event Data! Map(mapnum).EventCount = buffer.ReadLong If Map(mapnum).EventCount > 0 Then ReDim Map(mapnum).Events(0 To Map(mapnum).EventCount) For i = 1 To Map(mapnum).EventCount With Map(mapnum).Events(i) .Name = buffer.ReadString .Global = buffer.ReadLong .x = buffer.ReadLong .y = buffer.ReadLong .PageCount = buffer.ReadLong End With If Map(mapnum).Events(i).PageCount > 0 Then ReDim Map(mapnum).Events(i).Pages(0 To Map(mapnum).Events(i).PageCount) For x = 1 To Map(mapnum).Events(i).PageCount With Map(mapnum).Events(i).Pages(x) .chkVariable = buffer.ReadLong .VariableIndex = buffer.ReadLong .VariableCondition = buffer.ReadLong .VariableCompare = buffer.ReadLong .chkSwitch = buffer.ReadLong .SwitchIndex = buffer.ReadLong .SwitchCompare = buffer.ReadLong .chkHasItem = buffer.ReadLong .HasItemIndex = buffer.ReadLong .chkSelfSwitch = buffer.ReadLong .SelfSwitchIndex = buffer.ReadLong .SelfSwitchCompare = buffer.ReadLong .GraphicType = buffer.ReadLong .Graphic = buffer.ReadLong .GraphicX = buffer.ReadLong .GraphicY = buffer.ReadLong .GraphicX2 = buffer.ReadLong .GraphicY2 = buffer.ReadLong .MoveType = buffer.ReadLong .MoveSpeed = buffer.ReadLong .MoveFreq = buffer.ReadLong .MoveRouteCount = buffer.ReadLong .IgnoreMoveRoute = buffer.ReadLong .RepeatMoveRoute = buffer.ReadLong If .MoveRouteCount > 0 Then ReDim Map(mapnum).Events(i).Pages(x).MoveRoute(0 To .MoveRouteCount) For y = 1 To .MoveRouteCount .MoveRoute(y).index = buffer.ReadLong .MoveRoute(y).Data1 = buffer.ReadLong .MoveRoute(y).Data2 = buffer.ReadLong .MoveRoute(y).Data3 = buffer.ReadLong .MoveRoute(y).data4 = buffer.ReadLong .MoveRoute(y).data5 = buffer.ReadLong .MoveRoute(y).data6 = buffer.ReadLong Next End If .WalkAnim = buffer.ReadLong .DirFix = buffer.ReadLong .WalkThrough = buffer.ReadLong .ShowName = buffer.ReadLong .Trigger = buffer.ReadLong .CommandListCount = buffer.ReadLong .Position = buffer.ReadLong End With If Map(mapnum).Events(i).Pages(x).CommandListCount > 0 Then ReDim Map(mapnum).Events(i).Pages(x).CommandList(0 To Map(mapnum).Events(i).Pages(x).CommandListCount) For y = 1 To Map(mapnum).Events(i).Pages(x).CommandListCount Map(mapnum).Events(i).Pages(x).CommandList(y).CommandCount = buffer.ReadLong Map(mapnum).Events(i).Pages(x).CommandList(y).ParentList = buffer.ReadLong If Map(mapnum).Events(i).Pages(x).CommandList(y).CommandCount > 0 Then ReDim Map(mapnum).Events(i).Pages(x).CommandList(y).Commands(1 To Map(mapnum).Events(i).Pages(x).CommandList(y).CommandCount) For z = 1 To Map(mapnum).Events(i).Pages(x).CommandList(y).CommandCount With Map(mapnum).Events(i).Pages(x).CommandList(y).Commands(z) .index = buffer.ReadLong .Text1 = buffer.ReadString .Text2 = buffer.ReadString .Text3 = buffer.ReadString .Text4 = buffer.ReadString .Text5 = buffer.ReadString .Data1 = buffer.ReadLong .Data2 = buffer.ReadLong .Data3 = buffer.ReadLong .data4 = buffer.ReadLong .data5 = buffer.ReadLong .data6 = buffer.ReadLong .ConditionalBranch.CommandList = buffer.ReadLong .ConditionalBranch.Condition = buffer.ReadLong .ConditionalBranch.Data1 = buffer.ReadLong .ConditionalBranch.Data2 = buffer.ReadLong .ConditionalBranch.Data3 = buffer.ReadLong .ConditionalBranch.ElseCommandList = buffer.ReadLong .MoveRouteCount = buffer.ReadLong If .MoveRouteCount > 0 Then ReDim Preserve .MoveRoute(.MoveRouteCount) For w = 1 To .MoveRouteCount .MoveRoute(w).index = buffer.ReadLong .MoveRoute(w).Data1 = buffer.ReadLong .MoveRoute(w).Data2 = buffer.ReadLong .MoveRoute(w).Data3 = buffer.ReadLong .MoveRoute(w).data4 = buffer.ReadLong .MoveRoute(w).data5 = buffer.ReadLong .MoveRoute(w).data6 = buffer.ReadLong Next End If End With Next End If Next End If Next End If Next End If 'End Event Data Call SendMapNpcsToMap(mapnum) Call SpawnMapNpcs(mapnum) Call SpawnGlobalEvents(mapnum) For i = 1 To Player_HighIndex If Player(i).Map = mapnum Then SpawnMapEventsFor i, mapnum End If Next``` Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2012 Share Posted August 8, 2012 in modhandledata search for **Sub HandleNeedMap(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)**below```Call SendMapNpcsTo(index, GetPlayerMap(index))```add```Call SpawnMapEventsFor(index, GetPlayerMap(index))```in modhandle data find **Sub HandleRequestEditMap(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long**after```endif```add```SendMapEventData (index)```at the bottom of **modhandledata** add```Sub HandleEventChatReply(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim buffer As clsBuffer Dim eventID As Long, pageID As Long, reply As Long, i As Long Set buffer = New clsBuffer buffer.WriteBytes Data() eventID = buffer.ReadLong pageID = buffer.ReadLong reply = buffer.ReadLong If TempPlayer(index).EventProcessingCount > 0 Then For i = 1 To TempPlayer(index).EventProcessingCount If TempPlayer(index).EventProcessing(i).eventID = eventID And TempPlayer(index).EventProcessing(i).pageID = pageID Then If TempPlayer(index).EventProcessing(i).WaitingForResponse = 1 Then If reply = 0 Then If Map(GetPlayerMap(index)).Events(eventID).Pages(pageID).CommandList(TempPlayer(index).EventProcessing(i).CurList).Commands(TempPlayer(index).EventProcessing(i).CurSlot - 1).index = EventType.evShowText Then TempPlayer(index).EventProcessing(i).WaitingForResponse = 0 End If ElseIf reply > 0 Then If Map(GetPlayerMap(index)).Events(eventID).Pages(pageID).CommandList(TempPlayer(index).EventProcessing(i).CurList).Commands(TempPlayer(index).EventProcessing(i).CurSlot - 1).index = EventType.evShowChoices Then Select Case reply Case 1 TempPlayer(index).EventProcessing(i).ListLeftOff(TempPlayer(index).EventProcessing(i).CurList) = TempPlayer(index).EventProcessing(i).CurSlot TempPlayer(index).EventProcessing(i).CurList = Map(GetPlayerMap(index)).Events(eventID).Pages(pageID).CommandList(TempPlayer(index).EventProcessing(i).CurList).Commands(TempPlayer(index).EventProcessing(i).CurSlot - 1).Data1 TempPlayer(index).EventProcessing(i).CurSlot = 1 Case 2 TempPlayer(index).EventProcessing(i).ListLeftOff(TempPlayer(index).EventProcessing(i).CurList) = TempPlayer(index).EventProcessing(i).CurSlot TempPlayer(index).EventProcessing(i).CurList = Map(GetPlayerMap(index)).Events(eventID).Pages(pageID).CommandList(TempPlayer(index).EventProcessing(i).CurList).Commands(TempPlayer(index).EventProcessing(i).CurSlot - 1).Data2 TempPlayer(index).EventProcessing(i).CurSlot = 1 Case 3 TempPlayer(index).EventProcessing(i).ListLeftOff(TempPlayer(index).EventProcessing(i).CurList) = TempPlayer(index).EventProcessing(i).CurSlot TempPlayer(index).EventProcessing(i).CurList = Map(GetPlayerMap(index)).Events(eventID).Pages(pageID).CommandList(TempPlayer(index).EventProcessing(i).CurList).Commands(TempPlayer(index).EventProcessing(i).CurSlot - 1).Data3 TempPlayer(index).EventProcessing(i).CurSlot = 1 Case 4 TempPlayer(index).EventProcessing(i).ListLeftOff(TempPlayer(index).EventProcessing(i).CurList) = TempPlayer(index).EventProcessing(i).CurSlot TempPlayer(index).EventProcessing(i).CurList = Map(GetPlayerMap(index)).Events(eventID).Pages(pageID).CommandList(TempPlayer(index).EventProcessing(i).CurList).Commands(TempPlayer(index).EventProcessing(i).CurSlot - 1).data4 TempPlayer(index).EventProcessing(i).CurSlot = 1 End Select End If TempPlayer(index).EventProcessing(i).WaitingForResponse = 0 End If End If End If Next End If Set buffer = NothingEnd SubSub HandleEvent(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim i As Long Dim n As Long Dim Damage As Long Dim TempIndex As Long Dim x As Long, y As Long, begineventprocessing As Boolean, z As Long, buffer As clsBuffer ' Check tradeskills Select Case GetPlayerDir(index) Case DIR_UP If GetPlayerY(index) = 0 Then Exit Sub x = GetPlayerX(index) y = GetPlayerY(index) - 1 Case DIR_DOWN If GetPlayerY(index) = Map(GetPlayerMap(index)).MaxY Then Exit Sub x = GetPlayerX(index) y = GetPlayerY(index) + 1 Case DIR_LEFT If GetPlayerX(index) = 0 Then Exit Sub x = GetPlayerX(index) - 1 y = GetPlayerY(index) Case DIR_RIGHT If GetPlayerX(index) = Map(GetPlayerMap(index)).MaxX Then Exit Sub x = GetPlayerX(index) + 1 y = GetPlayerY(index) End Select Set buffer = New clsBuffer buffer.WriteBytes Data i = buffer.ReadLong Set buffer = Nothing If TempPlayer(index).EventMap.CurrentEvents > 0 Then For z = 1 To TempPlayer(index).EventMap.CurrentEvents If TempPlayer(index).EventMap.EventPages(z).eventID = i Then i = z begineventprocessing = True Exit For End If Next End If If begineventprocessing = True Then If Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Pages(TempPlayer(index).EventMap.EventPages(i).pageID).CommandListCount > 0 Then 'Process this event, it is action button and everything checks out. TempPlayer(index).EventProcessingCount = TempPlayer(index).EventProcessingCount + 1 ReDim Preserve TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount) With TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount) .ActionTimer = GetTickCount .CurList = 1 .CurSlot = 1 .eventID = TempPlayer(index).EventMap.EventPages(i).eventID .pageID = TempPlayer(index).EventMap.EventPages(i).pageID .WaitingForResponse = 0 ReDim .ListLeftOff(0 To Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Pages(TempPlayer(index).EventMap.EventPages(i).pageID).CommandListCount) End With End If begineventprocessing = False End IfEnd SubSub HandleRequestSwitchesAndVariables(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) SendSwitchesAndVariables (index)End SubSub HandleSwitchesAndVariables(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim buffer As clsBuffer, i As Long Set buffer = New clsBuffer buffer.WriteBytes Data() For i = 1 To MAX_SWITCHES Switches(i) = buffer.ReadString Next For i = 1 To MAX_VARIABLES Variables(i) = buffer.ReadString Next SaveSwitches SaveVariables Set buffer = Nothing SendSwitchesAndVariables 0, TrueEnd Sub```in modtypes search for **Public Map(1 To MAX_MAPS) As MapRec**just below add```Public TempEventMap(1 To MAX_MAPS) As GlobalEventsRec```and at bottom of list add```Public Switches(1 To MAX_SWITCHES) As StringPublic Variables(1 To MAX_VARIABLES) As String```then just below that add this```Private Type MoveRouteRec index As Long Data1 As Long Data2 As Long Data3 As Long data4 As Long data5 As Long data6 As LongEnd TypePrivate Type GlobalEventRec x As Long y As Long Dir As Long active As Long WalkingAnim As Long FixedDir As Long WalkThrough As Long Position As Long GraphicType As Long GraphicNum As Long GraphicX As Long GraphicX2 As Long GraphicY As Long GraphicY2 As Long 'Server Only Options MoveType As Long MoveSpeed As Long MoveFreq As Long MoveRouteCount As Long MoveRoute() As MoveRouteRec MoveRouteStep As Long RepeatMoveRoute As Long IgnoreIfCannotMove As Long MoveTimer As LongEnd TypePublic Type GlobalEventsRec EventCount As Long Events() As GlobalEventRecEnd Type```in modtypes search for **Private Type PlayerRec**at the bottom add```Switches(0 To MAX_SWITCHES) As Byte Variables(0 To MAX_VARIABLES) As Long```in modtypes search for **Public Type DoTRec**just below that type add```Public Type ConditionalBranchRec Condition As Long Data1 As Long Data2 As Long Data3 As Long CommandList As Long ElseCommandList As LongEnd TypePrivate Type EventCommandRec index As Byte Text1 As String Text2 As String Text3 As String Text4 As String Text5 As String Data1 As Long Data2 As Long Data3 As Long data4 As Long data5 As Long data6 As Long ConditionalBranch As ConditionalBranchRec MoveRouteCount As Long MoveRoute() As MoveRouteRecEnd TypePrivate Type CommandListRec CommandCount As Long ParentList As Long Commands() As EventCommandRecEnd TypePrivate Type EventPageRec 'These are condition variables that decide if the event even appears to the player. chkVariable As Long VariableIndex As Long VariableCondition As Long VariableCompare As Long chkSwitch As Long SwitchIndex As Long SwitchCompare As Long chkHasItem As Long HasItemIndex As Long chkSelfSwitch As Long SelfSwitchIndex As Long SelfSwitchCompare As Long 'End Conditions 'Handles the Event Sprite GraphicType As Byte Graphic As Long GraphicX As Long GraphicY As Long GraphicX2 As Long GraphicY2 As Long 'Handles Movement - Move Routes to come soon. MoveType As Byte MoveSpeed As Byte MoveFreq As Byte MoveRouteCount As Long MoveRoute() As MoveRouteRec IgnoreMoveRoute As Long RepeatMoveRoute As Long 'Guidelines for the event WalkAnim As Long DirFix As Long WalkThrough As Long ShowName As Long 'Trigger for the event Trigger As Byte 'Commands for the event CommandListCount As Long CommandList() As CommandListRec Position As Byte 'For EventMap x As Long y As LongEnd TypePrivate Type EventRec Name As String Global As Byte PageCount As Long Pages() As EventPageRec x As Long y As Long 'Self Switches re-set on restart. SelfSwitches(0 To 4) As LongEnd TypePublic Type GlobalMapEvents eventID As Long pageID As Long x As Long y As LongEnd TypePrivate Type MapEventRec Dir As Long x As Long y As Long WalkingAnim As Long FixedDir As Long WalkThrough As Long GraphicType As Long GraphicX As Long GraphicY As Long GraphicX2 As Long GraphicY2 As Long GraphicNum As Long movementspeed As Long Position As Long Visible As Long eventID As Long pageID As Long 'Server Only Options MoveType As Long MoveSpeed As Long MoveFreq As Long MoveRouteCount As Long MoveRoute() As MoveRouteRec MoveRouteStep As Long RepeatMoveRoute As Long IgnoreIfCannotMove As Long MoveTimer As Long SelfSwitches(0 To 4) As LongEnd TypePrivate Type EventMapRec CurrentEvents As Long EventPages() As MapEventRecEnd TypePrivate Type EventProcessingRec CurList As Long CurSlot As Long eventID As Long pageID As Long WaitingForResponse As Long ActionTimer As Long ListLeftOff() As LongEnd Type```in modtypes search for **Public Type TempPlayerRec**at the bottom add```EventMap As EventMapRec EventProcessingCount As Long EventProcessing() As EventProcessingRec```in modtypes search for **Private Type MapRec**at the bottom add```EventCount As Long Events() As EventRec```in modserverloop search for **frmServer.lblCPS.Caption = "CPS: " & Format$(GameCPS, "#,###,###,###")**just above that line and **next** add```UpdateEventLogic```at bottom of **modserverloop** add```Function CanEventMoveTowardsPlayer(playerID As Long, mapnum As Long, eventID As Long) As LongDim i As Long, x As Long, y As Long, x1 As Long, y1 As Long, didwalk As Boolean, WalkThrough As Long 'This does not work for global events so this MUST be a player one.... 'This Event returns a direction, 5 is not a valid direction so we assume fail unless otherwise told. CanEventMoveTowardsPlayer = 5 If playerID <= 0 Or playerID > Player_HighIndex Then Exit Function If mapnum <= 0 Or mapnum > MAX_MAPS Then Exit Function If eventID <= 0 Or eventID > TempPlayer(playerID).EventMap.CurrentEvents Then Exit Function x = GetPlayerX(playerID) y = GetPlayerY(playerID) x1 = TempPlayer(playerID).EventMap.EventPages(eventID).x y1 = TempPlayer(playerID).EventMap.EventPages(eventID).y WalkThrough = Map(mapnum).Events(TempPlayer(playerID).EventMap.EventPages(eventID).eventID).Pages(TempPlayer(playerID).EventMap.EventPages(eventID).pageID).WalkThrough i = Int(Rnd * 5) didwalk = False ' Lets move the event Select Case i Case 0 ' Up If y1 > y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_UP, False) Then CanEventMoveTowardsPlayer = DIR_UP Exit Function didwalk = True End If End If ' Down If y1 < y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_DOWN, False) Then CanEventMoveTowardsPlayer = DIR_DOWN Exit Function didwalk = True End If End If ' Left If x1 > x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_LEFT, False) Then CanEventMoveTowardsPlayer = DIR_LEFT Exit Function didwalk = True End If End If ' Right If x1 < x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_RIGHT, False) Then CanEventMoveTowardsPlayer = DIR_RIGHT Exit Function didwalk = True End If End If Case 1 ' Right If x1 < x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_RIGHT, False) Then CanEventMoveTowardsPlayer = DIR_RIGHT Exit Function didwalk = True End If End If ' Left If x1 > x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_LEFT, False) Then CanEventMoveTowardsPlayer = DIR_LEFT Exit Function didwalk = True End If End If ' Down If y1 < y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_DOWN, False) Then CanEventMoveTowardsPlayer = DIR_DOWN Exit Function didwalk = True End If End If ' Up If y1 > y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_UP, False) Then CanEventMoveTowardsPlayer = DIR_UP Exit Function didwalk = True End If End If Case 2 ' Down If y1 < y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_DOWN, False) Then CanEventMoveTowardsPlayer = DIR_DOWN Exit Function didwalk = True End If End If ' Up If y1 > y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_UP, False) Then CanEventMoveTowardsPlayer = DIR_UP Exit Function didwalk = True End If End If ' Right If x1 < x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_RIGHT, False) Then CanEventMoveTowardsPlayer = DIR_RIGHT Exit Function didwalk = True End If End If ' Left If x1 > x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_LEFT, False) Then CanEventMoveTowardsPlayer = DIR_LEFT Exit Function didwalk = True End If End If Case 3 ' Left If x1 > x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_LEFT, False) Then CanEventMoveTowardsPlayer = DIR_LEFT Exit Function didwalk = True End If End If ' Right If x1 < x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_RIGHT, False) Then CanEventMoveTowardsPlayer = DIR_RIGHT Exit Function didwalk = True End If End If ' Up If y1 > y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_UP, False) Then CanEventMoveTowardsPlayer = DIR_UP Exit Function didwalk = True End If End If ' Down If y1 < y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_DOWN, False) Then CanEventMoveTowardsPlayer = DIR_DOWN Exit Function didwalk = True End If End If End Select CanEventMoveTowardsPlayer = Random(0, 3)End FunctionFunction CanEventMoveAwayFromPlayer(playerID As Long, mapnum As Long, eventID As Long) As LongDim i As Long, x As Long, y As Long, x1 As Long, y1 As Long, didwalk As Boolean, WalkThrough As Long 'This does not work for global events so this MUST be a player one.... 'This Event returns a direction, 5 is not a valid direction so we assume fail unless otherwise told. CanEventMoveAwayFromPlayer = 5 If playerID <= 0 Or playerID > Player_HighIndex Then Exit Function If mapnum <= 0 Or mapnum > MAX_MAPS Then Exit Function If eventID <= 0 Or eventID > TempPlayer(playerID).EventMap.CurrentEvents Then Exit Function x = GetPlayerX(playerID) y = GetPlayerY(playerID) x1 = TempPlayer(playerID).EventMap.EventPages(eventID).x y1 = TempPlayer(playerID).EventMap.EventPages(eventID).y WalkThrough = Map(mapnum).Events(TempPlayer(playerID).EventMap.EventPages(eventID).eventID).Pages(TempPlayer(playerID).EventMap.EventPages(eventID).pageID).WalkThrough i = Int(Rnd * 5) didwalk = False ' Lets move the event Select Case i Case 0 ' Up If y1 > y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_DOWN, False) Then CanEventMoveAwayFromPlayer = DIR_DOWN Exit Function didwalk = True End If End If ' Down If y1 < y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_UP, False) Then CanEventMoveAwayFromPlayer = DIR_UP Exit Function didwalk = True End If End If ' Left If x1 > x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_RIGHT, False) Then CanEventMoveAwayFromPlayer = DIR_RIGHT Exit Function didwalk = True End If End If ' Right If x1 < x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_LEFT, False) Then CanEventMoveAwayFromPlayer = DIR_LEFT Exit Function didwalk = True End If End If Case 1 ' Right If x1 < x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_LEFT, False) Then CanEventMoveAwayFromPlayer = DIR_LEFT Exit Function didwalk = True End If End If ' Left If x1 > x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_RIGHT, False) Then CanEventMoveAwayFromPlayer = DIR_RIGHT Exit Function didwalk = True End If End If ' Down If y1 < y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_UP, False) Then CanEventMoveAwayFromPlayer = DIR_UP Exit Function didwalk = True End If End If ' Up If y1 > y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_DOWN, False) Then CanEventMoveAwayFromPlayer = DIR_DOWN Exit Function didwalk = True End If End If Case 2 ' Down If y1 < y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_UP, False) Then CanEventMoveAwayFromPlayer = DIR_UP Exit Function didwalk = True End If End If ' Up If y1 > y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_DOWN, False) Then CanEventMoveAwayFromPlayer = DIR_DOWN Exit Function didwalk = True End If End If ' Right If x1 < x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_LEFT, False) Then CanEventMoveAwayFromPlayer = DIR_LEFT Exit Function didwalk = True End If End If ' Left If x1 > x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_RIGHT, False) Then CanEventMoveAwayFromPlayer = DIR_RIGHT Exit Function didwalk = True End If End If Case 3 ' Left If x1 > x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_RIGHT, False) Then CanEventMoveAwayFromPlayer = DIR_RIGHT Exit Function didwalk = True End If End If ' Right If x1 < x And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_LEFT, False) Then CanEventMoveAwayFromPlayer = DIR_LEFT Exit Function didwalk = True End If End If ' Up If y1 > y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_DOWN, False) Then CanEventMoveAwayFromPlayer = DIR_DOWN Exit Function didwalk = True End If End If ' Down If y1 < y And Not didwalk Then If CanEventMove(playerID, mapnum, x1, y1, eventID, WalkThrough, DIR_UP, False) Then CanEventMoveAwayFromPlayer = DIR_UP Exit Function didwalk = True End If End If End Select CanEventMoveAwayFromPlayer = Random(0, 3)End FunctionFunction GetDirToPlayer(playerID As Long, mapnum As Long, eventID As Long) As LongDim i As Long, x As Long, y As Long, x1 As Long, y1 As Long, didwalk As Boolean, WalkThrough As Long, distance As Long 'This does not work for global events so this MUST be a player one.... 'This Event returns a direction, 5 is not a valid direction so we assume fail unless otherwise told. If playerID <= 0 Or playerID > Player_HighIndex Then Exit Function If mapnum <= 0 Or mapnum > MAX_MAPS Then Exit Function If eventID <= 0 Or eventID > TempPlayer(playerID).EventMap.CurrentEvents Then Exit Function x = GetPlayerX(playerID) y = GetPlayerY(playerID) x1 = TempPlayer(playerID).EventMap.EventPages(eventID).x y1 = TempPlayer(playerID).EventMap.EventPages(eventID).y i = DIR_RIGHT If x - x1 > 0 Then If x - x1 > distance Then i = DIR_RIGHT distance = x - x1 End If ElseIf x - x1 < 0 Then If ((x - x1) * -1) > distance Then i = DIR_LEFT distance = ((x - x1) * -1) End If End If If y - y1 > 0 Then If y - y1 > distance Then i = DIR_DOWN distance = y - y1 End If ElseIf y - y1 < 0 Then If ((y - y1) * -1) > distance Then i = DIR_UP distance = ((y - y1) * -1) End If End If GetDirToPlayer = iEnd FunctionFunction GetDirAwayFromPlayer(playerID As Long, mapnum As Long, eventID As Long) As LongDim i As Long, x As Long, y As Long, x1 As Long, y1 As Long, didwalk As Boolean, WalkThrough As Long, distance As Long 'This does not work for global events so this MUST be a player one.... 'This Event returns a direction, 5 is not a valid direction so we assume fail unless otherwise told. If playerID <= 0 Or playerID > Player_HighIndex Then Exit Function If mapnum <= 0 Or mapnum > MAX_MAPS Then Exit Function If eventID <= 0 Or eventID > TempPlayer(playerID).EventMap.CurrentEvents Then Exit Function x = GetPlayerX(playerID) y = GetPlayerY(playerID) x1 = TempPlayer(playerID).EventMap.EventPages(eventID).x y1 = TempPlayer(playerID).EventMap.EventPages(eventID).y i = DIR_RIGHT If x - x1 > 0 Then If x - x1 > distance Then i = DIR_LEFT distance = x - x1 End If ElseIf x - x1 < 0 Then If ((x - x1) * -1) > distance Then i = DIR_RIGHT distance = ((x - x1) * -1) End If End If If y - y1 > 0 Then If y - y1 > distance Then i = DIR_UP distance = y - y1 End If ElseIf y - y1 < 0 Then If ((y - y1) * -1) > distance Then i = DIR_DOWN distance = ((y - y1) * -1) End If End If GetDirAwayFromPlayer = iEnd Function```in modenumerations in **Public Enum ServerPackets**add at bottom```SSpawnEvent SEventMove SEventDir SEventChat SEventStart SEventEnd SPlayBGM SPlaySound SFadeoutBGM SStopSound SSwitchesAndVariables SMapEventData```in modenumerations in **Public Enum ClientPackets**add at bottom```CEventChatReply CEvent CSwitchesAndVariables CRequestSwitchesAndVariables```at bottom of **modenumerations** add```' Event TypesPublic Enum EventType ' Message evAddText = 1 evShowText evShowChoices ' Game Progression evPlayerVar evPlayerSwitch evSelfSwitch ' Flow Control evCondition evExitProcess ' Player evChangeItems evRestoreHP evRestoreMP evLevelUp evChangeLevel evChangeSkills evChangeClass evChangeSprite evChangeSex evChangePK ' Movement evWarpPlayer evSetMoveRoute ' Character evPlayAnimation ' Music and Sounds evPlayBGM evFadeoutBGM evPlaySound evStopSound 'Etc... evCustomScript evSetAccess 'Shop/Bank evOpenBank evOpenShop 'New evGiveExpEnd Enum```in modplayer find **Sub PlayerWarp(ByVal index As Long, ByVal mapnum As Long, ByVal x As Long, ByVal y As Long)**just above```' clear target```add```TempPlayer(index).EventProcessingCount = 0 TempPlayer(index).EventMap.CurrentEvents = 0```in modplayer find **Sub PlayerMove(ByVal index As Long, ByVal Dir As Long, ByVal movement As Long, Optional ByVal sendToSelf As Boolean = False)**at the top add```Dim TileType As Long, VitalType As Long, Colour As Long, amount As Long, begineventprocessing As Boolean```then after```' They tried to hack If Moved = NO Then PlayerWarp index, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index) End If```add```x = GetPlayerX(index) y = GetPlayerY(index) If Moved = YES Then If TempPlayer(index).EventMap.CurrentEvents > 0 Then For i = 1 To TempPlayer(index).EventMap.CurrentEvents If Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Global = 1 Then If Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).x = x And Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).y = y And Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Pages(TempPlayer(index).EventMap.EventPages(i).pageID).Trigger = 1 Then begineventprocessing = True Else If TempPlayer(index).EventMap.EventPages(i).x = x And TempPlayer(index).EventMap.EventPages(i).y = y And Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Pages(TempPlayer(index).EventMap.EventPages(i).pageID).Trigger = 1 Then begineventprocessing = True End If If begineventprocessing = True Then 'Process this event, it is on-touch and everything checks out. If Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Pages(TempPlayer(index).EventMap.EventPages(i).pageID).CommandListCount > 0 Then TempPlayer(index).EventProcessingCount = TempPlayer(index).EventProcessingCount + 1 ReDim Preserve TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount) TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).ActionTimer = GetTickCount TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).CurList = 1 TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).CurSlot = 1 TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).eventID = TempPlayer(index).EventMap.EventPages(i).eventID TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).pageID = TempPlayer(index).EventMap.EventPages(i).pageID TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).WaitingForResponse = 0 ReDim TempPlayer(index).EventProcessing(TempPlayer(index).EventProcessingCount).ListLeftOff(0 To Map(GetPlayerMap(index)).Events(TempPlayer(index).EventMap.EventPages(i).eventID).Pages(TempPlayer(index).EventMap.EventPages(i).pageID).CommandListCount) End If begineventprocessing = False End If Next End If End If```in **frmmain** add```Private Sub Command1_Click() Player(1).Switches(1) = 1End SubPrivate Sub Command2_Click() Player(1).Switches(1) = 0End Sub```in modplayer find **' Send some more little goodies, no need to explain these**at the bottom of the list add```Call SendSwitchesAndVariables(index)```in modconstants find **Public Const MAX_PARTY_MEMBERS As Long = 4**add```Public Const MAX_SWITCHES As Long = 1000Public Const MAX_VARIABLES As Long = 1000```**add modcustomscripts to your projectadd modeventlogic to your project****save first!!! native compile will crash vblastly when you compile you need to got project, server properties, compile tab, and select p-code. this wont compile as is in native. there are drawbacks to p-code in security so it may not be for everyone.** Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2012 Share Posted August 8, 2012 **Client Side**in **frmmap editor**create a option button named **optEvent** with the caption **event** it should go in the same frame as the layers atributes and block area.in **frmmain**copy and past the **entire event chat box from the 2.3 client source**. its a box with some lables.double click the big text area in that box. it should be **lblEventChat**.add```Private Sub lblEventChat_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) lblEventChatContinue.FontBold = FalseEnd Sub```double click any of the 4 choicesadd```Private Sub lblChoices_Click(Index As Integer)Dim Buffer As clsBufferSet Buffer = New clsBufferBuffer.WriteLong CEventChatReplyBuffer.WriteLong EventReplyIDBuffer.WriteLong EventReplyPageBuffer.WriteLong IndexSendData Buffer.ToArraySet Buffer = NothingClearEventChatInEvent = FalseEnd Sub```double click **continue** and add```Private Sub lblEventChatContinue_Click()Dim Buffer As clsBufferSet Buffer = New clsBufferBuffer.WriteLong CEventChatReplyBuffer.WriteLong EventReplyIDBuffer.WriteLong EventReplyPageBuffer.WriteLong 0SendData Buffer.ToArraySet Buffer = NothingClearEventChatInEvent = FalseEnd Sub```then just below that in frmmain add```Private Sub lblEventChatContinue_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) lblEventChatContinue.FontBold = FalseEnd SubPrivate Sub lblEventChatContinue_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) lblEventChatContinue.FontBold = TrueEnd SubPrivate Sub lblEventChatContinue_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) lblEventChatContinue.FontBold = TrueEnd SubPrivate Sub lblEventChat_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) lblEventChatContinue.FontBold = FalseEnd SubPrivate Sub picEventChat_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) lblEventChatContinue.FontBold = FalseEnd Sub```in frmmain search for **Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)**then below```' hotbar For i = 1 To MAX_HOTBAR If KeyCode = 111 + i Then SendHotbarUse i End If Next```add```' handles delete events If KeyCode = vbKeyDelete Then If InMapEditor Then DeleteEvent CurX, CurY End If ' handles copy + pasting events If KeyCode = vbKeyC Then If ControlDown Then If InMapEditor Then CopyEvent_Map CurX, CurY End If End If End If If KeyCode = vbKeyV Then If ControlDown Then If InMapEditor Then PasteEvent_Map CurX, CurY End If End If End If```in frmmain find **Private Sub picScreen_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)**at the bottom of the sub add```If frmEditor_Events.Visible Then frmEditor_Events.SetFocus```at the bottom of **modtext** add```Public Sub DrawEventName(ByVal Index As Long)Dim TextX As LongDim TextY As LongDim color As LongDim Name As String ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler If InMapEditor Then Exit Sub color = QBColor(White) Name = Trim$(Map.MapEvents(Index).Name) ' calc pos TextX = ConvertMapX(Map.MapEvents(Index).x * PIC_X) + Map.MapEvents(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name))) If Map.MapEvents(Index).GraphicType = 0 Then TextY = ConvertMapY(Map.MapEvents(Index).y * PIC_Y) + Map.MapEvents(Index).YOffset - 16 ElseIf Map.MapEvents(Index).GraphicType = 1 Then If Map.MapEvents(Index).GraphicNum < 1 Or Map.MapEvents(Index).GraphicNum > NumCharacters Then TextY = ConvertMapY(Map.MapEvents(Index).y * PIC_Y) + Map.MapEvents(Index).YOffset - 16 Else ' Determine location for text TextY = ConvertMapY(Map.MapEvents(Index).y * PIC_Y) + Map.MapEvents(Index).YOffset - (DDSD_Character(Map.MapEvents(Index).GraphicNum).lHeight / 4) + 16 End If ElseIf Map.MapEvents(Index).GraphicType = 2 Then If Map.MapEvents(Index).GraphicY2 = 0 Then TextY = ConvertMapY(Map.MapEvents(Index).y * PIC_Y) + Map.MapEvents(Index).YOffset - ((Map.MapEvents(Index).GraphicY2 - Map.MapEvents(Index).GraphicY) * 32) + 16 Else TextY = ConvertMapY(Map.MapEvents(Index).y * PIC_Y) + Map.MapEvents(Index).YOffset - 32 + 16 End If End If ' Draw name Call DrawText(TexthDC, TextX, TextY, Name, color) ' Error handler Exit Suberrorhandler: HandleError "DrawEventName", "modText", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```in modtypes find **Private Type PlayerRec**add at bottom```EventTimer As Long```in modtypes below **Private Type TileDataRec**add```Public Type ConditionalBranchRec Condition As Long Data1 As Long Data2 As Long Data3 As Long CommandList As Long ElseCommandList As LongEnd TypePublic Type MoveRouteRec Index As Long Data1 As Long Data2 As Long Data3 As Long Data4 As Long Data5 As Long Data6 As LongEnd TypePublic Type EventCommandRec Index As Long Text1 As String Text2 As String Text3 As String Text4 As String Text5 As String Data1 As Long Data2 As Long Data3 As Long Data4 As Long Data5 As Long Data6 As Long ConditionalBranch As ConditionalBranchRec MoveRouteCount As Long MoveRoute() As MoveRouteRecEnd TypePublic Type CommandListRec CommandCount As Long ParentList As Long Commands() As EventCommandRecEnd TypePublic Type EventPageRec 'These are condition variables that decide if the event even appears to the player. chkVariable As Long VariableIndex As Long VariableCondition As Long VariableCompare As Long chkSwitch As Long SwitchIndex As Long SwitchCompare As Long chkHasItem As Long HasItemIndex As Long chkSelfSwitch As Long SelfSwitchIndex As Long SelfSwitchCompare As Long 'End Conditions 'Handles the Event Sprite GraphicType As Byte Graphic As Long GraphicX As Long GraphicY As Long GraphicX2 As Long GraphicY2 As Long 'Handles Movement - Move Routes to come soon. MoveType As Byte MoveSpeed As Byte MoveFreq As Byte MoveRouteCount As Long MoveRoute() As MoveRouteRec IgnoreMoveRoute As Long RepeatMoveRoute As Long 'Guidelines for the event WalkAnim As Byte DirFix As Byte WalkThrough As Byte ShowName As Byte 'Trigger for the event Trigger As Byte 'Commands for the event CommandListCount As Long CommandList() As CommandListRec Position As Byte 'Client Needed Only x As Long y As LongEnd TypePublic Type EventRec Name As String Global As Long pageCount As Long Pages() As EventPageRec x As Long y As LongEnd Type```in modtypes below **Public Type TileRec**add```Private Type MapEventRec Name As String Dir As Long x As Long y As Long GraphicType As Long GraphicX As Long GraphicY As Long GraphicX2 As Long GraphicY2 As Long GraphicNum As Long Moving As Long MovementSpeed As Long Position As Long XOffset As Long YOffset As Long Step As Long Visible As Long WalkAnim As Long DirFix As Long ShowDir As Long WalkThrough As Long ShowName As LongEnd Type```in modtypes find **Private Type MapRec**at bottom add```EventCount As Long Events() As EventRec 'Client Side Only -- Temporary CurrentEvents As Long MapEvents() As MapEventRec```at bottom of **modtypes** add```Public Type EventListRec CommandList As Long CommandNum As LongEnd Type```search for **Call CheckKeys ' Check to make sure they aren't trying to auto do anything**then replace this line```If GetForegroundWindow() = frmMain.hWnd Then```with```If GetForegroundWindow() = frmMain.hWnd Or GetForegroundWindow() = frmEditor_Events.hWnd Then```in modgamelogic search for **' Process input before rendering, otherwise input will be behind by 1 frame**then just above it add```If Tick > EventChatTimer Then If frmMain.lblEventChat.Visible = False Then If frmMain.picEventChat.Visible Then frmMain.picEventChat.Visible = False End If End If End If```in modgamelogic search for **WalkTimer = Tick + 30 ' edit this value to change WalkTimer**then just above it add```If Map.CurrentEvents > 0 Then For i = 1 To Map.CurrentEvents Call ProcessEventMovement(i) Next i End If```in modgamelogic search for **Public Sub CheckAttack()**at the top add```Dim attackspeed As Long, x As Long, y As Long, i As Long```then before the last endif in the sub add```Select Case Player(MyIndex).Dir Case DIR_UP x = GetPlayerX(MyIndex) y = GetPlayerY(MyIndex) - 1 Case DIR_DOWN x = GetPlayerX(MyIndex) y = GetPlayerY(MyIndex) + 1 Case DIR_LEFT x = GetPlayerX(MyIndex) - 1 y = GetPlayerY(MyIndex) Case DIR_RIGHT x = GetPlayerX(MyIndex) + 1 y = GetPlayerY(MyIndex) End Select If GetTickCount > Player(MyIndex).EventTimer Then For i = 1 To Map.CurrentEvents If Map.MapEvents(i).Visible = 1 Then If Map.MapEvents(i).x = x And Map.MapEvents(i).y = y Then Set Buffer = New clsBuffer Buffer.WriteLong CEvent Buffer.WriteLong i SendData Buffer.ToArray() Set Buffer = Nothing Player(MyIndex).EventTimer = GetTickCount + 200 End If End If Next End If```in modgamelogic search for **Function CanMove() As Boolean**below```' Make sure they aren't trying to move when they are already moving If Player(MyIndex).Moving <> 0 Then CanMove = False Exit Function End If```add```If InEvent Then CanMove = False Exit Function End If```in modgamelogic search for **Function CheckDirection(ByVal Direction As Byte) As Boolean**at bottom of the function add```For i = 1 To Map.CurrentEvents If Map.MapEvents(i).Visible = 1 Then If Map.MapEvents(i).x = x Then If Map.MapEvents(i).y = y Then If Map.MapEvents(i).WalkThrough = 0 Then CheckDirection = True Exit Function End If End If End If End If Next```at the bottom of **modgamelogic** add```Sub ProcessEventMovement(ByVal id As Long) ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler ' Check if NPC is walking, and if so process moving them over If Map.MapEvents(id).Moving = 1 Then Select Case Map.MapEvents(id).Dir Case DIR_UP Map.MapEvents(id).YOffset = Map.MapEvents(id).YOffset - ((ElapsedTime / 1000) * (Map.MapEvents(id).MovementSpeed * SIZE_X)) If Map.MapEvents(id).YOffset < 0 Then Map.MapEvents(id).YOffset = 0 Case DIR_DOWN Map.MapEvents(id).YOffset = Map.MapEvents(id).YOffset + ((ElapsedTime / 1000) * (Map.MapEvents(id).MovementSpeed * SIZE_X)) If Map.MapEvents(id).YOffset > 0 Then Map.MapEvents(id).YOffset = 0 Case DIR_LEFT Map.MapEvents(id).XOffset = Map.MapEvents(id).XOffset - ((ElapsedTime / 1000) * (Map.MapEvents(id).MovementSpeed * SIZE_X)) If Map.MapEvents(id).XOffset < 0 Then Map.MapEvents(id).XOffset = 0 Case DIR_RIGHT Map.MapEvents(id).XOffset = Map.MapEvents(id).XOffset + ((ElapsedTime / 1000) * (Map.MapEvents(id).MovementSpeed * SIZE_X)) If Map.MapEvents(id).XOffset > 0 Then Map.MapEvents(id).XOffset = 0 End Select ' Check if completed walking over to the next tile If Map.MapEvents(id).Moving > 0 Then If Map.MapEvents(id).Dir = DIR_RIGHT Or Map.MapEvents(id).Dir = DIR_DOWN Then If (Map.MapEvents(id).XOffset >= 0) And (Map.MapEvents(id).YOffset >= 0) Then Map.MapEvents(id).Moving = 0 If Map.MapEvents(id).Step = 1 Then Map.MapEvents(id).Step = 3 Else Map.MapEvents(id).Step = 1 End If End If Else If (Map.MapEvents(id).XOffset <= 0) And (Map.MapEvents(id).YOffset <= 0) Then Map.MapEvents(id).Moving = 0 If Map.MapEvents(id).Step = 1 Then Map.MapEvents(id).Step = 3 Else Map.MapEvents(id).Step = 1 End If End If End If End If End If ' Error handler Exit Suberrorhandler: HandleError "ProcessNpcMovement", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPublic Function GetColorString(color As Long) Select Case color Case 0 GetColorString = "Black" Case 1 GetColorString = "Blue" Case 2 GetColorString = "Green" Case 3 GetColorString = "Cyan" Case 4 GetColorString = "Red" Case 5 GetColorString = "Magenta" Case 6 GetColorString = "Brown" Case 7 GetColorString = "Grey" Case 8 GetColorString = "Dark Grey" Case 9 GetColorString = "Bright Blue" Case 10 GetColorString = "Bright Green" Case 11 GetColorString = "Bright Cyan" Case 12 GetColorString = "Bright Red" Case 13 GetColorString = "Pink" Case 14 GetColorString = "Yellow" Case 15 GetColorString = "White" End SelectEnd FunctionSub ClearEventChat() Dim i As Long If AnotherChat = 1 Then For i = 1 To 4 frmMain.lblChoices(i).Visible = False Next frmMain.lblEventChat.Caption = "" frmMain.lblEventChatContinue.Visible = False ElseIf AnotherChat = 2 Then For i = 1 To 4 frmMain.lblChoices(i).Visible = False Next frmMain.lblEventChat.Visible = False frmMain.lblEventChatContinue.Visible = False EventChatTimer = GetTickCount + 100 Else frmMain.picEventChat.Visible = False End IfEnd Sub```in modclienttcp search for **Public Sub SendMap()**at the top add```Dim i As Long, z As Long, w As Long```at the bottom before```SendData Buffer.ToArray() Set Buffer = Nothing```add```'Event Data Buffer.WriteLong Map.EventCount If Map.EventCount > 0 Then For i = 1 To Map.EventCount With Map.Events(i) Buffer.WriteString .Name Buffer.WriteLong .Global Buffer.WriteLong .x Buffer.WriteLong .y Buffer.WriteLong .pageCount End With If Map.Events(i).pageCount > 0 Then For x = 1 To Map.Events(i).pageCount With Map.Events(i).Pages(x) Buffer.WriteLong .chkVariable Buffer.WriteLong .VariableIndex Buffer.WriteLong .VariableCondition Buffer.WriteLong .VariableCompare Buffer.WriteLong .chkSwitch Buffer.WriteLong .SwitchIndex Buffer.WriteLong .SwitchCompare Buffer.WriteLong .chkHasItem Buffer.WriteLong .HasItemIndex Buffer.WriteLong .chkSelfSwitch Buffer.WriteLong .SelfSwitchIndex Buffer.WriteLong .SelfSwitchCompare Buffer.WriteLong .GraphicType Buffer.WriteLong .Graphic Buffer.WriteLong .GraphicX Buffer.WriteLong .GraphicY Buffer.WriteLong .GraphicX2 Buffer.WriteLong .GraphicY2 Buffer.WriteLong .MoveType Buffer.WriteLong .MoveSpeed Buffer.WriteLong .MoveFreq Buffer.WriteLong .MoveRouteCount Buffer.WriteLong .IgnoreMoveRoute Buffer.WriteLong .RepeatMoveRoute If .MoveRouteCount > 0 Then For y = 1 To .MoveRouteCount Buffer.WriteLong .MoveRoute(y).Index Buffer.WriteLong .MoveRoute(y).Data1 Buffer.WriteLong .MoveRoute(y).Data2 Buffer.WriteLong .MoveRoute(y).Data3 Buffer.WriteLong .MoveRoute(y).Data4 Buffer.WriteLong .MoveRoute(y).Data5 Buffer.WriteLong .MoveRoute(y).Data6 Next End If Buffer.WriteLong .WalkAnim Buffer.WriteLong .DirFix Buffer.WriteLong .WalkThrough Buffer.WriteLong .ShowName Buffer.WriteLong .Trigger Buffer.WriteLong .CommandListCount Buffer.WriteLong .Position End With If Map.Events(i).Pages(x).CommandListCount > 0 Then For y = 1 To Map.Events(i).Pages(x).CommandListCount Buffer.WriteLong Map.Events(i).Pages(x).CommandList(y).CommandCount Buffer.WriteLong Map.Events(i).Pages(x).CommandList(y).ParentList If Map.Events(i).Pages(x).CommandList(y).CommandCount > 0 Then For z = 1 To Map.Events(i).Pages(x).CommandList(y).CommandCount With Map.Events(i).Pages(x).CommandList(y).Commands(z) Buffer.WriteLong .Index Buffer.WriteString .Text1 Buffer.WriteString .Text2 Buffer.WriteString .Text3 Buffer.WriteString .Text4 Buffer.WriteString .Text5 Buffer.WriteLong .Data1 Buffer.WriteLong .Data2 Buffer.WriteLong .Data3 Buffer.WriteLong .Data4 Buffer.WriteLong .Data5 Buffer.WriteLong .Data6 Buffer.WriteLong .ConditionalBranch.CommandList Buffer.WriteLong .ConditionalBranch.Condition Buffer.WriteLong .ConditionalBranch.Data1 Buffer.WriteLong .ConditionalBranch.Data2 Buffer.WriteLong .ConditionalBranch.Data3 Buffer.WriteLong .ConditionalBranch.ElseCommandList Buffer.WriteLong .MoveRouteCount If .MoveRouteCount > 0 Then For w = 1 To .MoveRouteCount Buffer.WriteLong .MoveRoute(w).Index Buffer.WriteLong .MoveRoute(w).Data1 Buffer.WriteLong .MoveRoute(w).Data2 Buffer.WriteLong .MoveRoute(w).Data3 Buffer.WriteLong .MoveRoute(w).Data4 Buffer.WriteLong .MoveRoute(w).Data5 Buffer.WriteLong .MoveRoute(w).Data6 Next End If End With Next End If Next End If Next End If Next End If 'End Event Data```in moddatabase search for **Public Sub SaveMap(ByVal MapNum As Long)**at the top add```Dim y As Long, i As Long, z As Long, w As Long```in moddatabase search for **Public Sub LoadMap(ByVal MapNum As Long)**at the top add```Dim y As Long, i As Long, z As Long, w As Long, p As Long```in modglobals search for **Public CurrencyMenu As Byte**below it add```Public InEvent As Boolean```at bottom of **modglobals** add```' Temp event storagePublic tmpEvent As EventRecPublic isEdit As BooleanPublic curPageNum As LongPublic curCommand As LongPublic GraphicSelX As LongPublic GraphicSelY As LongPublic GraphicSelX2 As LongPublic GraphicSelY2 As LongPublic EventTileX As LongPublic EventTileY As LongPublic EditorEvent As LongPublic GraphicSelType As Long 'Are we selecting a graphic for a move route? A page sprite? What???Public TempMoveRouteCount As LongPublic TempMoveRoute() As MoveRouteRecPublic IsMoveRouteCommand As BooleanPublic ListOfEvents() As LongPublic EventReplyID As LongPublic EventReplyPage As LongPublic RenameType As LongPublic RenameIndex As LongPublic EventChatTimer As LongPublic AnotherChat As Long 'Determines if another showtext/showchoices is comming up, if so, dont close the event chatbox...```at the top of **modgameeditors** just below```Option Explicit ```add```Public cpEvent As EventRecConst LB_SETHORIZONTALEXTENT = &H194Private Declare Function SendMessageByNum Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As LongPublic EventList() As EventListRec```search for **Public Sub MapEditorMouseDown(ByVal Button As Integer, ByVal x As Long, ByVal y As Long, Optional ByVal movedMouse As Boolean**below```If Not isInBounds Then Exit Sub If Button = vbLeftButton Then If frmEditor_Map.optLayers.Value Then If EditorTileWidth = 1 And EditorTileHeight = 1 Then 'single tile MapEditorSetTile CurX, CurY, CurLayer Else ' multi tile! MapEditorSetTile CurX, CurY, CurLayer, True End If```add```ElseIf frmEditor_Map.optEvent.Value Then If frmEditor_Events.Visible = False Then AddEvent CurX, CurY End If```then below```If Button = vbRightButton Then If frmEditor_Map.optLayers.Value Then With Map.Tile(CurX, CurY) ' clear layer .Layer(CurLayer).x = 0 .Layer(CurLayer).y = 0 .Layer(CurLayer).Tileset = 0 End With```add```ElseIf frmEditor_Map.optEvent.Value Then Call DeleteEvent(CurX, CurY)```at bottom of **modgameeditors** add```'Event Editor Stuffz Also includes event functions from the map editor (copy/paste/delete)Sub CopyEvent_Map(x As Long, y As Long)Dim Count As Long, i As Long Count = Map.EventCount If Count = 0 Then Exit Sub For i = 1 To Count If Map.Events(i).x = x And Map.Events(i).y = y Then ' copy it 'CopyMemory ByVal VarPtr(cpEvent), ByVal VarPtr(Map.Events(i)), LenB(Map.Events(i)) cpEvent = Map.Events(i) ' exit Exit Sub End If NextEnd SubSub PasteEvent_Map(x As Long, y As Long)Dim Count As Long, i As Long, eventNum As Long Count = Map.EventCount If Count > 0 Then For i = 1 To Count If Map.Events(i).x = x And Map.Events(i).y = y Then ' already an event - paste over it eventNum = i End If Next End If ' couldn't find one - create one If eventNum = 0 Then ' increment count AddEvent x, y, True eventNum = Count + 1 End If ' copy it 'CopyMemory ByVal VarPtr(Map.Events(eventNum)), ByVal VarPtr(cpEvent), LenB(cpEvent) Map.Events(eventNum) = cpEvent ' set position Map.Events(eventNum).x = x Map.Events(eventNum).y = yEnd SubSub DeleteEvent(x As Long, y As Long)Dim Count As Long, i As Long, lowIndex As Long If Not InMapEditor Then Exit Sub Count = Map.EventCount For i = 1 To Count If Map.Events(i).x = x And Map.Events(i).y = y Then ' delete it ClearEvent i lowIndex = i Exit For End If Next ' not found anything If lowIndex = 0 Then Exit Sub ' move everything down an index For i = lowIndex To Count - 1 CopyEvent i + 1, i Next ' delete the last index ClearEvent Count ' set the new count Map.EventCount = Count - 1End SubSub AddEvent(x As Long, y As Long, Optional ByVal cancelLoad As Boolean = False)Dim Count As Long, pageCount As Long, i As Long Count = Map.EventCount + 1 ' make sure there's not already an event If Count - 1 > 0 Then For i = 1 To Count - 1 If Map.Events(i).x = x And Map.Events(i).y = y Then ' already an event - edit it If Not cancelLoad Then EventEditorInit i Exit Sub End If Next End If ' increment count Map.EventCount = Count ReDim Preserve Map.Events(0 To Count) ' set the new event Map.Events(Count).x = x Map.Events(Count).y = y ' give it a new page pageCount = Map.Events(Count).pageCount + 1 Map.Events(Count).pageCount = pageCount ReDim Preserve Map.Events(Count).Pages(pageCount) ' load the editor If Not cancelLoad Then EventEditorInit CountEnd SubSub ClearEvent(eventNum As Long) Call ZeroMemory(ByVal VarPtr(Map.Events(eventNum)), LenB(Map.Events(eventNum)))End SubSub CopyEvent(original As Long, newone As Long) CopyMemory ByVal VarPtr(Map.Events(newone)), ByVal VarPtr(Map.Events(original)), LenB(Map.Events(original))End SubSub EventEditorInit(eventNum As Long)Dim i As Long EditorEvent = eventNum ' copy the event data to the temp event 'CopyMemory ByVal VarPtr(tmpEvent), ByVal VarPtr(Map.Events(eventNum)), LenB(Map.Events(eventNum)) tmpEvent = Map.Events(eventNum) ' populate form With frmEditor_Events ' set the tabs .tabPages.Tabs.Clear For i = 1 To tmpEvent.pageCount .tabPages.Tabs.Add , , str(i) Next ' items .cmbHasItem.Clear .cmbHasItem.AddItem "None" For i = 1 To MAX_ITEMS .cmbHasItem.AddItem i & ": " & Trim$(Item(i).Name) Next ' variables .cmbPlayerVar.Clear .cmbPlayerVar.AddItem "None" For i = 1 To MAX_VARIABLES .cmbPlayerVar.AddItem i & ". " & Variables(i) Next ' variables .cmbPlayerSwitch.Clear .cmbPlayerSwitch.AddItem "None" For i = 1 To MAX_SWITCHES .cmbPlayerSwitch.AddItem i & ". " & Switches(i) Next ' name .txtName.text = tmpEvent.Name ' enable delete button If tmpEvent.pageCount > 1 Then .cmdDeletePage.Enabled = True Else .cmdDeletePage.Enabled = False End If .cmdPastePage.Enabled = False ' Load page 1 to start off with curPageNum = 1 EventEditorLoadPage curPageNum End With ' show the editor frmEditor_Events.ShowEnd SubSub EventEditorLoadPage(pageNum As Long) ' populate form With tmpEvent.Pages(pageNum) GraphicSelX = .GraphicX GraphicSelY = .GraphicY GraphicSelX2 = .GraphicX2 GraphicSelY2 = .GraphicY2 frmEditor_Events.cmbGraphic.ListIndex = .GraphicType frmEditor_Events.cmbHasItem.ListIndex = .HasItemIndex frmEditor_Events.cmbMoveFreq.ListIndex = .MoveFreq frmEditor_Events.cmbMoveSpeed.ListIndex = .MoveSpeed frmEditor_Events.cmbMoveType.ListIndex = .MoveType frmEditor_Events.cmbPlayerVar.ListIndex = .VariableIndex frmEditor_Events.cmbPlayerSwitch.ListIndex = .SwitchIndex frmEditor_Events.cmbSelfSwitch.ListIndex = .SelfSwitchIndex frmEditor_Events.cmbSelfSwitchCompare.ListIndex = .SelfSwitchCompare frmEditor_Events.cmbPlayerSwitchCompare.ListIndex = .SwitchCompare frmEditor_Events.cmbPlayerVarCompare.ListIndex = .VariableCompare frmEditor_Events.chkGlobal.Value = tmpEvent.Global frmEditor_Events.cmbTrigger.ListIndex = .Trigger frmEditor_Events.chkDirFix.Value = .DirFix frmEditor_Events.chkHasItem.Value = .chkHasItem frmEditor_Events.chkPlayerVar.Value = .chkVariable frmEditor_Events.chkPlayerSwitch.Value = .chkSwitch frmEditor_Events.chkSelfSwitch.Value = .chkSelfSwitch frmEditor_Events.chkWalkAnim.Value = .WalkAnim frmEditor_Events.chkWalkThrough.Value = .WalkThrough frmEditor_Events.chkShowName.Value = .ShowName frmEditor_Events.txtPlayerVariable = .VariableCondition frmEditor_Events.scrlGraphic.Value = .Graphic If .chkHasItem = 0 Then frmEditor_Events.cmbHasItem.Enabled = False Else frmEditor_Events.cmbHasItem.Enabled = True End If If .chkSelfSwitch = 0 Then frmEditor_Events.cmbSelfSwitch.Enabled = False frmEditor_Events.cmbSelfSwitchCompare.Enabled = False Else frmEditor_Events.cmbSelfSwitch.Enabled = True frmEditor_Events.cmbSelfSwitchCompare.Enabled = True End If If .chkSwitch = 0 Then frmEditor_Events.cmbPlayerSwitch.Enabled = False frmEditor_Events.cmbPlayerSwitchCompare.Enabled = False Else frmEditor_Events.cmbPlayerSwitch.Enabled = True frmEditor_Events.cmbPlayerSwitchCompare.Enabled = True End If If .chkVariable = 0 Then frmEditor_Events.cmbPlayerVar.Enabled = False frmEditor_Events.txtPlayerVariable.Enabled = False frmEditor_Events.cmbPlayerVarCompare.Enabled = False Else frmEditor_Events.cmbPlayerVar.Enabled = True frmEditor_Events.txtPlayerVariable.Enabled = True frmEditor_Events.cmbPlayerVarCompare.Enabled = True End If If frmEditor_Events.cmbMoveType.ListIndex = 2 Then frmEditor_Events.cmdMoveRoute.Enabled = True Else frmEditor_Events.cmdMoveRoute.Enabled = False End If frmEditor_Events.cmbPositioning.ListIndex = .Position ' show the commands EventListCommands End WithEnd Sub``` Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2012 Share Posted August 8, 2012 add also the the bottom of **modgameeditors**```Sub EventEditorOK() ' copy the event data from the temp event 'CopyMemory ByVal VarPtr(Map.Events(EditorEvent)), ByVal VarPtr(tmpEvent), LenB(tmpEvent) Map.Events(EditorEvent) = tmpEvent ' unload the form Unload frmEditor_EventsEnd SubPublic Sub EventListCommands()Dim i As Long, curlist As Long, oldI As Long, x As Long, indent As String, listleftoff() As Long, conditionalstage() As Long frmEditor_Events.lstCommands.Clear If tmpEvent.Pages(curPageNum).CommandListCount > 0 Then ReDim listleftoff(1 To tmpEvent.Pages(curPageNum).CommandListCount) ReDim conditionalstage(1 To tmpEvent.Pages(curPageNum).CommandListCount) 'Start Up at 1 curlist = 1 x = -1newlist: For i = 1 To tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount If listleftoff(curlist) > 0 Then If (tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(listleftoff(curlist)).Index = EventType.evCondition Or tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(listleftoff(curlist)).Index = EventType.evShowChoices) And conditionalstage(curlist) <> 0 Then i = listleftoff(curlist) ElseIf listleftoff(curlist) >= i Then i = listleftoff(curlist) + 1 End If End If If i <= tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount Then If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Index = EventType.evCondition Then x = x + 1 Select Case conditionalstage(curlist) Case 0 ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = i Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Condition Case 0 Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data2 Case 0 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player Variable [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 & ". " & Variables(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1) & "] == " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data3 Case 1 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player Variable [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 & ". " & Variables(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1) & "] >= " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data3 Case 2 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player Variable [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 & ". " & Variables(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1) & "] <= " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data3 Case 3 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player Variable [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 & ". " & Variables(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1) & "] > " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data3 Case 4 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player Variable [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 & ". " & Variables(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1) & "] < " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data3 Case 5 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player Variable [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 & ". " & Variables(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1) & "] != " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data3 End Select Case 1 If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data2 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player Switch [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 & ". " & Switches(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1) & "] == " & "True" ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data2 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player Switch [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 & ". " & Switches(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1) & "] == " & "False" End If Case 2 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player Has Item [" & Trim$(Item(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1).Name) & "]" Case 3 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player's Class Is [" & Trim$(Class(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1).Name) & "]" Case 4 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player Knows Skill [" & Trim$(Spell(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1).Name) & "]" Case 5 Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data2 Case 0 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player's Level is == " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 Case 1 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player's Level is >= " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 Case 2 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player's Level is <= " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 Case 3 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player's Level is > " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 Case 4 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player's Level is < " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 Case 5 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Player's Level is NOT " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 End Select Case 6 If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data2 = 0 Then Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 Case 0 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Self Switch [A] == " & "True" Case 1 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Self Switch [b] == " & "True" Case 2 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Self Switch [C] == " & "True" Case 3 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Self Switch [D] == " & "True" End Select ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data2 = 1 Then Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.Data1 Case 0 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Self Switch [A] == " & "False" Case 1 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Self Switch [b] == " & "False" Case 2 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Self Switch [C] == " & "False" Case 3 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Conditional Branch: Self Switch [D] == " & "False" End Select End If End Select indent = indent & " " listleftoff(curlist) = i conditionalstage(curlist) = 1 curlist = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.CommandList GoTo newlist Case 1 ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = 0 frmEditor_Events.lstCommands.AddItem Mid(indent, 1, Len(indent) - 4) & " : " & "Else" listleftoff(curlist) = i conditionalstage(curlist) = 2 curlist = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).ConditionalBranch.ElseCommandList GoTo newlist Case 2 ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = 0 frmEditor_Events.lstCommands.AddItem Mid(indent, 1, Len(indent) - 4) & " : " & "End Branch" indent = Mid(indent, 1, Len(indent) - 7) listleftoff(curlist) = i conditionalstage(curlist) = 0 End Select ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Index = EventType.evShowChoices Then x = x + 1 Select Case conditionalstage(curlist) Case 0 ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = i frmEditor_Events.lstCommands.AddItem indent & "@>" & "Show Choices - Prompt: " & Mid(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text1, 1, 20) & "..." indent = indent & " " listleftoff(curlist) = i conditionalstage(curlist) = 1 GoTo newlist Case 1 If Trim$(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text2) <> "" Then ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = 0 frmEditor_Events.lstCommands.AddItem Mid(indent, 1, Len(indent) - 4) & " : " & "When [" & Trim$(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text2) & "]" listleftoff(curlist) = i conditionalstage(curlist) = 2 curlist = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 GoTo newlist Else x = x - 1 listleftoff(curlist) = i conditionalstage(curlist) = 2 curlist = curlist GoTo newlist End If Case 2 If Trim$(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text3) <> "" Then ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = 0 frmEditor_Events.lstCommands.AddItem Mid(indent, 1, Len(indent) - 4) & " : " & "When [" & Trim$(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text3) & "]" listleftoff(curlist) = i conditionalstage(curlist) = 3 curlist = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 GoTo newlist Else x = x - 1 listleftoff(curlist) = i conditionalstage(curlist) = 3 curlist = curlist GoTo newlist End If Case 3 If Trim$(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text4) <> "" Then ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = 0 frmEditor_Events.lstCommands.AddItem Mid(indent, 1, Len(indent) - 4) & " : " & "When [" & Trim$(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text4) & "]" listleftoff(curlist) = i conditionalstage(curlist) = 4 curlist = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 GoTo newlist Else x = x - 1 listleftoff(curlist) = i conditionalstage(curlist) = 4 curlist = curlist GoTo newlist End If Case 4 If Trim$(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text5) <> "" Then ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = 0 frmEditor_Events.lstCommands.AddItem Mid(indent, 1, Len(indent) - 4) & " : " & "When [" & Trim$(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text5) & "]" listleftoff(curlist) = i conditionalstage(curlist) = 5 curlist = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data4 GoTo newlist Else x = x - 1 listleftoff(curlist) = i conditionalstage(curlist) = 5 curlist = curlist GoTo newlist End If Case 5 ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = 0 frmEditor_Events.lstCommands.AddItem Mid(indent, 1, Len(indent) - 4) & " : " & "Branch End" indent = Mid(indent, 1, Len(indent) - 7) listleftoff(curlist) = i conditionalstage(curlist) = 0 End Select Else x = x + 1 ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = i Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Index Case EventType.evAddText Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 Case 0 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Add Text - " & Mid(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text1, 1, 20) & "... - Color: " & GetColorString(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1) & " - Chat Type: Player" Case 1 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Add Text - " & Mid(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text1, 1, 20) & "... - Color: " & GetColorString(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1) & " - Chat Type: Map" Case 2 frmEditor_Events.lstCommands.AddItem indent & "@>" & "Add Text - " & Mid(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text1, 1, 20) & "... - Color: " & GetColorString(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1) & " - Chat Type: Global" End Select Case EventType.evShowText frmEditor_Events.lstCommands.AddItem indent & "@>" & "Show Text - " & Mid(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text1, 1, 20) & "..." Case EventType.evPlayerVar frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player Variable [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & Variables(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1) & "] == " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 Case EventType.evPlayerSwitch If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player Switch [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & ". " & Switches(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1) & "] == True" ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player Switch [" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & ". " & Switches(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1) & "] == False" End If Case EventType.evSelfSwitch Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 Case 0 If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Self Switch [A] to ON" ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Self Switch [A] to OFF" End If Case 1 If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Self Switch [b] to ON" ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Self Switch [b] to OFF" End If Case 2 If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Self Switch [C] to ON" ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Self Switch [C] to OFF" End If Case 3 If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Self Switch [D] to ON" ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Self Switch [D] to OFF" End If End Select Case EventType.evExitProcess frmEditor_Events.lstCommands.AddItem indent & "@>" & "Exit Event Processing" Case EventType.evChangeItems If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Item Amount of [" & Trim$(Item(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) & "] to " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Give Player " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 & " " & Trim$(Item(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) & "(s)" ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 2 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Take " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 & " " & Trim$(Item(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) & "(s) from Player." End If Case EventType.evRestoreHP frmEditor_Events.lstCommands.AddItem indent & "@>" & "Restore Player HP" Case EventType.evRestoreMP frmEditor_Events.lstCommands.AddItem indent & "@>" & "Restore Player MP" Case EventType.evLevelUp frmEditor_Events.lstCommands.AddItem indent & "@>" & "Level Up Player" Case EventType.evChangeLevel frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player Level to " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 Case EventType.evChangeSkills If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Teach Player Skill [" & Trim$(Spell(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) & "]" ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Remove Player Skill [" & Trim$(Spell(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) & "]" End If Case EventType.evChangeClass frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player Class to " & Trim$(Class(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) Case EventType.evChangeSprite frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player Sprite to " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 Case EventType.evChangeSex If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player Sex to Male." ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player Sex to Female." End If Case EventType.evChangePK If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player PK to No." ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player PK to Yes." End If Case EventType.evWarpPlayer If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data4 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Warp Player To Map: " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & " Tile(" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 & "," & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 & ") while retaining direction." Else Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data4 - 1 Case DIR_UP frmEditor_Events.lstCommands.AddItem indent & "@>" & "Warp Player To Map: " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & " Tile(" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 & "," & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 & ") facing upward." Case DIR_DOWN frmEditor_Events.lstCommands.AddItem indent & "@>" & "Warp Player To Map: " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & " Tile(" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 & "," & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 & ") facing downward." Case DIR_LEFT frmEditor_Events.lstCommands.AddItem indent & "@>" & "Warp Player To Map: " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & " Tile(" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 & "," & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 & ") facing left." Case DIR_RIGHT frmEditor_Events.lstCommands.AddItem indent & "@>" & "Warp Player To Map: " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & " Tile(" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 & "," & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 & ") facing right." End Select End If Case EventType.evSetMoveRoute If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 <= Map.EventCount Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Move Route for Event #" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & " [" & Trim$(Map.Events(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) & "]" Else frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Move Route for COULD NOT FIND EVENT!" End If Case EventType.evPlayAnimation If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 0 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Play Animation " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & " [" & Trim$(Animation(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) & "]" & " on Player" ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 1 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Play Animation " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & " [" & Trim$(Animation(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) & "]" & " on Event #" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 & " [" & Trim$(Map.Events(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3).Name) & "]" ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data2 = 2 Then frmEditor_Events.lstCommands.AddItem indent & "@>" & "Play Animation " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & " [" & Trim$(Animation(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) & "]" & " on Tile(" & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data3 & "," & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data4 & ")" End If Case EventType.evCustomScript frmEditor_Events.lstCommands.AddItem indent & "@>" & "Execute Custom Script Case: " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 Case EventType.evPlayBGM frmEditor_Events.lstCommands.AddItem indent & "@>" & "Play BGM [" & Trim$(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text1) & "]" Case EventType.evFadeoutBGM frmEditor_Events.lstCommands.AddItem indent & "@>" & "Fadeout BGM" Case EventType.evPlaySound [/b][/b][/b][/b]``` Link to comment Share on other sites More sharing options...
Vus Posted August 8, 2012 Share Posted August 8, 2012 This can be nice thing for people using 2.0\. Good job :) Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2012 Share Posted August 8, 2012 **add directly to the end of the other post so it should still be the end of modgameeditors**```frmEditor_Events.lstCommands.AddItem indent & "@>" & "Play Sound [" & Trim$(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Text1) & "]" Case EventType.evStopSound frmEditor_Events.lstCommands.AddItem indent & "@>" & "Stop Sound" Case EventType.evOpenBank frmEditor_Events.lstCommands.AddItem indent & "@>" & "Open Bank" Case EventType.evOpenShop frmEditor_Events.lstCommands.AddItem indent & "@>" & "Open Shop [" & CStr(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1) & ". " & Trim$(Shop(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1).Name) & "]" Case EventType.evSetAccess frmEditor_Events.lstCommands.AddItem indent & "@>" & "Set Player Access [" & frmEditor_Events.cmbSetAccess.List(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1) & "]" Case EventType.evGiveExp frmEditor_Events.lstCommands.AddItem indent & "@>" & "Give Player " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i).Data1 & " Experience." Case Else 'Ghost x = x - 1 If x = -1 Then ReDim EventList(0) Else ReDim Preserve EventList(x) End If End Select End If End If Next If curlist > 1 Then x = x + 1 ReDim Preserve EventList(x) EventList(x).CommandList = curlist EventList(x).CommandNum = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount + 1 frmEditor_Events.lstCommands.AddItem indent & "@> " curlist = tmpEvent.Pages(curPageNum).CommandList(curlist).ParentList GoTo newlist End If End If frmEditor_Events.lstCommands.AddItem indent & "@> "End SubSub ListCommandAdd(s As String)Static x As Long frmEditor_Events.lstCommands.AddItem s ' scrollbar If x < frmEditor_Events.TextWidth(s & " ") Then x = frmEditor_Events.TextWidth(s & " ") If frmEditor_Events.ScaleMode = vbTwips Then x = x / Screen.TwipsPerPixelX ' if twips change to pixels SendMessageByNum frmEditor_Events.lstCommands.hWnd, LB_SETHORIZONTALEXTENT, x, 0 End IfEnd SubSub AddCommand(Index As Long) Dim curlist As Long, i As Long, x As Long, curslot As Long, p As Long, oldCommandList As CommandListRec If tmpEvent.Pages(curPageNum).CommandListCount = 0 Then tmpEvent.Pages(curPageNum).CommandListCount = 1 ReDim tmpEvent.Pages(curPageNum).CommandList(1) End If If frmEditor_Events.lstCommands.ListIndex = frmEditor_Events.lstCommands.ListCount - 1 Then curlist = 1 Else curlist = EventList(frmEditor_Events.lstCommands.ListIndex).CommandList End If If tmpEvent.Pages(curPageNum).CommandListCount = 0 Then tmpEvent.Pages(curPageNum).CommandListCount = 1 ReDim tmpEvent.Pages(curPageNum).CommandList(curlist) End If oldCommandList = tmpEvent.Pages(curPageNum).CommandList(curlist) tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount + 1 p = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount If p <= 0 Then ReDim tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(0) Else ReDim tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(1 To p) tmpEvent.Pages(curPageNum).CommandList(curlist).ParentList = oldCommandList.ParentList tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount = p For i = 1 To p - 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(i) = oldCommandList.Commands(i) Next End If If frmEditor_Events.lstCommands.ListIndex = frmEditor_Events.lstCommands.ListCount - 1 Then curslot = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount Else i = EventList(frmEditor_Events.lstCommands.ListIndex).CommandNum If i < tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount Then For x = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount - 1 To i Step -1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(x + 1) = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(x) Next curslot = EventList(frmEditor_Events.lstCommands.ListIndex).CommandNum Else curslot = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount End If End If Select Case Index Case EventType.evAddText tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 = frmEditor_Events.txtAddText_Text.text tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlAddText_Colour.Value If frmEditor_Events.optAddText_Map.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 ElseIf frmEditor_Events.optAddText_Global.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 ElseIf frmEditor_Events.optAddText_Player.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 2 End If Case EventType.evCondition 'This is the part where the whole entire source goes to hell :D tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandListCount = tmpEvent.Pages(curPageNum).CommandListCount + 2 ReDim Preserve tmpEvent.Pages(curPageNum).CommandList(tmpEvent.Pages(curPageNum).CommandListCount) tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.CommandList = tmpEvent.Pages(curPageNum).CommandListCount - 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.ElseCommandList = tmpEvent.Pages(curPageNum).CommandListCount tmpEvent.Pages(curPageNum).CommandList(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.CommandList).ParentList = curlist tmpEvent.Pages(curPageNum).CommandList(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.ElseCommandList).ParentList = curlist For i = 0 To 6 If frmEditor_Events.optCondition_Index(i).Value = True Then x = i Next Select Case x Case 0 'Player Var tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 0 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_PlayerVarIndex.ListIndex + 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 = frmEditor_Events.cmbCondition_PlayerVarCompare.ListIndex tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data3 = Val(frmEditor_Events.txtCondition_PlayerVarCondition.text) Case 1 'Player Switch tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_PlayerSwitch.ListIndex + 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 = frmEditor_Events.cmbCondtion_PlayerSwitchCondition.ListIndex Case 2 'Has Item tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 2 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_HasItem.ListIndex + 1 Case 3 'Class Is tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 3 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_ClassIs.ListIndex + 1 Case 4 'Learnt Skill tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 4 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_LearntSkill.ListIndex + 1 Case 5 'Level Is tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 5 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = Val(frmEditor_Events.txtCondition_LevelAmount.text) tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 = frmEditor_Events.cmbCondition_LevelCompare.ListIndex Case 6 'Self Switch tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 6 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_SelfSwitch.ListIndex tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 = frmEditor_Events.cmbCondition_SelfSwitchCondition.ListIndex End Select Case EventType.evShowText tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 = frmEditor_Events.txtShowText.text Case EventType.evShowChoices tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 = frmEditor_Events.txtChoicePrompt.text tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text2 = frmEditor_Events.txtChoices(1).text tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text3 = frmEditor_Events.txtChoices(2).text tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text4 = frmEditor_Events.txtChoices(3).text tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text5 = frmEditor_Events.txtChoices(4).text tmpEvent.Pages(curPageNum).CommandListCount = tmpEvent.Pages(curPageNum).CommandListCount + 4 ReDim Preserve tmpEvent.Pages(curPageNum).CommandList(tmpEvent.Pages(curPageNum).CommandListCount) tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = tmpEvent.Pages(curPageNum).CommandListCount - 3 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = tmpEvent.Pages(curPageNum).CommandListCount - 2 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = tmpEvent.Pages(curPageNum).CommandListCount - 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data4 = tmpEvent.Pages(curPageNum).CommandListCount tmpEvent.Pages(curPageNum).CommandList(tmpEvent.Pages(curPageNum).CommandListCount - 3).ParentList = curlist tmpEvent.Pages(curPageNum).CommandList(tmpEvent.Pages(curPageNum).CommandListCount - 2).ParentList = curlist tmpEvent.Pages(curPageNum).CommandList(tmpEvent.Pages(curPageNum).CommandListCount - 1).ParentList = curlist tmpEvent.Pages(curPageNum).CommandList(tmpEvent.Pages(curPageNum).CommandListCount).ParentList = curlist Case EventType.evPlayerVar tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbVariable.ListIndex + 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = Val(frmEditor_Events.txtVariable.text) Case EventType.evPlayerSwitch tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbSwitch.ListIndex + 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = frmEditor_Events.cmbPlayerSwitchSet.ListIndex Case EventType.evSelfSwitch tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbSetSelfSwitch.ListIndex tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = frmEditor_Events.cmbSetSelfSwitchTo.ListIndex Case EventType.evExitProcess tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index Case EventType.evChangeItems tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbChangeItemIndex.ListIndex + 1 If frmEditor_Events.optChangeItemSet.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 ElseIf frmEditor_Events.optChangeItemAdd.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 ElseIf frmEditor_Events.optChangeItemRemove.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 2 End If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = Val(frmEditor_Events.txtChangeItemsAmount.text) Case EventType.evRestoreHP tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index Case EventType.evRestoreMP tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index Case EventType.evLevelUp tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index Case EventType.evChangeLevel tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlChangeLevel.Value Case EventType.evChangeSkills tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbChangeSkills.ListIndex + 1 If frmEditor_Events.optChangeSkillsAdd.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 ElseIf frmEditor_Events.optChangeSkillsRemove.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 End If Case EventType.evChangeClass tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbChangeClass.ListIndex + 1 Case EventType.evChangeSprite tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlChangeSprite.Value Case EventType.evChangeSex tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index If frmEditor_Events.optChangeSexMale.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 0 ElseIf frmEditor_Events.optChangeSexFemale.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 1 End If Case EventType.evChangePK tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index If frmEditor_Events.optChangePKYes.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 1 ElseIf frmEditor_Events.optChangePKNo.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 0 End If Case EventType.evWarpPlayer tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlWPMap.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = frmEditor_Events.scrlWPX.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = frmEditor_Events.scrlWPY.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data4 = frmEditor_Events.cmbWarpPlayerDir.ListIndex Case EventType.evSetMoveRoute tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = ListOfEvents(frmEditor_Events.cmbEvent.ListIndex) tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = frmEditor_Events.chkIgnoreMove.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = frmEditor_Events.chkRepeatRoute.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).MoveRouteCount = TempMoveRouteCount tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).MoveRoute = TempMoveRoute Case EventType.evPlayAnimation tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbPlayAnim.ListIndex + 1 If frmEditor_Events.optPlayAnimPlayer.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 ElseIf frmEditor_Events.optPlayAnimEvent.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = frmEditor_Events.cmbPlayAnimEvent.ListIndex + 1 ElseIf frmEditor_Events.optPlayAnimTile.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 2 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = frmEditor_Events.scrlPlayAnimTileX.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data4 = frmEditor_Events.scrlPlayAnimTileY.Value End If Case EventType.evCustomScript tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlCustomScript.Value Case EventType.evPlayBGM tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 = musicCache(frmEditor_Events.cmbPlayBGM.ListIndex + 1) Case EventType.evFadeoutBGM tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index Case EventType.evPlaySound tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 = soundCache(frmEditor_Events.cmbPlaySound.ListIndex + 1) Case EventType.evStopSound tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index Case EventType.evOpenBank tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index Case EventType.evOpenShop tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbOpenShop.ListIndex + 1 Case EventType.evSetAccess tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbSetAccess.ListIndex Case EventType.evGiveExp tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index = Index tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlGiveExp.Value End Select EventListCommandsEnd Sub```and more for the bottom of modgameeditors```Public Sub EditEventCommand() Dim i As Long, x As Long, z As Long, curlist As Long, curslot As Long i = frmEditor_Events.lstCommands.ListIndex If i = -1 Then Exit Sub If i > UBound(EventList) Then Exit Sub curlist = EventList(i).CommandList curslot = EventList(i).CommandNum If curlist = 0 Then Exit Sub If curslot = 0 Then Exit Sub If curlist > tmpEvent.Pages(curPageNum).CommandListCount Then Exit Sub If curslot > tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount Then Exit Sub Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index Case EventType.evAddText isEdit = True frmEditor_Events.txtAddText_Text.text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 frmEditor_Events.scrlAddText_Colour.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 Case 0 frmEditor_Events.optAddText_Player.Value = True Case 1 frmEditor_Events.optAddText_Map.Value = True Case 2 frmEditor_Events.optAddText_Global.Value = True End Select frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraAddText.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evCondition isEdit = True frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraConditionalBranch.Visible = True frmEditor_Events.fraCommands.Visible = False frmEditor_Events.ClearConditionFrame frmEditor_Events.optCondition_Index(tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition).Value = True Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition Case 0 frmEditor_Events.cmbCondition_PlayerVarIndex.Enabled = True frmEditor_Events.cmbCondition_PlayerVarCompare.Enabled = True frmEditor_Events.txtCondition_PlayerVarCondition.Enabled = True frmEditor_Events.cmbCondition_PlayerVarIndex.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 - 1 frmEditor_Events.cmbCondition_PlayerVarCompare.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 frmEditor_Events.txtCondition_PlayerVarCondition.text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data3 Case 1 frmEditor_Events.cmbCondition_PlayerSwitch.Enabled = True frmEditor_Events.cmbCondtion_PlayerSwitchCondition.Enabled = True frmEditor_Events.cmbCondition_PlayerSwitch.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 - 1 frmEditor_Events.cmbCondtion_PlayerSwitchCondition.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 Case 2 frmEditor_Events.cmbCondition_HasItem.Enabled = True frmEditor_Events.cmbCondition_HasItem.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 - 1 Case 3 frmEditor_Events.cmbCondition_ClassIs.Enabled = True frmEditor_Events.cmbCondition_ClassIs.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 - 1 Case 4 frmEditor_Events.cmbCondition_LearntSkill.Enabled = True frmEditor_Events.cmbCondition_LearntSkill.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 - 1 Case 5 frmEditor_Events.cmbCondition_LevelCompare.Enabled = True frmEditor_Events.txtCondition_LevelAmount.Enabled = True frmEditor_Events.txtCondition_LevelAmount.text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 frmEditor_Events.cmbCondition_LevelCompare.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 Case 6 frmEditor_Events.cmbCondition_SelfSwitch.Enabled = True frmEditor_Events.cmbCondition_SelfSwitchCondition.Enabled = True frmEditor_Events.cmbCondition_SelfSwitch.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 frmEditor_Events.cmbCondition_SelfSwitchCondition.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 End Select Case EventType.evShowText isEdit = True frmEditor_Events.txtShowText.text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraShowText.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evShowChoices isEdit = True frmEditor_Events.txtChoicePrompt.text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 frmEditor_Events.txtChoices(1).text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text2 frmEditor_Events.txtChoices(2).text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text3 frmEditor_Events.txtChoices(3).text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text4 frmEditor_Events.txtChoices(4).text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text5 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraShowChoices.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evPlayerVar isEdit = True frmEditor_Events.cmbVariable.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 - 1 frmEditor_Events.txtVariable.text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraPlayerVar.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evPlayerSwitch isEdit = True frmEditor_Events.cmbSwitch.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 - 1 frmEditor_Events.cmbPlayerSwitchSet.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraPlayerSwitch.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evSelfSwitch isEdit = True frmEditor_Events.cmbSetSelfSwitch.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 frmEditor_Events.cmbSetSelfSwitchTo.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraSelfSwitch.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evChangeItems isEdit = True frmEditor_Events.cmbChangeItemIndex.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 - 1 If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 Then frmEditor_Events.optChangeItemSet.Value = True ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 Then frmEditor_Events.optChangeItemAdd.Value = True ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 2 Then frmEditor_Events.optChangeItemRemove.Value = True``` Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2012 Share Posted August 8, 2012 **and even more for modgameeditors at the end.**```End If frmEditor_Events.txtChangeItemsAmount.text = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraChangeItems.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evChangeLevel isEdit = True frmEditor_Events.scrlChangeLevel.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraChangeLevel.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evChangeSkills isEdit = True frmEditor_Events.cmbChangeSkills.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 - 1 If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 Then frmEditor_Events.optChangeSkillsAdd.Value = True ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 Then frmEditor_Events.optChangeSkillsRemove.Value = True End If frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraChangeSkills.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evChangeClass isEdit = True frmEditor_Events.cmbChangeClass.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 - 1 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraChangeClass.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evChangeSprite isEdit = True frmEditor_Events.scrlChangeSprite.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraChangeSprite.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evChangeSex isEdit = True If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 0 Then frmEditor_Events.optChangeSexMale.Value = True ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 1 Then frmEditor_Events.optChangeSexFemale.Value = True End If frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraChangeSex.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evChangePK isEdit = True If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 1 Then frmEditor_Events.optChangePKYes.Value = True ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 0 Then frmEditor_Events.optChangePKNo.Value = True End If frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraChangePK.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evWarpPlayer isEdit = True frmEditor_Events.scrlWPMap.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 frmEditor_Events.scrlWPX.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 frmEditor_Events.scrlWPY.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 frmEditor_Events.cmbWarpPlayerDir.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data4 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraWarpPlayer.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evSetMoveRoute isEdit = True frmEditor_Events.fraMoveRoute.Visible = True frmEditor_Events.lstMoveRoute.Clear frmEditor_Events.cmbEvent.Clear ReDim ListOfEvents(0 To Map.EventCount) ListOfEvents(0) = EditorEvent frmEditor_Events.cmbEvent.AddItem "This Event" frmEditor_Events.cmbEvent.ListIndex = 0 frmEditor_Events.cmbEvent.Enabled = True For i = 1 To Map.EventCount If i <> EditorEvent Then frmEditor_Events.cmbEvent.AddItem Trim$(Map.Events(i).Name) x = x + 1 ListOfEvents(x) = i If i = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 Then frmEditor_Events.cmbEvent.ListIndex = x End If Next IsMoveRouteCommand = True frmEditor_Events.chkIgnoreMove.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 frmEditor_Events.chkRepeatRoute.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 TempMoveRouteCount = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).MoveRouteCount TempMoveRoute = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).MoveRoute For i = 1 To TempMoveRouteCount Select Case TempMoveRoute(i).Index Case 1 frmEditor_Events.lstMoveRoute.AddItem "Move Up" Case 2 frmEditor_Events.lstMoveRoute.AddItem "Move Down" Case 3 frmEditor_Events.lstMoveRoute.AddItem "Move Left" Case 4 frmEditor_Events.lstMoveRoute.AddItem "Move Right" Case 5 frmEditor_Events.lstMoveRoute.AddItem "Move Randomly" Case 6 frmEditor_Events.lstMoveRoute.AddItem "Move Towards Player" Case 7 frmEditor_Events.lstMoveRoute.AddItem "Move Away From Player" Case 8 frmEditor_Events.lstMoveRoute.AddItem "Step Forward" Case 9 frmEditor_Events.lstMoveRoute.AddItem "Step Back" Case 10 frmEditor_Events.lstMoveRoute.AddItem "Wait 100ms" Case 11 frmEditor_Events.lstMoveRoute.AddItem "Wait 500ms" Case 12 frmEditor_Events.lstMoveRoute.AddItem "Wait 1000ms" Case 13 frmEditor_Events.lstMoveRoute.AddItem "Turn Up" Case 14 frmEditor_Events.lstMoveRoute.AddItem "Turn Down" Case 15 frmEditor_Events.lstMoveRoute.AddItem "Turn Left" Case 16 frmEditor_Events.lstMoveRoute.AddItem "Turn Right" Case 17 frmEditor_Events.lstMoveRoute.AddItem "Turn 90 Degrees To the Right" Case 18 frmEditor_Events.lstMoveRoute.AddItem "Turn 90 Degrees To the Left" Case 19 frmEditor_Events.lstMoveRoute.AddItem "Turn Around 180 Degrees" Case 20 frmEditor_Events.lstMoveRoute.AddItem "Turn Randomly" Case 21 frmEditor_Events.lstMoveRoute.AddItem "Turn Towards Player" Case 22 frmEditor_Events.lstMoveRoute.AddItem "Turn Away from Player" Case 23 frmEditor_Events.lstMoveRoute.AddItem "Set Speed 8x Slower" Case 24 frmEditor_Events.lstMoveRoute.AddItem "Set Speed 4x Slower" Case 25 frmEditor_Events.lstMoveRoute.AddItem "Set Speed 2x Slower" Case 26 frmEditor_Events.lstMoveRoute.AddItem "Set Speed to Normal" Case 27 frmEditor_Events.lstMoveRoute.AddItem "Set Speed 2x Faster" Case 28 frmEditor_Events.lstMoveRoute.AddItem "Set Speed 4x Faster" Case 29 frmEditor_Events.lstMoveRoute.AddItem "Set Frequency Lowest" Case 30 frmEditor_Events.lstMoveRoute.AddItem "Set Frequency Lower" Case 31 frmEditor_Events.lstMoveRoute.AddItem "Set Frequency Normal" Case 32 frmEditor_Events.lstMoveRoute.AddItem "Set Frequency Higher" Case 33 frmEditor_Events.lstMoveRoute.AddItem "Set Frequency Highest" Case 34 frmEditor_Events.lstMoveRoute.AddItem "Turn On Walking Animation" Case 35 frmEditor_Events.lstMoveRoute.AddItem "Turn Off Walking Animation" Case 36 frmEditor_Events.lstMoveRoute.AddItem "Turn On Fixed Direction" Case 37 frmEditor_Events.lstMoveRoute.AddItem "Turn Off Fixed Direction" Case 38 frmEditor_Events.lstMoveRoute.AddItem "Turn On Walk Through" Case 39 frmEditor_Events.lstMoveRoute.AddItem "Turn Off Walk Through" Case 40 frmEditor_Events.lstMoveRoute.AddItem "Set Position Below Player" Case 41 frmEditor_Events.lstMoveRoute.AddItem "Set Position at Player Level" Case 42 frmEditor_Events.lstMoveRoute.AddItem "Set Position Above Player" Case 43 frmEditor_Events.lstMoveRoute.AddItem "Set Graphic" End Select Next frmEditor_Events.fraMoveRoute.width = 841 frmEditor_Events.fraMoveRoute.height = 609 frmEditor_Events.fraMoveRoute.Visible = True frmEditor_Events.fraDialogue.Visible = False frmEditor_Events.fraCommands.Visible = False Case EventType.evPlayAnimation isEdit = True frmEditor_Events.lblPlayAnimX.Visible = False frmEditor_Events.lblPlayAnimY.Visible = False frmEditor_Events.scrlPlayAnimTileX.Visible = False frmEditor_Events.scrlPlayAnimTileY.Visible = False frmEditor_Events.cmbPlayAnimEvent.Visible = False frmEditor_Events.cmbPlayAnim.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 - 1 frmEditor_Events.cmbPlayAnimEvent.Clear For i = 1 To Map.EventCount frmEditor_Events.cmbPlayAnimEvent.AddItem i & ". " & Trim$(Map.Events(i).Name) Next frmEditor_Events.cmbPlayAnimEvent.ListIndex = 0 If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 Then frmEditor_Events.optPlayAnimPlayer.Value = True ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 Then frmEditor_Events.optPlayAnimEvent.Value = True frmEditor_Events.cmbPlayAnimEvent.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 - 1 ElseIf tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 2 Then frmEditor_Events.optPlayAnimTile.Value = True frmEditor_Events.scrlPlayAnimTileX.Max = Map.MaxX frmEditor_Events.scrlPlayAnimTileY.Max = Map.MaxY frmEditor_Events.scrlPlayAnimTileX.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 frmEditor_Events.scrlPlayAnimTileY.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data4 End If frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraPlayAnimation.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evCustomScript isEdit = True frmEditor_Events.scrlCustomScript.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraCustomScript.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evPlayBGM isEdit = True For i = 1 To UBound(musicCache()) If musicCache(i) = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 Then frmEditor_Events.cmbPlayBGM.ListIndex = i - 1 End If Next frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraPlayBGM.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evPlaySound isEdit = True For i = 1 To UBound(soundCache()) If soundCache(i) = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 Then frmEditor_Events.cmbPlaySound.ListIndex = i - 1 End If Next frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraPlaySound.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evOpenShop isEdit = True frmEditor_Events.cmbOpenShop.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 - 1 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraOpenShop.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evSetAccess isEdit = True frmEditor_Events.cmbSetAccess.ListIndex = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraSetAccess.Visible = True frmEditor_Events.fraCommands.Visible = False Case EventType.evGiveExp isEdit = True frmEditor_Events.scrlGiveExp.Value = tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 frmEditor_Events.lblGiveExp.Caption = "Give Exp: " & tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 frmEditor_Events.fraDialogue.Visible = True frmEditor_Events.fraGiveExp.Visible = True frmEditor_Events.fraCommands.Visible = False End SelectEnd SubPublic Sub DeleteEventCommand() Dim i As Long, x As Long, z As Long, curlist As Long, curslot As Long, p As Long, oldCommandList As CommandListRec i = frmEditor_Events.lstCommands.ListIndex If i = -1 Then Exit Sub curlist = EventList(i).CommandList curslot = EventList(i).CommandNum If curlist = 0 Then Exit Sub If curslot = 0 Then Exit Sub If curlist > tmpEvent.Pages(curPageNum).CommandListCount Then Exit Sub If curslot > tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount Then Exit Sub If curslot = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount Then tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount - 1 p = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount If p <= 0 Then ReDim tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(0) Else oldCommandList = tmpEvent.Pages(curPageNum).CommandList(curlist) ReDim tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(p) x = 1 tmpEvent.Pages(curPageNum).CommandList(curlist).ParentList = oldCommandList.ParentList tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount = p For i = 1 To p + 1 If i <> curslot Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(x) = oldCommandList.Commands(i) x = x + 1 End If Next End If Else tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount - 1 p = tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount oldCommandList = tmpEvent.Pages(curPageNum).CommandList(curlist) x = 1 If p <= 0 Then ReDim tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(0) Else ReDim tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(p) tmpEvent.Pages(curPageNum).CommandList(curlist).ParentList = oldCommandList.ParentList tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount = p For i = 1 To p + 1 If i <> curslot Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(x) = oldCommandList.Commands(i) x = x + 1 End If Next End If End If EventListCommandsEnd SubPublic Sub ClearEventCommands() ReDim tmpEvent.Pages(curPageNum).CommandList(1) tmpEvent.Pages(curPageNum).CommandListCount = 1 EventListCommandsEnd SubPublic Sub EditCommand() Dim i As Long, x As Long, z As Long, curlist As Long, curslot As Long i = frmEditor_Events.lstCommands.ListIndex If i = -1 Then Exit Sub If i > UBound(EventList) Then Exit Sub curlist = EventList(i).CommandList curslot = EventList(i).CommandNum If curlist = 0 Then Exit Sub If curslot = 0 Then Exit Sub If curlist > tmpEvent.Pages(curPageNum).CommandListCount Then Exit Sub If curslot > tmpEvent.Pages(curPageNum).CommandList(curlist).CommandCount Then Exit Sub Select Case tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Index Case EventType.evAddText tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 = frmEditor_Events.txtAddText_Text.text tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlAddText_Colour.Value If frmEditor_Events.optAddText_Player.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 ElseIf frmEditor_Events.optAddText_Map.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 ElseIf frmEditor_Events.optAddText_Global.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 2 End If Case EventType.evCondition If frmEditor_Events.optCondition_Index(0).Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 0 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_PlayerVarIndex.ListIndex + 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 = frmEditor_Events.cmbCondition_PlayerVarCompare.ListIndex tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data3 = Val(frmEditor_Events.txtCondition_PlayerVarCondition.text) ElseIf frmEditor_Events.optCondition_Index(1).Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_PlayerSwitch.ListIndex + 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 = frmEditor_Events.cmbCondtion_PlayerSwitchCondition.ListIndex ElseIf frmEditor_Events.optCondition_Index(2).Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 2 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_HasItem.ListIndex + 1 ElseIf frmEditor_Events.optCondition_Index(3).Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 3 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_ClassIs.ListIndex + 1 ElseIf frmEditor_Events.optCondition_Index(4).Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 4 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_LearntSkill.ListIndex + 1 ElseIf frmEditor_Events.optCondition_Index(5).Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 5 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = Val(frmEditor_Events.txtCondition_LevelAmount.text) tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 = frmEditor_Events.cmbCondition_LevelCompare.ListIndex ElseIf frmEditor_Events.optCondition_Index(6).Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Condition = 6 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data1 = frmEditor_Events.cmbCondition_SelfSwitch.ListIndex tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).ConditionalBranch.Data2 = frmEditor_Events.cmbCondition_SelfSwitchCondition.ListIndex End If Case EventType.evShowText tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 = frmEditor_Events.txtShowText.text Case EventType.evShowChoices tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 = frmEditor_Events.txtChoicePrompt.text tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text2 = frmEditor_Events.txtChoices(1).text tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text3 = frmEditor_Events.txtChoices(2).text tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text4 = frmEditor_Events.txtChoices(3).text tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text5 = frmEditor_Events.txtChoices(4).text Case EventType.evPlayerVar tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbVariable.ListIndex + 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = Val(frmEditor_Events.txtVariable.text) Case EventType.evPlayerSwitch tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbSwitch.ListIndex + 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = frmEditor_Events.cmbPlayerSwitchSet.ListIndex Case EventType.evSelfSwitch tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbSetSelfSwitch.ListIndex tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = frmEditor_Events.cmbSetSelfSwitchTo.ListIndex Case EventType.evChangeItems tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbChangeItemIndex.ListIndex + 1 If frmEditor_Events.optChangeItemSet.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 ElseIf frmEditor_Events.optChangeItemAdd.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 ElseIf frmEditor_Events.optChangeItemRemove.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 2 End If tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = Val(frmEditor_Events.txtChangeItemsAmount.text) Case EventType.evSelfSwitch tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlChangeLevel.Value Case EventType.evChangeSkills tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbChangeSkills.ListIndex + 1 If frmEditor_Events.optChangeSkillsAdd.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 ElseIf frmEditor_Events.optChangeSkillsRemove.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 End If Case EventType.evChangeClass tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbChangeClass.ListIndex + 1 Case EventType.evChangeSprite tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlChangeSprite.Value Case EventType.evChangeSex If frmEditor_Events.optChangeSexMale.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 0 ElseIf frmEditor_Events.optChangeSexFemale.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 1 End If Case EventType.evChangePK If frmEditor_Events.optChangePKYes.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 1 ElseIf frmEditor_Events.optChangePKNo.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = 0 End If Case EventType.evWarpPlayer tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlWPMap.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = frmEditor_Events.scrlWPX.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = frmEditor_Events.scrlWPY.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data4 = frmEditor_Events.cmbWarpPlayerDir.ListIndex Case EventType.evSetMoveRoute tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = ListOfEvents(frmEditor_Events.cmbEvent.ListIndex) tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = frmEditor_Events.chkIgnoreMove.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = frmEditor_Events.chkRepeatRoute.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).MoveRouteCount = TempMoveRouteCount tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).MoveRoute = TempMoveRoute Case EventType.evPlayAnimation tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbPlayAnim.ListIndex + 1 If frmEditor_Events.optPlayAnimPlayer.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 0 ElseIf frmEditor_Events.optPlayAnimEvent.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 1 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = frmEditor_Events.cmbPlayAnimEvent.ListIndex + 1 ElseIf frmEditor_Events.optPlayAnimTile.Value = True Then tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data2 = 2 tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data3 = frmEditor_Events.scrlPlayAnimTileX.Value tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data4 = frmEditor_Events.scrlPlayAnimTileY.Value End If Case EventType.evCustomScript tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlCustomScript.Value Case EventType.evPlayBGM tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 = musicCache(frmEditor_Events.cmbPlayBGM.ListIndex + 1) Case EventType.evPlaySound tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Text1 = soundCache(frmEditor_Events.cmbPlaySound.ListIndex + 1) Case EventType.evOpenShop tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbOpenShop.ListIndex + 1 Case EventType.evSetAccess tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.cmbSetAccess.ListIndex Case EventType.evGiveExp tmpEvent.Pages(curPageNum).CommandList(curlist).Commands(curslot).Data1 = frmEditor_Events.scrlGiveExp.Value End Select EventListCommandsEnd Sub```**and more**```Sub RequestSwitchesAndVariables()Dim i As Long, Buffer As clsBufferSet Buffer = New clsBufferBuffer.WriteLong CRequestSwitchesAndVariablesSendData Buffer.ToArraySet Buffer = NothingEnd SubSub SendSwitchesAndVariables()Dim i As Long, Buffer As clsBuffer Set Buffer = New clsBuffer Buffer.WriteLong CSwitchesAndVariables For i = 1 To MAX_SWITCHES Buffer.WriteString Switches(i) Next For i = 1 To MAX_VARIABLES Buffer.WriteString Variables(i) Next SendData Buffer.ToArraySet Buffer = NothingEnd Sub``` Link to comment Share on other sites More sharing options...
JohnPony Posted August 8, 2012 Share Posted August 8, 2012 You probably should of used spoilers. Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2012 Share Posted August 8, 2012 in moddirectdraw7 search for **Public DDS_Bars As DirectDrawSurface7**add```Public DDS_Event As DirectDrawSurface7```search for **Public DDSD_Bars As DDSURFACEDESC2**add```Public DDSD_Event As DDSURFACEDESC2```search for **If FileExist(App.Path & "\data files\graphics\bars.bmp", True) Then Call InitDDSurf("bars", DDSD_Bars, DDS_Bars)**add```If FileExist(App.Path & "\data files\graphics\event.bmp", True) Then Call InitDDSurf("event", DDSD_Event, DDS_Event)```search for **Public Sub Render_Graphics()**then below```' Blit out the items If NumItems > 0 Then For i = 1 To MAX_MAP_ITEMS If MapItem(i).num > 0 Then Call BltItem(i) End If Next End If```add```If Map.CurrentEvents > 0 Then For i = 1 To Map.CurrentEvents If Map.MapEvents(i).Position = 0 Then BltEvent i End If Next End If```search for **' Y-based render. Renders Players, Npcs and Resources based on Y-axis.**below```For y = 0 To Map.MaxY If NumCharacters > 0 Then```add```If Map.CurrentEvents > 0 Then For i = 1 To Map.CurrentEvents If Map.MapEvents(i).Position = 1 Then If y = Map.MapEvents(i).y Then BltEvent i End If End If Next End If```then below```' blit out upper tiles If NumTileSets > 0 Then For x = TileView.Left To TileView.Right For y = TileView.top To TileView.Bottom If IsValidMapPoint(x, y) Then Call BltMapFringeTile(x, y) End If Next Next End If```add```If Map.CurrentEvents > 0 Then For i = 1 To Map.CurrentEvents If Map.MapEvents(i).Position = 2 Then BltEvent i End If Next End If```then just below```For i = 1 To Npc_HighIndex If MapNpc(i).num > 0 Then If CurX = MapNpc(i).x And CurY = MapNpc(i).y Then If myTargetType = TARGET_TYPE_NPC And myTarget = i Then ' dont render lol Else BltHover TARGET_TYPE_NPC, i, (MapNpc(i).x * 32) + MapNpc(i).XOffset, (MapNpc(i).y * 32) + MapNpc(i).YOffset End If End If End If Next```add```If frmEditor_Events.Visible Then EditorEvent_BltGraphic End IfIf InMapEditor Then If frmEditor_Map.optEvent.Value = True Then BltEvents End If End If```then below```' draw player names For i = 1 To Player_HighIndex If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then Call DrawPlayerName(i) End If Next```add```For i = 1 To Map.CurrentEvents If Map.MapEvents(i).Visible = 1 Then If Map.MapEvents(i).ShowName = 1 Then DrawEventName (i) End If End If Next``` Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2012 Share Posted August 8, 2012 at the bottom of **moddirectdraw7** add```Public Sub BltEvents()Dim sRECT As DxVBLib.RECTDim width As Long, height As Long, i As Long, x As Long, y As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler If Map.EventCount <= 0 Then Exit Sub For i = 1 To Map.EventCount If Map.Events(i).pageCount <= 0 Then sRECT.top = 0 sRECT.Bottom = 32 sRECT.Left = 0 sRECT.Right = 32 Call Engine_BltFast(x, y, DDS_Event, sRECT, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) GoTo nextevent End If width = 32 height = 32 x = Map.Events(i).x * 32 y = Map.Events(i).y * 32 x = ConvertMapX(x) y = ConvertMapY(y) ' clipping If y < 0 Then With sRECT .top = .top - y End With y = 0 End If If x < 0 Then With sRECT .Left = .Left - x End With x = 0 End If If y + height > DDSD_BackBuffer.lHeight Then sRECT.Bottom = sRECT.Bottom - (y + height - DDSD_BackBuffer.lHeight) End If If x + width > DDSD_BackBuffer.lWidth Then sRECT.Right = sRECT.Right - (x + width - DDSD_BackBuffer.lWidth) End If If i > Map.EventCount Then Exit Sub If 1 > Map.Events(i).pageCount Then Exit Sub ' /clipping Select Case Map.Events(i).Pages(1).GraphicType Case 0 sRECT.top = 0 sRECT.Bottom = 32 sRECT.Left = 0 sRECT.Right = 32 Call Engine_BltFast(x, y, DDS_Event, sRECT, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) Case 1 If Map.Events(i).Pages(1).Graphic > 0 And Map.Events(i).Pages(1).Graphic <= NumCharacters Then CharacterTimer(Map.Events(i).Pages(1).Graphic) = GetTickCount + SurfaceTimerMax If DDS_Character(Map.Events(i).Pages(1).Graphic) Is Nothing Then Call InitDDSurf("Characters\" & Map.Events(i).Pages(1).Graphic, DDSD_Character(Map.Events(i).Pages(1).Graphic), DDS_Character(Map.Events(i).Pages(1).Graphic)) End If sRECT.top = (Map.Events(i).Pages(1).GraphicY * (DDSD_Character(Map.Events(i).Pages(1).Graphic).lHeight / 4)) sRECT.Left = (Map.Events(i).Pages(1).GraphicX * (DDSD_Character(Map.Events(i).Pages(1).Graphic).lWidth / 4)) sRECT.Bottom = sRECT.top + 32 sRECT.Right = sRECT.Left + 32 Call Engine_BltFast(x, y, DDS_Character(Map.Events(i).Pages(1).Graphic), sRECT, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) sRECT.top = 0 sRECT.Bottom = 32 sRECT.Left = 0 sRECT.Right = 32 Call Engine_BltFast(x, y, DDS_Event, sRECT, DDBLTFAST_SRCCOLORKEY) Else sRECT.top = 0 sRECT.Bottom = 32 sRECT.Left = 0 sRECT.Right = 32 Call Engine_BltFast(x, y, DDS_Event, sRECT, DDBLTFAST_SRCCOLORKEY) End If Case 2 If Map.Events(i).Pages(1).Graphic > 0 And Map.Events(i).Pages(1).Graphic < NumTileSets Then sRECT.top = Map.Events(i).Pages(1).GraphicY * 32 sRECT.Left = Map.Events(i).Pages(1).GraphicX * 32 sRECT.Bottom = sRECT.top + 32 sRECT.Right = sRECT.Left + 32 Call Engine_BltFast(x, y, DDS_Tileset(Map.Events(i).Pages(1).Graphic), sRECT, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) sRECT.top = 0 sRECT.Bottom = 32 sRECT.Left = 0 sRECT.Right = 32 Call Engine_BltFast(x, y, DDS_Event, sRECT, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) Else sRECT.top = 0 sRECT.Bottom = 32 sRECT.Left = 0 sRECT.Right = 32 Call Engine_BltFast(x, y, DDS_Event, sRECT, DDBLTFAST_SRCCOLORKEY) End If End Selectnextevent: Next ' Error handler Exit Suberrorhandler: HandleError "BltHover", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPublic Sub EditorEvent_BltGraphic()Dim sRECT As DxVBLib.RECTDim dRECT As DxVBLib.RECT ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler If frmEditor_Events.picGraphicSel.Visible Then Select Case frmEditor_Events.cmbGraphic.ListIndex Case 0 'None frmEditor_Events.picGraphicSel.Cls Exit Sub Case 1 If frmEditor_Events.scrlGraphic.Value > 0 And frmEditor_Events.scrlGraphic.Value <= NumCharacters Then CharacterTimer(frmEditor_Events.scrlGraphic.Value) = GetTickCount + SurfaceTimerMax If DDS_Character(frmEditor_Events.scrlGraphic.Value) Is Nothing Then Call InitDDSurf("Characters\" & frmEditor_Events.scrlGraphic.Value, DDSD_Character(frmEditor_Events.scrlGraphic.Value), DDS_Character(frmEditor_Events.scrlGraphic.Value)) End If If DDSD_Character(frmEditor_Events.scrlGraphic.Value).lWidth > 800 Then sRECT.Left = frmEditor_Events.hScrlGraphicSel.Value sRECT.Right = sRECT.Left + (DDSD_Character(frmEditor_Events.scrlGraphic.Value).lWidth - sRECT.Left) Else sRECT.Left = 0 sRECT.Right = DDSD_Character(frmEditor_Events.scrlGraphic.Value).lWidth End If If DDSD_Character(frmEditor_Events.scrlGraphic.Value).lHeight > 512 Then sRECT.top = frmEditor_Events.hScrlGraphicSel.Value sRECT.Bottom = sRECT.top + (DDSD_Character(frmEditor_Events.scrlGraphic.Value).lHeight - sRECT.top) Else sRECT.top = 0 sRECT.Bottom = DDSD_Character(frmEditor_Events.scrlGraphic.Value).lHeight End If With dRECT .top = 0 .Bottom = sRECT.Bottom - sRECT.top .Left = 0 .Right = sRECT.Right - sRECT.Left End With Call Engine_BltToDC(DDS_Character(frmEditor_Events.scrlGraphic.Value), sRECT, dRECT, frmEditor_Events.picGraphicSel) If GraphicSelX <= 3 And GraphicSelY <= 3 Then frmEditor_Events.shpLoc.Left = GraphicSelX * (DDSD_Character(frmEditor_Events.scrlGraphic.Value).lWidth / 4) frmEditor_Events.shpLoc.width = (DDSD_Character(frmEditor_Events.scrlGraphic.Value).lWidth / 4) frmEditor_Events.shpLoc.top = GraphicSelY * (DDSD_Character(frmEditor_Events.scrlGraphic.Value).lHeight / 4) frmEditor_Events.shpLoc.height = (DDSD_Character(frmEditor_Events.scrlGraphic.Value).lHeight / 4) Else GraphicSelX = 0 GraphicSelY = 0 End If Else frmEditor_Events.picGraphicSel.Cls Exit Sub End If Case 2 If frmEditor_Events.scrlGraphic.Value > 0 And frmEditor_Events.scrlGraphic.Value <= NumTileSets Then If DDS_Tileset(frmEditor_Events.scrlGraphic.Value) Is Nothing Then Call InitDDSurf("Tilesets\" & frmEditor_Events.scrlGraphic.Value, DDSD_Tileset(frmEditor_Events.scrlGraphic.Value), DDS_Tileset(frmEditor_Events.scrlGraphic.Value)) End If If DDSD_Tileset(frmEditor_Events.scrlGraphic.Value).lWidth > 800 Then sRECT.Left = frmEditor_Events.hScrlGraphicSel.Value sRECT.Right = sRECT.Left + 800 Else sRECT.Left = 0 sRECT.Right = DDSD_Tileset(frmEditor_Events.scrlGraphic.Value).lWidth sRECT.Left = frmEditor_Events.hScrlGraphicSel.Value = 0 End If If DDSD_Tileset(frmEditor_Events.scrlGraphic.Value).lHeight > 512 Then sRECT.top = frmEditor_Events.vScrlGraphicSel.Value sRECT.Bottom = sRECT.top + 512 Else sRECT.top = 0 sRECT.Bottom = DDSD_Tileset(frmEditor_Events.scrlGraphic.Value).lHeight frmEditor_Events.vScrlGraphicSel.Value = 0 End If With dRECT .top = 0 .Bottom = sRECT.Bottom - sRECT.top .Left = 0 .Right = sRECT.Right - sRECT.Left End With Call Engine_BltToDC(DDS_Tileset(frmEditor_Events.scrlGraphic.Value), sRECT, dRECT, frmEditor_Events.picGraphicSel) 'Now we draw the selection square.. tad bit harder.... 'Stretched or not.... If GraphicSelX2 > 0 Or GraphicSelY2 > 0 Then frmEditor_Events.shpLoc.top = (GraphicSelY * 32) - frmEditor_Events.vScrlGraphicSel.Value frmEditor_Events.shpLoc.Left = (GraphicSelX * 32) - frmEditor_Events.hScrlGraphicSel.Value frmEditor_Events.shpLoc.width = (GraphicSelX2 - GraphicSelX) * 32 frmEditor_Events.shpLoc.height = (GraphicSelY2 - GraphicSelY) * 32 Else frmEditor_Events.shpLoc.top = (GraphicSelY * 32) - frmEditor_Events.vScrlGraphicSel.Value frmEditor_Events.shpLoc.Left = (GraphicSelX * 32) - frmEditor_Events.hScrlGraphicSel.Value frmEditor_Events.shpLoc.width = 32 frmEditor_Events.shpLoc.height = 32 End If Else frmEditor_Events.picGraphicSel.Cls Exit Sub End If End Select Else Select Case tmpEvent.Pages(curPageNum).GraphicType Case 0 frmEditor_Events.picGraphic.Cls Case 1 If tmpEvent.Pages(curPageNum).Graphic > 0 And tmpEvent.Pages(curPageNum).Graphic <= NumCharacters Then sRECT.top = tmpEvent.Pages(curPageNum).GraphicY * (DDSD_Character(tmpEvent.Pages(curPageNum).Graphic).lHeight / 4) sRECT.Left = tmpEvent.Pages(curPageNum).GraphicX * (DDSD_Character(tmpEvent.Pages(curPageNum).Graphic).lWidth / 4) sRECT.Bottom = sRECT.top + (DDSD_Character(tmpEvent.Pages(curPageNum).Graphic).lHeight / 4) sRECT.Right = sRECT.Left + (DDSD_Character(tmpEvent.Pages(curPageNum).Graphic).lWidth / 4) With dRECT dRECT.top = (193 / 2) - ((sRECT.Bottom - sRECT.top) / 2) dRECT.Bottom = dRECT.top + (sRECT.Bottom - sRECT.top) dRECT.Left = (121 / 2) - ((sRECT.Right - sRECT.Left) / 2) dRECT.Right = dRECT.Left + (sRECT.Right - sRECT.Left) End With If DDS_Character(frmEditor_Events.scrlGraphic.Value) Is Nothing Then Call InitDDSurf("Characters\" & frmEditor_Events.scrlGraphic.Value, DDSD_Character(frmEditor_Events.scrlGraphic.Value), DDS_Character(frmEditor_Events.scrlGraphic.Value)) End If Call Engine_BltToDC(DDS_Character(frmEditor_Events.scrlGraphic.Value), sRECT, dRECT, frmEditor_Events.picGraphic) End If Case 2 If tmpEvent.Pages(curPageNum).Graphic > 0 And tmpEvent.Pages(curPageNum).Graphic <= NumTileSets Then If tmpEvent.Pages(curPageNum).GraphicX2 = 0 Or tmpEvent.Pages(curPageNum).GraphicY2 = 0 Then sRECT.top = tmpEvent.Pages(curPageNum).GraphicY * 32 sRECT.Left = tmpEvent.Pages(curPageNum).GraphicX * 32 sRECT.Bottom = sRECT.top + 32 sRECT.Right = sRECT.Left + 32 With dRECT dRECT.top = (193 / 2) - ((sRECT.Bottom - sRECT.top) / 2) dRECT.Bottom = dRECT.top + (sRECT.Bottom - sRECT.top) dRECT.Left = (120 / 2) - ((sRECT.Right - sRECT.Left) / 2) dRECT.Right = dRECT.Left + (sRECT.Right - sRECT.Left) End With If DDS_Tileset(frmEditor_Events.scrlGraphic.Value) Is Nothing Then Call InitDDSurf("Tilesets\" & frmEditor_Events.scrlGraphic.Value, DDSD_Tileset(frmEditor_Events.scrlGraphic.Value), DDS_Tileset(frmEditor_Events.scrlGraphic.Value)) End If Call Engine_BltToDC(DDS_Tileset(frmEditor_Events.scrlGraphic.Value), sRECT, dRECT, frmEditor_Events.picGraphic) Else sRECT.top = tmpEvent.Pages(curPageNum).GraphicY * 32 sRECT.Left = tmpEvent.Pages(curPageNum).GraphicX * 32 sRECT.Bottom = sRECT.top + ((tmpEvent.Pages(curPageNum).GraphicY2 - tmpEvent.Pages(curPageNum).GraphicY) * 32) sRECT.Right = sRECT.Left + ((tmpEvent.Pages(curPageNum).GraphicX2 - tmpEvent.Pages(curPageNum).GraphicX) * 32) With dRECT dRECT.top = (193 / 2) - ((sRECT.Bottom - sRECT.top) / 2) dRECT.Bottom = dRECT.top + (sRECT.Bottom - sRECT.top) dRECT.Left = (120 / 2) - ((sRECT.Right - sRECT.Left) / 2) dRECT.Right = dRECT.Left + (sRECT.Right - sRECT.Left) End With If DDS_Tileset(frmEditor_Events.scrlGraphic.Value) Is Nothing Then Call InitDDSurf("Tilesets\" & frmEditor_Events.scrlGraphic.Value, DDSD_Tileset(frmEditor_Events.scrlGraphic.Value), DDS_Tileset(frmEditor_Events.scrlGraphic.Value)) End If Call Engine_BltToDC(DDS_Tileset(frmEditor_Events.scrlGraphic.Value), sRECT, dRECT, frmEditor_Events.picGraphic) End If End If End Select End If ' Error handler Exit Suberrorhandler: HandleError "EditorMap_BltKey", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPublic Sub BltEvent(id As Long) Dim x As Long, y As Long, width As Long, height As Long, sRECT As DxVBLib.RECT, dRECT As DxVBLib.RECT, anim As Long, spritetop As Long If Map.MapEvents(id).Visible = 0 Then Exit Sub If InMapEditor Then Exit Sub Select Case Map.MapEvents(id).GraphicType Case 0 Exit Sub Case 1 If Map.MapEvents(id).GraphicNum <= 0 Or Map.MapEvents(id).GraphicNum > NumCharacters Then Exit Sub CharacterTimer(Map.MapEvents(id).GraphicNum) = GetTickCount + SurfaceTimerMax If DDS_Character(Map.MapEvents(id).GraphicNum) Is Nothing Then Call InitDDSurf("characters\" & Map.MapEvents(id).GraphicNum, DDSD_Character(Map.MapEvents(id).GraphicNum), DDS_Character(Map.MapEvents(id).GraphicNum)) End If width = DDSD_Character(Map.MapEvents(id).GraphicNum).lWidth / 4 height = DDSD_Character(Map.MapEvents(id).GraphicNum).lHeight / 4 ' Reset frame If Map.MapEvents(id).Step = 3 Then anim = 0 ElseIf Map.MapEvents(id).Step = 1 Then anim = 2 End If Select Case Map.MapEvents(id).Dir Case DIR_UP If (Map.MapEvents(id).YOffset > 8) Then anim = Map.MapEvents(id).Step Case DIR_DOWN If (Map.MapEvents(id).YOffset < -8) Then anim = Map.MapEvents(id).Step Case DIR_LEFT If (Map.MapEvents(id).XOffset > 8) Then anim = Map.MapEvents(id).Step Case DIR_RIGHT If (Map.MapEvents(id).XOffset < -8) Then anim = Map.MapEvents(id).Step End Select ' Set the left Select Case Map.MapEvents(id).ShowDir Case DIR_UP spritetop = 3 Case DIR_RIGHT spritetop = 2 Case DIR_DOWN spritetop = 0 Case DIR_LEFT spritetop = 1 End Select If Map.MapEvents(id).WalkAnim = 1 Then anim = 0 If Map.MapEvents(id).Moving = 0 Then anim = Map.MapEvents(id).GraphicX With sRECT .top = spritetop * height .Bottom = .top + height .Left = anim * width .Right = .Left + width End With ' Calculate the X x = Map.MapEvents(id).x * PIC_X + Map.MapEvents(id).XOffset - ((width - 32) / 2) ' Is the player's height more than 32..? If (height * 4) > 32 Then ' Create a 32 pixel offset for larger sprites y = Map.MapEvents(id).y * PIC_Y + Map.MapEvents(id).YOffset - ((height) - 32) Else ' Proceed as normal y = Map.MapEvents(id).y * PIC_Y + Map.MapEvents(id).YOffset End If ' render the actual sprite Call BltSprite(Map.MapEvents(id).GraphicNum, x, y, sRECT) Case 2 If Map.MapEvents(id).GraphicNum < 1 Or Map.MapEvents(id).GraphicNum > NumTileSets Then Exit Sub If Map.MapEvents(id).GraphicY2 > 0 Or Map.MapEvents(id).GraphicX2 > 0 Then With sRECT .top = Map.MapEvents(id).GraphicY * 32 .Bottom = .top + ((Map.MapEvents(id).GraphicY2 - Map.MapEvents(id).GraphicY) * 32) .Left = Map.MapEvents(id).GraphicX * 32 .Right = .Left + ((Map.MapEvents(id).GraphicX2 - Map.MapEvents(id).GraphicX) * 32) End With Else With sRECT .top = Map.MapEvents(id).GraphicY * 32 .Bottom = .top + 32 .Left = Map.MapEvents(id).GraphicX * 32 .Right = .Left + 32 End With End If x = Map.MapEvents(id).x * 32 y = Map.MapEvents(id).y * 32 x = x - ((sRECT.Right - sRECT.Left) / 2) y = y - (sRECT.Bottom - sRECT.top) + 32 If DDS_Tileset(Map.MapEvents(id).GraphicNum) Is Nothing Then Call InitDDSurf("tilesets\" & Map.MapEvents(id).GraphicNum, DDSD_Tileset(Map.MapEvents(id).GraphicNum), DDS_Tileset(Map.MapEvents(id).GraphicNum)) End If If Map.MapEvents(id).GraphicY2 > 0 Then Call Engine_BltFast(ConvertMapX(Map.MapEvents(id).x * 32), ConvertMapY((Map.MapEvents(id).y - ((Map.MapEvents(id).GraphicY2 - Map.MapEvents(id).GraphicY) - 1)) * 32), DDS_Tileset(Map.MapEvents(id).GraphicNum), sRECT, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) Else Call Engine_BltFast(ConvertMapX(Map.MapEvents(id).x * 32), ConvertMapY(Map.MapEvents(id).y * 32), DDS_Tileset(Map.MapEvents(id).GraphicNum), sRECT, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End SelectEnd Sub```in **modenumerations** add```SSpawnEvent SEventMove SEventDir SEventChat SEventStart SEventEnd SPlayBGM SPlaySound SFadeoutBGM SStopSound SSwitchesAndVariables SMapEventData```and in the c section```CEventChatReply CEvent CSwitchesAndVariables CRequestSwitchesAndVariables```at the bottom of modenumerations add```Public Enum MoveRouteOpts MoveUp = 1 MoveDown MoveLeft MoveRight MoveRandom MoveTowardsPlayer MoveAwayFromPlayer StepForward StepBack Wait100ms Wait500ms Wait1000ms TurnUp TurnDown TurnLeft TurnRight Turn90Right Turn90Left Turn180 TurnRandom TurnTowardPlayer TurnAwayFromPlayer SetSpeed8xSlower SetSpeed4xSlower SetSpeed2xSlower SetSpeedNormal SetSpeed2xFaster SetSpeed4xFaster SetFreqLowest SetFreqLower SetFreqNormal SetFreqHigher SetFreqHighest WalkingAnimOn WalkingAnimOff DirFixOn DirFixOff WalkThroughOn WalkThroughOff PositionBelowPlayer PositionWithPlayer PositionAbovePlayer ChangeGraphicEnd Enum' Event TypesPublic Enum EventType ' Message evAddText = 1 evShowText evShowChoices ' Game Progression evPlayerVar evPlayerSwitch evSelfSwitch ' Flow Control evCondition evExitProcess ' Player evChangeItems evRestoreHP evRestoreMP evLevelUp evChangeLevel evChangeSkills evChangeClass evChangeSprite evChangeSex evChangePK ' Movement evWarpPlayer evSetMoveRoute ' Character evPlayAnimation ' Music and Sounds evPlayBGM evFadeoutBGM evPlaySound evStopSound 'Etc... evCustomScript evSetAccess 'Shop/Bank evOpenBank evOpenShop 'New evGiveExpEnd Enum```search for **HandleDataSub(SPartyVitals) = GetAddress(AddressOf HandlePartyVitals)**below it add```'Events HandleDataSub(SSpawnEvent) = GetAddress(AddressOf HandleSpawnEventPage) HandleDataSub(SEventMove) = GetAddress(AddressOf HandleEventMove) HandleDataSub(SEventDir) = GetAddress(AddressOf HandleEventDir) HandleDataSub(SEventChat) = GetAddress(AddressOf HandleEventChat) HandleDataSub(SEventStart) = GetAddress(AddressOf HandleEventStart) HandleDataSub(SEventEnd) = GetAddress(AddressOf HandleEventEnd) HandleDataSub(SPlayBGM) = GetAddress(AddressOf HandlePlayBGM) HandleDataSub(SPlaySound) = GetAddress(AddressOf HandlePlaySound) HandleDataSub(SFadeoutBGM) = GetAddress(AddressOf HandleFadeoutBGM) HandleDataSub(SStopSound) = GetAddress(AddressOf HandleStopSound) HandleDataSub(SSwitchesAndVariables) = GetAddress(AddressOf HandleSwitchesAndVariables) HandleDataSub(SMapEventData) = GetAddress(AddressOf HandleMapEventData)```search for **' clear the blood**below```For i = 1 To MAX_BYTE Blood(i).x = 0 Blood(i).y = 0 Blood(i).Sprite = 0 Blood(i).Timer = 0 Next```add```Map.CurrentEvents = 0 ReDim Map.MapEvents(0)```at the bottom of **modhandledata** add```Private Sub HandleSpawnEventPage(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim id As Long, i As Long, z As Long, x As Long, y As LongDim Buffer As clsBuffer ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes Data() id = Buffer.ReadLong If id > Map.CurrentEvents Then Map.CurrentEvents = id ReDim Preserve Map.MapEvents(Map.CurrentEvents) End If With Map.MapEvents(id) .Name = Buffer.ReadString .Dir = Buffer.ReadLong .ShowDir = .Dir .GraphicNum = Buffer.ReadLong .GraphicType = Buffer.ReadLong .GraphicX = Buffer.ReadLong .GraphicX2 = Buffer.ReadLong .GraphicY = Buffer.ReadLong .GraphicY2 = Buffer.ReadLong .MovementSpeed = Buffer.ReadLong .Moving = 0 .x = Buffer.ReadLong .y = Buffer.ReadLong .XOffset = 0 .YOffset = 0 .Position = Buffer.ReadLong .Visible = Buffer.ReadLong .WalkAnim = Buffer.ReadLong .DirFix = Buffer.ReadLong .WalkThrough = Buffer.ReadLong .ShowName = Buffer.ReadLong End With Set Buffer = Nothing ' Error handler Exit Suberrorhandler: HandleError "HandleSpawnEventPage", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPrivate Sub HandleEventMove(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim id As LongDim x As LongDim y As LongDim Dir As Long, ShowDir As LongDim Movement As Long, MovementSpeed As LongDim Buffer As clsBuffer ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes Data() id = Buffer.ReadLong x = Buffer.ReadLong y = Buffer.ReadLong Dir = Buffer.ReadLong ShowDir = Buffer.ReadLong MovementSpeed = Buffer.ReadLong If id > Map.CurrentEvents Then Exit Sub With Map.MapEvents(id) .x = x .y = y .Dir = Dir .XOffset = 0 .YOffset = 0 .Moving = 1 .ShowDir = ShowDir .MovementSpeed = MovementSpeed Select Case Dir Case DIR_UP .YOffset = PIC_Y Case DIR_DOWN .YOffset = PIC_Y * -1 Case DIR_LEFT .XOffset = PIC_X Case DIR_RIGHT .XOffset = PIC_X * -1 End Select End With ' Error handler Exit Suberrorhandler: HandleError "HandleEventMove", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPrivate Sub HandleEventDir(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim i As LongDim Dir As ByteDim Buffer As clsBuffer ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes Data() i = Buffer.ReadLong Dir = Buffer.ReadLong If i > Map.CurrentEvents Then Exit Sub With Map.MapEvents(i) .Dir = Dir .ShowDir = Dir .XOffset = 0 .YOffset = 0 .Moving = 0 End With ' Error handler Exit Suberrorhandler: HandleError "HandleEventDir", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPrivate Sub HandleEventChat(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim i As LongDim Dir As ByteDim Buffer As clsBufferDim choices As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes Data() frmMain.picEventChat.Visible = True EventReplyID = Buffer.ReadLong EventReplyPage = Buffer.ReadLong frmMain.lblEventChat.Caption = Buffer.ReadString frmMain.lblEventChat.Caption = Replace(frmMain.lblEventChat.Caption, "/p", Trim$(Player(MyIndex).Name)) frmMain.picEventChat.Visible = True frmMain.lblEventChat.Visible = True choices = Buffer.ReadLong InEvent = True For i = 1 To 4 frmMain.lblChoices(i).Visible = False Next frmMain.lblEventChatContinue.Visible = False If choices = 0 Then frmMain.lblEventChatContinue.Visible = True Else For i = 1 To choices frmMain.lblChoices(i).Visible = True frmMain.lblChoices(i).Caption = Buffer.ReadString Next End If AnotherChat = Buffer.ReadLong Set Buffer = Nothing ' Error handler Exit Suberrorhandler: HandleError "HandleEventChat", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPrivate Sub HandleEventStart(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBuffer ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler InEvent = True ' Error handler Exit Suberrorhandler: HandleError "HandleEventStart", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPrivate Sub HandleEventEnd(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBuffer ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler InEvent = False ' Error handler Exit Suberrorhandler: HandleError "HandleEventEnd", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPrivate Sub HandlePlayBGM(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim str As String ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes Data() str = Buffer.ReadString StopMidi PlayMidi str Set Buffer = Nothing ' Error handler Exit Suberrorhandler: HandleError "HandlePlayBGM", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPrivate Sub HandlePlaySound(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim str As String ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes Data() str = Buffer.ReadString PlaySound str Set Buffer = Nothing ' Error handler Exit Suberrorhandler: HandleError "HandlePlaySound", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPrivate Sub HandleFadeoutBGM(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim str As String ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler 'Need to learn how to fadeout :P 'do later... way later.. like, after release, maybe never StopMidi ' Error handler Exit Suberrorhandler: HandleError "HandleFadeoutBGM", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPrivate Sub HandleStopSound(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim str As String, i As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler For i = 0 To UBound(Sound()) - 1 SoundStop (i) Next ' Error handler Exit Suberrorhandler: HandleError "HandleFadeoutBGM", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubPrivate Sub HandleSwitchesAndVariables(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim str As String, i As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes Data() For i = 1 To MAX_SWITCHES Switches(i) = Buffer.ReadString Next For i = 1 To MAX_VARIABLES Variables(i) = Buffer.ReadString Next Set Buffer = Nothing ' Error handler Exit Suberrorhandler: HandleError "HandleSwitchesAndVariables", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub``` Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2012 Share Posted August 8, 2012 the rest for the bottom of **modhandledata**```Private Sub HandleMapEventData(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim str As String, i As Long, x As Long, y As Long, z As Long, w As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes Data() 'Event Data! Map.EventCount = Buffer.ReadLong If Map.EventCount > 0 Then ReDim Map.Events(0 To Map.EventCount) For i = 1 To Map.EventCount With Map.Events(i) .Name = Buffer.ReadString .Global = Buffer.ReadLong .x = Buffer.ReadLong .y = Buffer.ReadLong .pageCount = Buffer.ReadLong End With If Map.Events(i).pageCount > 0 Then ReDim Map.Events(i).Pages(0 To Map.Events(i).pageCount) For x = 1 To Map.Events(i).pageCount With Map.Events(i).Pages(x) .chkVariable = Buffer.ReadLong .VariableIndex = Buffer.ReadLong .VariableCondition = Buffer.ReadLong .VariableCompare = Buffer.ReadLong .chkSwitch = Buffer.ReadLong .SwitchIndex = Buffer.ReadLong .SwitchCompare = Buffer.ReadLong .chkHasItem = Buffer.ReadLong .HasItemIndex = Buffer.ReadLong .chkSelfSwitch = Buffer.ReadLong .SelfSwitchIndex = Buffer.ReadLong .SelfSwitchCompare = Buffer.ReadLong .GraphicType = Buffer.ReadLong .Graphic = Buffer.ReadLong .GraphicX = Buffer.ReadLong .GraphicY = Buffer.ReadLong .GraphicX2 = Buffer.ReadLong .GraphicY2 = Buffer.ReadLong .MoveType = Buffer.ReadLong .MoveSpeed = Buffer.ReadLong .MoveFreq = Buffer.ReadLong .MoveRouteCount = Buffer.ReadLong .IgnoreMoveRoute = Buffer.ReadLong .RepeatMoveRoute = Buffer.ReadLong If .MoveRouteCount > 0 Then ReDim Map.Events(i).Pages(x).MoveRoute(0 To .MoveRouteCount) For y = 1 To .MoveRouteCount .MoveRoute(y).Index = Buffer.ReadLong .MoveRoute(y).Data1 = Buffer.ReadLong .MoveRoute(y).Data2 = Buffer.ReadLong .MoveRoute(y).Data3 = Buffer.ReadLong .MoveRoute(y).Data4 = Buffer.ReadLong .MoveRoute(y).Data5 = Buffer.ReadLong .MoveRoute(y).Data6 = Buffer.ReadLong Next End If .WalkAnim = Buffer.ReadLong .DirFix = Buffer.ReadLong .WalkThrough = Buffer.ReadLong .ShowName = Buffer.ReadLong .Trigger = Buffer.ReadLong .CommandListCount = Buffer.ReadLong .Position = Buffer.ReadLong End With If Map.Events(i).Pages(x).CommandListCount > 0 Then ReDim Map.Events(i).Pages(x).CommandList(0 To Map.Events(i).Pages(x).CommandListCount) For y = 1 To Map.Events(i).Pages(x).CommandListCount Map.Events(i).Pages(x).CommandList(y).CommandCount = Buffer.ReadLong Map.Events(i).Pages(x).CommandList(y).ParentList = Buffer.ReadLong If Map.Events(i).Pages(x).CommandList(y).CommandCount > 0 Then ReDim Map.Events(i).Pages(x).CommandList(y).Commands(1 To Map.Events(i).Pages(x).CommandList(y).CommandCount) For z = 1 To Map.Events(i).Pages(x).CommandList(y).CommandCount With Map.Events(i).Pages(x).CommandList(y).Commands(z) .Index = Buffer.ReadLong .Text1 = Buffer.ReadString .Text2 = Buffer.ReadString .Text3 = Buffer.ReadString .Text4 = Buffer.ReadString .Text5 = Buffer.ReadString .Data1 = Buffer.ReadLong .Data2 = Buffer.ReadLong .Data3 = Buffer.ReadLong .Data4 = Buffer.ReadLong .Data5 = Buffer.ReadLong .Data6 = Buffer.ReadLong .ConditionalBranch.CommandList = Buffer.ReadLong .ConditionalBranch.Condition = Buffer.ReadLong .ConditionalBranch.Data1 = Buffer.ReadLong .ConditionalBranch.Data2 = Buffer.ReadLong .ConditionalBranch.Data3 = Buffer.ReadLong .ConditionalBranch.ElseCommandList = Buffer.ReadLong .MoveRouteCount = Buffer.ReadLong If .MoveRouteCount > 0 Then ReDim Preserve .MoveRoute(.MoveRouteCount) For w = 1 To .MoveRouteCount .MoveRoute(w).Index = Buffer.ReadLong .MoveRoute(w).Data1 = Buffer.ReadLong .MoveRoute(w).Data2 = Buffer.ReadLong .MoveRoute(w).Data3 = Buffer.ReadLong .MoveRoute(w).Data4 = Buffer.ReadLong .MoveRoute(w).Data5 = Buffer.ReadLong .MoveRoute(w).Data6 = Buffer.ReadLong Next End If End With Next End If Next End If Next End If Next End If 'End Event Data Set Buffer = Nothing ' Error handler Exit Suberrorhandler: HandleError "HandleMapEventData", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```in modconstants search for **Public Const MAX_PARTY_MEMBERS As Long = 4**add```Public Const MAX_SWITCHES As Long = 1000Public Const MAX_VARIABLES As Long = 1000```add frmeidtor_events to project from 2.3 event system download.add modsound to project from 2.3 event system download.you can compile this one in native or p-code. doesnt matter. Link to comment Share on other sites More sharing options...
PVJsquad Posted August 9, 2012 Share Posted August 9, 2012 must deleted all maps ? Link to comment Share on other sites More sharing options...
tslusny Posted August 9, 2012 Share Posted August 9, 2012 Nice bro i will add this to CS:DE :P Link to comment Share on other sites More sharing options...
Guest Posted August 9, 2012 Share Posted August 9, 2012 Woah! Nice job converting it from DX8! :O Link to comment Share on other sites More sharing options...
fernz123 Posted August 9, 2012 Share Posted August 9, 2012 Sweet. No need to convert it myself now. Link to comment Share on other sites More sharing options...
tslusny Posted August 9, 2012 Share Posted August 9, 2012 @Wacko:> Woah! Nice job converting it from DX8! :O@sotvotkong:> there are a few things that you need to be aware of before you begin. > 1.this is from the 2.3 download avalible on this website.> 2.this is the dx7 version. Link to comment Share on other sites More sharing options...
Guest Posted August 9, 2012 Share Posted August 9, 2012 i duno if you have to delete maps or not… i didnt have to, but i didnt have much of anything anyways, just 1 map with some ground texture. i would convert or delet your maps to be safe. Link to comment Share on other sites More sharing options...
JohnPony Posted August 9, 2012 Share Posted August 9, 2012 For the love of god use spoilers. Link to comment Share on other sites More sharing options...
Justn Posted August 9, 2012 Share Posted August 9, 2012 @GoldSide:> must deleted all maps ?Use the converter Jc posted Link to comment Share on other sites More sharing options...
Jumbofile Posted August 9, 2012 Share Posted August 9, 2012 Wow i dont have enough time for this Link to comment Share on other sites More sharing options...
PVJsquad Posted August 12, 2012 Share Posted August 12, 2012 @Justn:> Use the converter Jc postedCan you tell me where the Link that Link to comment Share on other sites More sharing options...
Alerd Posted September 29, 2012 Share Posted September 29, 2012 Does anyone already compiled? Link to comment Share on other sites More sharing options...
Guest Posted September 30, 2012 Share Posted September 30, 2012 well if you havnt started your project yet in 2.0 there is the more official version 2.3 avalible somewhere on here for download, and of course the even better 3.0 with dx8 as this and 2.3 are both dx7. 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