Sign in to follow this  

Recommended Posts

Akiwoofer    0

-- 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

Share this post


Link to post
Share on other sites
AkaiNight    22

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 '.'

Share this post


Link to post
Share on other sites
Akiwoofer    0
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 

image.png

Edited by Akiwoofer

Share this post


Link to post
Share on other sites
Akiwoofer    0
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

Share this post


Link to post
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
Sign in to follow this