#MODIFIER_PROPERTY_MODEL_CHANGE caused the game to crash

1 messages · Page 1 of 1 (latest)

bleak moth
#

Here is my modifier:

modifier_test = class({})


function modifier_test:OnCreated(table)
    self:GetParent():AddNewModifier(
        self:GetParent(),
        self:GetAbility(),
        "modifier_lich_frostnova_slow",
        { duration = 10 }
    )
end

function modifier_test:DeclareFunctions(self)
    return { MODIFIER_PROPERTY_MODEL_SCALE, MODIFIER_PROPERTY_MODEL_CHANGE }
end

function modifier_test:GetModifierModelChange(self)
    print("model change")
    return "models/heroes/clinkz/clinkz_back_default.vmdl"
end

function modifier_test:GetModifierModelScale(self)
    print("model scale change")
    return 1
end

When I create a unit with this modifier before destroying the fort,the game end then scoreboard is displayed.the modifier('modifier_lich_frostnova_slow') expires and the game crashes. i have already tried remove MODIFIER_PROPERTY_MODEL_CHANGE that the crash fixed. what's the problem.

bleak pendant
#

this property crush game only when model is unavailable

manic pine
#

Why are you passing self into the function? Thats already how class functions work
But yeah dota crashes if you try and set a units model to ones thats undefined, so it clearly doesnt like that model you're trying to use

bleak moth
manic pine
#

Does the game crash if you remove the modifier without the game ending?

bleak moth
#

No ,just wait it expires and destroy

manic pine
#

so its the vanilla modifier that crashing the game, not the modifier that changes the model right?

#

because if its the vanilla one, why are you using it?

bleak moth
#

The "modifier_lich_frostnova_slow" is a built-in modifier, and replacing it with any other modifier will cause a crash.

This might be intended to understand the cause of crashes related to modifiers, so similar issues can be avoided when creating modifiers in the future.

verbal grove
#

"models/heroes/clinkz/clinkz_back_default.vmdl" doesn't exists in my dota installation and if this model is not your custom one issue probably in that string

#

You can also try delete "self" from every function args above because this is dota and anything may happen (like idk dota fails to pass self correctly when required and crash)

#

modifier_test also sounds like something that can be used by valve already (and exists in dota) so try make it name more unique like "modifier_test_custom"

bleak moth
#

alright, I’ll try out your suggestions. ty guys!

spice hedge
verbal grove
spice hedge
#

Sounds like the order of the arguments broke, rather than self wasn't being passed