Neat, life has been busy (and still is) and im trying another crack at modding KmodContinuing the theme of "turning this thread into a code analysis thread"
If anyone who is still interested in modding this game
Here is my "failed attempt" on creating a "press button to spawn monster"
My plan is to a way to "instantiate" a monster that set to spawn in that particular room, which, if possible, may be able to expand further to spawn any monster in the game at player's locationCode:GameObject[] Spawn_Mon; int Spawn_Mon_Length int Spawner_Random Vector3 Spawn_Mon_Local //// Need to find the right location to place these //// Spawn_Mon = GameObject.FindGameObjectsWithTag("Mon"); Spawn_Mon_Length = Spawn_Mon.Length; /////// //// I put these in the GameManager //// if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) //Change to any key you want { Spawn_Mon_Local = new Vector3(GameObject.Find("Player").transform.position.x + 5f, GameObject.Find("Player").transform.position.y, 0f); // Change to any value you want Spawn_Mon_Random = UnityEngine.Random.Range(0, this.Spawn_Mon_Length); GameObject gameObject = UnityEngine.Object.Instantiate(Spawn_Mon[Spawn_Mon_Random], Spawn_Mon_Local, base.transform.rotation) as GameObject; gameObject.transform.parent = base.transform.parent; }
So far, I only managed to spawn
1. Hatched egg
2. Tentacle that do nothing to player
and
I hope that someone with too many free time stumble on this and continue further and make this become realityCode:NullReferenceException at (wrapper managed-to-native) UnityEngine.Object:INTERNAL_CALL_Internal_InstantiateSingle (UnityEngine.Object,UnityEngine.Vector3&,UnityEngine.Quaternion&) at UnityEngine.Object.Internal_InstantiateSingle (UnityEngine.Object data, Vector3 pos, Quaternion rot) [0x00000] in <filename unknown>:0 at UnityEngine.Object.Instantiate (UnityEngine.Object original, Vector3 position, Quaternion rotation) [0x00000] in <filename unknown>:0 at GameManager.Spawner () [0x00000] in <filename unknown>:0 at GameManager.Update () [0x00000] in <filename unknown>:0 (Filename: Line: -1)
I think (but want to experiment more) or a better way of de-compiling, modifying and recompiling the code.
Using Visual Studio 2022 and ILSpy i was able to get the whole solution decompiled at once, but im having trouble getting changes in (text changes work no problem) i am concerned about this new method having assembly issues.
Btw does hitting the "pause" key in KMOD not toggle debug mode?