Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

karpaz

Members
  • Posts

    91
  • Joined

  • Last visited

    Never

Posts posted by karpaz

  1. ![](http://2.bp.blogspot.com/_Ul7vP6_aIK4/SueJHfTTdYI/AAAAAAAAAOk/rkFsekA1TIU/s400/libhtning%20eyes1.gif)

    ![](http://img260.imageshack.us/img260/6950/test4.gif)

    ![](http://img254.imageshack.us/img254/1561/test6muffinic.gif)
  2. Sub canplayerattacknpc

    > Public Function CanPlayerAttackNpc(ByVal attacker As Long, ByVal mapNpcNum As Long, Optional ByVal IsSpell As Boolean = False) As Boolean
    >     Dim mapNum As Long
    >     Dim npcNum As Long
    >     Dim NpcX As Long
    >     Dim NpcY As Long
    >     Dim attackspeed As Long
    >
    >     ' Check for subscript out of range
    >     If IsPlaying(attacker) = False Or mapNpcNum <= 0 Or mapNpcNum > MAX_MAP_NPCS Then
    >         Exit Function
    >     End If
    >
    >     ' Check for subscript out of range
    >     If MapNpc(GetPlayerMap(attacker)).NPC(mapNpcNum).Num <= 0 Then
    >         Exit Function
    >     End If
    >
    >     mapNum = GetPlayerMap(attacker)
    >     npcNum = MapNpc(mapNum).NPC(mapNpcNum).Num
    >    
    >     ' Make sure the npc isn't already dead
    >     If MapNpc(mapNum).NPC(mapNpcNum).Vital(Vitals.HP) <= 0 Then
    >         Exit Function
    >     End If
    >
    >     ' Make sure they are on the same map
    >     If IsPlaying(attacker) Then
    >    
    >         ' exit out early
    >         If IsSpell Then
    >             If npcNum > 0 Then
    >                 If NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER Then
    >                     CanPlayerAttackNpc = True
    >                     Exit Function
    >                 End If
    >             End If
    >         End If
    >
    >         ' attack speed from weapon
    >         If GetPlayerEquipment(attacker, Weapon) > 0 Then
    >             attackspeed = Item(GetPlayerEquipment(attacker, Weapon)).Speed
    >         Else
    >             attackspeed = 1000
    >         End If
    >
    >         If npcNum > 0 And GetTickCount > TempPlayer(attacker).AttackTimer + attackspeed Then
    >             ' Check if at same coordinates
    >             Select Case GetPlayerDir(attacker)
    >                 Case DIR_UP
    >                     NpcX = MapNpc(mapNum).NPC(mapNpcNum).x
    >                     NpcY = MapNpc(mapNum).NPC(mapNpcNum).y + 1
    >                 Case DIR_DOWN
    >                     NpcX = MapNpc(mapNum).NPC(mapNpcNum).x
    >                     NpcY = MapNpc(mapNum).NPC(mapNpcNum).y - 1
    >                 Case DIR_LEFT
    >                     NpcX = MapNpc(mapNum).NPC(mapNpcNum).x + 1
    >                     NpcY = MapNpc(mapNum).NPC(mapNpcNum).y
    >                 Case DIR_RIGHT
    >                     NpcX = MapNpc(mapNum).NPC(mapNpcNum).x - 1
    >                     NpcY = MapNpc(mapNum).NPC(mapNpcNum).y
    >             End Select
    >
    >             If NpcX = GetPlayerX(attacker) Then
    >                 If NpcY = GetPlayerY(attacker) Then
    >                     If NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER Then
    >                         CanPlayerAttackNpc = True
    >                     Else
    >                         'ALATAR
    >                         If NPC(npcNum).Behaviour = NPC_BEHAVIOUR_FRIENDLY Then
    >                             Call CheckTasks(attacker, QUEST_TYPE_GOTALK, npcNum)
    >                             Call CheckTasks(attacker, QUEST_TYPE_GOGIVE, npcNum)
    >                             Call CheckTasks(attacker, QUEST_TYPE_GOGET, npcNum)
    >                            
    >                             If NPC(npcNum).Quest = YES Then
    >                                 If CanStartQuest(attacker, NPC(npcNum).QuestNum) Then
    >                                     'if can start show the request message (chat1)
    >                                     QuestMessage attacker, NPC(npcNum).QuestNum, Trim$(Quest(NPC(npcNum).QuestNum).Chat(1)), NPC(npcNum).QuestNum
    >                                     Exit Function
    >                                 End If
    >                                 If QuestInProgress(attacker, NPC(npcNum).QuestNum) Then
    >                                     'if the quest is in progress show the meanwhile message (chat2)
    >                                     PlayerMsg attacker, Trim$(NPC(npcNum).Name) + ": " + Trim$(Quest(NPC(npcNum).QuestNum).Chat(2)), BrightGreen
    >                                     'QuestMessage attacker, NPC(npcNum).QuestNum, Trim$(Quest(NPC(npcNum).QuestNum).Chat(2)), 0
    >                                     Exit Function
    >                                 End If
    >                             End If
    >                         End If
    >                         '/ALATAR
    >                         If Len(Trim$(NPC(npcNum).AttackSay)) > 0 Then
    >                             PlayerMsg attacker, Trim$(NPC(npcNum).Name) & ": " & Trim$(NPC(npcNum).AttackSay), White
    >                         End If
    >                     End If
    >                 End If
    >             End If
    >         End If
    >     End If
×
×
  • Create New...