Mikrell Posted November 10, 2022 Share Posted November 10, 2022 I'm adding in an item that I want Pig King to accept and in turn, he'll drop a different item other than gold nuggets. I know how to implement this as I've already done something similar to Pigmen by adding in a PrefabPostInIt and just changing their ongetitem and accepttest functions. I wonder, however, if there is any other way for me to implement what I want to do other than changing those functions? I feel like with the way I've done things, my mod might clash with other Pig and PK mods that fiddle with their trader components. Link to comment https://forums.kleientertainment.com/forums/topic/144518-need-help-with-a-workaround-for-trader-component/ Share on other sites More sharing options...
TemporarySolutn Posted November 14, 2022 Share Posted November 14, 2022 (edited) you could probably do something like this local old_targetfn = inst.components.combat.targetfn local old_retargetperiod = inst.components.combat.retargetperiod inst.components.combat:SetRetargetFunction(old_retargetperiod, function(...) local target = old_targetfn(...) if target and target:HasTag("your_tag_here") then return end return old_targetfn(...) end) not using this function or whatever but the same concept with the old_targetfn Edited November 14, 2022 by TemporarySolutn Link to comment https://forums.kleientertainment.com/forums/topic/144518-need-help-with-a-workaround-for-trader-component/#findComment-1609421 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