private static void CreateSkillFamilies() { skillLocator.SetFieldValue <GenericSkill[]>("allSkills", new GenericSkill[0]); { skillLocator.primary = megaMushrum.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); skillLocator.primary.SetFieldValue("_skillFamily", newFamily); } { skillLocator.secondary = megaMushrum.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); skillLocator.secondary.SetFieldValue("_skillFamily", newFamily); } { skillLocator.utility = megaMushrum.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); skillLocator.utility.SetFieldValue("_skillFamily", newFamily); } { skillLocator.special = megaMushrum.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); skillLocator.special.SetFieldValue("_skillFamily", newFamily); } }
/// <summary> /// Creates an EmptySkillFamily. Be sure to call DestroyGenericSkillComponents before doing this. /// </summary> /// <param name="survivor"></param> public static void CreateEmptySkillFamily(GameObject survivor) { SkillLocator skillLocator = survivor.GetComponent <SkillLocator>(); skillLocator.SetFieldValue <GenericSkill[]>("allSkills", new GenericSkill[0]); { skillLocator.primary = survivor.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; EnigmaticThunder.Modules.Loadouts.RegisterSkillFamily(newFamily); skillLocator.primary.SetFieldValue("_skillFamily", newFamily); } { skillLocator.secondary = survivor.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; EnigmaticThunder.Modules.Loadouts.RegisterSkillFamily(newFamily); skillLocator.secondary.SetFieldValue("_skillFamily", newFamily); } { skillLocator.utility = survivor.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; EnigmaticThunder.Modules.Loadouts.RegisterSkillFamily(newFamily); skillLocator.utility.SetFieldValue("_skillFamily", newFamily); } { skillLocator.special = survivor.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; EnigmaticThunder.Modules.Loadouts.RegisterSkillFamily(newFamily); skillLocator.special.SetFieldValue("_skillFamily", newFamily); } }
public void Awake() { myCharacter = Resources.Load <GameObject>("Prefabs/CharacterBodies/megadronebody").InstantiateClone("Prefabs/CharacterBodies/megadroneplayerbody"); //Note; if your character cannot interact with things, play around with the following value after uncommenting them GameObject gameObject = myCharacter.GetComponent <ModelLocator>().modelBaseTransform.gameObject; myCharacter.transform.localScale *= 0.5f; myCharacter.GetComponent <CharacterBody>().aimOriginTransform.Translate(new Vector3(0, 0, 0)); SkillLocator skillLocator = myCharacter.GetComponent <SkillLocator>(); foreach (GenericSkill skill in myCharacter.GetComponentsInChildren <GenericSkill>()) { DestroyImmediate(skill); } foreach (MonoBehaviour skill in myCharacter.GetComponentsInChildren <MonoBehaviour>()) { Debug.Log(skill); if (skill as RoR2.RigidbodyStickOnImpact) { DestroyImmediate(skill); } if (skill as CameraRigController) { CameraRigController cameraRigController = skill as CameraRigController; cameraRigController.cameraMode = CameraRigController.CameraMode.Fly; } } myCharacter.AddComponent <EquipmentSlot>(); skillLocator.SetFieldValue <GenericSkill[]>("allSkills", new GenericSkill[0]); skillSetup(); BodyCatalog.getAdditionalEntries += delegate(List <GameObject> list) { list.Add(myCharacter); }; CharacterBody component = myCharacter.GetComponent <CharacterBody>(); component.GetComponent <ModelLocator>().modelBaseTransform.GetComponentInChildren <SkinnedMeshRenderer>().material.DisableKeyword("EMISSION"); component.baseDamage = 6f; component.levelDamage = 1.25f; component.baseCrit = 1f; component.levelCrit = 0; component.baseMaxHealth = 90; component.levelMaxHealth = 20f; component.baseArmor = 5f; component.baseRegen = 2f; component.levelRegen = 0.1f; component.baseMoveSpeed = 16f; component.baseAttackSpeed = 2f; component.baseNameToken = "MyCharacterName"; myCharacter.GetComponent <CharacterBody>().preferredPodPrefab = Resources.Load <GameObject>("Prefabs/CharacterBodies/toolbotbody").GetComponent <CharacterBody>().preferredPodPrefab; SurvivorDef survivorDef = new SurvivorDef { bodyPrefab = myCharacter, descriptionToken = "MyDescription \r\n", displayPrefab = myCharacter, primaryColor = new Color(0.8039216f, 0.482352942f, 0.843137264f), name = "MyCharacterName", unlockableName = "" }; SurvivorAPI.AddSurvivor(survivorDef); On.RoR2.EquipmentSlot.PerformEquipmentAction += (orig, self, equip) => { Debug.Log(equip.ToString()); return(orig(self, equip)); }; }