mads232 Posted March 13, 2015 Share Posted March 13, 2015 Hello, I checked out various modding tutorials and the Event Reference. But I couldn't find something like OnPlayerEquipOnBack or something like that.Did I overlook something, or isn't this created?Is it possible to make such a thing? -Thanks in forwards! Link to comment Share on other sites More sharing options...
blindcoder Posted March 13, 2015 Share Posted March 13, 2015 It is possible. You need to overload the ISWearClothing:perform function like this:require 'TimedActions/ISWearClothing'MyModName = {}MyModName.ISWearClothingOrigPerform = ISWearClothing.perform;ISWearClothing.perform = function(self) -- call original function MyModName.ISWearClothingOrigPerform(self) if instanceof(self.item, "InventoryContainer") and self.item:canBeEquipped() == "Back" then -- Do something if item gets equipped on back else if self.item:getBodyLocation() == ClothingBodyLocation.Top then -- Do something if item is worn on upper body elseif self.item:getBodyLocation() == ClothingBodyLocation.Shoes then -- Do something if item is worn on lower body elseif self.item:getBodyLocation() == ClothingBodyLocation.Bottoms then -- Do something if item is worn on feet end endendPut this into Zomboid/mods/MyModName/media/lua/client/MyModName_ISWearClothing.lua and you should be ready to go. mads232 and Jab 2 Link to comment Share on other sites More sharing options...
mads232 Posted March 13, 2015 Author Share Posted March 13, 2015 Thanks a lot! I'll try it out Link to comment Share on other sites More sharing options...
abreu20011 Posted April 13, 2015 Share Posted April 13, 2015 Also, if you want know when a item is wear or undress, use a event OnClothingUpdated(player).With the player, you can take de primary, secondary or clothing items with his gets. For example: UpdateCloth = function(player) local shoes = player:getClothingItem_Feet(); -- do something with shoes end Events.OnClothingUpdated.Add(UpdateCloth);Javadoc IsoPlayer gets:http://theindiestone.com/zomboidjavadocs/zombie/characters/IsoGameCharacter.html#getClothingItem_Feet() blindcoder and mads232 2 Link to comment Share on other sites More sharing options...
Alison22 Posted January 22, 2022 Share Posted January 22, 2022 On 3/13/2015 at 2:11 PM, blindcoder said: It is possible. You need to overload the ISWearClothing:perform function like this: require 'TimedActions/ISWearClothing'MyModName = {}MyModName.ISWearClothingOrigPerform = ISWearClothing.perform;ISWearClothing.perform = function(self) -- call original function MyModName.ISWearClothingOrigPerform(self) if instanceof(self.item, "InventoryContainer") and self.item:canBeEquipped() == "Back" then -- Do something if item gets equipped on back else if self.item:getBodyLocation() == ClothingBodyLocation.Top then -- Do something if item is worn on upper body elseif self.item:getBodyLocation() == ClothingBodyLocation.Shoes then -- Do something if item is worn on lower body elseif self.item:getBodyLocation() == ClothingBodyLocation.Bottoms then -- Do something if item is worn on feet end endend Put this into Zomboid/mods/MyModName/media/lua/client/MyModName_ISWearClothing.lua and you should be ready to go. This was really helpful for me. Thanks 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