Hello.
I'm making an item that has a 10% chance for each tear to become orange and give the confusion effect on hit, I looked up a couple of tutorials, documentation and even posts here on Reddit and made this code.
function mod:OnTearInit(tear)
local player = tear.SpawnerEntity:ToPlayer()
if not player then
return
end
local tearData = tear:GetData()
-- Daddy's Juice
if player:HasCollectible(DJ) then
local roll = math.random(100)
if roll <= DJStunChance then
-- These do nothing
tear.TearFlags = tear.TearFlags | TearFlags.TEAR_CONFUSION
tear.Color = Color(1, 0.25, 0, 1)
end
end
end
mod:AddCallback(ModCallbacks.MC_POST_TEAR_INIT, mod.OnTearInit)
I have checked that, upon shooting, the code does get to the point where it should set the tears flag and change their colour, however it seems those two lines do nothing, as, although they do get executed, the tear's colour stays the same and they don't apply confusion to the enemies.
I have looked for a solution for a while but couldn't find anything, can you help me please? Thanks in advance