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

New Function : GetPlayerPremium ! Exp x2 !


kornusdj
 Share

Recommended Posts

Hi i add to game new Function : GetPlayerPremium and SetPlayerPremium, and I want to do Exp x2, but doesn't work.

This is a code :

       ```
If IS_PREMIUM = 1 Then
        Call SetPlayerExp(Attacker, GetPlayerExp(Attacker) + Int(Exp * 2))
        Call BattleMsg(Attacker, "DostaÅ‚eÅ›/aÅ› " & Int(Exp * 2) & " doÅ›wiadczenia.", BrightBlue, 0)
            Else
        Call SetPlayerExp(Attacker, GetPlayerExp(Attacker) + Exp)
        Call BattleMsg(Attacker, "DostaÅ‚eÅ›/aÅ› " & Exp & " doÅ›wiadczenia.", BrightBlue, 0)
        End If
```
Anyone can help me ?
Sorry, for my english. I'm from Poland.
Link to comment
Share on other sites

try
```
If IS_PREMIUM = 1 Then
        Call SetPlayerExp(Index, GetPlayerExp(Index) + Int(Exp * 2))
        Call BattleMsg(Index, "DostaÅ‚eÅ›/aÅ› " & Int(Exp * 2) & " doÅ›wiadczenia.", BrightBlue, 0)
            Else
        Call SetPlayerExp(Index, GetPlayerExp(Index) + Exp)
        Call BattleMsg(Index, "DostaÅ‚eÅ›/aÅ› " & Exp & " doÅ›wiadczenia.", BrightBlue, 0)
        End If

```Since the attacker is who you want then it is still index, because index will check to see if that player is premium.
Let me know if it works ;)

O btw You Exp variable has not been dimmed or set.

Dim Exp
Exp = Whatever you want
Link to comment
Share on other sites

Zesh, This doesn't work
If i add :
Dim index as Long, show an RTE 9
Byval index as Long, show an RTE 13

This is my Sub AttackNpc, if i add my code.

```
Sub AttackNpc(ByVal Attacker As Long, _
  ByVal MapNpcNum As Long, _
  ByVal damage As Long)
    Dim Name As String
    Dim Exp As Long
    Dim N As Long, i As Long, x As Long, o As Long
    Dim MapNum As Long, NpcNum As Long

    ' Check for subscript out of range
    If IsPlaying(Attacker) = False Or MapNpcNum <= 0 Or MapNpcNum > MAX_MAP_NPCS Or damage < 0 Then
        Exit Sub
    End If

    ' Check for weapon
    If GetPlayerWeaponSlot(Attacker) > 0 Then
        N = GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))
    Else
        N = 0
    End If

    ' Send this packet so they can see the person attacking
    Call SendDataToMap(GetPlayerMap(Attacker), "ATTACKNPC" & SEP_CHAR & Attacker & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR)
    MapNum = GetPlayerMap(Attacker)
    NpcNum = MapNpc(MapNum, MapNpcNum).num
    Name = Trim$(Npc(NpcNum).Name)
    MapNpc(MapNum, MapNpcNum).LastAttack = GetTickCount

    If damage >= MapNpc(MapNum, MapNpcNum).HP Then

        ' Check for a weapon and say damage
        Call BattleMsg(Attacker, "ZabiÅ‚eÅ›/aÅ› a " & Name, BrightRed, 0)
        Dim add As String

        add = 0

        If GetPlayerWeaponSlot(Attacker) > 0 Then
            add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))).AddEXP
        End If

        If GetPlayerArmorSlot(Attacker) > 0 Then
            add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerArmorSlot(Attacker))).AddEXP
        End If

        If GetPlayerShieldSlot(Attacker) > 0 Then
            add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerShieldSlot(Attacker))).AddEXP
        End If

        If GetPlayerHelmetSlot(Attacker) > 0 Then
            add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerHelmetSlot(Attacker))).AddEXP
        End If

                If GetPlayerLegsSlot(Attacker) > 0 Then
            add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerLegsSlot(Attacker))).AddEXP
        End If

        If add > 0 Then
            If add < 100 Then
                If add < 10 Then
                    add = 0 & ".0" & Right$(add, 2)
                Else
                    add = 0 & "." & Right$(add, 2)
                End If

            Else
                add = Mid$(add, 1, 1) & "." & Right$(add, 2)
            End If
        End If

        ' Calculate exp to give attacker
        If add > 0 Then
            Exp = Npc(NpcNum).Exp + (Npc(NpcNum).Exp * Val(add))
        Else
            Exp = Npc(NpcNum).Exp
        End If

        ' Make sure we dont get less then 0
        If Exp < 0 Then
            Exp = 1
        End If

        If IS_PREMIUM = 1 Then
        Call SetPlayerExp(index, GetPlayerExp(index) + Int(Exp * 2))
        Call BattleMsg(index, "DostaÅ‚eÅ›/aÅ› " & Int(Exp * 2) & " doÅ›wiadczenia.", BrightBlue, 0)
            Else
        Call SetPlayerExp(index, GetPlayerExp(index) + Exp)
        Call BattleMsg(index, "DostaÅ‚eÅ›/aÅ› " & Exp & " doÅ›wiadczenia.", BrightBlue, 0)
        End If

        For i = 1 To MAX_NPC_DROPS

            ' Drop the goods if they get it
            N = Int(Rnd * Npc(NpcNum).ItemNPC(i).Chance) + 1

            If N = 1 Then
                Call SpawnItem(Npc(NpcNum).ItemNPC(i).ItemNum, Npc(NpcNum).ItemNPC(i).ItemValue, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y)
            End If

        Next

        ' Now set HP to 0 so we know to actually kill them in the server loop (this prevents subscript out of range)
        MapNpc(MapNum, MapNpcNum).num = 0
        MapNpc(MapNum, MapNpcNum).SpawnWait = GetTickCount
        MapNpc(MapNum, MapNpcNum).HP = 0
        Call SendDataToMap(MapNum, "NPCDEAD" & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR)

        ' Check for level up
        Call CheckPlayerLevelUp(Attacker)

        ' Check for level up party member
        If Player(Attacker).InParty = YES Then

            For x = 1 To MAX_PARTY_MEMBERS

                If Party(Player(Attacker).PartyID).Member(x) <> 0 Then
                    Call CheckPlayerLevelUp(Party(Player(Attacker).PartyID).Member(x))
                End If

            Next

        End If

        Call TakeFromGrid(MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y)

        ' Check if target is npc that died and if so set target to 0
        If Player(Attacker).TargetType = TARGET_TYPE_NPC And Player(Attacker).Target = MapNpcNum Then
            Player(Attacker).Target = 0
            Player(Attacker).TargetType = 0
        End If

    Else

        ' NPC not dead, just do the damage
        MapNpc(MapNum, MapNpcNum).HP = MapNpc(MapNum, MapNpcNum).HP - damage

        ' Check for a weapon and say damage
        Call BattleMsg(Attacker, "ZadaÅ‚eÅ›/aÅ› a " & Name & " " & damage & " obrażeÅ„.", White, 0)

        If N = 0 Then

            'Call PlayerMsg(Attacker, "ZadaÅ‚eÅ›/aÅ› a " & Name & " for " & obrażeÅ„ & " hit points.", White)
        Else

            'Call PlayerMsg(Attacker, "ZadaÅ‚eÅ›/aÅ› a " & Name & " with a " & Trim$(Item(n).Name) & " for " & obrażeÅ„ & " hit points.", White)
        End If

        ' Check if we should send a message
        If MapNpc(MapNum, MapNpcNum).Target = 0 And MapNpc(MapNum, MapNpcNum).Target <> Attacker Then
            If Trim$(Npc(NpcNum).AttackSay) <> "" Then
                Call PlayerMsg(Attacker, "A " & Trim$(Npc(NpcNum).Name) & " : " & Trim$(Npc(NpcNum).AttackSay) & "", SayColor)
            End If
        End If

        ' Set the NPC target to the player
        MapNpc(MapNum, MapNpcNum).Target = Attacker
        MapNpc(MapNum, MapNpcNum).TargetType = TARGET_TYPE_PLAYER

        ' Now check for guard ai and if so have all onmap guards come after'm
        If Npc(MapNpc(MapNum, MapNpcNum).num).Behavior = NPC_BEHAVIOR_GUARD Then

            For i = 1 To MAX_MAP_NPCS

                If MapNpc(MapNum, i).num = MapNpc(MapNum, MapNpcNum).num Then
                    MapNpc(MapNum, i).Target = Attacker
                    MapNpc(MapNum, i).TargetType = TARGET_TYPE_PLAYER
                End If

            Next

        End If
    End If

    'Call SendDataToMap(MapNum, "npchp" & SEP_CHAR & MapNpcNum & SEP_CHAR & MapNpc(MapNum, MapNpcNum).HP & SEP_CHAR & GetNpcMaxHP(MapNpc(MapNum, MapNpcNum).num) & SEP_CHAR & END_CHAR)
    ' Reset attack timer
    Player(Attacker).AttackTimer = GetTickCount
End Sub
```
Link to comment
Share on other sites

ummmm well i tried to help :P it could be that your not calling the sub correctly if you have added Index into the brackets then you would call it like this

```
Call AttackNpc(index, Attacker, MapNpcNum, damage)
```
Link to comment
Share on other sites

@kornusdj:

> Zesh, This doesn't work
> If I add :
> Dim index as Long, show an RTE 9
> Byval index as Long, show an RTE 13
>
> This is my Sub AttackNpc, if I add my code.
>
> ```
> Sub AttackNpc(ByVal Attacker As Long, _
>   ByVal MapNpcNum As Long, _
>   ByVal damage As Long)
>     Dim Name As String
>     Dim Exp As Long
>     Dim N As Long, I As Long, x As Long, o As Long
>     Dim MapNum As Long, NpcNum As Long
>
>     ' Check for subscript out of range
>     If IsPlaying(Attacker) = False Or MapNpcNum <= 0 Or MapNpcNum > MAX_MAP_NPCS Or damage < 0 Then
>         Exit Sub
>     End If
>
>     ' Check for weapon
>     If GetPlayerWeaponSlot(Attacker) > 0 Then
>         N = GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))
>     Else
>         N = 0
>     End If
>
>     ' Send this packet so they can see the person attacking
>     Call SendDataToMap(GetPlayerMap(Attacker), "ATTACKNPC" & SEP_CHAR & Attacker & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR)
>     MapNum = GetPlayerMap(Attacker)
>     NpcNum = MapNpc(MapNum, MapNpcNum).num
>     Name = Trim$(Npc(NpcNum).Name)
>     MapNpc(MapNum, MapNpcNum).LastAttack = GetTickCount
>
>     If damage >= MapNpc(MapNum, MapNpcNum).HP Then
>
>         ' Check for a weapon and say damage
>         Call BattleMsg(Attacker, "ZabiÅ‚eÅ›/aÅ› a " & Name, BrightRed, 0)
>         Dim add As String
>
>         add = 0
>
>         If GetPlayerWeaponSlot(Attacker) > 0 Then
>             add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))).AddEXP
>         End If
>
>         If GetPlayerArmorSlot(Attacker) > 0 Then
>             add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerArmorSlot(Attacker))).AddEXP
>         End If
>
>         If GetPlayerShieldSlot(Attacker) > 0 Then
>             add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerShieldSlot(Attacker))).AddEXP
>         End If
>
>         If GetPlayerHelmetSlot(Attacker) > 0 Then
>             add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerHelmetSlot(Attacker))).AddEXP
>         End If
>        
>                 If GetPlayerLegsSlot(Attacker) > 0 Then
>             add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerLegsSlot(Attacker))).AddEXP
>         End If
>
>         If add > 0 Then
>             If add < 100 Then
>                 If add < 10 Then
>                     add = 0 & ".0" & Right$(add, 2)
>                 Else
>                     add = 0 & "." & Right$(add, 2)
>                 End If
>
>             Else
>                 add = Mid$(add, 1, 1) & "." & Right$(add, 2)
>             End If
>         End If
>
>         ' Calculate exp to give attacker
>         If add > 0 Then
>             Exp = Npc(NpcNum).Exp + (Npc(NpcNum).Exp * Val(add))
>         Else
>             Exp = Npc(NpcNum).Exp
>         End If
>
>         ' Make sure we dont get less then 0
>         If Exp < 0 Then
>             Exp = 1
>         End If
>
>         If IS_PREMIUM = 1 Then
>         Call SetPlayerExp(index, GetPlayerExp(index) + Int(Exp * 2))
>         Call BattleMsg(index, "DostaÅ‚eÅ›/aÅ› " & Int(Exp * 2) & " doÅ›wiadczenia.", BrightBlue, 0)
>             Else
>         Call SetPlayerExp(index, GetPlayerExp(index) + Exp)
>         Call BattleMsg(index, "DostaÅ‚eÅ›/aÅ› " & Exp & " doÅ›wiadczenia.", BrightBlue, 0)
>         End If
>
>         For I = 1 To MAX_NPC_DROPS
>
>             ' Drop the goods if they get it
>             N = Int(Rnd * Npc(NpcNum).ItemNPC(I).Chance) + 1
>
>             If N = 1 Then
>                 Call SpawnItem(Npc(NpcNum).ItemNPC(I).ItemNum, Npc(NpcNum).ItemNPC(I).ItemValue, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y)
>             End If
>
>         Next
>
>         ' Now set HP to 0 so we know to actually kill them in the server loop (this prevents subscript out of range)
>         MapNpc(MapNum, MapNpcNum).num = 0
>         MapNpc(MapNum, MapNpcNum).SpawnWait = GetTickCount
>         MapNpc(MapNum, MapNpcNum).HP = 0
>         Call SendDataToMap(MapNum, "NPCDEAD" & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR)
>
>         ' Check for level up
>         Call CheckPlayerLevelUp(Attacker)
>
>         ' Check for level up party member
>         If Player(Attacker).InParty = YES Then
>
>             For x = 1 To MAX_PARTY_MEMBERS
>
>                 If Party(Player(Attacker).PartyID).Member(x) <> 0 Then
>                     Call CheckPlayerLevelUp(Party(Player(Attacker).PartyID).Member(x))
>                 End If
>
>             Next
>
>         End If
>
>         Call TakeFromGrid(MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y)
>
>         ' Check if target is npc that died and if so set target to 0
>         If Player(Attacker).TargetType = TARGET_TYPE_NPC And Player(Attacker).Target = MapNpcNum Then
>             Player(Attacker).Target = 0
>             Player(Attacker).TargetType = 0
>         End If
>
>     Else
>
>         ' NPC not dead, just do the damage
>         MapNpc(MapNum, MapNpcNum).HP = MapNpc(MapNum, MapNpcNum).HP - damage
>
>         ' Check for a weapon and say damage
>         Call BattleMsg(Attacker, "ZadaÅ‚eÅ›/aÅ› a " & Name & " " & damage & " obrażeÅ„.", White, 0)
>
>         If N = 0 Then
>
>             'Call PlayerMsg(Attacker, "ZadaÅ‚eÅ›/aÅ› a " & Name & " for " & obrażeÅ„ & " hit points.", White)
>         Else
>
>             'Call PlayerMsg(Attacker, "ZadaÅ‚eÅ›/aÅ› a " & Name & " with a " & Trim$(Item(n).Name) & " for " & obrażeÅ„ & " hit points.", White)
>         End If
>
>         ' Check if we should send a message
>         If MapNpc(MapNum, MapNpcNum).Target = 0 And MapNpc(MapNum, MapNpcNum).Target <> Attacker Then
>             If Trim$(Npc(NpcNum).AttackSay) <> "" Then
>                 Call PlayerMsg(Attacker, "A " & Trim$(Npc(NpcNum).Name) & " : " & Trim$(Npc(NpcNum).AttackSay) & "", SayColor)
>             End If
>         End If
>
>         ' Set the NPC target to the player
>         MapNpc(MapNum, MapNpcNum).Target = Attacker
>         MapNpc(MapNum, MapNpcNum).TargetType = TARGET_TYPE_PLAYER
>
>         ' Now check for guard ai and if so have all onmap guards come after'm
>         If Npc(MapNpc(MapNum, MapNpcNum).num).Behavior = NPC_BEHAVIOR_GUARD Then
>
>             For I = 1 To MAX_MAP_NPCS
>
>                 If MapNpc(MapNum, I).num = MapNpc(MapNum, MapNpcNum).num Then
>                     MapNpc(MapNum, I).Target = Attacker
>                     MapNpc(MapNum, I).TargetType = TARGET_TYPE_PLAYER
>                 End If
>
>             Next
>
>         End If
>     End If
>
>     'Call SendDataToMap(MapNum, "npchp" & SEP_CHAR & MapNpcNum & SEP_CHAR & MapNpc(MapNum, MapNpcNum).HP & SEP_CHAR & GetNpcMaxHP(MapNpc(MapNum, MapNpcNum).num) & SEP_CHAR & END_CHAR)
>     ' Reset attack timer
>     Player(Attacker).AttackTimer = GetTickCount
> End Sub
> ```

Change your Sub AttackNpc to this:

```
Sub AttackNpc(ByVal Attacker As Long, _
  ByVal MapNpcNum As Long, _
  ByVal damage As Long)
    Dim Name As String
    Dim Exp As Long
    Dim N As Long, I As Long, x As Long, o As Long
    Dim MapNum As Long, NpcNum As Long

    ' Check for subscript out of range
    If IsPlaying(Attacker) = False Or MapNpcNum <= 0 Or MapNpcNum > MAX_MAP_NPCS Or damage < 0 Then
        Exit Sub
    End If

    ' Check for weapon
    If GetPlayerWeaponSlot(Attacker) > 0 Then
        N = GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))
    Else
        N = 0
    End If

    ' Send this packet so they can see the person attacking
    Call SendDataToMap(GetPlayerMap(Attacker), "ATTACKNPC" & SEP_CHAR & Attacker & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR)
    MapNum = GetPlayerMap(Attacker)
    NpcNum = MapNpc(MapNum, MapNpcNum).num
    Name = Trim$(Npc(NpcNum).Name)
    MapNpc(MapNum, MapNpcNum).LastAttack = GetTickCount

    If damage >= MapNpc(MapNum, MapNpcNum).HP Then

        ' Check for a weapon and say damage
        Call BattleMsg(Attacker, "ZabiÅ‚eÅ›/aÅ› a " & Name, BrightRed, 0)
        Dim add As String

        add = 0

        If GetPlayerWeaponSlot(Attacker) > 0 Then
            add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))).AddEXP
        End If

        If GetPlayerArmorSlot(Attacker) > 0 Then
            add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerArmorSlot(Attacker))).AddEXP
        End If

        If GetPlayerShieldSlot(Attacker) > 0 Then
            add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerShieldSlot(Attacker))).AddEXP
        End If

        If GetPlayerHelmetSlot(Attacker) > 0 Then
            add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerHelmetSlot(Attacker))).AddEXP
        End If

                If GetPlayerLegsSlot(Attacker) > 0 Then
            add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerLegsSlot(Attacker))).AddEXP
        End If

        If add > 0 Then
            If add < 100 Then
                If add < 10 Then
                    add = 0 & ".0" & Right$(add, 2)
                Else
                    add = 0 & "." & Right$(add, 2)
                End If

            Else
                add = Mid$(add, 1, 1) & "." & Right$(add, 2)
            End If
        End If

        ' Calculate exp to give attacker
        If add > 0 Then
            Exp = Npc(NpcNum).Exp + (Npc(NpcNum).Exp * Val(add))
        Else
            Exp = Npc(NpcNum).Exp
        End If

        ' Make sure we dont get less then 0
        If Exp < 0 Then
            Exp = 1
        End If

        If IS_PREMIUM = 1 Then
            Call SetPlayerExp(Attacker, GetPlayerExp(Attacker) + Int(Exp * 2))
            Call BattleMsg(Attacker, "DostaÅ‚eÅ›/aÅ› " & Int(Exp * 2) & " doÅ›wiadczenia.", BrightBlue, 0)
        Else
            Call SetPlayerExp(Attacker, GetPlayerExp(Attacker) + Exp)
            Call BattleMsg(Attacker, "DostaÅ‚eÅ›/aÅ› " & Exp & " doÅ›wiadczenia.", BrightBlue, 0)
        End If

        For I = 1 To MAX_NPC_DROPS

            ' Drop the goods if they get it
            N = Int(Rnd * Npc(NpcNum).ItemNPC(I).Chance) + 1

            If N = 1 Then
                Call SpawnItem(Npc(NpcNum).ItemNPC(I).ItemNum, Npc(NpcNum).ItemNPC(I).ItemValue, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y)
            End If

        Next

        ' Now set HP to 0 so we know to actually kill them in the server loop (this prevents subscript out of range)
        MapNpc(MapNum, MapNpcNum).num = 0
        MapNpc(MapNum, MapNpcNum).SpawnWait = GetTickCount
        MapNpc(MapNum, MapNpcNum).HP = 0
        Call SendDataToMap(MapNum, "NPCDEAD" & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR)

        ' Check for level up
        Call CheckPlayerLevelUp(Attacker)

        ' Check for level up party member
        If Player(Attacker).InParty = YES Then

            For x = 1 To MAX_PARTY_MEMBERS

                If Party(Player(Attacker).PartyID).Member(x) <> 0 Then
                    Call CheckPlayerLevelUp(Party(Player(Attacker).PartyID).Member(x))
                End If

            Next

        End If

        Call TakeFromGrid(MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y)

        ' Check if target is npc that died and if so set target to 0
        If Player(Attacker).TargetType = TARGET_TYPE_NPC And Player(Attacker).Target = MapNpcNum Then
            Player(Attacker).Target = 0
            Player(Attacker).TargetType = 0
        End If

    Else

        ' NPC not dead, just do the damage
        MapNpc(MapNum, MapNpcNum).HP = MapNpc(MapNum, MapNpcNum).HP - damage

        ' Check for a weapon and say damage
        Call BattleMsg(Attacker, "ZadaÅ‚eÅ›/aÅ› a " & Name & " " & damage & " obrażeÅ„.", White, 0)

        If N = 0 Then

            'Call PlayerMsg(Attacker, "ZadaÅ‚eÅ›/aÅ› a " & Name & " for " & obrażeÅ„ & " hit points.", White)
        Else

            'Call PlayerMsg(Attacker, "ZadaÅ‚eÅ›/aÅ› a " & Name & " with a " & Trim$(Item(n).Name) & " for " & obrażeÅ„ & " hit points.", White)
        End If

        ' Check if we should send a message
        If MapNpc(MapNum, MapNpcNum).Target = 0 And MapNpc(MapNum, MapNpcNum).Target <> Attacker Then
            If Trim$(Npc(NpcNum).AttackSay) <> "" Then
                Call PlayerMsg(Attacker, "A " & Trim$(Npc(NpcNum).Name) & " : " & Trim$(Npc(NpcNum).AttackSay) & "", SayColor)
            End If
        End If

        ' Set the NPC target to the player
        MapNpc(MapNum, MapNpcNum).Target = Attacker
        MapNpc(MapNum, MapNpcNum).TargetType = TARGET_TYPE_PLAYER

        ' Now check for guard ai and if so have all onmap guards come after'm
        If Npc(MapNpc(MapNum, MapNpcNum).num).Behavior = NPC_BEHAVIOR_GUARD Then

            For I = 1 To MAX_MAP_NPCS

                If MapNpc(MapNum, I).num = MapNpc(MapNum, MapNpcNum).num Then
                    MapNpc(MapNum, I).Target = Attacker
                    MapNpc(MapNum, I).TargetType = TARGET_TYPE_PLAYER
                End If

            Next

        End If
    End If

    'Call SendDataToMap(MapNum, "npchp" & SEP_CHAR & MapNpcNum & SEP_CHAR & MapNpc(MapNum, MapNpcNum).HP & SEP_CHAR & GetNpcMaxHP(MapNpc(MapNum, MapNpcNum).num) & SEP_CHAR & END_CHAR)
    ' Reset attack timer
    Player(Attacker).AttackTimer = GetTickCount
End Sub
```
The "Index" variable is not always referring to the player. In the AttackNpc Sub, Index is passed through it, and it is renamed "Attacker," so instead of referring to the player as "Index," you'd need to refer to the player with the "Attacker" variable.
Link to comment
Share on other sites

Kimimaru, thanks. Now, game is working, but my command don't work.
Now is only exp x2 !
But I good add a function.
This is my Declarations :
```
' Premium
Public Const IS_PREMIUM = 1
Public Const IS_NOT_PREMIUM = 0
```When I Add :
If GetpPlayerPremium = 1 Then, or If GetPlayerPramium(index) = 1 Then don't work.
Edit. I resolved that i post comand```
If GetpPlayerPremium(Attacker) = 1 Then
```And it work. Thanks for all.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...