ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Removing mines and/or anomalies permanently

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  23:32:44  6 February 2019
profilee-mailreply Message URLTo the Top
On forum: 12/18/2014

Message edited by:
02/06/2019 23:49:51
Messages: 6
Removing mines and/or anomalies permanently

I need to remove mines permanently. I'm using a mod which adds mines (as items) recognized by the game as anomaly (zone_mine_field) but they are respawning after explosion (on reload), rendering them useless cause its a permanent trap for my own. I tried to remove them with an 'anomaly remover mod' (disables not removes anomalies), and in 'amk_anoms.script but got no clue.

Got this code from anomaly remover:

function get_anoms(npc, radius)
local anoms = {}
local pos = npc osition()
for i= 1, 65534 do
local obj = level.object_by_id(i)
if obj ~= nil and obj:clsid() >= 168 and obj:clsid() <= 181 then
local dist = pos:distance_to(obj osition())
if dist < radius then
table.insert(anoms, obj)
return anoms

function on_item_drop(item)
local sect = item:section()
if sect ~= "anom_remover" then return end
--dbg.log("drop anomaly remover. start removing..."
local anoms = get_anoms(, radius)
if table.getn(anoms) == 0 then
--dbg.log("anomaly not found"
for i, obj in ipairs(anoms) do
--dbg.log("anomaly[%s] disabled", obj:name())

Gave a new class to 'zone_mine_field' works. I can disable them
but not remove:

if obj ~= nil and ((obj:clsid() >= 168 and obj:clsid() <= 181) or obj:clsid()==clsid.zone_mine_s) then

I was fiddling around in 'amk_anoms' but can't figure out how they removed anomalies after blow, tried a lot:

for i, obj in ipairs(anoms) do

doesn't work, tried adding 'zone_minefield' to amk_anoms table, so they would be removed after blows, but didn't work.

Any help would be appreciated.
PS sorry, don't know how to remove the emoticons from the code, that are colons and brackets of course.

  01:28:08  10 February 2019
profilee-mailreply Message URLTo the Top
Senior Resident

On forum: 06/15/2007
Messages: 4255
First off, hamlet77, your code is attempting to release a client-side (online, visible) item when it needs to release the server-side object. The objects stored in the anoms table were obtained with level.object_by_id(i). To get the server object for that client object, use this:


So your release code could be

    alife():release(alife():object(obj:id()), true)

You very likely will still have trouble even when that succeeds, because deleting anomalies via release() tends to corrupt games, something to do with orphaning connections to entities that had encountered them. (Recall any mutants that floated after you killed them?) I recall someone who determined that he could safely remove (delete) the anomalies a full game day after he used disable_anomaly() to hide them, to bypass the troubles that result from just deleting them. I have not verified that this approach works.

I'll tell you about my workarounds in the ZRP to deal with this. The fires around the Rostok/Wild Territory helicopter involved in the Kruglov/mercs fight never go out in pure vanilla. I have a script that is executed when the level is loaded that uses disable_anomaly() to shut down those fires. So they are always turned off when you revisit Rostok after doing a bit of work in Yantar.

Another thing I have in the ZRP is the "removal" of certain anomalies in free-play mode, to support the survival of NPCs. This permits more faction-vs-faction battles in Pripyat, for instance. The word "removal" is in quotes because they are not really removed, but they are changed; the damage is reduced and (more importantly) their radius is set to zero and they are moved up out of the way.

See gamedata\scripts\_z.script in ZRP 1.07 or later if interested in the code that does this. The function remove_anomaly_set() "removes" certain anomalies for free play and the function disable_rostok_heli_fires() turns off the fire anomalies when the level is loaded; see on_add_actor() in the same script.

I vaguely recall that the AMK anomalies in Oblivion Lost simply alternated between two or three sets of anomalies, enabling only one set at a time. They were fixed anomalies, and one pernicious killer anomaly was right in front of Sid's bunker entrance.

One last heads-up: Don't rely on numeric CLSIDs unless you obtain them for each game. If you add or remove object classes, those numbers can change, something that has happened with different patch versions.

You can use pre and /pre in square brackets to bookend a code block so that those smilies don't appear.
  06:22:35  11 February 2019
profilee-mailreply Message URLTo the Top
On forum: 12/18/2014
Messages: 6
Many thanks for your capable answer NatVac!

I will try your function from ZRP, will post an update if I get it to work.
Each word should be at least 3 characters long.
Search conditions:    - spaces as AND    - spaces as OR   

All short dates are in Month-Day-Year format.


Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.