Zamin Posted December 25, 2009 Author Share Posted December 25, 2009 Hello,Kind of a noobish question. Is there a sadscript command to check whether the item is equipped or no? I checked the "All Commands' topic and foudn nothing.-Thanks Link to comment Share on other sites More sharing options...
Lam3r Posted December 25, 2009 Share Posted December 25, 2009 Yep,```Function GetInvItemslot(index, F_item_num, F_Min_value, F_Min_dur)```And the command list you should be looking @ now is [HERE](http://www.touchofdeathforums.com/smf/index.php/topic,28153.0.html)~ Lam3r Link to comment Share on other sites More sharing options...
Zamin Posted December 25, 2009 Author Share Posted December 25, 2009 @Lam3r:> Yep,```> Function GetInvItemslot(index, F_item_num, F_Min_value, F_Min_dur)> ```> And the command list you should be looking @ now is [HERE](http://www.touchofdeathforums.com/smf/index.php/topic,28153.0.html)> > ~ Lam3rHow do I use this function to check whether the given item is equipped or not? Link to comment Share on other sites More sharing options...
Godlord Posted December 26, 2009 Share Posted December 26, 2009 ```Function IsPlayerSlotEquipped(Index, Slot) If GetPlayerArmorSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerWeaponSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerHelmetSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerShieldSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerNecklaceSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerRingSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerLegsSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If Is PlayedItemEquiped = FalseEnd Function```If you want to know if a given item is equipped instead of slot, then use this:```Function IsPlayerSlotEquipped(Index, Item) Dim Slot Slot = 0 For SearchSlot = 1 To MAX_INVSLOTS If GetPlayerInvItemNum(Index, SearchSlot) = Item Then Slot = SearchSlot Exit For End If Next If Slot = 0 Then IsPlayedItemEquiped = False Exit Function End If If GetPlayerArmorSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerWeaponSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerHelmetSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerShieldSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerNecklaceSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerRingSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If If GetPlayerLegsSlot(Index) = Slot Then IsPlayedItemEquiped = True Exit Function End If Is PlayedItemEquiped = FalseEnd Function```Also, if you aren't using GM and if MAX_INVSLOTS isn't defined then add:```Public Const MAX_INVSLOTS = 24```as well.Regards, Godlord. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now