Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
32*64 NPC's Full Tut
#1
Tutorial by: DarkX
Code tested on: MSE

Ok I was looking over all the things that were missing on that version that William posted, which I guess was made by Sign, not really sure, but I wanted people to have the whole idea before they add it, here's my version of the tutorial.

Ok this is all client side, let's start with this:
Code:
' Blit out the npcs
        For i = 1 To MAX_MAP_NPCS
             Call BltNpc(i)
        Next i
It should be duplicated, (copy it and paste it right beneath the first one)
It should look like this:
Code:
' Blit out the npcs top
        For i = 1 To MAX_MAP_NPCS
             Call BltNpcTop(i)
        Next i
Next we should move along to find " Public sub BltNPC(Byvl MapNpcNum as long) "
copy the entire sub. Then paste it below the first one and rename it, " Public sub BltNpcTop(byval MapNpcNum as long) "

In bltNpcTop; replace This:
Code:
' Check if its out of bounds because of the offset
    If y < 0 Then
        y = 0
        With rec
             .top = .top + (y * -1)
        End With
    End If
With this:
Code:
' Check if its out of bounds because of the offset
    y = y - 32
    If y < 0 And y > -32 Then
        With rec
              .top = .top - y
              y = 0
        End With
    End If
Tim to move along; let's work on the rest go into sub BltNpc; and replace This:
Code:
With rec
        .top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y
        .Bottom = .top + PIC_Y
        .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        .Right = .Left + PIC_X
    End With
With This:
Code:
With rec
        .top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y + PIC_Y
        .Bottom = .top + PIC_Y
        .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        .Right = .Left + PIC_X
    End With
Keep it moving theres more to see, go into BltNpcTop and replace This
Code:
With rec
        .top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y
        .Bottom = .top + PIC_Y
        .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        .Right = .Left + PIC_X
    End With
With this:
Code:
With rec
        .top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y * 2
        .Bottom = .top + PIC_Y
        .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        .Right = .Left + PIC_X
    End With

Now that's still not all of it.
Go into sub BltMapNpcName and replace This:
Code:
TextY = MapNpc(Index).y * PIC_Y + MapNpc(Index).YOffset - CLng(PIC_Y / 2) - 4
With this:
Code:
TextY = MapNpc(Index).Y * PIC_Y + MapNpc(Index).YOffset - 50 '(or-4 -  pic_y - pic_y/2)
Again Still not all of it; there's a little more be patient. Ok go into frmNpcEditor and click picSprite
Make it's width 480
And it's height 960
And finally the LAST part.
In modGameLogic find Sub NPCEditorBltSprite
Once you've found it, replace the whole sub with this:
Code:
Public Sub NpcEditorBltSprite()
    Call BitBlt(frmNpcEditor.picSprite.hdc, 0, 0, PIC_X, PIC_Y * 2, frmNpcEditor.picSprites.hdc, 3 * PIC_X, frmNpcEditor.scrlSprite.Value * PIC_Y * 2, SRCCOPY)
End Sub

Or just put this: *2 :After every PIC_Y.

And that's the complete tutorial; have fun with it.
Reply
#2
I was looking over my code and it blt's correctly for me, it blts the players head over the npc's... Though I have to work on the part where it blts your feet over the npc's head.
Reply
#3
Sorry for bringing back this old tut guys,but im Quake. Im new to VB and Mirage. I was testing out this tutorial and i thought i could help DarkX a bit. I hope you dont get offended if you think im trying to make my way look better im only trying to help Big Grin

Well, I placed
Code:
' Blit out the npcs top
        For i = 1 To MAX_MAP_NPCS
             Call BltNpcTop(i)
        Next i

AFTER
Code:
' Blit out players
        For i = 1 To MAX_PLAYERS
              If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                  Call BltPlayer(i)
              End If
        Next i

By doing this, it makes the NPC tops over the players.

Now for some reason this bit of code didnt work well for me
Code:
With rec
        .top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y * 2
        .Bottom = .top + PIC_Y
        .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        .Right = .Left + PIC_X
    End With

So i just removed the * 2 after PIC_Y and it worked. I dont actually know what i did lol but it works. BTW nice tut i used it
Reply
#4
Not sure if I was the only one that got this error, but my NPc's kept showing up like this if the sprite number was odd:

[Image: ErrorNPC64.png]

So I simply went into Sub NPCEditorOk() and changed this line:

Code:
Npc(EditorIndex).Sprite = frmNpcEditor.scrlSprite.Value * 2

And in Sub NPCEditorInit()

Code:
frmNpcEditor.scrlSprite.Value = Npc(EditorIndex).Sprite / 2

(At first I thought I need to double the editor's scroll value, but that wasn't the case.)
Reply
#5
What font is that? And you better tell meh!
Reply
#6
Looks like Arial.
Reply
#7
Tahomaz0rz
Reply
#8
Rezeyu Wrote:Tahomaz0rz

Whats the exacts?! Tahoma Bold, size?
Reply
#9
Code:
' Font variables
Public Const FONT_NAME = "tahoma"
Public Const FONT_SIZE = 18

No other variables changed. Except stroked.
Reply
#10
Why the hell is your shit so smooth?
Reply
#11
Umm.. I dunno.

When I added the stroked text, I sued Elysium's tut because I couldn't find the one I used from Mirage on my original source.

(I think it was lost from the backups)


Then I went into a tut request about text outline and I think I actually used YOUR modification to the code..

Code:
Call TextOut(hdc, x + 1, y + 0, Text, Len(Text))
    Call TextOut(hdc, x + 0, y + 1, Text, Len(Text))
    Call TextOut(hdc, x + 1, y + 1, Text, Len(Text))
    Call TextOut(hdc, x - 1, y - 0, Text, Len(Text))
    Call TextOut(hdc, x - 0, y - 1, Text, Len(Text))
    Call TextOut(hdc, x - 1, y - 1, Text, Len(Text))
Reply
#12
I'm positive thats not it o.o

I guess its gfx card concerns?
Reply
#13
Mehbeh..

I'm running on a 256MB ATI Radeon X1300 Pro, I needed a 256g= Meg card to run Vista.


Reply
#14
Try chaning your resolution to like 16 Bit, see if that helps :o
Reply
#15
Hello, i have a bug, look that :
[Image: bugdg5.png]

Can I help me please ?

Thanks you in advance.
Reply
#16
Sorry for necroing but I just had to put up the bug fix.

Refer to: [Image: bugdg5.png]

This can easily be fixed by moving the:
Code:
' Blit out the npcs top
        For i = 1 To MAX_MAP_NPCS
            Call BltNpcTop(i)
        Next i


Under:
Code:
' Blit out players
        For i = 1 To MAX_PLAYERS
            If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                Call BltPlayer(i)
            End If
        Next i


Making it look like:
Code:
' Blit out the npcs
        For i = 1 To MAX_MAP_NPCS
            Call BltNpc(i)
        Next i
        
        ' Blit out players
        For i = 1 To MAX_PLAYERS
            If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                Call BltPlayer(i)
            End If
        Next i
        
        ' Blit out the npcs top
        For i = 1 To MAX_MAP_NPCS
            Call BltNpcTop(i)
        Next i
        
        ' Blit out players top
        For i = 1 To MAX_PLAYERS
              If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                  Call BltPlayerTop(i)
              End If
        Next i

Solved.
Reply
#17
That bug fix doesn't work for me.. I tried this out and I still get the doubled sprite.. Instead of getting the "top" sprite?
Reply
#18
somewhere up above one of the guys posted a fix replace the * with a /
Reply
#19
Why do you need an algorithm?

Code:
For y = 0 to max_mapy
For i = 1 to HighIndex
If getplayery(i) = y then
bltplayer
end if
next
next

Something like that should work.
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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)