Mirage Engine
TakeGold - Printable Version

+- Mirage Engine (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: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: TakeGold (/showthread.php?tid=1349)



TakeGold - William - 16-10-2007

Basicly I remade the TakeItem for this one. I didn't see TakeItem fitting my need on my travel system.

Add this in a module:
[code]Function TakeGold(ByVal index As Long, ByVal ItemNum As Long, ByVal ItemVal As Long) As Boolean
Dim i As Long, N As Long
TakeGold = False
' Check for subscript out of range
If IsPlaying(index) = False Or ItemNum MAX_ITEMS Then
Exit Function
End If

For i = 1 To MAX_INV
' Check to see if the player has the item
If GetPlayerInvItemNum(index, i) = ItemNum Then
If Item(ItemNum).Type = ITEM_TYPE_CURRENCY Then
' Is what we are trying to take away more then what they have? If so just set it to zero
If ItemVal