Lucemodok Posted June 16, 2020 Share Posted June 16, 2020 Ok, so I'm trying to make my character have up to 3 critters, but there's this on builder.lua which prevents me crafting another critter elseif recipe.level.ORPHANAGE > 0 and ( self.inst.components.petleash == nil or self.inst.components.petleash:IsFull() or self.inst.components.petleash:HasPetWithTag("critter") ) then return false, "HASPET" how do I circumvent this? Thanks in advance. Link to comment Share on other sites More sharing options...
IronHunter Posted June 17, 2020 Share Posted June 17, 2020 5 hours ago, Doxarez said: Ok, so I'm trying to make my character have up to 3 critters, but there's this on builder.lua which prevents me crafting another critter elseif recipe.level.ORPHANAGE > 0 and ( self.inst.components.petleash == nil or self.inst.components.petleash:IsFull() or self.inst.components.petleash:HasPetWithTag("critter") ) then return false, "HASPET" how do I circumvent this? Thanks in advance. Increasing the petleash maxpets coupled with a extension of the HasPetWithTag function to always return false for the "critter" tag for your character should probably do it. 2 Link to comment Share on other sites More sharing options...
Lucemodok Posted June 17, 2020 Author Share Posted June 17, 2020 Sorry, but I'm pretty bad at this, how would I do that? Link to comment Share on other sites More sharing options...
Lucemodok Posted June 17, 2020 Author Share Posted June 17, 2020 inst.components.petleash:SetMaxPets(3) local _HasPetWithTag = inst.components.petleash.HasPetWithTag function inst.components.petleash:HasPetWithTag(tag, ...) --test if have less than three pets, if you do return false, otherwise return true --always run the original function when possible return _HasPetWithTag(self, tag, ...) end Ok, so someone told me to use this, but since I suck, I don't know what checks to put where it's commented. Link to comment Share on other sites More sharing options...
Lucemodok Posted June 17, 2020 Author Share Posted June 17, 2020 inst.components.petleash:SetMaxPets(X) local _HasPetWithTag = inst.components.petleash.HasPetWithTag function inst.components.petleash:HasPetWithTag(tag, ...) if inst.components.petleash.numpets < X then return false end return _HasPetWithTag(self, tag, ...) end Fixed it! I'm posting the code here for anyone that wants it, remember to replace X with your desired number. 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