Jump to content

Recommended Posts

This works, I suppose, but only if I drop the amulet on the ground.  I'm not worried about that, but how do I get the amulet to shine light while equipped?

function BlueAmuletPostInit(inst)inst.entity:AddLight()inst.Light:SetRadius(5)inst.Light:SetFalloff(1)inst.Light:SetIntensity(.5)inst.Light:SetColour(128/255,128/255,255/255)inst.Light:Enable(true)endAddPrefabPostInit("blueamulet", BlueAmuletPostInit)
Link to comment
https://forums.kleientertainment.com/forums/topic/28719-how-do-i-fix-this/
Share on other sites

take a look at the magiluminescence's code that should help you a bit

 

in the meantime I'll try and find it for you and add it to this post

heres the yellow amulets code, it uses the fueled component 

 

[codesyntax]
---YELLOW
local function onequip_yellow(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_body", "torso_amulets", "yellowamulet")
 
    if inst.components.fueled then
        inst.components.fueled:StartConsuming()        
    end
 
    inst.Light:Enable(true)
 
    owner.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
 
end
 
local function onunequip_yellow(inst, owner) 
    owner.AnimState:ClearBloomEffectHandle()
    owner.AnimState:ClearOverrideSymbol("swap_body")
    if inst.components.fueled then
        inst.components.fueled:StopConsuming()        
    end
 
    inst.Light:Enable(false)
end

[/codesyntax]

 

it may not be configurable but this part of the code may help

 

 inst.Light:Enable(true)

Edited by Craig_Perry

take a look at the magiluminescence's code that should help you a bit

[snip]

 

Thank you very much.  This did work:

local assets={Asset("ANIM", "anim/amulets.zip"),Asset("ANIM", "anim/torso_amulets.zip"),}local function onequip_yellow(inst, owner)     owner.AnimState:OverrideSymbol("swap_body", "torso_amulets", "yellowamulet")    if inst.components.fueled then        inst.components.fueled:StartConsuming()            end    inst.Light:Enable(true)    owner.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )endlocal function onunequip_yellow(inst, owner)     owner.AnimState:ClearBloomEffectHandle()    owner.AnimState:ClearOverrideSymbol("swap_body")    if inst.components.fueled then        inst.components.fueled:StopConsuming()            end    inst.Light:Enable(false)endfunction BlueAmuletPostInit(inst)    inst.components.equippable:SetOnEquip( onequip_yellow )    inst.components.equippable:SetOnUnequip( onunequip_yellow )     inst.entity:AddLight()    inst.Light:Enable(false)    inst.Light:SetRadius(2)    inst.Light:SetFalloff(0.7)    inst.Light:SetIntensity(.65)    inst.Light:SetColour(128/255,128/255,255/255)endAddPrefabPostInit("blueamulet", BlueAmuletPostInit)

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
×
  • Create New...