The Guild II: Renaissance

The Guild II: Renaissance

=NV=Hammer Jan 14, 2017 @ 10:12am
Calling all modding experts in LUA files McCoy,Fajeth et al
I am trying to combine the forever 21 mod with always win elections to see how long I can get the game to last through many families and generations. On the runeforge website I found this thread. However with patch 4.21 and the mods it seems obsolete can you guys tell me how to get it to work so I always win office with the new and improve 4.21 patch? Thank You


http://forum.runeforge-games.net/index.php?topic=12494.0

Hey, sorry if this is in the wrong place. I've been trying to enable an election cheat mod, but I keep failing to get it to work. I've tried two separate ones - the one by Picqua and the one by Shano. Neither one works.

I'm running the latest beta on Steam, which is 4.2 (not sure if the hotfix is included or not).

I've added the sections according to both files, I've replaced OfficeSession with the mod files, I've even tried playing around with officesessionproto but to no avail. Picqua's mod should have me winning and Shano's should have me the only candidate, but from what I can tell they aren't even firing. There's a log output in Shano's code that I've never seen outputted, I've even tried throwing in a few MsgQuicks in there to see if I could pinpoint where the code was going wrong, and I never saw a peep from any of them.

Has the election system changed so drastically in the past couple of patches? Or am I missing something, like I need to start a new game?

The codes of the cheats are:

Shano's

Code: [Select]
-- If we are cheating, lets see if we are a candidate
local CHEAT_Vote = GetSettingNumber("GAME", "CHEAT_Vote", 0)
local apply_cheat = 10
if CHEAT_Vote > 0 then
for i=0,ApplicantCnt - 1 do
-- Is this us?
if( DynastyIsPlayer("Applicant"..i) ) then
-- Its us, lets cheat away
apply_cheat = i
end
end
end

This is right before the applicants are counted.

Code: [Select]
if(ApplicantCnt == 1 or apply_cheat ~= 10 ) then
if ( apply_cheat ~= 10 ) then
LogMessage( "CHEAT Found us voting at " .. apply_cheat )
Winner = apply_cheat
else
Winner = 0
end
officesession_OverviewCam()
MsgSay("Chairman","@L_SESSION_ADDON_ONLY_ONE_CANDIDATE")

Shortly after, right in the place where the game checks if there's only one applicant.


Picqua's

Code: [Select]
--picqua
for i=0, ApplicantCnt - 1 do
if DynastyIsPlayer("Applicant"..i) then
Winner = i
end
end

This is right after the Chairman announces the winner. I've tried moving it to right after the votes are tallied, and even both, but that didn't work either.

Last edited by =NV=Hammer; Jan 14, 2017 @ 10:23am
< >
Showing 1-12 of 12 comments
McCoy! Jan 14, 2017 @ 10:50am 
for i=0,Applicant do local SimExists = GetAliasByID(GetID("Applicant"..i),"ExisitingSim") local SimPolAtt = 0 if( (SimExists == true) and (GetHP("ExisitingSim") > 0) and (GetState("ExisitingSim", STATE_DEAD) == false) ) then GetAliasByID(VoterID,"VoterAlias") if GetDynasty("ExisitingSim","SimDynasty") then SimPolAtt = GetImpactValue("SimDynasty","PoliticalAttention") * 10 end local CurrentOfficeBonus = 0 if SimGetOffice("ExisitingSim","ExistingSimOffice") then if (GetID("ExistingSimOffice") == GetID(Office)) then CurrentOfficeBonus = 10 end end local RhetSkill = GetSkillValue("ExisitingSim", RHETORIC) local Fav = GetFavorToSim("VoterAlias","ExisitingSim") + GetImpactValue("ExisitingSim","CutsceneFavor") + SimPolAtt + ShadowMalus + CurrentOfficeBonus + RhetSkill if Fav > MaxFavor then MaxFavor = Fav FavoriteApplicant = GetID("Applicant"..i) elseif Fav == MaxFavor then FavoriteApplicant = -1 end end end return FavoriteApplicant

This is where you need to be in officesessions.lua. There are two of these you need to fix up. One is run when you are inside the office meeting and one is run when you are outside the office building (can happen if you are under attack or something)

Open your editor and search "CurrentOfficeBonus" and clicking next should bring you to all the places its called

create a new local under CurrentOfficeBonus
local CurrentOfficeBonus = 0 local MyBonus = 0 if DynastyIsPlayer("ExistingSim") then MyBonus = 7500 end
you then need to add your bonus to the rest
GetImpactValue("ExisitingSim","CutsceneFavor") + SimPolAtt + ShadowMalus + CurrentOfficeBonus + RhetSkill + MyBonus

Again there are TWO spots in this file where you will need to do this. If you are still not winning simply increase your bonus value but I would think that should be more then sufficient.
Last edited by McCoy!; Jan 14, 2017 @ 10:54am
=NV=Hammer Jan 14, 2017 @ 10:52am 
Thank you sir!
McCoy! Jan 14, 2017 @ 11:41am 
You can use the config.ini to make tweaking both of those values easier by writing it this way

Add this entry near the bottom of the config.ini file
[CHEAT] // Office election favor bonus for me MyFavorBonus = 7500

Then make the following change to both entries in officesession.lua
local CurrentOfficeBonus = 0 local CustomAmount = GetSettingNumber("CHEAT","MyFavorBonus","") local MyBonus = 0 if DynastyIsPlayer("ExisitingSim") then MyBonus = 0 + CustomAmount end

obviously you still need to add it to both entries to make it work
GetImpactValue("ExisitingSim","CutsceneFavor") + SimPolAtt + ShadowMalus + CurrentOfficeBonus + RhetSkill + MyBonus

Now using your config.ini you can increase, decrease or turn off your bonus by setting it to zero
Last edited by McCoy!; Jan 14, 2017 @ 4:40pm
=NV=Hammer Jan 14, 2017 @ 12:30pm 
tested the first method didnt work with 7500 so i uppped it to 99000 testing now
Last edited by =NV=Hammer; Jan 14, 2017 @ 12:31pm
=NV=Hammer Jan 14, 2017 @ 12:48pm 
still not being declared the winner even if i lost using 99000as a bonus as i was up for reelection wich I lost
it think Picequa mod always made you the winner if you didnt win you were still declared the winner Thank you for your help

Last edited by =NV=Hammer; Jan 14, 2017 @ 12:49pm
=NV=Hammer Jan 14, 2017 @ 2:58pm 
I removed the line of code and lost still however is there a way to in a sense trick the game into winning the election even if i dont I think that is what this
Picqua's

Code: [Select]
--picqua
for i=0, ApplicantCnt - 1 do
if DynastyIsPlayer("Applicant"..i) then
Winner = i
end
end

was designed to do however I do no longer have the Always win elections mod as it is no longer available to download im guessing because of incompatibility since offices were reworked?
=NV=Hammer Jan 14, 2017 @ 2:59pm 
I thought frost might have it in his mods i wasn't sure where i got that file from.
McCoy! Jan 14, 2017 @ 4:50pm 
Oh no doubt there is probably a way. If the code worked in previous versions it should still be able to work in this one. The code I gave you above was slightly off but I did test the version I will post below and did get results as seen in my logfile
[Script] MyBonus: 0 Fav: 42 LastName: Alzheimer [Script] MyBonus: 7500 Fav: 7533 LastName: Haraan [Script] MyBonus: 0 Fav: 42 LastName: Alzheimer [Script] MyBonus: 7500 Fav: 7533 LastName: Haraan [Script] MyBonus: 0 Fav: 45 LastName: Alzheimer [Script] MyBonus: 7500 Fav: 7536 LastName: Haraan
The flaw of this method is of course if no voters show up
function GetFavoriteApplicantToVoter(Office,VoterID) local ApplicantCnt = officesession_OfficeGetApplicants(Office,"Applicant") local AppsArray = {} local MaxFavor = -99 local FavoriteApplicant= -1 local NobilityBonus = 0 local CurrentOfficeBonus = 0 local CustomAmount = GetSettingNumber("CHEAT","MyFavorBonus",0) local MyBonus = 0 --PATCH TODO -- prevents cutscene from freezing if (ApplicantCnt == nil) then ApplicantCnt = officesession_OfficeGetApplicants(Office,"Applicant") end local Applicant = ApplicantCnt - 1 -- PATCH TODO for i=0,Applicant do local SimExists = GetAliasByID(GetID("Applicant"..i),"ExisitingSim") if( (SimExists == true) and (GetHP("ExisitingSim") > 0) and (GetState("ExisitingSim", STATE_DEAD) == false) ) then GetAliasByID(VoterID,"VoterAlias") GetDynasty("ExisitingSim","SimDynasty") if SimGetOffice("ExisitingSim","ExistingSimOffice") then if (GetID("ExistingSimOffice") == GetID(Office)) then CurrentOfficeBonus = 10 end end local TmpFavor = GetFavorToSim("VoterAlias","ExisitingSim") local GTfavor = math.floor(math.pow(TmpFavor + 1, 0.94) / 2) --A:7 D:8 local VAtt = math.floor(GetSkillValue("ExisitingSim", RHETORIC) * 3) local MDef = math.floor(GetSkillValue("VoterAlias", EMPATHY) * 3) local ResultVs = VAtt - MDef local TitleBonus = GetNobilityTitle("ExisitingSim") * 5 if GetImpactValue("ExisitingSim","BeFromNobleBlood") > 0 then NobilityBonus = 30 end if DynastyIsPlayer("ExisitingSim") then MyBonus = 0 + CustomAmount end local Fav = GTfavor + ResultVs + GetImpactValue("ExisitingSim","CutsceneFavor") + (GetImpactValue("SimDynasty","PoliticalAttention") * 15) + CurrentOfficeBonus + TitleBonus + NobilityBonus + MyBonus LogMessage("MyBonus: "..MyBonus.." Fav: "..Fav.." LastName: "..SimGetLastname("ExisitingSim")) if Fav > MaxFavor then MaxFavor = Fav FavoriteApplicant = GetID("Applicant"..i) elseif Fav == MaxFavor then FavoriteApplicant = -1 end end end return FavoriteApplicant end
AND
function AIAbstimmung(Params) local VoterAlias = Params[1] local App local Best = -1 local MaxFav = -999 local ApplicantCnt = officesession_OfficeGetApplicants(GetData("CurrentOffice"),"Applicant") local NobilityBonus = 0 local CurrentOfficeBonus = 0 local CustomAmount = GetSettingNumber("CHEAT","MyFavorBonus",0) local MyBonus = 0 -- PATCH TODO -- prevents the cutscene from freezing if (ApplicantCnt == nil) then ApplicantCnt = officesession_OfficeGetApplicants(GetData("CurrentOffice"),"Applicant") end local Applicant = ApplicantCnt - 1 -- PATCH TODO for App=0, Applicant, 1 do local CurrentApplicant = "Applicant"..App if( (GetHP(CurrentApplicant) > 0) and (GetState(CurrentApplicant, STATE_DEAD) == false )) then local Fav = GetFavorToSim(VoterAlias, CurrentApplicant) GetDynasty(CurrentApplicant,"SimDynasty") if SimGetOffice(CurrentApplicant,"ExistingSimOffice") then if (GetID("ExistingSimOffice") == GetID(GetData("CurrentOffice"))) then CurrentOfficeBonus = 10 end end local TmpFavor = GetFavorToSim(VoterAlias,CurrentApplicant) local GTfavor = math.floor(math.pow(TmpFavor + 1, 0.94) / 2) --A:7 D:8 local VAtt = math.floor(GetSkillValue(CurrentApplicant, RHETORIC) * 3) local MDef = math.floor(GetSkillValue(VoterAlias, EMPATHY) * 3) local ResultVs = VAtt - MDef local TitleBonus = GetNobilityTitle(CurrentApplicant) * 5 if GetImpactValue(CurrentApplicant,"BeFromNobleBlood") > 0 then NobilityBonus = 30 end if DynastyIsPlayer(CurrentApplicant) then MyBonus = 0 + CustomAmount end local Fav = GTfavor + ResultVs + GetImpactValue(CurrentApplicant,"CutsceneFavor") + (GetImpactValue("SimDynasty","PoliticalAttention") * 15) + CurrentOfficeBonus + TitleBonus + NobilityBonus + MyBonus LogMessage("MyBonus: "..MyBonus.." Fav: "..Fav) if Fav > MaxFav then Best = App MaxFav = Fav elseif Fav == MaxFavor then Best = -1 end end end return Best end
Lastly in your config.ini
[CHEAT] // Office election favor bonus for me MyFavorBonus = 7500

These are entire functions so just need to copy the new over the old and it works just fine
Monete Oct 15, 2017 @ 3:23am 
Hello!

Sorry for resurrecting an old post, but I thought it might be of interest for someone else to know that I applied the modifications McCoy! offered in the post above mine and as in for now, it seems to work. My dinasty so far always wins the elections with me not doing any diplomacy, if fact, everyone pretty much hates me 'cos I don't bother at all with socialization in the game.

I will do further testing/playing and post again if I detect any issues.

Thank you McCoy!
Last edited by Monete; Oct 15, 2017 @ 7:08am
Zawarudo Oct 15, 2017 @ 9:18am 
Its so easy to win elections without cheating.
Monete Oct 15, 2017 @ 10:55am 
I don't really care about the social part of the game, just hard-core the production part. And I just bother to go into politics to get free city guards to protect my buildings from rogues. If the rogues left me alone I wouldn't even bother with politics.
=NV=Hammer Oct 16, 2017 @ 1:17pm 
Shout out!! McCoy and Fajeth are the men in this game they damn near make this game do anything!
< >
Showing 1-12 of 12 comments
Per page: 1530 50

Date Posted: Jan 14, 2017 @ 10:12am
Posts: 12