Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Npc Walking Alterations (Based off Advocate's tut)
#1
First off im giving credit to Advocate since its his code this is based off. This is walking alterations for NPCs. It is easy but just posting it here to help the community. Credit to Advocate.

sub bltnpc
replace
Code:
' Check for animation
    Anim = 0
    If MapNpc(MapNpcNum).Attacking = 0 Then
        Select Case MapNpc(MapNpcNum).Dir
            Case DIR_UP
                If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_DOWN
                If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2 * -1) Then Anim = 1
            Case DIR_LEFT
                If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_RIGHT
                If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2 * -1) Then Anim = 1
        End Select
    Else
        If MapNpc(MapNpcNum).AttackTimer + 500 > GetTickCount Then
            Anim = 2
        End If
    End If

withhhhh
Code:
' Check for animation
    Anim = 0
    If MapNpc(MapNpcNum).Attacking = 0 Then
        Select Case MapNpc(MapNpcNum).Dir
    Case DIR_UP
                If (MapNpc(MapNpcNum).YOffset < PIC_Y / 3) Then
               Anim = 1
               ElseIf (MapNpc(MapNpcNum).YOffset > PIC_Y / 3) And ((MapNpc(MapNpcNum).YOffset > PIC_Y / 3 * 2)) Then
               Anim = 2
                End If
    Case DIR_DOWN
                Anim = 1
               If (MapNpc(MapNpcNum).YOffset < PIC_X / 4 * -1) Then Anim = 0
               If (MapNpc(MapNpcNum).YOffset < PIC_X / 2 * -1) Then Anim = 2
    Case DIR_LEFT
                Anim = 0
               If (MapNpc(MapNpcNum).XOffset < PIC_Y / 3) Then
               Anim = 1
               ElseIf (MapNpc(MapNpcNum).XOffset > PIC_Y / 3) And ((MapNpc(MapNpcNum).XOffset > PIC_Y / 3 * 2)) Then
               Anim = 2
               End If
    Case DIR_RIGHT
                  Anim = 0
               If (MapNpc(MapNpcNum).XOffset < PIC_Y / 4 * -1) Then Anim = 1
               If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2 * -1) Then Anim = 2
       End Select
   Else
       If MapNpc(MapNpcNum).AttackTimer + 500 > GetTickCount Then
           Anim = 2
       End If
   End If

im pretty sure it works =P
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)