Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ranged weapons.
#1
Well this is my first tutorial and im changing somethings in the 2handed tutorial so. here it is
Copy and paste 1/5
Understanding 2/5
Untested but 99.9% im sure it will work
*i used the 2handed version by Sync and changed somethings around*

Lets begin.

-=Server side=-
Go into Modtypes and find.
Code:
Type ItemRec

Add This
Code:
Ranged As Byte

Below
Code:
Data3 Integer

Now go into ModDatabase and Find.
Code:
Sub SaveItem(ByVal ItemNum As Long)

Then add
Code:
Call PutVar(FileName, "ITEM" & ItemNum, "Ranged", Trim(Item(ItemNum).Ranged))

Below
Code:
Call PutVar(FileName, "ITEM" & ItemNum, "Data3", Trim(Item(ItemNum).Data3))

Now find
Code:
Sub Loaditems()

Add in
Code:
Item(i).Ranged = Val(GetVar(FileName, "ITEM" & i, "Ranged"))

Below
Code:
Item(i).Data3 = Val(GetVar(FileName, "ITEM" & i, "Data3"))

Server side is almost done now.

Go into Modhandledata find
Code:
If LCase(Parse(0)) = "useitem" Then

And find
Code:
Case ITEM_TYPE_WEAPON

Change it to this
Code:
Case ITEM_TYPE_WEAPON
                      If InvNum  GetPlayerWeaponSlot(Index) Then
                          If Item(GetPlayerInvItemNum(Index, InvNum)).Ranged < 1 Then
                                If Int(GetPlayerSTR(Index)) < n Then
                                    Call PlayerMsg(Index, "Your strength is to low to hold this weapon!  Required SPEED (" & n * 2 & ")", BrightRed)
                                    Exit Sub
                                End If
                                Call SetPlayerWeaponSlot(Index, InvNum)
                          Else
                                If GetPlayerShieldSlot(Index) = 0 Then
                                    Call SetPlayerWeaponSlot(Index, InvNum)
                                    Call SetPlayerShieldSlot(Index, InvNum)
                                Else
                                    Call PlayerMsg(Index, "You have a sheild on!!", BrightRed)
                                End If
                          End If
                      Else
                          Call SetPlayerWeaponSlot(Index, 0)
                      End If
                      Call SendWornEquipment(Index)

Just under the Case_item_Weapon
You have Case_item_shield make it look like this

Code:
Case ITEM_TYPE_SHIELD
                      If GetPlayerShieldSlot(Index) > 0 Then
                          If GetPlayerWeaponSlot(Index) = GetPlayerShieldSlot(Index) Then
                                Call PlayerMsg(Index, "You have a Ranged weapon equipped! Please unequip it before using your shield!", BrightRed)
                                Exit Sub
                          Else
                                Call PlayerMsg(Index, "You already have a shield equipped! Please unequip it before using your shield!", BrightRed)
                          End If
                      Else
                          If InvNum  GetPlayerShieldSlot(Index) Then
                                Call SetPlayerShieldSlot(Index, InvNum)
                          Else
                                Call SetPlayerShieldSlot(Index, 0)
                          End If
                          Call SendWornEquipment(Index)
                      End If

Now find
Code:
If LCase(Parse(0)) = "saveitem" Then

Add in
Code:
Item(n).Ranged = Val(Parse(8))

So now it looks like this

[code] ' Update the item
Item(n).Name = Parse(2)
Item(n).Pic = Val(Parse(3))
Item(n).Type = Val(Parse(4))
Item(n).Data1 = Val(Parse(5))
Item(n).Data2 = Val(Parse(6))
Item(n).Data3 = Val(Parse(7))
Item(n).Ranged = Val(Parse(8)) = ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)