fxsjosh Posted July 6, 2016 Share Posted July 6, 2016 All effects have an ApplyChance field if you just want a simple chance. UnconsciousEffect.ApplyChance = 50; (for example) Link to comment Share on other sites More sharing options...
kexx456 Posted July 6, 2016 Author Share Posted July 6, 2016 Ok, that sounds easy enough. I'm just very, very new at this whole modding thing. I've come a long way, but mainly copying and modifying existing assets/scripts from game/other users. I don't know how to create or write new code. What do I need to write, or where do I put that "UnconsciousEffect.ApplyChance = 50;" part? Does it need a "Template." before it? Does it need additional lines? I'm sorry if this seems dumb, it's just hard for me to understand this new language. I'm trying though! Link to comment Share on other sites More sharing options...
kexx456 Posted July 16, 2016 Author Share Posted July 16, 2016 Hey all. Still in need of assistance for making the UnconsciousEffect be a %-based ability, and not a guarantee. But that's not on my priority list right now. I finally gave the enemy an autopsy, and and an item based on that autopsy. It grants immunity to unconscious, it adds a 3rd turn, and it gives 2HP like other vests. Only... it's not giving 2HP like other vests, and I've copied exactly the code from the base game. Stasis Vest, Nanoscale Vest, Plated Vest, Hazmat Vest, even other vests modders have published. They're all written exactly the same: X2Item_Vest, and X2Ability_VestAbility, with their proper stats and codes and such, and they're all the same, at least in the persistenteffect to grant 2HP, and for the life of me, I can't figure out why it's not doing it in mine. Please, someone help me with this simple thing! Here's what the Item code looks like: class X2Item_SleipnirVest extends X2Item config(GameCore); var config int SLEIPNIR_VEST_HP_BONUS; static function array<X2DataTemplate> CreateTemplates() { local array<X2DataTemplate> Items; Items.AddItem(CreateSleipnirVest()); return Items; } static function X2DataTemplate CreateSleipnirVest() { local X2EquipmentTemplate Template; local ArtifactCost Resources; local ArtifactCost Artifacts; `CREATE_X2TEMPLATE(class'X2EquipmentTemplate', Template, 'SleipnirVest'); Template.ItemCat = 'defense'; Template.InventorySlot = eInvSlot_Utility; Template.strImage = "img:///GameUnit_Valkyrie.ScienceIcons.Inv_SleipnirVest"; //create green vest icon. Template.EquipSound = "StrategyUI_Vest_Equip"; // Template.Abilities.AddItem('SleipnirVestAbility'); // Template.CanBeBuilt = true; Template.TradingPostValue = 25; Template.Tier = 2; Template.SetUIStatMarkup(class'XLocalizedData'.default.HealthLabel, eStat_HP, default.SLEIPNIR_VEST_HP_BONUS); // Requirements Template.Requirements.RequiredTechs.AddItem('AutopsyValkyrie'); // Cost Resources.ItemTemplateName = 'Supplies'; Resources.Quantity = 100; Template.Cost.ResourceCosts.AddItem(Resources); Resources.ItemTemplateName = 'AlienAlloy'; Resources.Quantity = 15; Template.Cost.ResourceCosts.AddItem(Resources); Resources.ItemTemplateName = 'EleriumDust'; Resources.Quantity = 10; Template.Cost.ResourceCosts.AddItem(Resources); Artifacts.ItemTemplateName = 'CorpseValkyrie'; Artifacts.Quantity = 1; //Want 4, it's 1 for testing purposes. Template.Cost.ArtifactCosts.AddItem(Artifacts); return Template;Here's what the Ability looks like: class X2Ability_SleipnirVest extends X2Ability dependson (XComGameStateContext_Ability) config(GameCore); var config int SLEIPNIR_VEST_HP_BONUS; static function array<X2DataTemplate> CreateTemplates() { local array<X2DataTemplate> Templates; Templates.AddItem(SleipnirVestAbility()); return Templates; } static function X2AbilityTemplate SleipnirVestAbility() { local X2AbilityTemplate Template; local X2Effect_PersistentStatChange PersistentStatChangeEffect; local X2Effect_DamageImmunity DamageImmunity; local X2Effect_TurnStartActionPoints ThreeActionPoints; `CREATE_X2ABILITY_TEMPLATE(Template, 'SleipnirVestAbility'); Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_item_nanofibervest"; //Doesn't matter, doesn't show up. Template.AbilitySourceName = 'eAbilitySource_Item'; Template.eAbilityIconBehaviorHUD = EAbilityIconBehavior_NeverShow; Template.Hostility = eHostility_Neutral; Template.bDisplayInUITacticalText = false; Template.AbilityToHitCalc = default.DeadEye; Template.AbilityTargetStyle = default.SelfTarget; Template.AbilityTriggers.AddItem(default.UnitPostBeginPlayTrigger); // Bonus to health stat Effect // PersistentStatChangeEffect = new class'X2Effect_PersistentStatChange'; PersistentStatChangeEffect.BuildPersistentEffect(1, true, false, false); PersistentStatChangeEffect.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.GetMyLongDescription(), Template.IconImage, false, , Template.AbilitySourceName); PersistentStatChangeEffect.AddPersistentStatChange(eStat_HP, class'X2Ability_SleipnirVest'.default.SLEIPNIR_VEST_HP_BONUS); Template.AddTargetEffect(PersistentStatChangeEffect); // Protection from Unconscious // DamageImmunity = new class'X2Effect_DamageImmunity'; DamageImmunity.ImmuneTypes.AddItem('Unconscious'); DamageImmunity.BuildPersistentEffect(1, true, false, false); DamageImmunity.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.GetMyLongDescription(), Template.IconImage, false, , Template.AbilitySourceName); Template.AddTargetEffect(DamageImmunity); // Adds an additional turn, for 3 total. // ThreeActionPoints = new class'X2Effect_TurnStartActionPoints'; ThreeActionPoints.ActionPointType = class'X2CharacterTemplateManager'.default.StandardActionPoint; ThreeActionPoints.NumActionPoints = 1; ThreeActionPoints.bInfiniteDuration = true; Template.AddTargetEffect(ThreeActionPoints); Template.BuildNewGameStateFn = TypicalAbility_BuildGameState; return Template; }You'll notice both reference GameCore for the HP. I've tried it with it only being reference by one, by the other, and by both. Hell, it's a nice thing to add for modders, but I'll settle with it not being configurable and just have a flat number "+2" in there somewhere, I just don't know where to put it. Everything else works beautifully, I just don't understand why this isn't sticking. Also, and probably related, I'm not seeing the stats granted of the vest in the armory screen. Here's a pic to illustrate: http://i.imgur.com/emr5GTu.png Help! Link to comment Share on other sites More sharing options...
Recommended Posts