Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Editing Juice?  (Read 1481 times)

Keigan

  • Bay Watcher
  • Death or Liberal
    • View Profile
Editing Juice?
« on: October 17, 2013, 12:30:23 pm »

Is there anyway I can make it so if you have 1000 Juice you can recurite as much as you want?
Logged
- A Fat Liberal

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Editing Juice?
« Reply #1 on: October 17, 2013, 05:50:54 pm »

Yes, this could very easily be done by editing the source code and compiling and building it. Of course there are 2 separate recruitment caps: the recruitment cap for people persuaded to join the LCS by talking about the issues or being liberated from oppression, and the recruitment cap for people who get seduced. There isn't any recruitment cap for people who get brainwashed. Anyway, as long as the recruitment cap is a greater number than the number of recruits of that type, you can recruit more people. So if, for instance, the function to return the number of possible recruits returns a value equal to the current number of recruits plus one, then you'd be able to recruit unlimited numbers of people, and that is only a very minor code modification. Of course, since your hypothetical mod would only take effect with 1000 Juice, the functions for the number of possible recruits would have if...else statements in them to see if you have 1000 Juice, and use the existing code, inside braces, if there's less than 1000 Juice, and return the current number of recruits plus one if you have 1000 Juice.

Oh yeah, and the functions to edit are all in /trunk/src/common/commonactions.cpp. The 4 functions to edit are maxsubordinates(), subordinatesleft(), loveslaves(), and loveslavesleft(), all in that file. I won't actually write the code for those functions for your mod... that oughta be enough information for you to figure out the rest of how to implement it. Oh yeah, and when you do the juice check, you do it with cr.juice, since those functions all have cr as the Creature variable, and juice is a variable that is part of the Creature class. Like, you'd say "if(cr.juce==1000) { code for unlimited recruits } else { original code for the function }". Or you could do it in the other order: "if(cr.juce!=1000) { original code for the function } else { code for unlimited recruits }". Either way would work. And I'd do that in all 4 of those functions. Well technically you only need to do it in maxsubordinates() and loveslaves(), since if you use the suggestion of the formula (current number of recruits + 1) for number of possible recruits, that'll mean that subordinatesleft() and loveslavesleft() wouldn't have to be modified at all if you did a good enough job on editing maxsubordinates() and loveslaves(). So really you only need to modify 2 functions.
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: Editing Juice?
« Reply #2 on: October 22, 2013, 04:29:59 am »

Alternatively, you edit the save file or use cheat engine. Both much easier than what LE suggested.
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Editing Juice?
« Reply #3 on: October 22, 2013, 07:35:57 pm »

Alternatively, you edit the save file or use cheat engine. Both much easier than what LE suggested.

Meh, what I suggested is easiest for me. I would have more difficulty trying to edit the save file or trying to use cheat engine, I already know how to edit and compile the source code. :P The source code is human-readable text, after all, while the save file isn't and I don't really use programs like cheat engine personally. I was just suggesting something that I knew would work, that I would know how to do myself... I could probably figure out how to use cheat engine if I downloaded it, but editing the save file, I am not comfortable with editing save files, I know part of them is in XML but part of it isn't, and they might have some sort of checksum or something, I don't know, I'd need to look at the relevant source code regarding reading and writing save files to figure it out the save file format better... So I guess probably both of us could agree the easiest solution would be a program like cheat engine, which is probably easy enough for anyone to use, without having to edit source code or decode the save game format.

So yeah, Cheat Engine, this is the link here. There's your easiest solution. ;)
« Last Edit: October 22, 2013, 07:38:44 pm by Liberal Elitist »
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL