Mirage Source http://www.miragesource.net/forums/ |
|
MS4 http://www.miragesource.net/forums/viewtopic.php?f=193&t=6148 |
Page 2 of 2 |
Author: | Xlithan [ Tue Sep 08, 2009 2:47 pm ] |
Post subject: | Re: MS4 |
Did you get chance to check it out? |
Author: | Matt [ Tue Sep 08, 2009 5:08 pm ] |
Post subject: | Re: MS4 |
Xlithan wrote: Did you get chance to check it out? Not yet. Still getting adjusted to having a new baby in the house and I've been doin' work on the basement as well. I'll try to get around to it tonight though. |
Author: | xp79 [ Wed Sep 09, 2009 1:06 pm ] |
Post subject: | Re: MS4 |
Congrats on the new baby. Any news about the npc error or what may of caused it? |
Author: | Matt [ Wed Sep 09, 2009 4:06 pm ] |
Post subject: | Re: MS4 |
xp79 wrote: Congrats on the new baby. Any news about the npc error or what may of caused it? Pretty sure I fixed it and updated the download.. Lol. |
Author: | xp79 [ Thu Sep 10, 2009 12:44 pm ] |
Post subject: | Re: MS4 |
Whenever I reload a map the npc disappears, In some cases the npc stays there but the sprite doesnt blt. I did a simple drawtext over them to check where they are and that blts successfully, |
Author: | Matt [ Thu Sep 10, 2009 12:57 pm ] |
Post subject: | Re: MS4 |
If I'm not mistaken, it was a packet issue with the spawn npc system. Run through that if you want and if you're using a large map, remember they'll spawn all over the map. |
Author: | xp79 [ Thu Sep 10, 2009 4:00 pm ] |
Post subject: | Re: MS4 |
Matt wrote: If I'm not mistaken, it was a packet issue with the spawn npc system. Run through that if you want and if you're using a large map, remember they'll spawn all over the map. When you say it "was" il take it you fixed it recently because im using the latest source and im still having the problem, And dont worry I took that into account And thanks il look into it and post my results |
Author: | Matt [ Thu Sep 10, 2009 4:16 pm ] |
Post subject: | Re: MS4 |
xp79 wrote: Matt wrote: If I'm not mistaken, it was a packet issue with the spawn npc system. Run through that if you want and if you're using a large map, remember they'll spawn all over the map. When you say it "was" il take it you fixed it recently because im using the latest source and im still having the problem, And dont worry I took that into account And thanks il look into it and post my results I'm pretty sure I fixed it, but I don't really remember. I may have fixed it in my game's source, which is based off this source. I'll take a look later. I need to get some sleep for a change. |
Author: | xp79 [ Sat Sep 12, 2009 12:48 pm ] |
Post subject: | Re: MS4 |
I browsed through the spawnnpc sub and could not find anything wrong? Code: Sub SpawnNpc(ByVal MapNpcNum As Long, ByVal MapNum As Long) Dim Packet As String Dim NpcNum As Long Dim i As Long Dim x As Long Dim y As Long Dim Spawned As Boolean Dim Buffer As clsBuffer ' Check for subscript out of range If MapNpcNum <= 0 Or MapNpcNum > MAX_MAP_NPCS Or MapNum <= 0 Or MapNum > MAX_MAPS Then Exit Sub End If NpcNum = Map(MapNum).Npc(MapNpcNum) If NpcNum > 0 Then MapNpc(MapNum).Npc(MapNpcNum).Num = NpcNum MapNpc(MapNum).Npc(MapNpcNum).Target = 0 MapNpc(MapNum).Npc(MapNpcNum).Vital(Vitals.HP) = GetNpcMaxVital(NpcNum, Vitals.HP) MapNpc(MapNum).Npc(MapNpcNum).Vital(Vitals.MP) = GetNpcMaxVital(NpcNum, Vitals.MP) MapNpc(MapNum).Npc(MapNpcNum).Vital(Vitals.SP) = GetNpcMaxVital(NpcNum, Vitals.SP) MapNpc(MapNum).Npc(MapNpcNum).Dir = Int(Rnd * 4) ' Well try 100 times to randomly place the sprite For i = 1 To 100 x = Int(Rnd * Map(MapNum).MaxX) y = Int(Rnd * Map(MapNum).MaxY) ' Check if the tile is walkable If Map(MapNum).Tile(x, y).Type = TILE_TYPE_WALKABLE Then MapNpc(MapNum).Npc(MapNpcNum).x = x MapNpc(MapNum).Npc(MapNpcNum).y = y Spawned = True Exit For End If Next ' Didn't spawn, so now we'll just try to find a free tile If Not Spawned Then For x = 0 To Map(MapNum).MaxX For y = 0 To Map(MapNum).MaxY If Map(MapNum).Tile(x, y).Type = TILE_TYPE_WALKABLE Then MapNpc(MapNum).Npc(MapNpcNum).x = x MapNpc(MapNum).Npc(MapNpcNum).y = y Spawned = True End If Next Next End If ' If we suceeded in spawning then send it to everyone If Spawned Then Set Buffer = New clsBuffer Buffer.WriteLong SSpawnNpc Buffer.WriteLong MapNpcNum Buffer.WriteLong MapNpc(MapNum).Npc(MapNpcNum).Num Buffer.WriteLong MapNpc(MapNum).Npc(MapNpcNum).x Buffer.WriteLong MapNpc(MapNum).Npc(MapNpcNum).y Buffer.WriteLong MapNpc(MapNum).Npc(MapNpcNum).Dir SendDataToMap MapNum, Buffer.ToArray() Set Buffer = Nothing End If End If End Sub On top of that whenever you cast a spell with the required mp you get an RTE9 highlighting. Code: MPReq = Spell(SpellNum).MPReq I personally think that the problem is DX orientated because the npcs do exist just the sprites don't blt, I dont know very much Dx so im not sure where to continue with it but any help would be great |
Author: | Matt [ Sat Sep 12, 2009 4:07 pm ] |
Post subject: | Re: MS4 |
I don't exactly remember the problem. I have time today to look at it and I will get it all handled. When it's fixed, I'll update the source download as well as post the fix so that people can fix it in the source they're developing their game with, if someone is doing that. Lol. |
Author: | xp79 [ Sat Sep 12, 2009 6:15 pm ] |
Post subject: | Re: MS4 |
I am hopefully planning on using your source I love the speed of the byte arrays Plus im not experianced enough to convert it myself Thanks for getting round to it mate and hope your little'un is well ! |
Author: | Robin [ Fri Sep 25, 2009 7:52 pm ] |
Post subject: | Re: MS4 |
Editing an item crashes the server. As in, breaks VB6. EDIT: Dies on the first READ STRING, so I'm guessing it's a problem with the CopyMemory stuff. |
Author: | Robin [ Fri Sep 25, 2009 8:18 pm ] |
Post subject: | Re: MS4 |
It was using copymemory for the client, but wasn't reading it like it should server-side. Anyway, it's all in HandleSaveItem. Add at top: Code: Dim ItemSize As Long Dim ItemData() As Byte Replace: Code: Item(n).Name = Buffer.ReadString Item(n).Pic = Buffer.ReadLong Item(n).Type = Buffer.ReadLong Item(n).Data1 = Buffer.ReadLong Item(n).Data2 = Buffer.ReadLong Item(n).Data3 = Buffer.ReadLong With: Code: ItemSize = LenB(Item(n))
ReDim ItemData(ItemSize - 1) ItemData = Buffer.ReadBytes(ItemSize) CopyMemory ByVal VarPtr(Item(n)), ByVal VarPtr(ItemData(0)), ItemSize |
Author: | Matt [ Fri Sep 25, 2009 8:27 pm ] |
Post subject: | Re: MS4 |
I posted the fix for NPCs. This is needed for shops and spells too if I recall. |
Author: | Robin [ Fri Sep 25, 2009 8:29 pm ] |
Post subject: | Re: MS4 |
Matt wrote: I posted the fix for NPCs. This is needed for shops and spells too if I recall. NPCs need a fix? I got this code from the NPC part of the project, and just changed it for Items. |
Author: | Matt [ Fri Sep 25, 2009 8:36 pm ] |
Post subject: | Re: MS4 |
Robin wrote: Matt wrote: I posted the fix for NPCs. This is needed for shops and spells too if I recall. NPCs need a fix? I got this code from the NPC part of the project, and just changed it for Items. I thought npcs were the only problem the first time I updated it with the fix. I fixed everything before, guess I forgot to upload it. I don't have it anymore though.. |
Author: | Matt [ Fri Sep 25, 2009 8:43 pm ] |
Post subject: | Re: MS4 |
Matt wrote: Server side find: Code: Sub HandleSaveNPC Replace the whole sub with: Code: Private Sub HandleSaveNpc(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim NpcNum As Long Dim Buffer As clsBuffer Dim NpcSize As Long Dim NpcData() As Byte ' Prevent hacking If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then Call HackingAttempt(Index, "Admin Cloning") Exit Sub End If Set Buffer = New clsBuffer Buffer.WriteBytes Data() NpcNum = Buffer.ReadLong ' Prevent hacking If NpcNum < 0 Or NpcNum > MAX_NpcS Then Call HackingAttempt(Index, "Invalid Npc Index") Exit Sub End If NpcSize = LenB(Npc(NpcNum)) ReDim NpcData(NpcSize - 1) NpcData = Buffer.ReadBytes(NpcSize) CopyMemory ByVal VarPtr(Npc(NpcNum)), ByVal VarPtr(NpcData(0)), NpcSize ' Save it Call SendUpdateNpcToAll(NpcNum) Call SaveNpc(NpcNum) Call AddLog(GetPlayerName(Index) & " saved Npc #" & NpcNum & ".", ADMIN_LOG) End Sub I have also already updated the source download. That's the fix for NPCs that I posted on the first page. |
Author: | Robin [ Fri Sep 25, 2009 8:52 pm ] |
Post subject: | Re: MS4 |
Oh, that was in the source I downloaded anyway. Just copying the stuff across to the other subs works fine. |
Author: | Matt [ Fri Sep 25, 2009 9:55 pm ] |
Post subject: | Re: MS4 |
Robin wrote: Oh, that was in the source I downloaded anyway. Just copying the stuff across to the other subs works fine. Yeah, I know. Like I said, I updated the download when I found the NPC editor issue, but I thought that was the only one so I didn't fix the others until later and I forgot to upload the fixed source. Lol. Thanks for the help. |
Page 2 of 2 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |