private void AssignSecondary(SkillLocator sk) { SkillFamily secondarySkillFamily = ScriptableObject.CreateInstance <SkillFamily>(); secondarySkillFamily.defaultVariantIndex = 0u; secondarySkillFamily.variants = new SkillFamily.Variant[1]; Reflection.SetFieldValue <SkillFamily>(sk.secondary, "_skillFamily", secondarySkillFamily); SkillDef secondaryHeatWaveDef = SkillDef.CreateInstance <SkillDef>(); secondaryHeatWaveDef.activationState = new SerializableEntityStateType(typeof(HeatWave)); secondaryHeatWaveDef.activationStateMachineName = "Weapon"; secondaryHeatWaveDef.baseMaxStock = 1; secondaryHeatWaveDef.baseRechargeInterval = 0f; secondaryHeatWaveDef.beginSkillCooldownOnSkillEnd = true; secondaryHeatWaveDef.canceledFromSprinting = false; secondaryHeatWaveDef.dontAllowPastMaxStocks = true; secondaryHeatWaveDef.forceSprintDuringState = false; secondaryHeatWaveDef.fullRestockOnAssign = true; secondaryHeatWaveDef.icon = Resources.Load <Sprite>(assetPrefix + ":skill2.png"); secondaryHeatWaveDef.interruptPriority = InterruptPriority.Skill; secondaryHeatWaveDef.isBullets = true; secondaryHeatWaveDef.isCombatSkill = true; secondaryHeatWaveDef.keywordTokens = new string[] { "KEYWORD_PYRO_HEAT" }; secondaryHeatWaveDef.mustKeyPress = false; secondaryHeatWaveDef.noSprint = false; secondaryHeatWaveDef.rechargeStock = 1; secondaryHeatWaveDef.requiredStock = 1; secondaryHeatWaveDef.shootDelay = 0f; secondaryHeatWaveDef.skillName = "FireBlast"; secondaryHeatWaveDef.skillNameToken = "PYRO_SECONDARY_NAME"; secondaryHeatWaveDef.skillDescriptionToken = "PYRO_SECONDARY_DESC"; secondaryHeatWaveDef.stockToConsume = 0; LoadoutAPI.AddSkill(typeof(HeatWave)); LoadoutAPI.AddSkillDef(secondaryHeatWaveDef); secondarySkillFamily.variants[0] = new SkillFamily.Variant { skillDef = secondaryHeatWaveDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(secondaryHeatWaveDef.skillNameToken, false) }; SkillDef secondaryBurnDef = SkillDef.CreateInstance <SkillDef>(); secondaryBurnDef.activationState = new SerializableEntityStateType(typeof(SuppressiveFire)); secondaryBurnDef.activationStateMachineName = "Weapon"; secondaryBurnDef.baseMaxStock = 1; secondaryBurnDef.baseRechargeInterval = 0f; secondaryBurnDef.beginSkillCooldownOnSkillEnd = true; secondaryBurnDef.canceledFromSprinting = false; secondaryBurnDef.dontAllowPastMaxStocks = true; secondaryBurnDef.forceSprintDuringState = false; secondaryBurnDef.fullRestockOnAssign = true; secondaryBurnDef.icon = Resources.Load <Sprite>(assetPrefix + ":skill2.png"); secondaryBurnDef.interruptPriority = InterruptPriority.Skill; secondaryBurnDef.isBullets = true; secondaryBurnDef.isCombatSkill = true; secondaryBurnDef.keywordTokens = new string[] { "KEYWORD_PYRO_HEAT" }; secondaryBurnDef.mustKeyPress = false; secondaryBurnDef.noSprint = true; secondaryBurnDef.rechargeStock = 1; secondaryBurnDef.requiredStock = 1; secondaryBurnDef.shootDelay = 0f; secondaryBurnDef.skillName = "SuppressiveFire"; secondaryBurnDef.skillNameToken = "PYRO_SECONDARY_ALT_NAME"; secondaryBurnDef.skillDescriptionToken = "PYRO_SECONDARY_ALT_DESC"; secondaryBurnDef.stockToConsume = 0; LoadoutAPI.AddSkillDef(secondaryBurnDef); Array.Resize(ref secondarySkillFamily.variants, secondarySkillFamily.variants.Length + 1); secondarySkillFamily.variants[secondarySkillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = secondaryBurnDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(secondaryBurnDef.skillNameToken, false) }; LoadoutAPI.AddSkill(typeof(SuppressiveFire)); }
internal static void UtilitySetup() { UtilityStateMachineSetup(); SkillLocator component = characterPrefab.GetComponent <SkillLocator>(); LanguageAPI.Add("ROCKETEER_UTILITY_JET_NAME", "Jet"); LanguageAPI.Add("ROCKETEER_UTILITY_JET_DESCRIPTION", "They fly now. Activate again for a small secondary burst."); // set up your primary skill def here! SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(RocketeerJet)); mySkillDef.activationStateMachineName = "ROCKETEER_Utility"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 6.0f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.PrioritySkill; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.stockToConsume = 1; mySkillDef.icon = Resources.Load <Sprite>("Textures/MiscIcons/texMysteryIcon"); mySkillDef.skillDescriptionToken = "ROCKETEER_UTILITY_JET_DESCRIPTION"; mySkillDef.skillName = "ROCKETEER_UTILITY_JET_NAME"; mySkillDef.skillNameToken = "ROCKETEER_UTILITY_JET_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); component.utility = characterPrefab.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); component.utility.SetFieldValue("_skillFamily", newFamily); SkillFamily skillFamily = component.utility.skillFamily; skillFamily.variants[0] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; // add this code after defining a new skilldef if you're adding an alternate skill /*Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); * skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant * { * skillDef = newSkillDef, * unlockableName = "", * viewableNode = new ViewablesCatalog.Node(newSkillDef.skillNameToken, false, null) * };*/ ContentPacks.skillDefs.Add(mySkillDef); ContentPacks.skillFamilies.Add(newFamily); LoadoutAPI.AddSkill(typeof(RocketeerJet)); }
private static void BuffsSetup() { SkillLocator component = WispSurvivor.characterPrefab.GetComponent <SkillLocator>(); #region hasteslow LanguageAPI.Add("WISP_HASTE_NAME", "Haste"); LanguageAPI.Add("WISP_HASTE_DESCRIPTION", "Increase attack and movespeed by <style=cIsUtility>150%</style>. Duplicate effect on <style=cIsHealing>partner</style>. Reduce " + "attack and movespeed of <style=cIsHealing>tethered</style> enemies."); // set up your primary skill def here! SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(EntityStates.WispSurvivorStates.WispHasteSkillState)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 9f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Skill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon2; mySkillDef.skillDescriptionToken = "WISP_HASTE_DESCRIPTION"; mySkillDef.skillName = "WISP_HASTE_NAME"; mySkillDef.skillNameToken = "WISP_HASTE_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); hasteSkillDef = mySkillDef; component.secondary = WispSurvivor.characterPrefab.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); component.secondary.SetFieldValue("_skillFamily", newFamily); SkillFamily skillFamily = component.secondary.skillFamily; skillFamily.variants[0] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; #endregion /* * // add this code after defining a new skilldef if you're adding an alternate skill * Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); * skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant * { * skillDef = mySkillDef, * unlockableName = "", * viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) * }; */ #region invigorate LanguageAPI.Add("WISP_REGEN_NAME", "Invigorate"); LanguageAPI.Add("WISP_REGEN_DESCRIPTION", "Increase healing rate and base damage. Duplicate effect on <style=cIsHealing>partner</style>. " + "Deal <style=cIsDamage>100%</style> damage per second to <style=cIsHealing>tethered</style> enemies."); // set up your primary skill def here! SkillDef secondarySkillDef = ScriptableObject.CreateInstance <SkillDef>(); secondarySkillDef.activationState = new SerializableEntityStateType(typeof(EntityStates.WispSurvivorStates.WispInvigorateSkillState)); secondarySkillDef.activationStateMachineName = "Weapon"; secondarySkillDef.baseMaxStock = 1; secondarySkillDef.baseRechargeInterval = 9f; secondarySkillDef.beginSkillCooldownOnSkillEnd = true; secondarySkillDef.canceledFromSprinting = false; secondarySkillDef.fullRestockOnAssign = true; secondarySkillDef.interruptPriority = InterruptPriority.Skill; secondarySkillDef.isBullets = false; secondarySkillDef.isCombatSkill = false; secondarySkillDef.mustKeyPress = false; secondarySkillDef.noSprint = false; secondarySkillDef.rechargeStock = 1; secondarySkillDef.requiredStock = 1; secondarySkillDef.shootDelay = 0f; secondarySkillDef.stockToConsume = 1; secondarySkillDef.icon = Assets.icon2_invigorate; secondarySkillDef.skillDescriptionToken = "WISP_REGEN_DESCRIPTION"; secondarySkillDef.skillName = "WISP_REGEN_NAME"; secondarySkillDef.skillNameToken = "WISP_REGEN_NAME"; invigorateSkillDef = secondarySkillDef; LoadoutAPI.AddSkillDef(secondarySkillDef); Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = secondarySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(secondarySkillDef.skillNameToken, false, null) }; #endregion }
public void Awake() { // myCharacter should either be // Resources.Load<GameObject>("prefabs/characterbodies/BanditBody"); // or BodyCatalog.FindBodyIndex("BanditBody"); var myCharacter = Resources.Load <GameObject>("prefabs/characterbodies/CommandoBody"); // If you're confused about the language tokens, they're the proper way to add any strings used by the game. // We use AssetPlus API for that LanguageAPI.Add("MYBANDIT_DESCRIPTION", "cum! cum! f**k!" + Environment.NewLine); var mySurvivorDef = new SurvivorDef { //We're finding the body prefab here, bodyPrefab = myCharacter, //Description descriptionToken = "MYBANDIT_DESCRIPTION", //Display displayPrefab = Resources.Load <GameObject>("Prefabs/Characters/BanditDisplay"), //Color on select screen primaryColor = new Color(0.8039216f, 0.482352942f, 0.843137264f), //Unlockable name unlockableName = "", }; SurvivorAPI.AddSurvivor(mySurvivorDef); // If you're confused about the language tokens, they're the proper way to add any strings used by the game. // We use AssetPlus API for that LanguageAPI.Add("COMMANDO_PRIMARY_BURSTFIRE_NAME", "Burst Fire"); LanguageAPI.Add("COMMANDO_PRIMARY_BURSTFIRE_DESCRIPTION", "Unload a burst of 3 bullets for 3x100% damage"); var mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(MyNameSpace.MyEntityStates.Commando_Primary)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 0f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = true; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = true; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0.5f; mySkillDef.stockToConsume = 1; //mySkillDef.icon = Resources.Load<Sprite>("NotAnActualPath"); mySkillDef.skillDescriptionToken = "COMMANDO_PRIMARY_BURSTFIRE_DESCRIPTION"; mySkillDef.skillName = "COMMANDO_PRIMARY_BURSTFIRE_NAME"; mySkillDef.skillNameToken = "COMMANDO_PRIMARY_BURSTFIRE_NAME"; LanguageAPI.Add("COMMANDO_SECONDARY_BACKUPSHIV_NAME", "Backup Shiv"); LanguageAPI.Add("COMMANDO_SECONDARY_BACKUPSHIV_DESCRIPTION", "Slice for 220% damage. Recover 7% health on kill."); var commandoSecondarySkillDef = ScriptableObject.CreateInstance <SkillDef>(); commandoSecondarySkillDef.activationState = new SerializableEntityStateType(typeof(MyNameSpace.MyEntityStates.Commando_Secondary)); commandoSecondarySkillDef.activationStateMachineName = "Weapon"; commandoSecondarySkillDef.baseMaxStock = 1; commandoSecondarySkillDef.baseRechargeInterval = 2f; commandoSecondarySkillDef.beginSkillCooldownOnSkillEnd = true; commandoSecondarySkillDef.canceledFromSprinting = false; commandoSecondarySkillDef.fullRestockOnAssign = false; commandoSecondarySkillDef.interruptPriority = InterruptPriority.Any; commandoSecondarySkillDef.isBullets = false; commandoSecondarySkillDef.isCombatSkill = true; commandoSecondarySkillDef.mustKeyPress = false; commandoSecondarySkillDef.noSprint = false; commandoSecondarySkillDef.rechargeStock = 1; commandoSecondarySkillDef.requiredStock = 1; //commandoSecondarySkillDef.shootDelay = 0.5f; commandoSecondarySkillDef.stockToConsume = 1; commandoSecondarySkillDef.skillDescriptionToken = "COMMANDO_SECONDARY_BACKUPSHIV_DESCRIPTION"; commandoSecondarySkillDef.skillName = "COMMANDO_SECONDARY_BACKUPSHIV_NAME"; commandoSecondarySkillDef.skillNameToken = "COMMANDO_SECONDARY_BACKUPSHIV_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); LoadoutAPI.AddSkillDef(commandoSecondarySkillDef); //This adds our skilldef. If you don't do this, the skill will not work. var skillLocator = myCharacter.GetComponent <SkillLocator>(); //Note; you can change component.primary to component.secondary , component.utility and component.special var skillFamily = skillLocator.primary.skillFamily; var skillFamily2 = skillLocator.secondary.skillFamily; //var skillFamily3 = skillLocator.utility.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; Array.Resize(ref skillFamily2.variants, skillFamily2.variants.Length + 1); skillFamily2.variants[skillFamily2.variants.Length - 1] = new SkillFamily.Variant { skillDef = commandoSecondarySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(commandoSecondarySkillDef.skillNameToken, false, null) };/* * Array.Resize(ref skillFamily3.variants, skillFamily3.variants.Length + 1); * skillFamily.variants[skillFamily3.variants.Length - 1] = new SkillFamily.Variant * { * skillDef = commandoSecondarySkillDef, * unlockableName = "", * viewableNode = new ViewablesCatalog.Node(commandoSecondarySkillDef.skillNameToken, false, null) * };*/ }
internal static void CreatePrefab() { // first clone the commando prefab so we can turn that into our own survivor characterPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterBodies/CommandoBody"), "WispPreview", true, "C:\\Users\\test\\Documents\\ror2mods\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor.cs", "CreatePrefab", 151); //Debug.Log("Loaded prefab"); characterPrefab.GetComponent <NetworkIdentity>().localPlayerAuthority = true; //Debug.Log("Set local player authority"); #region charactermodel // create the model here, we're gonna replace commando's model with our own GameObject model = CreateModel(characterPrefab); GameObject gameObject = new GameObject("ModelBase"); gameObject.transform.parent = characterPrefab.transform; gameObject.transform.localPosition = new Vector3(0f, -0.81f, 0f); gameObject.transform.localRotation = Quaternion.identity; gameObject.transform.localScale = new Vector3(1f, 1f, 1f); //Debug.Log("Created model base"); GameObject gameObject2 = new GameObject("CameraPivot"); gameObject2.transform.parent = gameObject.transform; gameObject2.transform.localPosition = new Vector3(0f, 1.6f, 0f); gameObject2.transform.localRotation = Quaternion.identity; gameObject2.transform.localScale = Vector3.one; //Debug.Log("Created camera pivot"); GameObject gameObject3 = new GameObject("AimOrigin"); gameObject3.transform.parent = gameObject.transform; gameObject3.transform.localPosition = new Vector3(0f, 1.4f, 0f); gameObject3.transform.localRotation = Quaternion.identity; gameObject3.transform.localScale = Vector3.one; //Debug.Log("Created aim origin"); Transform transform = model.transform; transform.parent = gameObject.transform; transform.localPosition = Vector3.zero; transform.localScale = new Vector3(1f, 1f, 1f); transform.localRotation = Quaternion.identity; //Debug.Log("Created character transform"); CharacterDirection characterDirection = characterPrefab.GetComponent <CharacterDirection>(); characterDirection.moveVector = Vector3.zero; characterDirection.targetTransform = gameObject.transform; characterDirection.overrideAnimatorForwardTransform = null; characterDirection.rootMotionAccumulator = null; characterDirection.modelAnimator = model.GetComponentInChildren <Animator>(); characterDirection.driveFromRootRotation = false; characterDirection.turnSpeed = 720f; //Debug.Log("Set character direction"); #endregion #region basestats // set up the character body here CharacterBody bodyComponent = characterPrefab.GetComponent <CharacterBody>(); bodyComponent.bodyIndex = -1; bodyComponent.baseNameToken = "WISP_NAME"; // name token bodyComponent.subtitleNameToken = "WISP_SUBTITLE"; // subtitle token- used for umbras bodyComponent.bodyFlags = CharacterBody.BodyFlags.ImmuneToExecutes; bodyComponent.rootMotionInMainState = false; bodyComponent.mainRootSpeed = 0; bodyComponent.baseMaxHealth = 82.5f; bodyComponent.levelMaxHealth = 24.75f; bodyComponent.baseRegen = 1f; bodyComponent.levelRegen = 0.25f; bodyComponent.baseMaxShield = 0; bodyComponent.levelMaxShield = 0f; bodyComponent.baseMoveSpeed = 7; bodyComponent.levelMoveSpeed = 0; bodyComponent.baseAcceleration = 80; bodyComponent.baseJumpPower = 15; bodyComponent.levelJumpPower = 0; bodyComponent.baseDamage = 6; bodyComponent.levelDamage = 1.2f; bodyComponent.baseAttackSpeed = 1; bodyComponent.levelAttackSpeed = 0; bodyComponent.baseCrit = 1; bodyComponent.levelCrit = 0; bodyComponent.baseArmor = 0; bodyComponent.levelArmor = 0; bodyComponent.baseJumpCount = 1; bodyComponent.sprintingSpeedMultiplier = 1.45f; bodyComponent.wasLucky = false; bodyComponent.hideCrosshair = false; bodyComponent.aimOriginTransform = gameObject3.transform; bodyComponent.hullClassification = HullClassification.Human; bodyComponent.portraitIcon = Assets.charPortrait; bodyComponent.isChampion = false; bodyComponent.currentVehicle = null; bodyComponent.skinIndex = 0U; //Debug.Log("Created character body"); #endregion #region spawning-and-states //Replace the existing spawn animation EntityStateMachine entityStateMachine = characterPrefab.GetComponent <EntityStateMachine>(); entityStateMachine.initialStateType = new SerializableEntityStateType(typeof(EntityStates.WispSurvivorStates.Spawn)); bodyComponent.currentVehicle = null; bodyComponent.preferredPodPrefab = null; bodyComponent.preferredInitialStateType = entityStateMachine.initialStateType; //Change our main state to account for the float functionality entityStateMachine.mainStateType = new SerializableEntityStateType(typeof(EntityStates.WispSurvivorStates.WispCharacterMain)); characterPrefab.AddComponent <TetherHandler>(); #endregion #region movement-camera // the charactermotor controls the survivor's movement and stuff CharacterMotor characterMotor = characterPrefab.GetComponent <CharacterMotor>(); characterMotor.walkSpeedPenaltyCoefficient = 1f; characterMotor.characterDirection = characterDirection; characterMotor.muteWalkMotion = false; characterMotor.mass = 100f; //characterMotor.airControl = 0.75f; characterMotor.airControl = 5f; characterMotor.disableAirControlUntilCollision = false; characterMotor.generateParametersOnAwake = true; //characterMotor.useGravity = true; //characterMotor.isFlying = false; //Debug.Log("Created character motor"); InputBankTest inputBankTest = characterPrefab.GetComponent <InputBankTest>(); inputBankTest.moveVector = Vector3.zero; CameraTargetParams cameraTargetParams = characterPrefab.GetComponent <CameraTargetParams>(); cameraTargetParams.cameraParams = Resources.Load <GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponent <CameraTargetParams>().cameraParams; cameraTargetParams.cameraPivotTransform = null; cameraTargetParams.aimMode = CameraTargetParams.AimType.Standard; cameraTargetParams.recoil = Vector2.zero; cameraTargetParams.idealLocalCameraPos = Vector3.zero; cameraTargetParams.dontRaycastToPivot = false; //Debug.Log("Created camera target parameters"); // this component is used to locate the character model(duh), important to set this up here ModelLocator modelLocator = characterPrefab.GetComponent <ModelLocator>(); modelLocator.modelTransform = transform; modelLocator.modelBaseTransform = gameObject.transform; modelLocator.dontReleaseModelOnDeath = false; modelLocator.autoUpdateModelTransform = true; modelLocator.dontDetatchFromParent = false; modelLocator.noCorpse = false; modelLocator.normalizeToFloor = false; // set true if you want your character to rotate on terrain like acrid does modelLocator.preserveModel = false; //Debug.Log("Created model locator"); #endregion // childlocator is something that must be set up in the unity project, it's used to find any child objects for things like footsteps or muzzle flashes // also important to set up if you want quality ChildLocator childLocator = model.GetComponent <ChildLocator>(); //Debug.Log("Established child locator reference"); // this component is used to handle all overlays and whatever on your character, without setting this up you won't get any cool effects like burning or freeze on the character // it goes on the model object of course CharacterModel characterModel = model.AddComponent <CharacterModel>(); characterModel.body = bodyComponent; characterModel.baseRendererInfos = new CharacterModel.RendererInfo[] { // set up multiple rendererinfos if needed, but for this example there's only the one new CharacterModel.RendererInfo { defaultMaterial = model.GetComponentInChildren <SkinnedMeshRenderer>().material, renderer = model.GetComponentInChildren <SkinnedMeshRenderer>(), defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = true //Disable overlays for incorrectly formatted character } }; characterModel.autoPopulateLightInfos = true; characterModel.invisibilityCount = 0; characterModel.temporaryOverlays = new List <TemporaryOverlay>(); //Debug.Log("Created character model"); #region skin SkinnedMeshRenderer mainRenderer = (characterModel.baseRendererInfos[0].renderer as SkinnedMeshRenderer); if (!mainRenderer) { Debug.LogError("No main renderer found!"); } if (!mainRenderer.sharedMesh) { Debug.LogError("No shared mesh found for main renderer!"); } ModelSkinController modelSkinController = model.AddComponent <ModelSkinController>(); LanguageAPI.Add("WISP_DEFAULT_SKIN", "Default"); LoadoutAPI.SkinDefInfo skinDefInfo = default(LoadoutAPI.SkinDefInfo); skinDefInfo.BaseSkins = Array.Empty <SkinDef>(); skinDefInfo.MinionSkinReplacements = new SkinDef.MinionSkinReplacement[0]; skinDefInfo.ProjectileGhostReplacements = new SkinDef.ProjectileGhostReplacement[0]; GameObject[] allObjects = new GameObject[0]; skinDefInfo.GameObjectActivations = getActivations(allObjects); skinDefInfo.Icon = Assets.skin; skinDefInfo.MeshReplacements = new SkinDef.MeshReplacement[] { new SkinDef.MeshReplacement { renderer = mainRenderer, mesh = mainRenderer.sharedMesh } }; skinDefInfo.Name = "WISP_DEFAULT_SKIN"; skinDefInfo.NameToken = "WISP_DEFAULT_SKIN"; skinDefInfo.RendererInfos = characterModel.baseRendererInfos; skinDefInfo.RootObject = model; skinDefInfo.UnlockableName = ""; SkinDef defaultSkin = LoadoutAPI.CreateNewSkinDef(skinDefInfo); var skinDefs = new List <SkinDef>() { defaultSkin }; modelSkinController.skins = skinDefs.ToArray(); //Debug.Log("Created skin"); #endregion #region team-health TeamComponent teamComponent = null; if (characterPrefab.GetComponent <TeamComponent>() != null) { teamComponent = characterPrefab.GetComponent <TeamComponent>(); } else { teamComponent = characterPrefab.GetComponent <TeamComponent>(); } teamComponent.hideAllyCardDisplay = false; teamComponent.teamIndex = TeamIndex.None; HealthComponent healthComponent = characterPrefab.GetComponent <HealthComponent>(); healthComponent.health = 82.5f; healthComponent.shield = 0f; healthComponent.barrier = 0f; healthComponent.magnetiCharge = 0f; healthComponent.body = null; healthComponent.dontShowHealthbar = false; healthComponent.globalDeathEventChanceCoefficient = 1f; //Debug.Log("Created components"); #endregion characterPrefab.GetComponent <Interactor>().maxInteractionDistance = 3f; characterPrefab.GetComponent <InteractionDriver>().highlightInteractor = true; // this disables ragdoll since the character's not set up for it, and instead plays a death animation CharacterDeathBehavior characterDeathBehavior = characterPrefab.GetComponent <CharacterDeathBehavior>(); characterDeathBehavior.deathStateMachine = characterPrefab.GetComponent <EntityStateMachine>(); characterDeathBehavior.deathState = new SerializableEntityStateType(typeof(GenericCharacterDeath)); // edit the sfxlocator if you want different sounds SfxLocator sfxLocator = characterPrefab.GetComponent <SfxLocator>(); sfxLocator.deathSound = "Play_ui_player_death"; sfxLocator.barkSound = ""; sfxLocator.openSound = ""; sfxLocator.landingSound = "Play_char_land"; sfxLocator.fallDamageSound = "Play_char_land_fall_damage"; sfxLocator.aliveLoopStart = ""; sfxLocator.aliveLoopStop = ""; //Debug.Log("Created sfx"); Rigidbody rigidbody = characterPrefab.GetComponent <Rigidbody>(); rigidbody.mass = 50f; rigidbody.drag = 0f; rigidbody.angularDrag = 0f; rigidbody.useGravity = false; rigidbody.isKinematic = true; rigidbody.interpolation = RigidbodyInterpolation.None; rigidbody.collisionDetectionMode = CollisionDetectionMode.Discrete; rigidbody.constraints = RigidbodyConstraints.None; //Debug.Log("Created rigidbody"); CapsuleCollider capsuleCollider = characterPrefab.GetComponent <CapsuleCollider>(); capsuleCollider.isTrigger = false; capsuleCollider.material = null; capsuleCollider.center = new Vector3(0f, 0f, 0f); capsuleCollider.radius = 0.5f; capsuleCollider.height = 1.82f; capsuleCollider.direction = 1; //Debug.Log("Created capsule collider"); KinematicCharacterMotor kinematicCharacterMotor = characterPrefab.GetComponent <KinematicCharacterMotor>(); kinematicCharacterMotor.CharacterController = characterMotor; kinematicCharacterMotor.Capsule = capsuleCollider; kinematicCharacterMotor.Rigidbody = rigidbody; capsuleCollider.radius = 0.5f; capsuleCollider.height = 1.82f; capsuleCollider.center = new Vector3(0, 0, 0); capsuleCollider.material = null; kinematicCharacterMotor.DetectDiscreteCollisions = false; kinematicCharacterMotor.GroundDetectionExtraDistance = 0f; kinematicCharacterMotor.MaxStepHeight = 0.2f; kinematicCharacterMotor.MinRequiredStepDepth = 0.1f; kinematicCharacterMotor.MaxStableSlopeAngle = 55f; kinematicCharacterMotor.MaxStableDistanceFromLedge = 0.5f; kinematicCharacterMotor.PreventSnappingOnLedges = false; kinematicCharacterMotor.MaxStableDenivelationAngle = 55f; kinematicCharacterMotor.RigidbodyInteractionType = RigidbodyInteractionType.None; kinematicCharacterMotor.PreserveAttachedRigidbodyMomentum = true; kinematicCharacterMotor.HasPlanarConstraint = false; kinematicCharacterMotor.PlanarConstraintAxis = Vector3.up; kinematicCharacterMotor.StepHandling = StepHandlingMethod.None; kinematicCharacterMotor.LedgeHandling = true; kinematicCharacterMotor.InteractiveRigidbodyHandling = true; kinematicCharacterMotor.SafeMovement = false; //Debug.Log("Set physics"); // this sets up the character's hurtbox, kinda confusing, but should be fine as long as it's set up in unity right HurtBoxGroup hurtBoxGroup = model.AddComponent <HurtBoxGroup>(); //Debug.Log("Set reference to hurtBoxGroup"); if (model.GetComponentInChildren <CapsuleCollider>() == null) { Debug.LogError("Could not find capsule collider!"); } HurtBox componentInChildren = model.GetComponentInChildren <CapsuleCollider>().gameObject.AddComponent <HurtBox>(); //Debug.Log("Added hurtbox component to capsule collider"); componentInChildren.gameObject.layer = LayerIndex.entityPrecise.intVal; componentInChildren.healthComponent = healthComponent; componentInChildren.isBullseye = true; componentInChildren.damageModifier = HurtBox.DamageModifier.Normal; componentInChildren.hurtBoxGroup = hurtBoxGroup; componentInChildren.indexInGroup = 0; hurtBoxGroup.hurtBoxes = new HurtBox[] { componentInChildren }; hurtBoxGroup.mainHurtBox = componentInChildren; hurtBoxGroup.bullseyeCount = 1; //Debug.Log("Set components"); // this is for handling footsteps, not needed but polish is always good FootstepHandler footstepHandler = model.AddComponent <FootstepHandler>(); footstepHandler.baseFootstepString = "Play_player_footstep"; footstepHandler.sprintFootstepOverrideString = ""; footstepHandler.enableFootstepDust = true; footstepHandler.footstepDustPrefab = Assets.footstepPrefab; // ragdoll controller is a pain to set up so we won't be doing that here.. RagdollController ragdollController = model.AddComponent <RagdollController>(); ragdollController.bones = null; ragdollController.componentsToDisableOnRagdoll = null; // this handles the pitch and yaw animations, but honestly they are nasty and a huge pain to set up so i didn't bother AimAnimator aimAnimator = model.AddComponent <AimAnimator>(); aimAnimator.inputBank = inputBankTest; aimAnimator.directionComponent = characterDirection; aimAnimator.pitchRangeMax = 55f; aimAnimator.pitchRangeMin = -50f; aimAnimator.yawRangeMin = -44f; aimAnimator.yawRangeMax = 44f; aimAnimator.pitchGiveupRange = 30f; aimAnimator.yawGiveupRange = 10f; aimAnimator.giveupDuration = 8f; //Debug.Log("Finished setup"); }
private static void SetupSkills() { LanguageAPI.Add("BANDIT2SCEPTER_NAME", "Eclipse"); LanguageAPI.Add("BANDIT2SCEPTER_DESCRIPTION", "<style=cIsUtility>Cripples</style> nearby enemies within a radius of <style=cIsDamage>7 meters</style>."); var mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(Bandit2.PrepEclipse)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 4f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.stockToConsume = 1; mySkillDef.icon = Resources.Load <Sprite>("textures/bufficons/texBuffLunarShellIcon"); mySkillDef.skillDescriptionToken = "BANDIT2SCEPTER_DESCRIPTION"; mySkillDef.skillName = "BANDIT2SCEPTER_NAME"; mySkillDef.skillNameToken = mySkillDef.skillName; LoadoutAPI.AddSkillDef(mySkillDef); var skillLocator = myCharacter.GetComponent <SkillLocator>(); var skillFamily = skillLocator.special.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableDef = null, viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; LanguageAPI.Add("BANDIT2DESPERADOSCEPTER_NAME", "Renegade"); LanguageAPI.Add("BANDIT2DESPERADOSCEPTER_DESCRIPTION", "Marks up to three targets before firing."); mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(Bandit2.PrepPaint)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 4f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.stockToConsume = 1; mySkillDef.icon = Resources.Load <Sprite>("textures/bufficons/texBuffLunarShellIcon"); mySkillDef.skillDescriptionToken = "BANDIT2DESPERADOSCEPTER_DESCRIPTION"; mySkillDef.skillName = "BANDIT2DESPERADOSCEPTER_NAME"; mySkillDef.skillNameToken = mySkillDef.skillName; LoadoutAPI.AddSkillDef(mySkillDef); Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableDef = null, viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; }
private static void SpecialSetup(GameObject bodyPrefab) { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(PaladinMod.States.Spell.ChannelHealZone)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 18f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = true; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Skill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0.5f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon4; mySkillDef.skillDescriptionToken = "PALADIN_SPECIAL_HEALZONE_DESCRIPTION"; mySkillDef.skillName = "PALADIN_SPECIAL_HEALZONE_NAME"; mySkillDef.skillNameToken = "PALADIN_SPECIAL_HEALZONE_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); skillLocator.special = bodyPrefab.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); skillLocator.special._skillFamily = newFamily; SkillFamily skillFamily = skillLocator.special.skillFamily; skillFamily.variants[0] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(PaladinMod.States.Spell.ChannelTorpor)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 18f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = true; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Skill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0.5f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon4b; mySkillDef.skillDescriptionToken = "PALADIN_SPECIAL_TORPOR_DESCRIPTION"; mySkillDef.skillName = "PALADIN_SPECIAL_TORPOR_NAME"; mySkillDef.skillNameToken = "PALADIN_SPECIAL_TORPOR_NAME"; mySkillDef.keywordTokens = new string[] { "KEYWORD_TORPOR" }; LoadoutAPI.AddSkillDef(mySkillDef); Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "PALADIN_TORPORUNLOCKABLE_REWARD_ID", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(PaladinMod.States.Spell.ChannelWarcry)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 18f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = true; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Skill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0.5f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon4c; mySkillDef.skillDescriptionToken = "PALADIN_SPECIAL_WARCRY_DESCRIPTION"; mySkillDef.skillName = "PALADIN_SPECIAL_WARCRY_NAME"; mySkillDef.skillNameToken = "PALADIN_SPECIAL_WARCRY_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; }
private static void UtilitySetup(GameObject bodyPrefab) { crouchSkillDef = ScriptableObject.CreateInstance <SkillDef>(); crouchSkillDef.activationState = new SerializableEntityStateType(typeof(ROR2_SaxtonHale.States.Crouch)); crouchSkillDef.activationStateMachineName = "Weapon"; crouchSkillDef.baseMaxStock = 1; crouchSkillDef.baseRechargeInterval = 0f; crouchSkillDef.beginSkillCooldownOnSkillEnd = true; crouchSkillDef.canceledFromSprinting = false; crouchSkillDef.fullRestockOnAssign = true; crouchSkillDef.interruptPriority = InterruptPriority.Death; crouchSkillDef.isBullets = false; crouchSkillDef.isCombatSkill = false; crouchSkillDef.mustKeyPress = true; crouchSkillDef.noSprint = true; crouchSkillDef.rechargeStock = 1; crouchSkillDef.requiredStock = 1; crouchSkillDef.shootDelay = 0.5f; crouchSkillDef.stockToConsume = 1; crouchSkillDef.icon = Resources.Load <Sprite>("textures/bufficons/texBuffSlow80Icon"); crouchSkillDef.skillDescriptionToken = "SAXTONHALE_UTILITY_CROUCH_DESCRIPTION"; crouchSkillDef.skillName = "SAXTONHALE_UTILITY_CROUCH_NAME"; crouchSkillDef.skillNameToken = "SAXTONHALE_UTILITY_CROUCH_NAME"; weighdownSkillDef = ScriptableObject.CreateInstance <SkillDef>(); weighdownSkillDef.activationState = new SerializableEntityStateType(typeof(ROR2_SaxtonHale.States.Weighdown)); weighdownSkillDef.activationStateMachineName = "Weapon"; weighdownSkillDef.baseMaxStock = 1; weighdownSkillDef.baseRechargeInterval = 0f; weighdownSkillDef.beginSkillCooldownOnSkillEnd = true; weighdownSkillDef.canceledFromSprinting = false; weighdownSkillDef.fullRestockOnAssign = true; weighdownSkillDef.interruptPriority = InterruptPriority.Death; weighdownSkillDef.isBullets = false; weighdownSkillDef.isCombatSkill = false; weighdownSkillDef.mustKeyPress = true; weighdownSkillDef.noSprint = true; weighdownSkillDef.rechargeStock = 0; weighdownSkillDef.requiredStock = 1; weighdownSkillDef.shootDelay = 0.5f; weighdownSkillDef.stockToConsume = 1; weighdownSkillDef.icon = Resources.Load <Sprite>("textures/bufficons/texBuffSlow50Icon"); weighdownSkillDef.skillDescriptionToken = "SAXTONHALE_UTILITY_WEIGHDOWN_DESCRIPTION"; weighdownSkillDef.skillName = "SAXTONHALE_UTILITY_WEIGHDOWN_NAME"; weighdownSkillDef.skillNameToken = "SAXTONHALE_UTILITY_WEIGHDOWN_NAME"; LoadoutAPI.AddSkillDef(crouchSkillDef); LoadoutAPI.AddSkillDef(weighdownSkillDef); skillLocator.utility = bodyPrefab.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); skillLocator.utility._skillFamily = newFamily; SkillFamily skillFamily = skillLocator.utility.skillFamily; skillFamily.variants[0] = new SkillFamily.Variant { skillDef = crouchSkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(crouchSkillDef.skillNameToken, false, null) }; }
private void EditModelSkins() { var model = this.sniperBody.GetComponent <ModelLocator>().modelTransform; var charModel = model.GetComponent <CharacterModel>(); var modelSkins = model.GetComponent <ModelSkinController>(); var baseSkin = modelSkins.skins[0]; var skinDef = LoadoutAPI.CreateNewSkinDef(new LoadoutAPI.SkinDefInfo()); skinDef.baseSkins = Array.Empty <SkinDef>(); skinDef.gameObjectActivations = Array.Empty <SkinDef.GameObjectActivation>(); skinDef.icon = Resources.Load <Sprite>("NotAPath"); // TODO: Grab skin icon generator and implement skinDef.rendererInfos = new CharacterModel.RendererInfo[3] { new CharacterModel.RendererInfo { defaultMaterial = this.sniperPistolMaterial, defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false, renderer = baseSkin.rendererInfos[0].renderer }, new CharacterModel.RendererInfo { defaultMaterial = this.sniperRifleMaterial, defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false, renderer = baseSkin.rendererInfos[1].renderer }, new CharacterModel.RendererInfo { defaultMaterial = this.sniperBodyMaterial, defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false, renderer = baseSkin.rendererInfos[2].renderer } }; skinDef.meshReplacements = new SkinDef.MeshReplacement[3] { new SkinDef.MeshReplacement { mesh = this.sniperBodyMesh, renderer = baseSkin.meshReplacements[0].renderer }, new SkinDef.MeshReplacement { mesh = this.sniperRifleMesh, renderer = baseSkin.rendererInfos[0].renderer }, new SkinDef.MeshReplacement { mesh = this.knifeMesh3, renderer = baseSkin.rendererInfos[1].renderer } }; skinDef.rootObject = baseSkin.rootObject; skinDef.unlockableName = ""; modelSkins.skins = new SkinDef[1] { skinDef }; }
public static void Setup() { On.RoR2.Orbs.LightningOrb.Begin += LightningOrb_Begin; #region huntress LoadoutAPI.AddSkill(typeof(VTStates.States.Huntress.JumpingArrow)); { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(VTStates.States.Huntress.JumpingArrow)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 0.5f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = true; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 0; //mySkillDef.icon = Resources.Load<Sprite>() mySkillDef.skillDescriptionToken = "<style=cIsUtility>Agile</style>. Quickly fire a seeking arrow for <style=cIsDamage>100% damage</style>. It <style=cIsUtility>Bounces</style> twice"; mySkillDef.skillName = "EXPANDEDSKILLS_JUMPINGARROW_PRIMARY"; mySkillDef.skillNameToken = "Jumping Arrow"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = Resources.Load <GameObject>("prefabs/characterbodies/huntressbody"); SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.primary.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } LoadoutAPI.AddSkill(typeof(VTStates.States.Huntress.MultiArrow)); { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(VTStates.States.Huntress.MultiArrow)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 3; mySkillDef.baseRechargeInterval = 2f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 0; //mySkillDef.icon = Resources.Load<Sprite>() mySkillDef.skillDescriptionToken = "Launch an arrow that deals <style=cIsDamage>75% damage</style> and bounces between up to <style=cIsDamage>2</style> times, <style=cIsUtility>Doubling Damage and splitting into two each time</style>"; mySkillDef.skillName = "EXPANDEDSKILLS_MULTIARROW_SECONDARY"; mySkillDef.skillNameToken = "Splinter Shot"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = Resources.Load <GameObject>("prefabs/characterbodies/huntressbody"); SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.secondary.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } LoadoutAPI.AddSkill(typeof(VTStates.States.Huntress.ChargedArrow)); { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(VTStates.States.Huntress.ChargedArrow)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 4; mySkillDef.baseRechargeInterval = 4f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 0; //mySkillDef.icon = Resources.Load<Sprite>() mySkillDef.skillDescriptionToken = "Charge an arrow for up to <style=cIsDamage>600% damage</style> per stock."; mySkillDef.skillName = "EXPANDEDSKILLS_CHARGED_SECONDARY"; mySkillDef.skillNameToken = "Charged Shot"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = Resources.Load <GameObject>("prefabs/characterbodies/huntressbody"); SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.secondary.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } #endregion huntress }
/// <summary> /// Create a survivor prefab from a model. Don't register the prefab that it outputs, because the method already does that for you. /// </summary> /// <returns>The prefab created from the model.</returns> public GameObject CreatePrefab() { if (prefabName == "") { Log.LogW("Prefab name has not been set."); prefabName = "RandomAssSurvivorBody"; } GameObject prefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterBodies/CommandoBody"), prefabName, true); prefab.GetComponent <NetworkIdentity>().localPlayerAuthority = true; SetupModelBase(); SetupCamera(); SetupAim(); void SetupModelBase() { UnityEngine.Object.Destroy(prefab.transform.Find("ModelBase").gameObject); UnityEngine.Object.Destroy(prefab.transform.Find("CameraPivot").gameObject); UnityEngine.Object.Destroy(prefab.transform.Find("AimOrigin").gameObject); modelBase.transform.parent = prefab.transform; modelBase.transform.localPosition = new Vector3(0f, -0.81f, 0f); modelBase.transform.localRotation = Quaternion.identity; //modelBase.transform.localScale = Vector3.one; } void SetupCamera() { camPivot.transform.parent = prefab.transform; camPivot.transform.localPosition = new Vector3(0f, -0.81f, 0f); camPivot.transform.rotation = Quaternion.identity; camPivot.transform.localScale = Vector3.one; } void SetupAim() { aimOrigin.transform.parent = prefab.transform; aimOrigin.transform.localPosition = new Vector3(0f, 1.4f, 0f); aimOrigin.transform.rotation = Quaternion.identity; aimOrigin.transform.localScale = Vector3.one; } if (!model) { Log.LogE("Character model has not been loaded, returning null. " + prefabName + " will not function properly."); return(null); } Transform transform = model.transform; CharacterDirection dir = prefab.GetComponent <CharacterDirection>(); CharacterBody body = prefab.GetComponent <CharacterBody>(); CharacterMotor motor = prefab.GetComponent <CharacterMotor>(); CameraTargetParams camParams = prefab.GetComponent <CameraTargetParams>(); ModelLocator locator = prefab.GetComponent <ModelLocator>(); CharacterModel charModel = transform.gameObject.AddComponent <CharacterModel>(); ChildLocator childLoc = model.GetComponent <ChildLocator>(); TeamComponent teamComponent = null; if (prefab.GetComponent <TeamComponent>() != null) { teamComponent = prefab.GetComponent <TeamComponent>(); } else { teamComponent = prefab.GetComponent <TeamComponent>(); } HealthComponent health = prefab.GetComponent <HealthComponent>(); CharacterDeathBehavior deathBehavior = prefab.GetComponent <CharacterDeathBehavior>(); Rigidbody rigidbody = prefab.GetComponent <Rigidbody>(); CapsuleCollider collider = prefab.GetComponent <CapsuleCollider>(); KinematicCharacterMotor kMotor = prefab.GetComponent <KinematicCharacterMotor>(); HurtBoxGroup hurtbox = model.AddComponent <HurtBoxGroup>(); CapsuleCollider coll1 = model.GetComponentInChildren <CapsuleCollider>(); HurtBox hb = coll1.gameObject.AddComponent <HurtBox>(); FootstepHandler footstep = model.AddComponent <FootstepHandler>(); AimAnimator aimer = model.AddComponent <AimAnimator>(); SetupModelTransform(); SetupCharacterDirection(); SetupCharacterBody(); SetupCharacterMotor(); SetupCameraParams(); SetupModelLocator(); SetupModel(); SetupShaders(); SetupSkins(); SetupTeamComponent(); SetupHealthComponent(); SetupInteractors(); SetupDeathBehavior(); SetupRigidBody(); SetupCollider(); SetupKCharacterMotor(); SetupHurtbox(); SetupFootstep(); SetupAimAnimator(); SetupHitbox(); void SetupModelTransform() { transform.parent = modelBase.transform; //transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.identity; } void SetupCharacterDirection() { dir.moveVector = Vector3.zero; dir.targetTransform = modelBase.transform; dir.overrideAnimatorForwardTransform = null; dir.rootMotionAccumulator = null; dir.modelAnimator = model.GetComponentInChildren <Animator>(); dir.driveFromRootRotation = false; dir.turnSpeed = 720f; } void SetupCharacterBody() { body.name = prefabName; body.bodyFlags = CharacterBody.BodyFlags.ImmuneToExecutes; body.rootMotionInMainState = false; body.mainRootSpeed = 0; body.bodyIndex = -1; body.aimOriginTransform = aimOrigin.transform; body.hullClassification = HullClassification.Human; } void SetupCharacterMotor() { //CharacterMotor motor = prefab.GetComponent<CharacterMotor>(); motor.walkSpeedPenaltyCoefficient = 1f; motor.characterDirection = dir; motor.muteWalkMotion = false; motor.mass = 100f; motor.airControl = 0.25f; motor.disableAirControlUntilCollision = false; motor.generateParametersOnAwake = true; } void SetupCameraParams() { camParams.cameraParams = Resources.Load <GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponent <CameraTargetParams>().cameraParams; camParams.cameraPivotTransform = null; camParams.aimMode = CameraTargetParams.AimType.Standard; camParams.recoil = Vector2.zero; camParams.idealLocalCameraPos = Vector3.zero; camParams.dontRaycastToPivot = false; } void SetupModelLocator() { locator.modelTransform = transform; locator.modelBaseTransform = modelBase.transform; locator.dontReleaseModelOnDeath = false; locator.autoUpdateModelTransform = true; locator.dontDetatchFromParent = false; locator.noCorpse = false; locator.normalizeToFloor = false; locator.preserveModel = false; } void SetupTeamComponent() { teamComponent.hideAllyCardDisplay = false; teamComponent.teamIndex = TeamIndex.None; } void SetupHealthComponent() { health.body = null; health.dontShowHealthbar = false; health.globalDeathEventChanceCoefficient = 1f; } void SetupInteractors() { prefab.GetComponent <Interactor>().maxInteractionDistance = 3f; prefab.GetComponent <InteractionDriver>().highlightInteractor = true; } void SetupDeathBehavior() { deathBehavior.deathStateMachine = prefab.GetComponent <EntityStateMachine>(); deathBehavior.deathState = new SerializableEntityStateType(typeof(GenericCharacterDeath)); } void SetupRigidBody() { rigidbody.mass = 100f; rigidbody.drag = 0f; rigidbody.angularDrag = 0f; rigidbody.useGravity = false; rigidbody.isKinematic = true; rigidbody.interpolation = RigidbodyInterpolation.None; rigidbody.collisionDetectionMode = CollisionDetectionMode.Discrete; rigidbody.constraints = RigidbodyConstraints.None; } void SetupCollider() { collider.isTrigger = false; collider.material = null; collider.center = Vector3.zero; collider.direction = 1; } void SetupModel() { charModel.body = body; List <CharacterModel.RendererInfo> infos = new List <CharacterModel.RendererInfo>(); infos.Add(new CharacterModel.RendererInfo { defaultMaterial = model.GetComponentInChildren <SkinnedMeshRenderer>().material, renderer = model.GetComponentInChildren <SkinnedMeshRenderer>(), defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off, ignoreOverlays = false }); SkinnedMeshRenderer[] skinnedMeshRenderer = model.GetComponentsInChildren <SkinnedMeshRenderer>(); for (int i = 0; i < skinnedMeshRenderer.Length; i++) { infos.Add(new CharacterModel.RendererInfo { defaultMaterial = skinnedMeshRenderer[i].material, renderer = skinnedMeshRenderer[i], defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false }); } charModel.baseRendererInfos = infos.ToArray(); charModel.autoPopulateLightInfos = true; charModel.invisibilityCount = 0; charModel.temporaryOverlays = new List <TemporaryOverlay>(); } void SetupKCharacterMotor() { kMotor.CharacterController = motor; kMotor.Capsule = collider; kMotor.Rigidbody = rigidbody; kMotor.DetectDiscreteCollisions = false; kMotor.GroundDetectionExtraDistance = 0f; kMotor.MaxStepHeight = 0.2f; kMotor.MinRequiredStepDepth = 0.1f; kMotor.MaxStableSlopeAngle = 55f; kMotor.MaxStableDistanceFromLedge = 0.5f; kMotor.PreventSnappingOnLedges = false; kMotor.MaxStableDenivelationAngle = 55f; kMotor.RigidbodyInteractionType = RigidbodyInteractionType.None; kMotor.PreserveAttachedRigidbodyMomentum = true; kMotor.HasPlanarConstraint = false; kMotor.PlanarConstraintAxis = Vector3.up; kMotor.StepHandling = StepHandlingMethod.None; kMotor.LedgeHandling = true; kMotor.InteractiveRigidbodyHandling = true; kMotor.SafeMovement = false; } void SetupHurtbox() { hb.gameObject.layer = LayerIndex.entityPrecise.intVal; hb.healthComponent = health; hb.isBullseye = true; hb.damageModifier = HurtBox.DamageModifier.Normal; hb.hurtBoxGroup = hurtbox; hb.indexInGroup = 0; hurtbox.hurtBoxes = new HurtBox[] { hb }; hurtbox.mainHurtBox = hb; hurtbox.bullseyeCount = 1; } void SetupFootstep() { footstep.baseFootstepString = "Play_player_footstep"; footstep.sprintFootstepOverrideString = ""; footstep.enableFootstepDust = true; footstep.footstepDustPrefab = Resources.Load <GameObject>("Prefabs/GenericFootstepDust"); } //RagdollController ragdoll = model.GetComponent<RagdollController>(); //TODO //ragdoll.bones = null; //ragdoll.componentsToDisableOnRagdoll = null; void SetupAimAnimator() { aimer.inputBank = prefab.GetComponent <InputBankTest>(); aimer.directionComponent = dir; aimer.pitchRangeMax = 60f; aimer.pitchRangeMin = -60f; aimer.yawRangeMax = 90f; aimer.yawRangeMin = -90f; aimer.pitchGiveupRange = 30f; aimer.yawGiveupRange = 10f; aimer.giveupDuration = 3f; } void SetupHitbox() { foreach (Transform child in transform) { if (child.name.Contains("Hitbox")) { var hitBoxGroup = model.AddComponent <HitBoxGroup>(); var hitBox = child.gameObject.AddComponent <HitBox>(); hitBoxGroup.groupName = child.name; hitBoxGroup.hitBoxes = new HitBox[] { hitBox }; } } } void SetupShaders() { foreach (Transform child in transform) { var renderer = child.gameObject.GetComponent <Renderer>(); if (renderer) { var material = CreateMaterial(renderer.material, 10, Color.white, 0); renderer.material = material; } } } void SetupSkins() { //LanguageAPI.Add("NEMMANDO_DEFAULT_SKIN_NAME", "Default"); var obj = transform.gameObject; var mdl = obj.GetComponent <CharacterModel>(); var skinController = obj.AddComponent <ModelSkinController>(); LoadoutAPI.SkinDefInfo skinDefInfo = new LoadoutAPI.SkinDefInfo { Name = "DEFAULT_SKIN", NameToken = "DEFAULT_SKIN", Icon = defaultSkinIcon, RootObject = obj, RendererInfos = mdl.baseRendererInfos, GameObjectActivations = Array.Empty <SkinDef.GameObjectActivation>(), MeshReplacements = Array.Empty <SkinDef.MeshReplacement>(), BaseSkins = Array.Empty <SkinDef>(), MinionSkinReplacements = Array.Empty <SkinDef.MinionSkinReplacement>(), ProjectileGhostReplacements = Array.Empty <SkinDef.ProjectileGhostReplacement>(), UnlockableName = "" }; CharacterModel.RendererInfo[] rendererInfos = skinDefInfo.RendererInfos; CharacterModel.RendererInfo[] array = new CharacterModel.RendererInfo[rendererInfos.Length]; rendererInfos.CopyTo(array, 0); array[0].defaultMaterial = masterySkinDelegate.Invoke(); LoadoutAPI.SkinDefInfo masteryInfo = new LoadoutAPI.SkinDefInfo { Name = "DEFAULT_SKIN", NameToken = "DEFAULT_SKIN", Icon = defaultSkinIcon, RootObject = obj, RendererInfos = array, GameObjectActivations = Array.Empty <SkinDef.GameObjectActivation>(), MeshReplacements = Array.Empty <SkinDef.MeshReplacement>(), BaseSkins = Array.Empty <SkinDef>(), MinionSkinReplacements = Array.Empty <SkinDef.MinionSkinReplacement>(), ProjectileGhostReplacements = Array.Empty <SkinDef.ProjectileGhostReplacement>(), UnlockableName = masteryAchievementUnlockable }; SkinDef skinDefault = LoadoutAPI.CreateNewSkinDef(skinDefInfo); SkinDef mastery = LoadoutAPI.CreateNewSkinDef(masteryInfo); SkinDef[] skinDefs = new SkinDef[2] { skinDefault, mastery }; skinController.skins = skinDefs; } API.RegisterNewBody(prefab); return(prefab); }
public static void Setup() { LoadoutAPI.AddSkill(typeof(VTStates.States.Mercenary.SummonManyAtPoint)); { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(VTStates.States.Mercenary.SummonManyAtPoint)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 4; mySkillDef.baseRechargeInterval = 25f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = true; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 0; //mySkillDef.icon = Resources.Load<Sprite>() mySkillDef.skillDescriptionToken = "Summon a clone that <style=cIsUtility>inherits your items</style>."; mySkillDef.skillName = "EXPANDEDSKILLS_SUMMONMANYCLONE_SPECIAL"; mySkillDef.skillNameToken = "Swarming Clones"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = Resources.Load <GameObject>("prefabs/characterbodies/mercbody"); SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.special.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } LoadoutAPI.AddSkill(typeof(VTStates.States.Mercenary.SummonDistraction)); { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(VTStates.States.Mercenary.SummonDistraction)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 12f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = true; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 0; //mySkillDef.icon = Resources.Load<Sprite>() mySkillDef.skillDescriptionToken = "Summon a <style=cIsUtility>Celestine</style> Mercenary and teleport away."; mySkillDef.skillName = "EXPANDEDSKILLS_SUMMONDISTRACTION_UTILITY"; mySkillDef.skillNameToken = "Meatshield"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = Resources.Load <GameObject>("prefabs/characterbodies/mercbody"); SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.utility.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } }
private void AddSkins(GameObject bodyObject) //credits to rob { GameObject bodyPrefab = bodyObject; GameObject model = bodyPrefab.GetComponentInChildren <ModelLocator>().modelTransform.gameObject; CharacterModel characterModel = model.GetComponent <CharacterModel>(); ModelSkinController skinController = null; if (model.GetComponent <ModelSkinController>()) { skinController = model.GetComponent <ModelSkinController>(); } else { skinController = model.AddComponent <ModelSkinController>(); } SkinnedMeshRenderer mainRenderer = Reflection.GetFieldValue <SkinnedMeshRenderer>(characterModel, "mainSkinnedMeshRenderer"); if (mainRenderer == null) { CharacterModel.RendererInfo[] bRI = Reflection.GetFieldValue <CharacterModel.RendererInfo[]>(characterModel, "baseRendererInfos"); if (bRI != null) { foreach (CharacterModel.RendererInfo rendererInfo in bRI) { if (rendererInfo.renderer is SkinnedMeshRenderer) { mainRenderer = (SkinnedMeshRenderer)rendererInfo.renderer; break; } } if (mainRenderer != null) { characterModel.SetFieldValue <SkinnedMeshRenderer>("mainSkinnedMeshRenderer", mainRenderer); } } } LoadoutAPI.SkinDefInfo skinDefInfo = default(LoadoutAPI.SkinDefInfo); skinDefInfo.BaseSkins = Array.Empty <SkinDef>(); skinDefInfo.GameObjectActivations = Array.Empty <SkinDef.GameObjectActivation>(); skinDefInfo.Icon = LoadoutAPI.CreateSkinIcon(Color.white, Color.white, Color.white, Color.white); skinDefInfo.MeshReplacements = new SkinDef.MeshReplacement[] { new SkinDef.MeshReplacement { renderer = mainRenderer, mesh = mainRenderer.sharedMesh } }; skinDefInfo.Name = "PYRO_DEFAULT_SKIN_NAME"; skinDefInfo.NameToken = "PYRO_DEFAULT_SKIN_NAME"; skinDefInfo.RendererInfos = characterModel.baseRendererInfos; skinDefInfo.RootObject = model; skinDefInfo.UnlockableName = ""; skinDefInfo.MinionSkinReplacements = new SkinDef.MinionSkinReplacement[0]; skinDefInfo.ProjectileGhostReplacements = new SkinDef.ProjectileGhostReplacement[0]; SkinDef defaultSkin = LoadoutAPI.CreateNewSkinDef(skinDefInfo); skinController.skins = new SkinDef[1] { defaultSkin, }; }
private void AssignSpecial(SkillLocator sk) { SkillFamily specialSkillFamily = ScriptableObject.CreateInstance <SkillFamily>(); specialSkillFamily.defaultVariantIndex = 0u; specialSkillFamily.variants = new SkillFamily.Variant[1]; Reflection.SetFieldValue <SkillFamily>(sk.special, "_skillFamily", specialSkillFamily); SkillDef specialFlareDef = SkillDef.CreateInstance <SkillDef>(); specialFlareDef.activationState = new SerializableEntityStateType(typeof(Flaregun)); specialFlareDef.activationStateMachineName = "Weapon"; specialFlareDef.baseMaxStock = 1; specialFlareDef.baseRechargeInterval = 10f; specialFlareDef.beginSkillCooldownOnSkillEnd = true; specialFlareDef.canceledFromSprinting = false; specialFlareDef.dontAllowPastMaxStocks = true; specialFlareDef.forceSprintDuringState = false; specialFlareDef.fullRestockOnAssign = true; specialFlareDef.icon = Resources.Load <Sprite>(assetPrefix + ":skill4.png"); specialFlareDef.interruptPriority = InterruptPriority.PrioritySkill; specialFlareDef.isBullets = false; specialFlareDef.isCombatSkill = true; specialFlareDef.keywordTokens = new string[] { "KEYWORD_PYRO_HEAT" }; specialFlareDef.mustKeyPress = false; specialFlareDef.noSprint = true; specialFlareDef.rechargeStock = 1; specialFlareDef.requiredStock = 1; specialFlareDef.shootDelay = 0f; specialFlareDef.skillName = "Flaregun"; specialFlareDef.skillNameToken = "PYRO_SPECIAL_NAME"; specialFlareDef.skillDescriptionToken = "PYRO_SPECIAL_DESC"; specialFlareDef.stockToConsume = 1; LoadoutAPI.AddSkill(typeof(Flaregun)); LoadoutAPI.AddSkillDef(specialFlareDef); specialSkillFamily.variants[0] = new SkillFamily.Variant { skillDef = specialFlareDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(specialFlareDef.skillNameToken, false) }; SkillDef specialBlazeborneDef = SkillDef.CreateInstance <SkillDef>(); specialBlazeborneDef.activationState = new SerializableEntityStateType(typeof(Blazeborne)); specialBlazeborneDef.activationStateMachineName = "Weapon"; specialBlazeborneDef.baseMaxStock = 1; specialBlazeborneDef.baseRechargeInterval = 10f; specialBlazeborneDef.beginSkillCooldownOnSkillEnd = true; specialBlazeborneDef.canceledFromSprinting = false; specialBlazeborneDef.dontAllowPastMaxStocks = true; specialBlazeborneDef.forceSprintDuringState = false; specialBlazeborneDef.fullRestockOnAssign = true; specialBlazeborneDef.icon = Resources.Load <Sprite>(assetPrefix + ":skill4.png"); specialBlazeborneDef.interruptPriority = InterruptPriority.PrioritySkill; specialBlazeborneDef.isBullets = false; specialBlazeborneDef.isCombatSkill = true; specialBlazeborneDef.keywordTokens = new string[] { "KEYWORD_PYRO_HEAT" }; specialBlazeborneDef.mustKeyPress = false; specialBlazeborneDef.noSprint = true; specialBlazeborneDef.rechargeStock = 1; specialBlazeborneDef.requiredStock = 1; specialBlazeborneDef.shootDelay = 0f; specialBlazeborneDef.skillName = "Blazeborne"; specialBlazeborneDef.skillNameToken = "PYRO_SPECIAL_ALT_NAME"; specialBlazeborneDef.skillDescriptionToken = "PYRO_SPECIAL_ALT_DESC"; specialBlazeborneDef.stockToConsume = 1; LoadoutAPI.AddSkill(typeof(Blazeborne)); LoadoutAPI.AddSkillDef(specialBlazeborneDef); Array.Resize(ref specialSkillFamily.variants, specialSkillFamily.variants.Length + 1); specialSkillFamily.variants[specialSkillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = specialBlazeborneDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(specialBlazeborneDef.skillNameToken, false) }; //Unused LoadoutAPI.AddSkill(typeof(PrepFlare)); LoadoutAPI.AddSkill(typeof(FireFlareBurst)); }
void UtilitySkills() { { SkillLocator skillLocator = myCharacter.GetComponent <SkillLocator>(); skillLocator.utility = myCharacter.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[3]; LoadoutAPI.AddSkillFamily(newFamily); skillLocator.utility.SetFieldValue("_skillFamily", newFamily); } { GameObject gameObject = myCharacter; SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.utility.skillFamily; SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(EntityStates.Toolbot.ToolbotDash)); mySkillDef.activationStateMachineName = "WeaponGun"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 12f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 1f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Resources.Load <GameObject>("Prefabs/CharacterBodies/toolbotbody").GetComponent <SkillLocator>().utility.skillFamily.variants[0].skillDef.icon; mySkillDef.skillDescriptionToken = "Gain a boost of movement"; mySkillDef.skillName = "PP_PLAYABLETC_Utility"; mySkillDef.skillNameToken = "Movement Boost"; LoadoutAPI.AddSkillDef(mySkillDef); skillFamily.variants[0] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } LoadoutAPI.AddSkill(typeof(EnterPainter)); { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(EnterPainter)); mySkillDef.activationStateMachineName = "WeaponGun"; mySkillDef.baseMaxStock = 16; mySkillDef.baseRechargeInterval = 2f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = false; mySkillDef.interruptPriority = InterruptPriority.PrioritySkill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 0; mySkillDef.icon = Resources.Load <GameObject>("Prefabs/CharacterBodies/engibody").GetComponent <SkillLocator>().utility.skillFamily.variants[1].skillDef.icon; mySkillDef.skillDescriptionToken = "Enter target-painting mode."; mySkillDef.skillName = "PP_PLAYABLETC_PAINT"; mySkillDef.skillNameToken = "Target Acquisition"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = myCharacter; SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.utility.skillFamily; skillFamily.variants[1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } LoadoutAPI.AddSkill(typeof(AllyPing)); { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(AllyPing)); mySkillDef.activationStateMachineName = "WeaponGun"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 10f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = false; mySkillDef.interruptPriority = InterruptPriority.PrioritySkill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Resources.Load <GameObject>("Prefabs/CharacterBodies/huntressbody").GetComponent <SkillLocator>().utility.skillFamily.variants[1].skillDef.icon; mySkillDef.skillDescriptionToken = "Command your drones to target an enemy or ally that you have pinged for 5 seconds"; mySkillDef.skillName = "PP_PLAYABLETC_ALLYPING"; mySkillDef.skillNameToken = "Additional Directives"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = myCharacter; SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.utility.skillFamily; skillFamily.variants[2] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } }
public static void Initialize() { SkillDef sharpClawsSkillDef = ScriptableObject.CreateInstance <SkillDef>(); sharpClawsSkillDef.activationState = new SerializableEntityStateType(typeof(States.SharpClaws)); sharpClawsSkillDef.activationStateMachineName = "Weapon"; sharpClawsSkillDef.baseMaxStock = 1; sharpClawsSkillDef.baseRechargeInterval = 0f; sharpClawsSkillDef.beginSkillCooldownOnSkillEnd = false; sharpClawsSkillDef.canceledFromSprinting = false; sharpClawsSkillDef.fullRestockOnAssign = true; sharpClawsSkillDef.interruptPriority = InterruptPriority.Any; sharpClawsSkillDef.isCombatSkill = true; sharpClawsSkillDef.mustKeyPress = false; sharpClawsSkillDef.cancelSprintingOnActivation = true; sharpClawsSkillDef.rechargeStock = 1; sharpClawsSkillDef.requiredStock = 1; sharpClawsSkillDef.stockToConsume = 1; sharpClawsSkillDef.icon = Core.Assets.icon1; sharpClawsSkillDef.skillDescriptionToken = "URSA_PRIMARY_DESCRIPTION"; sharpClawsSkillDef.skillName = "URSA_PRIMARY_NAME"; sharpClawsSkillDef.skillNameToken = "URSA_PRIMARY_NAME"; SkillDef overpowerSkillDef = ScriptableObject.CreateInstance <SkillDef>(); overpowerSkillDef.activationState = new SerializableEntityStateType(typeof(States.Overpower)); overpowerSkillDef.activationStateMachineName = "Body"; overpowerSkillDef.baseMaxStock = Core.Config.secondaryBaseCharges.Value; overpowerSkillDef.baseRechargeInterval = Core.Config.secondaryBaseCooldown.Value; overpowerSkillDef.beginSkillCooldownOnSkillEnd = false; overpowerSkillDef.canceledFromSprinting = false; overpowerSkillDef.fullRestockOnAssign = true; overpowerSkillDef.interruptPriority = InterruptPriority.Skill; overpowerSkillDef.isCombatSkill = true; overpowerSkillDef.mustKeyPress = true; overpowerSkillDef.cancelSprintingOnActivation = false; overpowerSkillDef.rechargeStock = 1; overpowerSkillDef.requiredStock = 1; overpowerSkillDef.stockToConsume = 1; overpowerSkillDef.icon = Core.Assets.icon2; overpowerSkillDef.skillDescriptionToken = "URSA_SECONDARY_DESCRIPTION"; overpowerSkillDef.skillName = "URSA_SECONDARY_NAME"; overpowerSkillDef.skillNameToken = "URSA_SECONDARY_NAME"; SkillDef earthshockSkillDef = ScriptableObject.CreateInstance <SkillDef>(); earthshockSkillDef.activationState = new SerializableEntityStateType(typeof(States.Earthshock)); earthshockSkillDef.activationStateMachineName = "Weapon"; earthshockSkillDef.baseMaxStock = 1; earthshockSkillDef.baseRechargeInterval = Core.Config.utilityBaseCooldown.Value; earthshockSkillDef.beginSkillCooldownOnSkillEnd = true; earthshockSkillDef.canceledFromSprinting = false; earthshockSkillDef.fullRestockOnAssign = true; earthshockSkillDef.interruptPriority = InterruptPriority.Skill; earthshockSkillDef.isCombatSkill = false; earthshockSkillDef.mustKeyPress = true; earthshockSkillDef.cancelSprintingOnActivation = false; earthshockSkillDef.rechargeStock = 1; earthshockSkillDef.requiredStock = 1; earthshockSkillDef.stockToConsume = 1; earthshockSkillDef.icon = Core.Assets.icon3; earthshockSkillDef.skillDescriptionToken = "URSA_UTILITY_DESCRIPTION"; earthshockSkillDef.skillName = "URSA_UTILITY_NAME"; earthshockSkillDef.skillNameToken = "URSA_UTILITY_NAME"; SkillDef enrageSkillDef = ScriptableObject.CreateInstance <SkillDef>(); enrageSkillDef.activationState = new SerializableEntityStateType(typeof(States.Enrage)); enrageSkillDef.activationStateMachineName = "Body"; enrageSkillDef.baseMaxStock = 1; enrageSkillDef.baseRechargeInterval = Core.Config.specialBaseCooldown.Value; enrageSkillDef.beginSkillCooldownOnSkillEnd = true; enrageSkillDef.canceledFromSprinting = false; enrageSkillDef.fullRestockOnAssign = true; enrageSkillDef.interruptPriority = InterruptPriority.Frozen; enrageSkillDef.isCombatSkill = true; enrageSkillDef.mustKeyPress = true; enrageSkillDef.cancelSprintingOnActivation = true; enrageSkillDef.rechargeStock = 1; enrageSkillDef.requiredStock = 1; enrageSkillDef.stockToConsume = 1; enrageSkillDef.icon = Core.Assets.icon4; enrageSkillDef.skillDescriptionToken = "URSA_SPECIAL_DESCRIPTION"; enrageSkillDef.skillName = "URSA_SPECIAL_NAME"; enrageSkillDef.skillNameToken = "URSA_SPECIAL_NAME"; LoadoutAPI.AddSkillDef(sharpClawsSkillDef); LoadoutAPI.AddSkillDef(overpowerSkillDef); LoadoutAPI.AddSkillDef(earthshockSkillDef); LoadoutAPI.AddSkillDef(enrageSkillDef); foreach (GenericSkill i in Survivor.Character.body.GetComponentsInChildren <GenericSkill>()) { UnityEngine.Object.DestroyImmediate(i); } SkillLocator skillLocator = Survivor.Character.body.GetComponent <SkillLocator>(); //Passive skillLocator.passiveSkill.enabled = true; skillLocator.passiveSkill.skillNameToken = "URSA_PASSIVE_NAME"; skillLocator.passiveSkill.skillDescriptionToken = "URSA_PASSIVE_DESCRIPTION"; skillLocator.passiveSkill.icon = Core.Assets.icon5; //Primary skillLocator.primary = Survivor.Character.body.AddComponent <GenericSkill>(); SkillFamily newFamilyPrimary = ScriptableObject.CreateInstance <SkillFamily>(); newFamilyPrimary.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamilyPrimary); skillLocator.primary.SetFieldValue("_skillFamily", newFamilyPrimary); SkillFamily skillFamilyPrimary = skillLocator.primary.skillFamily; skillFamilyPrimary.variants[0] = new SkillFamily.Variant { skillDef = sharpClawsSkillDef, viewableNode = new ViewablesCatalog.Node(sharpClawsSkillDef.skillNameToken, false, null) }; //Secondary skillLocator.secondary = Survivor.Character.body.AddComponent <GenericSkill>(); SkillFamily newFamilySecondary = ScriptableObject.CreateInstance <SkillFamily>(); newFamilySecondary.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamilySecondary); skillLocator.secondary.SetFieldValue("_skillFamily", newFamilySecondary); SkillFamily skillFamilySecondary = skillLocator.secondary.skillFamily; skillFamilySecondary.variants[0] = new SkillFamily.Variant { skillDef = overpowerSkillDef, viewableNode = new ViewablesCatalog.Node(overpowerSkillDef.skillNameToken, false, null) }; //Utility skillLocator.utility = Survivor.Character.body.AddComponent <GenericSkill>(); SkillFamily newFamilyUtility = ScriptableObject.CreateInstance <SkillFamily>(); newFamilyUtility.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamilyUtility); skillLocator.utility.SetFieldValue("_skillFamily", newFamilyUtility); SkillFamily skillFamilyUtility = skillLocator.utility.skillFamily; skillFamilyUtility.variants[0] = new SkillFamily.Variant { skillDef = earthshockSkillDef, viewableNode = new ViewablesCatalog.Node(earthshockSkillDef.skillNameToken, false, null) }; //Special skillLocator.special = Survivor.Character.body.AddComponent <GenericSkill>(); SkillFamily newFamilySpecial = ScriptableObject.CreateInstance <SkillFamily>(); newFamilySpecial.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamilySpecial); skillLocator.special.SetFieldValue("_skillFamily", newFamilySpecial); SkillFamily skillFamilySpecial = skillLocator.special.skillFamily; skillFamilySpecial.variants[0] = new SkillFamily.Variant { skillDef = enrageSkillDef, viewableNode = new ViewablesCatalog.Node(enrageSkillDef.skillNameToken, false, null) }; }
void SpecialSkills() { { SkillLocator skillLocator = myCharacter.GetComponent <SkillLocator>(); skillLocator.special = myCharacter.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); skillLocator.special.SetFieldValue("_skillFamily", newFamily); } LoadoutAPI.AddSkill(typeof(DroneSummonBasic)); { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(DroneSummonBasic)); mySkillDef.activationStateMachineName = "WeaponGun"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 16f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = false; mySkillDef.interruptPriority = InterruptPriority.PrioritySkill; mySkillDef.isBullets = true; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Resources.Load <GameObject>("Prefabs/CharacterBodies/drone1body").GetComponent <SkillLocator>().primary.skillFamily.variants[0].skillDef.icon; mySkillDef.skillDescriptionToken = "Summon two basic gunner drones that inherit all your items"; mySkillDef.skillName = "PP_PLAYABLETC_SPECIAL_BASIC"; mySkillDef.skillNameToken = "Calling Backup"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = myCharacter; SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.special.skillFamily; skillFamily.variants[0] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } //LoadoutAPI.AddSkill(typeof(DroneSummonHealing)); //{ // SkillDef mySkillDef = ScriptableObject.CreateInstance<SkillDef>(); // mySkillDef.activationState = new SerializableEntityStateType(typeof(DroneSummonHealing)); // mySkillDef.activationStateMachineName = "WeaponGun"; // mySkillDef.baseMaxStock = 1; // mySkillDef.baseRechargeInterval = 16f; // mySkillDef.beginSkillCooldownOnSkillEnd = false; // mySkillDef.canceledFromSprinting = false; // mySkillDef.fullRestockOnAssign = false; // mySkillDef.interruptPriority = InterruptPriority.PrioritySkill; // mySkillDef.isBullets = true; // mySkillDef.isCombatSkill = false; // mySkillDef.mustKeyPress = false; // mySkillDef.noSprint = true; // mySkillDef.rechargeStock = 1; // mySkillDef.requiredStock = 1; // mySkillDef.shootDelay = 3f; // mySkillDef.stockToConsume = 1; // mySkillDef.icon = Resources.Load<GameObject>("Prefabs/CharacterBodies/drone2body").GetComponent<SkillLocator>().primary.skillFamily.variants[0].skillDef.icon; // mySkillDef.skillDescriptionToken = "Summon two healing drones that inherit all your items"; // mySkillDef.skillName = "PP_PLAYABLETC_SPECIAL_HEALING"; // mySkillDef.skillNameToken = "Emergency Services"; // LoadoutAPI.AddSkillDef(mySkillDef); // GameObject gameObject = myCharacter; // SkillLocator component = gameObject.GetComponent<SkillLocator>(); // SkillFamily skillFamily = component.special.skillFamily; // skillFamily.variants[1] = // new SkillFamily.Variant // { // skillDef = mySkillDef, // unlockableName = "", // viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) // }; //} }
public static void Setup() { LoadoutAPI.AddSkill(typeof(VTStates.States.Engineer.SummonDrone)); { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(VTStates.States.Engineer.SummonDrone)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 2; mySkillDef.baseRechargeInterval = 20f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = true; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 1; //mySkillDef.icon = Resources.Load<Sprite>() mySkillDef.skillDescriptionToken = "Spawn a drone that <style=cIsUtility>inherits all your items.</style> Fires 4 shots for <style=cIsDamage>100% damage</style>. Can have up to 2."; mySkillDef.skillName = "EXPANDEDSKILLS_SUMMONDRONE_SPECIAL"; mySkillDef.skillNameToken = "Backup Drone"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = Resources.Load <GameObject>("prefabs/characterbodies/engibody"); SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.special.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } LoadoutAPI.AddSkill(typeof(VTStates.States.Engineer.SummonProbe)); { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(VTStates.States.Engineer.SummonProbe)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 2; mySkillDef.baseRechargeInterval = 40f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = true; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 1; //mySkillDef.icon = Resources.Load<Sprite>() mySkillDef.skillDescriptionToken = "Spawn a miniature probe that <style=cIsUtility>inherits all your items.</style> Fires a beam for <style=cIsDamage>100% damage</style>. Can have up to 2."; mySkillDef.skillName = "EXPANDEDSKILLS_SUMMONPROBE_SPECIAL"; mySkillDef.skillNameToken = "TR-8R Probe"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = Resources.Load <GameObject>("prefabs/characterbodies/engibody"); SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.special.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } { EntityStates.Mage.Weapon.FireLaserbolt.damageCoefficient = 2f; EntityStates.Mage.Weapon.FireLaserbolt.force = -100f; SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(EntityStates.Mage.Weapon.FireLaserbolt)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 1f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 0; //mySkillDef.icon = Resources.Load<Sprite>() mySkillDef.skillDescriptionToken = "Fire a beam that deals <style=cIsDamage>200% damage</style> and <style=cIsUtility> Brings enemies towards you </style>"; mySkillDef.skillName = "EXPANDEDSKILLS_BEAM_PRIMARY"; mySkillDef.skillNameToken = "Augmented Beam"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = Resources.Load <GameObject>("prefabs/characterbodies/engibody"); SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.primary.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(VTStates.States.Engineer.MinorShield)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 3; mySkillDef.baseRechargeInterval = 8f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 0; //mySkillDef.icon = Resources.Load<Sprite>() mySkillDef.skillDescriptionToken = "Give each ally shields equal to their maximum health that last 5 seconds and shock anyone nearby them. Each ally takes one stock of this skill."; mySkillDef.skillName = "EXPANDEDSKILLS_SHIELDALL_UTILITY"; mySkillDef.skillNameToken = "Panic Button"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = Resources.Load <GameObject>("prefabs/characterbodies/engibody"); SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.utility.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(VTStates.States.Engineer.TrueShield)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 3; mySkillDef.baseRechargeInterval = 15f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 0; //mySkillDef.icon = Resources.Load<Sprite>() mySkillDef.skillDescriptionToken = "Make all allies <style=cIsUtility>immune</style> for 3 seconds, gain <style=cIsUtility>damage Reduction</style> for 8 seconds and <style=cIsUtility>regenerate their shields</style>. Each ally takes one stock of this skill."; mySkillDef.skillName = "EXPANDEDSKILLS_SHIELDALL_UTILITY"; mySkillDef.skillNameToken = "Panic Button"; LoadoutAPI.AddSkillDef(mySkillDef); GameObject gameObject = Resources.Load <GameObject>("prefabs/characterbodies/engibody"); SkillLocator component = gameObject.GetComponent <SkillLocator>(); SkillFamily skillFamily = component.utility.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; } }
private static void UtilitySetup(GameObject bodyPrefab) { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(PaladinMod.States.Quickstep.QuickstepSimple)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 2; mySkillDef.baseRechargeInterval = 10f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.PrioritySkill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.forceSprintDuringState = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0.5f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon3; mySkillDef.skillDescriptionToken = "PALADIN_UTILITY_DASH_DESCRIPTION"; mySkillDef.skillName = "PALADIN_UTILITY_DASH_NAME"; mySkillDef.skillNameToken = "PALADIN_UTILITY_DASH_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); skillLocator.utility = bodyPrefab.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); skillLocator.utility._skillFamily = newFamily; SkillFamily skillFamily = skillLocator.utility.skillFamily; skillFamily.variants[0] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(PaladinMod.States.AimHeal)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 8; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Skill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0.5f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon3b; mySkillDef.skillDescriptionToken = "PALADIN_UTILITY_HEAL_DESCRIPTION"; mySkillDef.skillName = "PALADIN_UTILITY_HEAL_NAME"; mySkillDef.skillNameToken = "PALADIN_UTILITY_HEAL_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "PALADIN_HEALUNLOCKABLE_REWARD_ID", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; }
public override void SetupUtility() { LanguageAPI.Add("DC_COMMANDO_UTILITY_TACTICALDIVE_NAME", "Reflect Shield"); LanguageAPI.Add("DC_COMMANDO_UTILITY_TACTICALDIVE_DESCRIPTION", "Place a <style=cIsUtility>reflective shield</style> that <style=cIsDamage>reflects</style> attacks back at their attacker."); var oldDef = Resources.Load <SkillDef>("skilldefs/engibody/engibodyplacebubbleshield"); reflectShieldSkillDef = ScriptableObject.CreateInstance <SkillDef>(); reflectShieldSkillDef.activationState = oldDef.activationState; reflectShieldSkillDef.activationStateMachineName = oldDef.activationStateMachineName; reflectShieldSkillDef.baseMaxStock = 1; reflectShieldSkillDef.baseRechargeInterval = oldDef.baseRechargeInterval; reflectShieldSkillDef.beginSkillCooldownOnSkillEnd = oldDef.beginSkillCooldownOnSkillEnd; reflectShieldSkillDef.canceledFromSprinting = oldDef.canceledFromSprinting; reflectShieldSkillDef.fullRestockOnAssign = oldDef.fullRestockOnAssign; reflectShieldSkillDef.interruptPriority = oldDef.interruptPriority; reflectShieldSkillDef.isCombatSkill = oldDef.isCombatSkill; reflectShieldSkillDef.mustKeyPress = oldDef.mustKeyPress; reflectShieldSkillDef.rechargeStock = 1; reflectShieldSkillDef.requiredStock = 1; reflectShieldSkillDef.stockToConsume = 1; reflectShieldSkillDef.icon = oldDef.icon; reflectShieldSkillDef.skillDescriptionToken = "DC_COMMANDO_UTILITY_TACTICALDIVE_DESCRIPTION"; reflectShieldSkillDef.skillName = "DC_COMMANDO_UTILITY_TACTICALDIVE_NAME"; reflectShieldSkillDef.skillNameToken = reflectShieldSkillDef.skillName; reflectShieldSkillDef.keywordTokens = new string[] { "KEYWORD_AGILE", "KEYWORD_REFLECTSHIELD" }; LoadoutAPI.AddSkillDef(reflectShieldSkillDef); var skillFamily = SurvivorSkillLocator.utility.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = reflectShieldSkillDef, unlockableDef = null, viewableNode = new ViewablesCatalog.Node(reflectShieldSkillDef.skillNameToken, false, null) }; /* * LanguageAPI.Add("DC_COMMANDO_UTILITY_TACTICALDIVE_NAME", "Reflect Shield"); * LanguageAPI.Add("DC_COMMANDO_UTILITY_TACTICALDIVE_DESCRIPTION", "Place a <style=cIsUtility>reflective shield</style> that <style=cIsDamage>reflects</style> attacks back at their attacker."); * * reflectShieldSkillDef = ScriptableObject.CreateInstance<SkillDef>(); * reflectShieldSkillDef.activationState = oldDef.activationState; * reflectShieldSkillDef.activationStateMachineName = oldDef.activationStateMachineName; * reflectShieldSkillDef.baseMaxStock = 1; * reflectShieldSkillDef.baseRechargeInterval = oldDef.baseRechargeInterval; * reflectShieldSkillDef.beginSkillCooldownOnSkillEnd = oldDef.beginSkillCooldownOnSkillEnd; * reflectShieldSkillDef.canceledFromSprinting = oldDef.canceledFromSprinting; * reflectShieldSkillDef.fullRestockOnAssign = oldDef.fullRestockOnAssign; * reflectShieldSkillDef.interruptPriority = oldDef.interruptPriority; * reflectShieldSkillDef.isCombatSkill = oldDef.isCombatSkill; * reflectShieldSkillDef.mustKeyPress = oldDef.mustKeyPress; * reflectShieldSkillDef.rechargeStock = 1; * reflectShieldSkillDef.requiredStock = 1; * reflectShieldSkillDef.stockToConsume = 1; * reflectShieldSkillDef.icon = oldDef.icon; * reflectShieldSkillDef.skillDescriptionToken = "DC_COMMANDO_UTILITY_TACTICALDIVE_DESCRIPTION"; * reflectShieldSkillDef.skillName = "DC_COMMANDO_UTILITY_TACTICALDIVE_NAME"; * reflectShieldSkillDef.skillNameToken = reflectShieldSkillDef.skillName; * reflectShieldSkillDef.keywordTokens = new string[] * { * "KEYWORD_AGILE", * "KEYWORD_REFLECTSHIELD" * }; * * LoadoutAPI.AddSkillDef(reflectShieldSkillDef);*/ }
private static void SecondarySetup(GameObject bodyPrefab) { SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(PaladinMod.States.SpinSlashEntry)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 6f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Skill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0.5f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon2; mySkillDef.skillDescriptionToken = "PALADIN_SECONDARY_SPINSLASH_DESCRIPTION"; mySkillDef.skillName = "PALADIN_SECONDARY_SPINSLASH_NAME"; mySkillDef.skillNameToken = "PALADIN_SECONDARY_SPINSLASH_NAME"; mySkillDef.keywordTokens = new string[] { "KEYWORD_STUNNING", }; LoadoutAPI.AddSkillDef(mySkillDef); skillLocator.secondary = bodyPrefab.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); skillLocator.secondary._skillFamily = newFamily; SkillFamily skillFamily = skillLocator.secondary.skillFamily; skillFamily.variants[0] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(PaladinMod.States.ChargeLightningSpear)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 6f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Skill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0.5f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon2b; mySkillDef.skillDescriptionToken = "PALADIN_SECONDARY_LIGHTNING_DESCRIPTION"; mySkillDef.skillName = "PALADIN_SECONDARY_LIGHTNING_NAME"; mySkillDef.skillNameToken = "PALADIN_SECONDARY_LIGHTNING_NAME"; mySkillDef.keywordTokens = new string[] { "KEYWORD_SHOCKING", "KEYWORD_AGILE" }; LoadoutAPI.AddSkillDef(mySkillDef); Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "",//PALADIN_LIGHTNINGSPEARUNLOCKABLE_REWARD_ID viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(PaladinMod.States.LunarShards)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = StaticValues.lunarShardMaxStock; mySkillDef.baseRechargeInterval = 0.75f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0.5f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon2c; mySkillDef.skillDescriptionToken = "PALADIN_SECONDARY_LUNARSHARD_DESCRIPTION"; mySkillDef.skillName = "PALADIN_SECONDARY_LUNARSHARD_NAME"; mySkillDef.skillNameToken = "PALADIN_SECONDARY_LUNARSHARD_NAME"; mySkillDef.keywordTokens = new string[] { "KEYWORD_AGILE" }; LoadoutAPI.AddSkillDef(mySkillDef); Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "PALADIN_LUNARSHARDUNLOCKABLE_REWARD_ID", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; }
void RegisterStates() { // register the entitystates for networking reasons LoadoutAPI.AddSkill(typeof(ExampleSurvivorFireArrow)); LoadoutAPI.AddSkill(typeof(GutsSwordAttack)); }
private static void SetupSkills() { // If you're confused about the language tokens, they're the proper way to add any strings used by the game. // We use AssetPlus API for that // ADD: -> We use R2API's LanguageAPI for that. LanguageAPI.Add("COMMANDO_SECONDARY_BACKUPSHIV_NAME", "Backup Shiv"); LanguageAPI.Add("COMMANDO_SECONDARY_BACKUPSHIV_DESCRIPTION", "Slice for <style=cIsDamage>220% damage</style>. <style=cIsHealing>Recover 7% health</style> on kill."); var mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(MyNameSpace.MyEntityStates.ExampleState)); // ADD: some comment about how the machines work // ADD: some comment about looking at the prefabs for the name of the machine // (EntityStateMachine) in the prefabs mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 7f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.cancelSprintingOnActivation = false; mySkillDef.dontAllowPastMaxStocks = true; mySkillDef.forceSprintDuringState = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.resetCooldownTimerOnUse = false; mySkillDef.stockToConsume = 1; mySkillDef.icon = Resources.Load <Sprite>("textures/achievementicons/texAttackSpeedIcon"); mySkillDef.skillDescriptionToken = "COMMANDO_SECONDARY_BACKUPSHIV_DESCRIPTION"; mySkillDef.skillName = "COMMANDO_SECONDARY_BACKUPSHIV_NAME"; mySkillDef.skillNameToken = mySkillDef.skillName; mySkillDef.keywordTokens = new string[] { "KEYWORD_RAPIDFIRE" }; LoadoutAPI.AddSkillDef(mySkillDef); //This adds our skilldef. If you don't do this, the skill will not work. var skillLocator = myCharacter.GetComponent <SkillLocator>(); //Note; if your character does not originally have a skill family for this, use the following: //skillLocator.special = gameObject.AddComponent<GenericSkill>(); //var newFamily = ScriptableObject.CreateInstance<SkillFamily>(); //LoadoutAPI.AddSkillFamily(newFamily); //skillLocator.special.SetFieldValue("_skillFamily", newFamily); //var specialSkillFamily = skillLocator.special.skillFamily; //Note; you can change component.primary to component.secondary , component.utility and component.special var skillFamily = skillLocator.secondary.skillFamily; //If this is an alternate skill, use this code. // Here, we add our skill as a variant to the exisiting Skill Family. Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableDef = null, viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; //Note; if your character does not originally have a skill family for this, use the following: //skillFamily.variants = new SkillFamily.Variant[1]; // substitute 1 for the number of skill variants you are implementing //If this is the default/first skill, copy this code and remove the //, //skillFamily.variants[0] = new SkillFamily.Variant //{ // skillDef = mySkillDef, // unlockableName = "", // viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) //}; }
void PrimarySetup() { SkillLocator component = characterPrefab.GetComponent <SkillLocator>(); LanguageAPI.Add("EXAMPLESURVIVOR_PRIMARY_CROSSBOW_NAME", "Crossbow"); LanguageAPI.Add("EXAMPLESURVIVOR_PRIMARY_CROSSBOW_DESCRIPTION", "Fire an arrow, dealing <style=cIsDamage>200% damage</style>."); // set up your primary skill def here! SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(ExampleSurvivorFireArrow)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 0f; mySkillDef.beginSkillCooldownOnSkillEnd = false; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon1; mySkillDef.skillDescriptionToken = "EXAMPLESURVIVOR_PRIMARY_CROSSBOW_DESCRIPTION"; mySkillDef.skillName = "EXAMPLESURVIVOR_PRIMARY_CROSSBOW_NAME"; mySkillDef.skillNameToken = "EXAMPLESURVIVOR_PRIMARY_CROSSBOW_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); component.primary = characterPrefab.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); component.primary.SetFieldValue("_skillFamily", newFamily); SkillFamily skillFamily = component.primary.skillFamily; skillFamily.variants[0] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; // add this code after defining a new skilldef if you're adding an alternate skill /*Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); * skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant * { * skillDef = newSkillDef, * unlockableName = "", * viewableNode = new ViewablesCatalog.Node(newSkillDef.skillNameToken, false, null) * };*/ Debug.LogWarning("finished PrimarySetup"); }
internal static void SecondarySetup() { SkillLocator component = characterPrefab.GetComponent <SkillLocator>(); LanguageAPI.Add("ROCKETEER_SECONDARY_DETPACK_NAME", "Sticky Grenades"); LanguageAPI.Add("ROCKETEER_SECONDARY_DETPACK_DESCRIPTION", "Stick to the wall. Or a guy. <style=cIsDamage>600% Damage.</style>"); // set up your primary skill def here! SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(RocketeerAimDetpack)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 3; mySkillDef.baseRechargeInterval = 3f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Skill; mySkillDef.isCombatSkill = true; mySkillDef.mustKeyPress = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.stockToConsume = 1; mySkillDef.icon = Resources.Load <Sprite>("Textures/MiscIcons/texMysteryIcon"); mySkillDef.skillDescriptionToken = "ROCKETEER_SECONDARY_DETPACK_DESCRIPTION"; mySkillDef.skillName = "ROCKETEER_SECONDARY_DETPACK_NAME"; mySkillDef.skillNameToken = "ROCKETEER_SECONDARY_DETPACK_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); component.secondary = characterPrefab.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); component.secondary.SetFieldValue("_skillFamily", newFamily); SkillFamily skillFamily = component.secondary.skillFamily; skillFamily.variants[0] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; // add this code after defining a new skilldef if you're adding an alternate skill /*Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); * skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant * { * skillDef = newSkillDef, * unlockableName = "", * viewableNode = new ViewablesCatalog.Node(newSkillDef.skillNameToken, false, null) * };*/ ContentPacks.skillDefs.Add(mySkillDef); ContentPacks.skillFamilies.Add(newFamily); LoadoutAPI.AddSkill(typeof(RocketeerAimDetpack)); }
private void Awake() { using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SkinTest.skintest")) { var MainAssetBundle = AssetBundle.LoadFromStream(assetStream); ResourcesAPI.AddProvider(new AssetBundleResourcesProvider("@SkinTest", MainAssetBundle)); } var commandoPrefab = Resources.Load <GameObject>("prefabs/characterbodies/CommandoBody").InstantiateClone("CommandoCopy"); var commandoBody = commandoPrefab.GetComponent <CharacterBody>(); commandoBody.baseNameToken = "test"; Debug.Log(string.Join(", ", commandoPrefab.GetComponentInChildren <SkinnedMeshRenderer>().bones.Select(el => "'" + el.name + "'"))); BodyCatalog.getAdditionalEntries += (list) => list.Add(commandoPrefab); var mySurvivorDef = new SurvivorDef { name = "Test commando" + Environment.NewLine, bodyPrefab = commandoPrefab, descriptionToken = "Test commando", displayPrefab = Resources.Load <GameObject>("prefabs/characterdisplays/CommandoDisplay").InstantiateClone("CommandoTestDisplay", false), primaryColor = new Color(0.8039216f, 0.482352942f, 0.843137264f), unlockableName = "", }; SurvivorAPI.AddSurvivor(mySurvivorDef); var skinController = commandoPrefab.GetComponentInChildren <ModelSkinController>(); var mdl = skinController.gameObject; var renderer = mdl.GetComponentInChildren <SkinnedMeshRenderer>(); var renderers = mdl.transform.GetChild(0).GetComponentsInChildren <Renderer>(); var altSkin = new LoadoutAPI.SkinDefInfo(); altSkin.Name = "ComandoCustomAlt"; altSkin.NameToken = "TEST_SKIN"; altSkin.RootObject = mdl; altSkin.BaseSkins = new SkinDef[0];// { skinController.skins[0] }; altSkin.UnlockableName = ""; altSkin.RendererInfos = new CharacterModel.RendererInfo[] { new CharacterModel.RendererInfo() { defaultMaterial = Resources.Load <Material>("@SkinTest:Assets/Resources/matMercAlt.mat"), defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false, renderer = renderer }, new CharacterModel.RendererInfo() { defaultMaterial = Resources.Load <Material>("@SkinTest:Assets/Resources/matMercAlt.mat"), defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false, renderer = renderers[0] }, new CharacterModel.RendererInfo() { defaultMaterial = Resources.Load <Material>("@SkinTest:Assets/Resources/matMercAlt.mat"), defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false, renderer = renderers[1] } }; altSkin.GameObjectActivations = new SkinDef.GameObjectActivation[0]; //altSkin.MinionSkinReplacements = new SkinDef.MinionSkinReplacement[0]; //altSkin.ProjectileGhostReplacements = new SkinDef.ProjectileGhostReplacement[0]; altSkin.MeshReplacements = new SkinDef.MeshReplacement[] { new SkinDef.MeshReplacement() { mesh = Resources.Load <Mesh>("@SkinTest:Assets/Resources/skintest.blend"), renderer = renderer } }; Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = LoadoutAPI.CreateNewSkinDef(altSkin); }
private static void UtilitySetup() { SkillLocator component = WispSurvivor.characterPrefab.GetComponent <SkillLocator>(); LanguageAPI.Add("WISP_SIPHON_NAME", "Siphon"); LanguageAPI.Add("WISP_SIPHON_DESCRIPTION", "<style=cIsHealing>Tether</style> to the nearest enemy. Drain their health and convert into <style=cShrine>barrier</style>"); SkillDef mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(EntityStates.WispSurvivorStates.WispSiphon)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 1f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = false; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.PrioritySkill; mySkillDef.isBullets = false; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = true; mySkillDef.noSprint = false; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 1f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Assets.icon3_siphon; mySkillDef.skillDescriptionToken = "WISP_SIPHON_DESCRIPTION"; mySkillDef.skillName = "WISP_SIPHON_NAME"; mySkillDef.skillNameToken = "WISP_SIPHON_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); component.utility = WispSurvivor.characterPrefab.AddComponent <GenericSkill>(); SkillFamily newFamily = ScriptableObject.CreateInstance <SkillFamily>(); newFamily.variants = new SkillFamily.Variant[1]; LoadoutAPI.AddSkillFamily(newFamily); component.utility.SetFieldValue("_skillFamily", newFamily); SkillFamily skillFamily = component.utility.skillFamily; skillFamily.variants[0] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; siphonSkillDef = mySkillDef; short siphonIndex = EntityStates.StateIndexTable.TypeToIndex(typeof(EntityStates.WispSurvivorStates.WispSiphon)); LanguageAPI.Add("WISP_TETHER_NAME", "Tether"); LanguageAPI.Add("WISP_TETHER_DESCRIPTION", "<style=cIsHealing>Tether</style> to the nearest ally and increase regen rate. Gain <style=cShrine>barrier</style> when they deal damage."); SkillDef tetherDef = ScriptableObject.CreateInstance <SkillDef>(); tetherDef.activationState = new SerializableEntityStateType(typeof(EntityStates.WispSurvivorStates.WispTether)); tetherDef.activationStateMachineName = "Weapon"; tetherDef.baseMaxStock = 1; tetherDef.baseRechargeInterval = 1f; tetherDef.beginSkillCooldownOnSkillEnd = true; tetherDef.canceledFromSprinting = false; tetherDef.fullRestockOnAssign = true; tetherDef.interruptPriority = InterruptPriority.PrioritySkill; tetherDef.isBullets = false; tetherDef.isCombatSkill = false; tetherDef.mustKeyPress = true; tetherDef.noSprint = false; tetherDef.rechargeStock = 1; tetherDef.requiredStock = 1; tetherDef.shootDelay = 1f; tetherDef.stockToConsume = 1; tetherDef.icon = Assets.icon3_tether; tetherDef.skillDescriptionToken = "WISP_TETHER_DESCRIPTION"; tetherDef.skillName = "WISP_TETHER_NAME"; tetherDef.skillNameToken = "WISP_TETHER_NAME"; LoadoutAPI.AddSkillDef(tetherDef); //For some reason this isn't loading properly, so tetherIndex will always resolve to -1 tetherSkillDef = tetherDef; short tetherIndex = EntityStates.StateIndexTable.TypeToIndex(typeof(EntityStates.WispSurvivorStates.WispTether)); if (tetherIndex == -1) { Debug.LogError("Issue setting up tether skilldef! Attempting to re-add..."); TryAddSkill(typeof(EntityStates.WispSurvivorStates.WispTether)); //So...we just add again tetherIndex = EntityStates.StateIndexTable.TypeToIndex(typeof(EntityStates.WispSurvivorStates.WispTether)); } Debug.Log("Set up tether skilldef. Index: " + tetherIndex); /* * Debug.Log("Last indicies: "); * for(short i = siphonIndex; i < tetherIndex; i++) * { * Debug.Log(i + ": " + StateIndexTable.IndexToType(i)); * } */ // add this code after defining a new skilldef if you're adding an alternate skill Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = tetherDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(tetherDef.skillNameToken, false, null) }; }
public static void Create() { stanWorshipperBody = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/characterbodies/BanditBody"), "StanWorshipperBody", true); stanWorshipperBody.GetComponent <NetworkIdentity>().localPlayerAuthority = true; CharacterBody bodyComponent = stanWorshipperBody.GetComponent <CharacterBody>(); bodyComponent.bodyIndex = BodyIndex.None; bodyComponent.baseNameToken = "STANWORSHIPPER_NAME"; bodyComponent.subtitleNameToken = "STANWORSHIPPER_SUBTITLE"; bodyComponent.bodyFlags = CharacterBody.BodyFlags.ImmuneToExecutes; bodyComponent.rootMotionInMainState = false; bodyComponent.mainRootSpeed = 0; bodyComponent.baseMaxHealth = 100; bodyComponent.levelMaxHealth = 28; bodyComponent.baseRegen = 0.5f; bodyComponent.levelRegen = 0.25f; bodyComponent.baseMaxShield = 0; bodyComponent.levelMaxShield = 0; bodyComponent.baseMoveSpeed = 7; bodyComponent.levelMoveSpeed = 0; bodyComponent.baseAcceleration = 80; bodyComponent.baseJumpPower = 15; bodyComponent.levelJumpPower = 0; bodyComponent.baseDamage = 13; bodyComponent.levelDamage = 3.3f; bodyComponent.baseAttackSpeed = 1; bodyComponent.levelAttackSpeed = 0; bodyComponent.baseCrit = 1; bodyComponent.levelCrit = 0; bodyComponent.baseArmor = 5; bodyComponent.levelArmor = 0; bodyComponent.baseJumpCount = 1; bodyComponent.sprintingSpeedMultiplier = 1.45f; bodyComponent.wasLucky = false; bodyComponent.hideCrosshair = false; bodyComponent.hullClassification = HullClassification.Human; bodyComponent.portraitIcon = Resources.Load <Texture>("textures/bodyicons/ScavBody"); bodyComponent.isChampion = false; bodyComponent.currentVehicle = null; bodyComponent.skinIndex = 0U; bodyComponent.bodyColor = new Color(0.6f, 0.3f, 0f); NetworkStateMachine networkStateMachine = stanWorshipperBody.GetComponent <NetworkStateMachine>(); EntityStateMachine customEntityStateMachine = stanWorshipperBody.AddComponent <EntityStateMachine>(); customEntityStateMachine.customName = "Sacrifice"; customEntityStateMachine.mainStateType = new SerializableEntityStateType(typeof(Idle)); customEntityStateMachine.initialStateType = new SerializableEntityStateType(typeof(Idle)); ArrayUtils.ArrayAppend(ref networkStateMachine.stateMachines, customEntityStateMachine); //Adds a default placeholder skin to prevent weird errors (another disgusting waste of my time :D). GameObject model = stanWorshipperBody.GetComponent <ModelLocator>().modelTransform.gameObject; CharacterModel characterModel = model.GetComponent <CharacterModel>(); ModelSkinController skinController = model.AddComponent <ModelSkinController>(); CharacterModel.RendererInfo[] renderInfos = characterModel.baseRendererInfos; LoadoutAPI.SkinDefInfo skinDefInfo = new LoadoutAPI.SkinDefInfo { BaseSkins = Array.Empty <SkinDef>(), GameObjectActivations = new SkinDef.GameObjectActivation[0], Icon = Assets.emptyIcon, MeshReplacements = new SkinDef.MeshReplacement[0], MinionSkinReplacements = new SkinDef.MinionSkinReplacement[0], Name = "STANWORSHIPPER_NAME", NameToken = "STANWORSHIPPER_NAME", ProjectileGhostReplacements = new SkinDef.ProjectileGhostReplacement[0], RendererInfos = renderInfos, RootObject = model }; SkinDef skin = LoadoutAPI.CreateNewSkinDef(skinDefInfo); skinController.skins = new SkinDef[] { skin }; //Doppelganger stanWorshipperDoppelganger = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterMasters/CommandoMonsterMaster"), "StanWorshipperMonsterMaster", true); if (!stanWorshipperDoppelganger.GetComponent <NetworkIdentity>()) { stanWorshipperDoppelganger.AddComponent <NetworkIdentity>(); } CharacterMaster component = stanWorshipperDoppelganger.GetComponent <CharacterMaster>(); component.bodyPrefab = stanWorshipperBody; }
internal override void SetupAttributes() { var oldDef = Resources.Load <SkillDef>("skilldefs/magebody/MageBodyFlamethrower"); myDef = CloneSkillDef(oldDef); var nametoken = "CLASSICITEMS_SCEPMAGE_FLAMETHROWERNAME"; newDescToken = "CLASSICITEMS_SCEPMAGE_FLAMETHROWERDESC"; oldDescToken = oldDef.skillDescriptionToken; var namestr = "Dragon's Breath"; LanguageAPI.Add(nametoken, namestr); myDef.skillName = namestr; myDef.skillNameToken = nametoken; myDef.skillDescriptionToken = newDescToken; myDef.icon = Resources.Load <Sprite>("@ClassicItems:Assets/ClassicItems/icons/scepter/mage_flamethrowericon.png"); LoadoutAPI.AddSkillDef(myDef); projCloud = Resources.Load <GameObject>("prefabs/projectiles/BeetleQueenAcid").InstantiateClone("CIScepMageFlamethrowerCloud"); var pdz = projCloud.GetComponent <ProjectileDotZone>(); pdz.lifetime = 10f; pdz.impactEffect = null; pdz.fireFrequency = 2f; var fxObj = projCloud.transform.Find("FX"); fxObj.Find("Spittle").gameObject.SetActive(false); fxObj.Find("Decal").gameObject.SetActive(false); fxObj.Find("Gas").gameObject.SetActive(false); foreach (var x in fxObj.GetComponents <AnimateShaderAlpha>()) { x.enabled = false; } var fxcloud = UnityEngine.Object.Instantiate(Resources.Load <GameObject>("prefabs/FireTrail").GetComponent <DamageTrail>().segmentPrefab, fxObj.transform); var psmain = fxcloud.GetComponent <ParticleSystem>().main; psmain.duration = 10f; psmain.gravityModifier = -0.05f; var pstartx = psmain.startSizeX; pstartx.constantMin *= 0.75f; pstartx.constantMax *= 0.75f; var pstarty = psmain.startSizeY; pstarty.constantMin *= 0.75f; pstarty.constantMax *= 0.75f; var pstartz = psmain.startSizeZ; pstartz.constantMin *= 0.75f; pstartz.constantMax *= 0.75f; var pslife = psmain.startLifetime; pslife.constantMin = 0.75f; pslife.constantMax = 1.5f; fxcloud.GetComponent <DestroyOnTimer>().enabled = false; fxcloud.transform.localPosition = Vector3.zero; fxcloud.transform.localScale = Vector3.one; var psshape = fxcloud.GetComponent <ParticleSystem>().shape; psshape.shapeType = ParticleSystemShapeType.Sphere; psshape.scale = Vector3.one * 1.5f; var psemit = fxcloud.GetComponent <ParticleSystem>().emission; psemit.rateOverTime = Scepter_V2.instance.artiFlamePerformanceMode ? 4f : 20f; var lightObj = fxObj.Find("Point Light").gameObject; if (Scepter_V2.instance.artiFlamePerformanceMode) { UnityEngine.Object.Destroy(lightObj); } else { var lightCpt = lightObj.GetComponent <Light>(); lightCpt.color = new Color(1f, 0.5f, 0.2f); lightCpt.intensity = 3.5f; lightCpt.range = 5f; } ProjectileCatalog.getAdditionalEntries += (list) => list.Add(projCloud); }
public void Awake() { // myCharacter should either be // Resources.Load<GameObject>("prefabs/characterbodies/BanditBody"); // or BodyCatalog.FindBodyIndex("BanditBody"); var myCharacter = Resources.Load <GameObject>("prefabs/characterbodies/MageBody"); // If you're confused about the language tokens, they're the proper way to add any strings used by the game. // We use AssetPlus API for that var mySurvivorDef = new SurvivorDef { //We're finding the body prefab here, bodyPrefab = myCharacter, //Description descriptionToken = "MAGE_DESCRIPTION", //Display displayPrefab = Resources.Load <GameObject>("Prefabs/Characters/MageDisplay"), //Color on select screen primaryColor = new Color(0.8039216f, 0.482352942f, 0.843137264f), //Unlockable name unlockableName = "", }; SurvivorAPI.AddSurvivor(mySurvivorDef); var mySkillDef = ScriptableObject.CreateInstance <SkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(ThunderDownUnder.ImprovedArtificer.TEntityStates.ExampleState)); mySkillDef.activationStateMachineName = "Weapon"; mySkillDef.baseMaxStock = 1; mySkillDef.baseRechargeInterval = 0f; mySkillDef.beginSkillCooldownOnSkillEnd = true; mySkillDef.canceledFromSprinting = true; mySkillDef.fullRestockOnAssign = true; mySkillDef.interruptPriority = InterruptPriority.Any; mySkillDef.isBullets = true; mySkillDef.isCombatSkill = false; mySkillDef.mustKeyPress = false; mySkillDef.noSprint = true; mySkillDef.rechargeStock = 1; mySkillDef.requiredStock = 1; mySkillDef.shootDelay = 0.5f; mySkillDef.stockToConsume = 1; mySkillDef.icon = Resources.Load <Sprite>("NotAnActualPath"); mySkillDef.skillDescriptionToken = "CHARACTERNAME_SKILLSLOT_SKILLNAME_DESCRIPTION"; mySkillDef.skillName = "CHARACTERNAME_SKILLSLOT_SKILLNAME_NAME"; mySkillDef.skillNameToken = "CHARACTERNAME_SKILLSLOT_SKILLNAME_NAME"; LoadoutAPI.AddSkillDef(mySkillDef); //This adds our skilldef. If you don't do this, the skill will not work. var skillLocator = myCharacter.GetComponent <SkillLocator>(); //Note; if your character does not originally have a skill family for this, use the following: //skillLocator.special = gameObject.AddComponent<GenericSkill>(); //var newFamily = ScriptableObject.CreateInstance<SkillFamily>(); //LoadoutAPI.AddSkillFamily(newFamily); //skillLocator.special.SetFieldValue("_skillFamily", newFamily); //var specialSkillFamily = skillLocator.special.skillFamily; //Note; you can change component.primary to component.secondary , component.utility and component.special var skillFamily = skillLocator.primary.skillFamily; //If this is an alternate skill, use this code. // Here, we add our skill as a variant to the exisiting Skill Family. Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; //If this is the default/first skill, copy this code and remove the //, //skillFamily.variants[0] = new SkillFamily.Variant //{ // skillDef = mySkillDef, // unlockableName = "", // viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) //}; }