It has not been tested, so backup your source.
Since there are not many new tutorials being created, I thought I should share one.
Difficulty 1/5
By William
Explanation
This will make it so a item can either:
- 0 Be dropable always
- 1 Cant be dropped from inventory
- 2 Cant be dropped from inventory or enemy
This could be good for quests and the like.
Client Side
In frmItemEditor add a txt box named: txtDropable
You may only enter a number between 0 and 2, see the numbers above to know what they do.
Now in:
Code:
Public Sub ItemEditorInit()
Add:
Code:
frmItemEditor.txtDropable.Text = Item(EditorIndex).DropAble
In:
Code:
Public Sub ItemEditorOk()
Inside this if statement:
Code:
If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_SHIELD)
Add:
Code:
Item(EditorIndex).DropAble = frmItemEditor.txtDropable.Text
Now in:
Code:
If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_POTIONSUBSP) Then
And:
Code:
If (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_SPELL) Then
Add:
Code:
Item(EditorIndex).DropAble = 0
In:
Code:
Sub ClearItem(ByVal Index As Long)
Add:
Code:
Item(Index).DropAble = 0
In the "updateitem" if in modHandleData, add a new parse:
(change the 20 to your number)
Code:
Item(n).DropAble = Val(Parse$(20))
Do the same in "edititem".
Now in:
Code:
Type ItemRec
Add:
Code:
DropAble As Byte
Server SideIn:
Code:
Sub ClearItem(ByVal index As Long)
Add:
Code:
Item(index).DropAble = 0
Now in these three add the same code:
Code:
Sub SendUpdateItemToAll(ByVal ItemNum As Long)
Sub SendUpdateItemTo(ByVal index As Long, ByVal ItemNum As Long)
Sub SendEditItemTo(ByVal index As Long, ByVal ItemNum As Long)
Add:
Code:
Item(ItemNum).DropAble
Now in:
Code:
Sub SaveItem(ByVal ItemNum As Long)
Add:
Code:
Call PutVar(FileName, "ITEM" & ItemNum, "DropAble", Trim$(Item(ItemNum).DropAble))
In:
Code:
Sub LoadItems()
Add:
Code:
Item(i).DropAble = Val(GetVar(FileName, "ITEM" & i, "DropAble"))
In:
Code:
Type ItemRec
Add:
Code:
DropAble As Byte
In:
Code:
Sub AttackPlayer(ByVal Attacker As Long, ByVal Victim As Long, ByVal Damage As Long)
There are 4 places were the items are dropped, for weapon, shield, armor and helmet.
Add this for each:
Code:
If Item(GetPlayerInvItemNum(Victim, GetPlayerWeaponSlot(Victim))).DropAble = 0 Then
End If
Remember to change Weapon to Armor etc for the different.
Do the same in:
Code:
Sub NpcAttackPlayer(ByVal MapNpcNum As Long, ByVal Victim As Long, ByVal Damage As Long)
In:
Code:
Sub MapDropItem
Around:
Code:
Call PlayerMapDropItem
Add:
Code:
If Item(GetPlayerInvItemNum(index, GetPlayerWeaponSlot(index))).DropAble = 0 or Item(GetPlayerInvItemNum(index, GetPlayerWeaponSlot(index))).DropAble = 1 Then
End If
That should be it!