Cheating on My Colony for Fun and Profit? pt.2 – Topping up your Resources

Hey G33ks, So if you didn't notice it yet, I started building my own cheating script for My Colony. If you didn't read part 1, then I definitely recommend to go read that first, as it will give you a great insight on what I've been doing so far. In this part, I will top up the resources. First, I'll tackle the non-limited resources (ones that - unlike food for example - do not need storage, like gold). Then, I'll handle the other resources later. Again: and again: I do not endorse cheating!  
 

Reading Parts list


Because this is a multi-part research, here are the links to all parts:  
 

Learning the resource data


First, ofcourse, I had to learn how the resource data works. I did expect it to look similar to the buildings data, and I was right! Unfortunately for me, each and every building that could hold resources was in there as well. But then again, I wanted to tackle the non-limited resources first.  
 

Editting the Money


So I started with the money first. I started by dumping the array containing the money data. Doing so made me able to read out the JSON a lot easier. Again, here is it's structure in the save file:
{
	"resources":{
		"Money":{
			"amount":2943,
			"capacity":null,
			"price":960,
			"previous":2943,
			"storageCapacity":0,
			"unlocked":true,
			"inflows":{
				"allCurrent":140973,
				"allTime":140973,
				"current":{
				},
				"total":{
					"Gift":3314,
					"Gold Mint":95382,
					"Sale":9985,
					"Colonist":1877,
					"Bank":6100,
					"Trade":23615,
					"Mass Driver":700
				}
			},
			"outflows":{
				"allCurrent":107455,
				"allTime":107455,
				"current":{
				},
				"total":{
					"Tax":86357,
					"Colonist":13266,
					"Civic Center":1222,
					"Construction":6000,
					"Bank":610
				}
			},
			"historic":{
				"inflows":{
					"Bank":10,
					"Gold Mint":42
				},
				"outflows":{
					"Bank":1
				}
			}
		}
	}
}  
So now that we have that, I could edit the amount with relative ease (Yes, I am aware of function names jumping all around lol). However, this doesn't look legit at all. So, I added the difference to the Gold Mintinflow and the allCurrent & allTime inflow! :) However, just setting it to a static 9999999999 isn't fun. So I added a new input for the money-total, and added the needed code to the script as well :) I added some more code, for example, for the toggle to finish buildings or not before I gave it another shot. So, I imported my game again, And.... But after a little while, something rather funny happened :-P The game started to take adding $14 to the balance a bit too literally :-P So, back to the drawing board it was :) After a bit of troubleshooting, I figured out that the values in the JSON where no longer integers. Which meant that instead of doing 1 + 1 = 2, it did "1" + 1 = "11" (or something like it). So I editted the code a little to make integer values of it again, And...  
 

Editting the Other Unlimited Resources


With the money changer finished, I could do the same with all the other unlimited resources. This was as easy as copy-pasting the code, changing some values and done :) (it actually took me quite some time to do this lol) Unfortunately for some, I didn't bother about wood, clay etc, just the resources you can find on the Red Planet map (it's very easy to adapt to other planets so). However, the code is quite unoptimized, but it's fine for now :)  
 

Making it look more legit


In case you noticed: you can get Uranium without even having Uranium unlocked. To prevent these cases, I updated the code some more to make it look slightly more legit :) Did my usual import stuff, And... Yes, Uranium doesn't show up there because I don't have Uranium unlocked yet (I can unlock it already, but I was too lazy) :)  
 

Editting the limited Resources


Next up was topping up the resources that do require storage (for example, food). This was relatively easy to do as well now that I know the JSON structure of the save file better. I added another checkbox to the form, made a function to top off all the other resources (This is where I realized Microchips are limited), did my usual import stuff, And... Yes, the inflows aren't correct, but I think you can figure that out on yourself :)  
 
So that basically means we can now complete all buildings, get unlimited resources, and still (sorta) look legit :) How cool! Well, that's it for this part :) I hope you guys enjoyed! I think next part will be "making" a better relationship with the United Earth, and make my colonists less angry at me :) But until then... [g33kout]

Comments


Leave a comment


Please login to leave comment!