RPG System


This mod adds a basic RPG system to the game (XP, level-up and skills)

8 months ago
0.16 - 1.1
103K

i [QOL] Prevent Friendly Fire?

1 year, 6 months ago

It's not uhh....fun, to die because your Personal Lasers dumped a sack of cluster grenade magic at your feet to kill one biter...this has happened to me multiple times recently.

1 year, 6 months ago

same for me thow i git killed by the posen that i thow

1 year, 3 months ago

During gameplay, this happened to me aswell getting killed by the DoT of the poison grenade you get, if you were to be in detonation range. After looking, I didn't see any way to somehow change it to no friendlyfire, nor did I find any mod, which changes the friendlyfire aspect of explosions in general. Matter of fact, I didn't find any usable properties in the files that could change this aspect, hinting that it is an internally programmed explosion, whose properties cannot be modified via lua script it seems.
However, I found a workaround, which should prevent dying from those explosions again. To respect the author's license, a modified version of his mod cannot be uploaded to this mod portal, so I instead show the changes here for anyone to apply individually to this mod.

In the "control.lua", go to line 1340. You will see this:

if w=='rpg-magic-shock' then ShockNear(entity,player,LV)
    else player.surface.create_entity{name=w, target=entity, target_position=entity.position,  position=player.position, force=player.force, speed=0.4} end
end

Replace it with this:

if w=='rpg-magic-shock' then
    ShockNear(entity,player,LV)
else
    if w=='poison-capsule' then
        local range = (entity.position.x - player.position.x) ^ 2 + (entity.position.y - player.position.y) ^ 2
        if range < 144 then
            w='distractor-capsule'
        end
    end
    player.surface.create_entity{name=w, target=entity, target_position=entity.position,  position=player.position, force=player.force, speed=2.0}
end

This adds a range limitation to the poison grenade magic effect. The area of the poison explosion is roughly a radius of 10, while the poison cloud visuals have a radius of roughly 12. If you kill an enemy being in close range and you were to throw a poison grenade magic, it changes the effect to the distractor capsule effect, which shouldn't be as hazardous to you. It also helps to change the velocity of the throwed entity, if you happen to be very fast on movement.
With this code, the velocity of the thrown entity is 5 times higher, and you must be at least 12 range units away from the dying enemy to potentially throw a poison grenade.

I hope this helps.

1 year, 2 months ago

Adding the suggested fix to a new version. thanks

New response