IEMod / IEMod.pw

A mod for Pillars of Eternity
31 stars 19 forks source link

Can we increase the Bestiary's limit, thus we can get EXP after every kill? #95

Open jasonlejardo opened 8 years ago

jasonlejardo commented 8 years ago

File: BestiaryManager.cs

I want to get EXP after every monster's been killed. But by default, after killing certain amount of monsters, it's Bestiary got 100% and got no EXP further. I used ILSPY and found BestiaryManager.cs might be involved of this. I don't know how to change the script and recompile to dll. Can anybody solve this?

jasonlejardo commented 8 years ago

File: BestiaryReference.cs [Tooltip("The number of kills before all information is revealed.")] public int KillsToMaster = 10;

There is a public int here, i've change this "10" to "100" and start a new game. After killing a young wolf in the camp, still got 33% progress and a 24/72 bestiary exp, party got 28 exp. Seems changing "KillsToMaster = 10" here is useless?

Alakabon commented 8 years ago

Did you recompile it or just change the value?

I'm going to work on some mod functions tomorrow, I can look into it a bit more then.

jasonlejardo commented 8 years ago

I just change the value, and after two day's test, i think i've already success. Here's the steps:

  1. Using ILDASM.exe dump the file "Assembly-CSharp.dll.pw.modified" to 1.il
  2. Using EMEDITOR or ULTRAEDIT open 1.il
  3. Search "IL_0053: ldfld int32[] BestiaryManager::m_KillCounts" IL_0053: ldfld int32[] BestiaryManager::m_KillCounts IL_0058: ldloc.1 IL_0059: ldelema [mscorlib]System.Int32 IL_005e: dup IL_005f: ldind.i4 IL_0060: ldc.i4.1 IL_0061: add
  4. Change "IL_0060: ldc.i4.1" to "IL_0060: ldc.i4.0" and save 1.il
  5. Using ILASM.exe to compile the 1.il and 1.res to 1.dll
  6. Rename 1.dll to "Assembly-CSharp.dll.pw.modified" and overwrite.
  7. Open PatchworkLauncher and hit " Launch with MOD"

This method has a few limit. When killing an enemy, the killcount of this enemy DOESN'T increase. Thus when play a new game, every enemy you kill always get the 1st kill EXP as before. But the Bestiary will always be empty.

jasonlejardo commented 8 years ago

And if IEMOD can set area enemy respawn after 2 day's game time .... :dancer:

jasonlejardo commented 8 years ago

The code part:

public void RecordKill(BestiaryReference form) { this.m_TotalKills++; if (!form) { return; } float killProportion = this.GetKillProportion(form); int num = this.IndexOf(form); if (num >= 0) { this.m_KillCounts[num] ++; }

The IL code I changed is just make "this.m_KillCounts[num] ++;" to "this.m_KillCounts[num] += 0;"

@Alakabon Can you spare some time into these code, improve and merge this function to IEMOD?