Mirage Source

Free ORPG making software.
It is currently Sat Apr 27, 2024 5:48 am

All times are UTC




Post new topic Reply to topic  [ 44 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: MS4
PostPosted: Tue Sep 08, 2009 2:47 pm 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
Did you get chance to check it out?


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Tue Sep 08, 2009 5:08 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
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.


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Wed Sep 09, 2009 1:06 pm 
Offline
Regular

Joined: Thu Aug 13, 2009 7:06 pm
Posts: 39
Congrats on the new baby.

Any news about the npc error or what may of caused it?


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Wed Sep 09, 2009 4:06 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
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.


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Thu Sep 10, 2009 12:44 pm 
Offline
Regular

Joined: Thu Aug 13, 2009 7:06 pm
Posts: 39
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,


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Thu Sep 10, 2009 12:57 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
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.


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Thu Sep 10, 2009 4:00 pm 
Offline
Regular

Joined: Thu Aug 13, 2009 7:06 pm
Posts: 39
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 :P

And thanks il look into it and post my results :)


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Thu Sep 10, 2009 4:16 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
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 :P

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.


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Sat Sep 12, 2009 12:48 pm 
Offline
Regular

Joined: Thu Aug 13, 2009 7:06 pm
Posts: 39
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 :)


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Sat Sep 12, 2009 4:07 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
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.


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Sat Sep 12, 2009 6:15 pm 
Offline
Regular

Joined: Thu Aug 13, 2009 7:06 pm
Posts: 39
I am hopefully planning on using your source :)
I love the speed of the byte arrays :P Plus im not experianced enough to convert it myself :)

Thanks for getting round to it mate and hope your little'un is well :)!


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Fri Sep 25, 2009 7:52 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
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.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Fri Sep 25, 2009 8:18 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
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

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Fri Sep 25, 2009 8:27 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
I posted the fix for NPCs. This is needed for shops and spells too if I recall.


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Fri Sep 25, 2009 8:29 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
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.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Fri Sep 25, 2009 8:36 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
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..


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Fri Sep 25, 2009 8:43 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
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.


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Fri Sep 25, 2009 8:52 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Oh, that was in the source I downloaded anyway.

Just copying the stuff across to the other subs works fine.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: MS4
PostPosted: Fri Sep 25, 2009 9:55 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 44 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group