Mirage Source http://web.miragesource.net/forums/ |
|
Undropable Items http://web.miragesource.net/forums/viewtopic.php?f=210&t=1429 |
Page 1 of 1 |
Author: | William [ Fri Mar 02, 2007 9:12 pm ] |
Post subject: | Undropable Items |
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:
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 Side In: 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! |
Author: | Boo [ Wed Apr 11, 2007 12:13 am ] |
Post subject: | |
EDIT: Nevermind, added an extra line on accident xD. I decided to change the Subs on UpdateItemToAll, UpdateItemTo, and EditItemTo... To use ElseIf's to make it just 1 If . But im wandering if I did it right like to read if after the first if. Code: ' Drop all worn items by victim
If GetPlayerWeaponSlot(Victim) > 0 Then ElseIf Item(GetPlayerInvItemNum(Victim, GetPlayerWeaponSlot(Victim))).DropAble = 0 Then Call PlayerMapDropItem(Victim, GetPlayerWeaponSlot(Victim), 0) End If If GetPlayerArmorSlot(Victim) > 0 Then ElseIf Item(GetPlayerInvItemNum(Victim, GetPlayerArmorSlot(Victim))).DropAble = 0 Then Call PlayerMapDropItem(Victim, GetPlayerArmorSlot(Victim), 0) End If If GetPlayerHelmetSlot(Victim) > 0 Then ElseIf Item(GetPlayerInvItemNum(Victim, GetPlayerHelmetSlot(Victim))).DropAble = 0 Then Call PlayerMapDropItem(Victim, GetPlayerHelmetSlot(Victim), 0) End If If GetPlayerShieldSlot(Victim) > 0 Then ElseIf Item(GetPlayerInvItemNum(Victim, GetPlayerShieldSlot(Victim))).DropAble = 0 Then Call PlayerMapDropItem(Victim, GetPlayerShieldSlot(Victim), 0) End If |
Author: | Obsidian [ Wed Apr 11, 2007 12:29 am ] |
Post subject: | |
isn't 'not droppable from inventory or enemy' rather self defeating? If you don't want an NPC to drop the item... don't assign it to them...? and if it can't be dropped from inventory (the #1), then an enemy combatant shouldn't drop it anyways. |
Author: | Boo [ Wed Apr 11, 2007 1:02 am ] |
Post subject: | |
it was in tut idk :p I guess so like Player or NPC cant Drop, npc cant drop but player can if have, npc drop but player cant... i guess xD |
Author: | William [ Wed Apr 11, 2007 5:20 am ] |
Post subject: | |
I mean it cant be dropped if killed by a enemy or dropped by from the inventory by the drop button. lol |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |