Giano Posted October 2, 2019 Share Posted October 2, 2019 (edited) Hi everyone! I just can't figure out how to hide the popping up attack hint or the controller attack button hint in my function. For example when playing with a controller going near a mob the buttons "inspect" with the Y button image and "attack" with the X button image will pop up. I just want to avoid the Attack with the X button image popping up I hope someone can help Thanks in advance EDIT: I write here the function that makes followers and walls not attackable. I know that the commands popup are related maybe to the "playercontroller" but i don't seem to find out which function is used to show the Button widget for the attack action. function Combat:IsValidTarget(target) local isPlayerAttacker = self.inst:HasTag("player") --if GLOBAL.TheInput:IsKeyDown(GLOBAL.KEY_J) then -- return true --end if GLOBAL.TheInput:IsControlPressed(GLOBAL.CONTROL_OPEN_DEBUG_MENU) then return true end if (target.components.follower ~= nil and target.components.follower.leader ~= nil and target.components.follower.leader:HasTag("player")) or (isPlayerAttacker and save_companion and target:HasTag("companion")) or (isPlayerAttacker and save_walls and target:HasTag("wall")) then return false elseif not target or not target:IsValid() or not target.components or not target.components.combat or not target.entity:IsVisible() or not target.components.health or target == self.inst or target.components.health:IsDead() or (target:HasTag("shadow") and not self.inst.components.sanity) or Vector3(target.Transform:GetWorldPosition()).y > self.attackrange then return false else return true end end With this i can't attack the followers anymore but the attack prompt shows up anyway. Any tips? thanks Edited October 3, 2019 by Giano Link to comment https://forums.kleientertainment.com/forums/topic/112321-help-on-hiding-button-image-popping-up/ Share on other sites More sharing options...
Giano Posted October 3, 2019 Author Share Posted October 3, 2019 Alternatively can anyone help me making this mod working with the controller? (the code is taken from an old reddit post) local function make_no_f_able(inst) local combat = inst.components.combat if not combat then return end combat.canbeattackedfn = (function() local oldfn = combat.canbeattackedfn return function(inst, attacker) if not oldfn or oldfn(inst, attacker) then if attacker:HasTag("player") then local status, info = pcall(getinfo, 4, 'f') return not status or info.func ~= attacker.components.playercontroller.GetAttackTarget else return true end end end end)() end AddComponentPostInit("repairable", function(_, inst) if inst:HasTag("wall") then inst:DoTaskInTime(0, make_no_f_able) end end) AddComponentPostInit("follower", function(_, inst) if inst:HasTag("companion") then inst:DoTaskInTime(0, make_no_f_able) end end) AddComponentPostInit("workable", function(_, inst) if inst:HasTag("wall") then inst:DoTaskInTime(0, make_no_f_able) end end) It works fine with keyboard and mouse but not with the controller (maybe because the controller has the attack and force attack button bound together) Link to comment https://forums.kleientertainment.com/forums/topic/112321-help-on-hiding-button-image-popping-up/#findComment-1267417 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