ArcAngela Posted October 10, 2023 Share Posted October 10, 2023 I am making a captain character and I want this character to refuse to abandon ship (by refusing to walk the plank). Considering that Abandoning ship is an Action, is there away to blacklist a character from performing specific actions? Any help is appreciated. Link to comment https://forums.kleientertainment.com/forums/topic/151601-help-blacklist-an-action/ Share on other sites More sharing options...
Rickzzs Posted October 11, 2023 Share Posted October 11, 2023 my implement, local actions = {"MINE", "CHOP", "HAMMER", "DIG", "TERRAFORM"} local function BanAction_Client(inst, b) local oldval = inst._actionbanned if oldval ~= b then inst._actionbanned = b for i, v in ipairs(actions) do local a = ACTIONS[v] if a then if b then a._oldex = a.ghost_exclusive a.ghost_exclusive = true else a.ghost_exclusive = a._oldex a._oldex = nil end end end end end if not inst:HasTag("playerghost") then BanAction_Client(inst, true) else BanAction_Client(inst, false) end local function onperform(inst, data) local a = data and data.action local act = a and a.action act = act and act.id if act and table.contains(actions, act) then if inst:IsDrained() then a.Do = function() a:Fail() return false, "drained" end end end end local function BanAction_Server(inst) inst:ListenForEvent("performaction", onperform) end Link to comment https://forums.kleientertainment.com/forums/topic/151601-help-blacklist-an-action/#findComment-1671575 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