Page 1 of 1

Console code to regenerate a resource patch

Posted: Fri Apr 15, 2016 12:29 am
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

Re: Console code to regenerate a resource patch

Posted: Fri Apr 15, 2016 12:46 am
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?