How do I destroy all the NPCs on a single map?

From OHRRPGCE-Wiki
Jump to navigation Jump to search

If you want to destroy every single NPC on the map, and any copies it may have, you will have to use plotscripting.

What this script will do is go through each NPC that can exist on the map, and brute-force destroy all possible 300 copies that an NPC can have.

script, destroy npcs, begin

    variable(npc id)   #npc id counter
    variable(npc copy) #npc copy counter
    
    for(npc id, 0, 99, 1) do, begin         # npc id loop. npcs start at id 0
        for (npc copy, 1,npc copy count(npc id), 1) do, begin # npc copy loop
            destroy npc(npc reference(npc id, 0))     
        end
    end

end

See Also[edit]