Jump to content

Mermguard Upgrade


Recommended Posts

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 by Well-met
Link to comment
Share on other sites

 

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 by thomas4846
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...