Console command to find rare ore

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
RoddyVR
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Thu May 07, 2015 6:29 am
Contact:

Console command to find rare ore

Post by RoddyVR »

In my current game i just found out that i have no stone after the patch that was in the starting area. the map gen options were NOT set to 0 stone (it was probably low frequency small patches, migh even be poor ones).
Anyway in an attempt to salvage the 14 hours i've put into this map, i am cheating to find the stones i need. I would prefer to do this without turning of achievements as there are still a lot i can get.

Anyway i've revealed 3k*3k of the map, but failed to find stone. i am hoping that i'm just missing it ont the map (maybe being bitters or something).
so want the console to fnid the stone for me.

took the wiki's command for deleting all rocks (as it's gotta find them first, but i need to replace the destory with a print coordinates... how do i do that???


/c local surface = game.player.surface
for c in surface.get_chunks() do
for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, name = "ORE/OBJECT"})) do
entity.destroy()
end
end

i replace the "ORE/OBJECT" with "stone-ore" and replace entity.destroy() with game.player.print(entity.pos) and its not giving me an error on execution, but i'm not sure i'm doing it right, and since i'm getting no result, i ask for help.

I want to find the ore that SHOULD be there, and then reload an older save to keep playing "without" console help. and go get the ore (have enough stone saved up from fist patch to build rails there i think).

changed stone-ore to iron-ore to test my comman, and now getting errors for the print command.... so i guess that means it never found any stone ore to get to the part of the code that tries to print.... this is discouraging.
RoddyVR
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Thu May 07, 2015 6:29 am
Contact:

Re: Console command to find rare ore

Post by RoddyVR »

didnt find a way ot get position, but did find a way to confirm that there are no stone patches.
/c local surface = game.player.surface
for c in surface.get_chunks() do
for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, name = "stone-ore"})) do
game.player.print(entity.amount)
end
end

gave no output, where as when i replace stone ore with iron, i get a long list.

Guess my only option now is to use console to add stone ore to the map, and forget achievemetns.... frustrating really.... i barely get about an hour a day of playtime (otherwise either my wife or my son start feeling neglected), so this map is about 2 weeks of playtime, that i have to weigh throwing out the window if i want ot get some achievments out of this game.

just got the map string for my game...
>>>AAAOABMAAAADBAYAAAAEAAAAY29hbAICAwoAAABjb3BwZXItb3Jl
AQMECQAAAGNydWRlLW9pbAIEAgoAAABlbmVteS1iYXNlAwQDCAAAAGl
yb24tb3JlAQQDBQAAAHN0b25lAgEDFq/PloCEHgCAhB4ABABUFhS5<<
<

stone is set to low freq, small patches. can someone explain why there are no stone patches in an area revealed by
/c game.forces.player.chart(game.player.surface, {{x = -1500, y = -1500}, {x = 1500, y = 1500}})
RoddyVR
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Thu May 07, 2015 6:29 am
Contact:

Re: Console command to find rare ore

Post by RoddyVR »

think i found some ore.... my mistake was stone-ore instad of just stone.

one wrong assumption made me an ass.

this code

Code: Select all

/c local tot = 0;  
local surface = game.player.surface  
for c in surface.get_chunks() do     
for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, name = "stone"})) do      
game.player.print(entity.position.x) 
game.player.print(entity.position.y)  
  tot=tot+entity.amount    
 end 
  end 
 game.player.print(tot)
gives coordinates of every stone resourse on map and total amount of resourses it found.
i got results of about 6k ore at 600x by 1000y/ now i just need to figure out where that is.
Post Reply

Return to “Gameplay Help”