Akiwoofer Posted August 30, 2020 Share Posted August 30, 2020 -- Panic mode local panicmode = false local function panicfn (inst) if panicmode == false and inst.components.health.currenthealth == .5 then --Transformation local x, y, z = inst.Transform:GetWorldPosition() local fx = SpawnPrefab("maxwell smoke") SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get()) inst.AnimState:SetBuild("aki") --Stat changes inst.components.combat.damagemultiplier = 2.5 inst.components.locomotor.walkspeed = 5 inst.components.locomotor.runspeed = 7 inst.components.talker:Say("WAIT STOP!") if inst.components.healthtrigger ~= nil then end panicmode = true end if panicmode == true and inst.components.health.currenthealth == 1 then local x, y, z = inst.Transform:GetWorldPosition() local fx = SpawnPrefab("maxwell smoke") SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get()) inst.AnimState:SetBuild("aki_panic") inst.components.combat.damagemultiplier = 1 inst.components.locomotor.walkspeed = 3 inst.components.locomotor.runspeed = 5 if inst.components.healthtrigger ~= nil then end panicmode = false end if inst.components.healthtrigger ~= nil then end end inst.components.healthtrigger:AddTrigger(panicfn) When I apply this to my character It keeps on crashing, I really need help Link to comment Share on other sites More sharing options...
AkaiNight Posted August 30, 2020 Share Posted August 30, 2020 can you post the error too and im not sure but it can be because of Quote if panicmode == false and inst.components.health.currenthealth == .5 then try to remove '.' Link to comment Share on other sites More sharing options...
Akiwoofer Posted August 30, 2020 Author Share Posted August 30, 2020 (edited) 4 hours ago, AkaiNight said: can you post the error too and im not sure but it can be because of try to remove '.' It Shows this once I replaced the .5 and 1 with 100 and 200 respectively Edited August 30, 2020 by Akiwoofer Link to comment Share on other sites More sharing options...
AkaiNight Posted August 30, 2020 Share Posted August 30, 2020 can you post 109th code? in aki.lua? Link to comment Share on other sites More sharing options...
Akiwoofer Posted August 31, 2020 Author Share Posted August 31, 2020 13 hours ago, AkaiNight said: can you post 109th code? in aki.lua? Quote -- This initializes for the server only. Components are added here. local master_postinit = function(inst) inst:AddComponent("healthtrigger") -- Panic mode local panicmode = false local function panicfn (inst) if panicmode == false and inst.components.health.currenthealth <= 100 then --Transformation local x, y, z = inst.Transform:GetWorldPosition() local fx = SpawnPrefab("maxwell smoke") SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get()) inst.AnimState:SetBuild("aki") --Stat changes inst.components.combat.damagemultiplier = 2.5 inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 5) inst.components.locomotor.walkspeed = 4.5 inst.components.locomotor.runspeed = 6.5 inst.components.talker:Say("WAIT STOP!") if inst.components.healthtrigger ~= nil then end panicmode = true end if panicmode == true and inst.components.health.currenthealth == 200 then local x, y, z = inst.Transform:GetWorldPosition() local fx = SpawnPrefab("maxwell smoke") SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get()) inst.AnimState:SetBuild("aki") inst.components.combat.damagemultiplier = 1 inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.5) inst.components.locomotor.walkspeed = 3 inst.components.locomotor.runspeed = 5 inst.components.talker:Say("Phew.. that was close!") if inst.components.healthtrigger ~= nil then end panicmode = false end if inst.components.healthtrigger ~= nil then end end inst.components.healthtrigger:AddTrigger(panicfn) This code is from 68th to 113rd Link to comment Share on other sites More sharing options...
DecDuck Posted August 31, 2020 Share Posted August 31, 2020 You want to have the function outside of the master_postinit. 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