Mirage Source
Unbreakable items - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51)
+----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44)
+------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13)
+------ Thread: Unbreakable items (/showthread.php?tid=2331)



Unbreakable items - Joost - 01-11-2008

Allow the dur scrollbar to go to -1

You might have to change the way dur is dimmed somewhere, but yeah, this works. And you don't need another var to increase the size of the item file.
Code:
Sub DamageEquipment(ByVal Index As Long, ByVal EquipmentSlot As Equipment)
Dim Slot As Long
    
    Slot = GetPlayerEquipmentSlot(Index, EquipmentSlot)
    
    If Slot > 0 And GetPlayerInvItemDur(Index, Slot) > -1 Then
        Call SetPlayerInvItemDur(Index, Slot, GetPlayerInvItemDur(Index, Slot) - 1)
            
        If GetPlayerInvItemDur(Index, Slot) = 0 Then
            Call PlayerMsg(Index, "Your " & Trim$(Item(GetPlayerInvItemNum(Index, Slot)).Name) & " has broken.", Yellow)
            Call TakeItem(Index, GetPlayerInvItemNum(Index, Slot), 0)
        Else
            If GetPlayerInvItemDur(Index, Slot)  0 Then
                Call PlayerMsg(Index, "Your " & Trim$(Item(GetPlayerInvItemNum(Index, Slot)).Name) & " is about to break!", Yellow)
            End If
        End If
    End If



Re: Unbreakable items - wisefire - 02-11-2008

Can't you just remove the code? Well, I suppose if you want perfect and imperfect items then you would use something like this..


Re: Unbreakable items - Joost - 02-11-2008

Yer, this is for both breakable and unbreakable items. If you want every item to be unbreakable, just remove that part.


Re: Unbreakable items - Kraft - 02-11-2008

All items with 0 durability are supposed to be unbreakable, right?
If I set their durability to 0, they never break.


Re: Unbreakable items - Rian - 02-11-2008

Looks like unbreakable items have a dur of -1


Re: Unbreakable items - Joost - 02-11-2008

If GetPlayerInvItemDur(Index, Slot) = 0 Then
Call PlayerMsg(Index, "Your " & Trim$(Item(GetPlayerInvItemNum(Index, Slot)).Name) & " has broken.", Yellow)
Call TakeItem(Index, GetPlayerInvItemNum(Index, Slot), 0)
Else


So judging from this part of the code, I'd say they do break.


Use this code and set dur to -1 to make it infinite