SHI_YE Posted April 22, 2021 Share Posted April 22, 2021 I need to make some changes for my character on the SGWilson and SGWilson_client stategraphs.I saw some tutorials and other mods.They just use the function AddStategraphPostInit to change the stategraph.And obviously it changes stategraphs of all characters.If other characters change same places it will lead to conflicts.That's what I don't want to happen.So,is there any way to avoid affecting others when making changes on stategraphs only work for my character?Really appreciate it if somebody could help me. Link to comment Share on other sites More sharing options...
Yakuzashi Posted April 23, 2021 Share Posted April 23, 2021 I have made some changes for stategraph in order to change animation for specific weapon. I have just added tag to the weapon and inside stategraph function looked for that tag. Take a look, I am terrible person to explain things. local function avtofir(sg) local _onenter = sg.states["attack"].onenter sg.states["attack"].onenter = function(inst) _onenter(inst) local equip = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) local cooldown = inst.components.combat.min_attack_period + 300 * FRAMES if equip ~= nil and equip:HasTag("sprayer") then inst.AnimState:PlayAnimation("ngnt") end cooldown = math.max(cooldown, 300 * FRAMES) end end AddStategraphPostInit("wilson", avtofir) tag is called "sprayer". Cheers! Link to comment Share on other sites More sharing options...
SHI_YE Posted April 25, 2021 Author Share Posted April 25, 2021 On 4/23/2021 at 6:40 PM, Yakuzashi said: I have made some changes for stategraph in order to change animation for specific weapon. I have just added tag to the weapon and inside stategraph function looked for that tag. Take a look, I am terrible person to explain things. local function avtofir(sg) local _onenter = sg.states["attack"].onenter sg.states["attack"].onenter = function(inst) _onenter(inst) local equip = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) local cooldown = inst.components.combat.min_attack_period + 300 * FRAMES if equip ~= nil and equip:HasTag("sprayer") then inst.AnimState:PlayAnimation("ngnt") end cooldown = math.max(cooldown, 300 * FRAMES) end end AddStategraphPostInit("wilson", avtofir) tag is called "sprayer". Cheers! Thanks.It gives me some ideas. 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