Well-met Posted June 7, 2021 Share Posted June 7, 2021 (edited) Hello I wish to mod mermguards so they immediately "upgrade" when they are spawned, even if a king doesn't exist. I have tried this if GLOBAL.TheNet and GLOBAL.TheNet:GetIsServer() then AddPrefabPostInit("mermguard", function(inst) inst:PushEvent("onmermking_created") end) end It seems a good start because the mermguards play their "upgrade" animation and effects, but they don't actually get anything. They don't receive their healthy skin or stats. They're still frail and weak even after the event. what am I doing wrong? Edited June 7, 2021 by Well-met Link to comment Share on other sites More sharing options...
Thomas Die Posted June 7, 2021 Share Posted June 7, 2021 (edited) if GLOBAL.TheNet and GLOBAL.TheNet:GetIsServer() then AddPrefabPostInit("mermguard", function(inst) inst:DoTaskInTime(math.random(), function(inst) --< a inst:PushEvent("onmermking_created") end) end) end You might need to add that, personally idk just happens some times Edited June 7, 2021 by thomas4846 Link to comment Share on other sites More sharing options...
Well-met Posted June 7, 2021 Author Share Posted June 7, 2021 (edited) that code does not work putting a delay to the buff also does not fix the problem Edited June 7, 2021 by Well-met Link to comment Share on other sites More sharing options...
Well-met Posted June 9, 2021 Author Share Posted June 9, 2021 could still use some help Link to comment Share on other sites More sharing options...
Thomas Die Posted June 9, 2021 Share Posted June 9, 2021 Looked through the code it might have to manually be done as the event may only be called in regarded to the worlds events which means that all merms would have to have the upgrade if you don't mind, but anyone feel free to correct me if i'm wrong. inst:ListenForEvent("onmermkingdestroyed", function() inst:DoTaskInTime(math.random()*SLIGHTDELAY,function() RoyalGuardDowngrade(inst) inst:PushEvent("onmermkingdestroyed") end) end, TheWorld) --< inst:DoTaskInTime(0,function() if not (TheWorld.components.mermkingmanager and TheWorld.components.mermkingmanager:HasKing()) then --< RoyalGuardDowngrade(inst) end end) If you wanna just sweep it under the rug you could like inst:ListenForEvent("onmermkingdestroyed", function() inst:DoTaskInTime(math.random()*2,function() --RoyalGuardDowngrade(inst) --inst:PushEvent("onmermkingdestroyed") --upgrade code end) end, TheWorld) inst:DoTaskInTime(01,function() --upgrade code end) not too sure but good luck on ya 1 Link to comment Share on other sites More sharing options...
Well-met Posted June 10, 2021 Author Share Posted June 10, 2021 Got it, it's TheWorld:PushEvent("onmermkingcreated") that was needed Link to comment Share on other sites More sharing options...
Thomas Die Posted June 11, 2021 Share Posted June 11, 2021 (edited) yeah but wouldn't that upgrade all the merms? Edited June 11, 2021 by Thomas Die "?" added in 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