Console code to regenerate a resource patch

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
minchains
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Apr 14, 2016 8:49 pm
Contact:

Console code to regenerate a resource patch

Post by minchains »

Hello, so I was wondering if it was possible to use console commands to set a area of resource around you using console commands to a certain value: I can see for 1 patch it is :

Code: Select all

/c game.local_player.selected.amount=7500
So I was wondering why this following code does not work:

Code: Select all

/c local pos=game.local_player.position 
for k,v in pairs(game.surfaces.nauvis.find_entities_filtered{area={{pos.x-10,pos.y-10},{pos.x+10,pos.y+10}}, type="resource"}) do 
v.amount=2500+math.random(0,2500) 
end
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Console code to regenerate a resource patch

Post by daniel34 »

The code you posted works for me. Are you sure you are putting it all in as one command, and not separated by lines?
quick links: log file | graphical issues | wiki
Post Reply

Return to “Gameplay Help”