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

Trying to get this thing to work….


Aeon Trag
 Share

Recommended Posts

I have file named weapons.ini created. It includes…..
[12]
WepATK = 5
WepDEF = 1
WepName = Rusty Knife

Now, the rusty knife is itemnum 12…. How do I get the Item number of the weapons slot? is it something like this?

Itm = GetPlayerWeapomSlot(Index, GetItemNum(index))

also how would i difine that number drawing on my .ini? such as....

WepAtk = GetVar("Weapons.ini", "Itm", "WepATK")

Itm above represents the number drawn by the first definition...need to get the item number from the weapons slot to the defined number of the ini file and draw from it the weapons attack.

Thanks
Link to comment
Share on other sites

@ 1st question :  it is Int(GetPlayerInvItemNum(index , Int(GetPlayerWeaponSlot(index))))

@ second you can do something like this

Dim ItemNum
Dim WepAtk

ItemNum = Int(GetPlayerInvItemNum(index , Int(GetPlayerWeaponSlot(index))))
WepAtk = Int(GetVar("Weapons.ini" , ""& ItemNum , "WepATK"))
Link to comment
Share on other sites

Here's What I have, Doesn't work if someone could tell me whts wrong with it I'd appreciate it.```
' Executes when a player presses the CONTROL key.
Sub OnAttack(Index, Damage)
Dim Target
Dim Itm
Dim WepAtk
Dim Str
Dim Max
Dim Min
Dim Avg
Dim LowAvg
Dim HiAvg
Dim Hit

  Itm = Int(GetPlayerInvItemNum(index , Int(GetPlayerWeaponSlot(index))))
  WepAtk = GetVar("Weapons.ini", "" & Itm & "", "WepATK")
  Str = GetPlayerSTR(Index) /2
  Max = (WepAtk, Str) *3
  Min = 1
  Avg = (WepAtk, Str)
  LowAvg = (WepAtk, Str) /2
  HiAvg = (WepAtk, Str) *2
  Hit = Rand(1, 6)

    If Int(GetPlayerTarget(Index)) > 0 Then
      Target = GetPlayerTarget(Index)
      Call DamagePlayer(Index, Target, Rand(1, Max))
  End If                 
    Else
      Target = GetPlayerTargetNPC(Index)

    If Hit = 1 Then
        Call DamageNPC(Index, Target, Rand(1, Str))
        End If

    If Hit = 2 Then
        Call DamageNPC(Index, Target, Rand(1, Str))
        End If

    If Hit = 3 Then
        Call DamageNPC(Index, Target, Rand(LowAvg, Avg))
        End If

    If Hit = 4 Then
        Call DamageNPC(Index, Target, Rand(LowAvg, HiAvg))
        End If

    If Hit = 5 Then
        Call DamageNPC(Index, Target, Rand(Avg, HiAvg))
        End If

    If Hit = 6 Then
        Call DamageNPC(Index, Target, Rand(HiAvg, Max))
        End If

End Sub
```
Thanks for the help
Link to comment
Share on other sites

```
' Executes when a player presses the CONTROL key.
Sub OnAttack(Index, Damage)
Dim Target
Dim Itm
Dim WepAtk
Dim Str
Dim Max
Dim Min
Dim Avg
Dim LowAvg
Dim HiAvg
Dim Hit

  Itm = Int(GetPlayerInvItemNum(index , Int(GetPlayerWeaponSlot(index))))
  WepAtk = GetVar("Weapons.ini", "" & Itm , "WepATK")
  Str = GetPlayerSTR(Index) /2
  Max = (WepAtk, Str) *3
  Min = 1
  Avg = (WepAtk, Str)
  LowAvg = (WepAtk, Str) /2
  HiAvg = (WepAtk, Str) *2
  Hit = Rand(1, 6)

    If Int(GetPlayerTarget(Index)) > 0 Then
      Target = GetPlayerTarget(Index)
      Call DamagePlayer(Index, Target, Rand(1, Max))
  End If               
    Else
      Target = GetPlayerTargetNPC(Index)

    If Hit = 1 Then
        Call DamageNPC(Index, Target, Rand(1, Str))
        End If

    If Hit = 2 Then
        Call DamageNPC(Index, Target, Rand(1, Str))
        End If

    If Hit = 3 Then
        Call DamageNPC(Index, Target, Rand(LowAvg, Avg))
        End If

    If Hit = 4 Then
        Call DamageNPC(Index, Target, Rand(LowAvg, HiAvg))
        End If

    If Hit = 5 Then
        Call DamageNPC(Index, Target, Rand(Avg, HiAvg))
        End If

    If Hit = 6 Then
        Call DamageNPC(Index, Target, Rand(HiAvg, Max))
        End If

End Sub
```try now
Link to comment
Share on other sites

lol..

```
' Executes when a player presses the CONTROL key.
Sub OnAttack(Index, Damage)
Dim Target
Dim Itm
Dim WepAtk
Dim Str
Dim Max
Dim Min
Dim Avg
Dim LowAvg
Dim HiAvg
Dim Hit

  Itm = Int(GetPlayerInvItemNum(index , Int(GetPlayerWeaponSlot(index))))
  WepAtk = GetVar("Weapons.ini", "" & Itm , "WepATK")
  Str = GetPlayerSTR(Index) / 2
  Max = (WepAtk, Str) * 3
  Min = 1
  Avg = (WepAtk, Str)
  LowAvg = (WepAtk, Str) / 2
  HiAvg = (WepAtk, Str) * 2
  Hit = Rand(1, 6)

    If Int(GetPlayerTarget(Index)) > 0 Then
      Target = GetPlayerTarget(Index)
      Call DamagePlayer(Index, Target, Rand(1, Max))
  End If               
    Else
      Target = GetPlayerTargetNPC(Index)

    If Hit = 1 Then
        Call DamageNPC(Index, Target, Rand(1, Str))
        End If

    If Hit = 2 Then
        Call DamageNPC(Index, Target, Rand(1, Str))
        End If

    If Hit = 3 Then
        Call DamageNPC(Index, Target, Rand(LowAvg, Avg))
        End If

    If Hit = 4 Then
        Call DamageNPC(Index, Target, Rand(LowAvg, HiAvg))
        End If

    If Hit = 5 Then
        Call DamageNPC(Index, Target, Rand(Avg, HiAvg))
        End If

    If Hit = 6 Then
        Call DamageNPC(Index, Target, Rand(HiAvg, Max))
        End If

End Sub
```try now²
Link to comment
Share on other sites

```
' Executes when a player presses the CONTROL key.
Sub OnAttack(Index, Damage)
Dim Target
Dim Itm
Dim WepAtk
Dim Str
Dim Max
Dim Min
Dim Avg
Dim LowAvg
Dim HiAvg
Dim Hit

  Itm = Int(GetPlayerInvItemNum(index , Int(GetPlayerWeaponSlot(index))))
  WepAtk = GetVar("Weapons.ini", "" & Itm , "WepATK")
  Str = GetPlayerSTR(Index) / 2
  Max = (WepAtk + Str) * 3
  Min = 1
  Avg = (WepAtk + Str)
  LowAvg = (WepAtk + Str) / 2
  HiAvg = (WepAtk + Str) * 2
  Hit = Rand(1, 6)

    If Int(GetPlayerTarget(Index)) > 0 Then
      Target = GetPlayerTarget(Index)
      Call DamagePlayer(Index, Target, Rand(1, Max))               
    Else
      Target = GetPlayerTargetNPC(Index)
End If
    If Hit = 1 Then
        Call DamageNPC(Index, Target, Rand(1, Str))
        End If

    If Hit = 2 Then
        Call DamageNPC(Index, Target, Rand(1, Str))
        End If

    If Hit = 3 Then
        Call DamageNPC(Index, Target, Rand(LowAvg, Avg))
        End If

    If Hit = 4 Then
        Call DamageNPC(Index, Target, Rand(LowAvg, HiAvg))
        End If

    If Hit = 5 Then
        Call DamageNPC(Index, Target, Rand(Avg, HiAvg))
        End If

    If Hit = 6 Then
        Call DamageNPC(Index, Target, Rand(HiAvg, Max))
        End If

End Sub
```Try that
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...