Spell Pack


Adds spells, mana, spirit, magic. (+10 fancy spells with customization) (Currently, the mod isn't so stable for multiplayer) Author: OwnlyMe Modified by ZwerOxotnik Anyone can translate the mod on Crowdin. https://crowdin.com/project/factorio-mods-localization

Content
1 year, 16 days ago
1.1 - 2.0
5.13K
Combat

g No spirit appearing issue

1 year, 4 months ago

I have been using the spell pack and while it's really fun, whenever you kill an enemy you don't get any spirit showing up. I've set the number you're supposed to get to 100000 or even more and still the game will not spawn any spirit upon enemy death. I've tested if spirit only appears when you kill an enemy directly next to you and from 30+ distance away. I've tried killing enemies with the fireball spell, and with turrets and none of them spawn any spirit, leading me to believe this is a bug. I've tried turning spirit visibility on and off and that hasn't helped. Can you look into this and see if you can fix any issues with spirit appearing?

13 days ago

Not spooling for me, either. Killed Biters and Nests, with and without spells.

12 days ago

I made a fix that works by replacing the entity_died method in control.lua with this:

script.on_event(defines.events.on_entity_died, function(event)
local entity = event.entity
if not entity or not entity.valid then return end

--DEBUG: Ensure enemy death being detected correctly
-- game.print("entity died: " .. entity.name)

-- Skip players
if entity.type == "character" then return end

-- Optional: only count enemies (recommended)
if entity.force ~= game.forces.enemy then return end

-- Optional: restrict to combat entities only
if entity.type ~= "unit" and entity.type ~= "unit-spawner" then
    return
end

-- Get max health safely
local max_health = entity.max_health or 0
if max_health <= 0 then return end

-- Tune this ratio to your liking
local SPIRIT_RATIO = 0.05  -- 5% of max HP

local spirit_gain = math.max(1, math.ceil(max_health * SPIRIT_RATIO))

-- Award to all players
for _, player in pairs(game.connected_players) do
    if player.valid and player.character then
        local player_data = storage.players[player.index]
        local force_data = storage.forces[player.force.name]
        player_data.spirit = math.min(player_data.max_spirit + force_data.max_spirit,player_data.spirit + spirit_gain)
    end
end

end)

12 days ago

This change awards Spirit based on the enemy entity's max HP, and is correctly awarding Spirit. Ensure when you rezip the file you haven't renamed anything, and that info.json is EXACTLY 1 layer deep. You can see if Factorio is loading it correctly by checking factorio-current.log and searching (Ctrl+F) for "error".

New response