Jump to content

Help with ability modding?


Krazyguy75

Recommended Posts

So I'm attempting to make a sectoid clone with a support sort of Mindspin that grants all nearby units (in a radius around the sectoid) a random stat buff, but I, for the life of me, can't figure out how one would do that.

 

The ability code is too simple for me to make any sense of it. Any help, whether it'd be to solve my problem or simply refer me to a tutorial or some documentation that'd help me find my way, would be greatly appreciated.

Link to comment
Share on other sites

Thank you for your advice, but I've already done that...

 

This isn't my first project in unrealscript, though it is my first project in XCOM2 ability modding. I've completed the cloning of the unit, the reskinning of the unit, and the restatting of the unit. The only problem is with the ability.

 

I've looked at all the tutorials. I've downloaded and scried through most of the mods with new abilities. My problem is that patching together the mods doesn't seem to work.

 

I'd be happy just to give Mindspin an AoE, because I also need to do that in the future anyways, but even that doesn't work right.

Link to comment
Share on other sites

Yeah, I know, I've looked at all those. My current problem is that, no matter what I change, my game won't let me use it, as it claims there is no target, which makes no sense for an AoE. I'm assuming I'm missing something simple, but for the life of me, I can't figure it out.

 

What are the parts I'd need to change? I have the deadeye self targeting part, as well as the multitargeting radius. What else would I need to change to make it stop claiming there are no targets?

Link to comment
Share on other sites

Can you post your custom ability template here? I've been doing quite a bit of work on them lately, so I might be able to spot something. It's hard to start making suggestions without an idea of what you've already put in place.

 

If you've got the multi-targeting style already set, the next thing I can think of is that IIRC effects (at least, I think it's effects; maybe it's the multi-targeting style itself?) have flags for whether it can target friendly or enemy units; if those aren't set right, it won't pick up friendlies in the multi-target radius.

Edited by Lucubration
Link to comment
Share on other sites

static function X2AbilityTemplate AoeBuff()

{
	local X2AbilityTemplate					Template;
	local X2AbilityCost_ActionPoints			ActionPointCost;
	local X2AbilityCharges				        Charges;
	local X2AbilityCost_Charges				ChargeCost;
	local X2AbilityCooldown					Cooldown;
	local X2Condition_UnitProperty				UnitPropertyCondition;
	local X2AbilityTrigger_PlayerInput			InputTrigger;
	local X2Effect_PersistentStatChange			BuffEffect;
	local X2AbilityMultiTarget_Radius			MultiTarget;

	`CREATE_X2ABILITY_TEMPLATE(Template, 'AoeBuff');
	Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_adventshieldbearer_energyshield";

	Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_AlwaysShow;
	Template.AbilitySourceName = 'eAbilitySource_Standard';
	Template.Hostility = eHostility_Defensive;

	ActionPointCost = new class'X2AbilityCost_ActionPoints';
	ActionPointCost.iNumPoints = 1;
	ActionPointCost.bConsumeAllPoints = true;
	Template.AbilityCosts.AddItem(ActionPointCost);

	Charges = new class 'X2AbilityCharges';
	Charges.InitialCharges = 1;
	Template.AbilityCharges = Charges;

	ChargeCost = new class'X2AbilityCost_Charges';
	ChargeCost.NumCharges = 1;
	Template.AbilityCosts.AddItem(ChargeCost);

	Cooldown = new class'X2AbilityCooldown';
	Cooldown.iNumTurns = 1;
	Template.AbilityCooldown = Cooldown;

	
	Template.AbilityShooterConditions.AddItem(default.LivingShooterProperty);

	
	Template.AbilityToHitCalc = default.DeadEye;
	Template.AbilityTargetStyle = default.SelfTarget;


	MultiTarget = new class'X2AbilityMultiTarget_Radius';
	MultiTarget.fTargetRadius = 5;
	MultiTarget.bIgnoreBlockingCover = true;
	Template.AbilityMultiTargetStyle = MultiTarget;

	InputTrigger = new class'X2AbilityTrigger_PlayerInput';
	Template.AbilityTriggers.AddItem(InputTrigger);

	
	UnitPropertyCondition = new class'X2Condition_UnitProperty';
	UnitPropertyCondition.ExcludeDead = true;
	UnitPropertyCondition.ExcludeFriendlyToSource = false;
	UnitPropertyCondition.ExcludeHostileToSource = true;
	UnitPropertyCondition.ExcludeCivilian = true;
	UnitPropertyCondition.FailOnNonUnits = true;
	Template.AbilityMultiTargetConditions.AddItem(UnitPropertyCondition);

	BuffEffect = new class 'X2Effect_PersistentStatChange';
	BuffEffect.EffectName = 'BuffEffect';
	BuffEffect.BuildPersistentEffect(2, false, true, , eGameRule_PlayerTurnBegin);
	BuffEffect.AddPersistentStatChange(eStat_Hp, 5);
	BuffEffect.SetDisplayInfo(ePerkBuff_Bonus, Template.LocFriendlyName, Template.GetMyLongDescription(), Template.IconImage, true,, Template.AbilitySourceName);
	
	Template.AddShooterEffect(BuffEffect);
	Template.AddMultiTargetEffect(BuffEffect);

	Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
	Template.BuildVisualizationFn = TypicalAbility_BuildVisualization;
	
	Template.bSkipFireAction = true;

	return Template;
}

Here's a quick change on the shieldbearer's ability. Worked fine in debug-tactical.

Link to comment
Share on other sites

Hunh. I figured it'd be something obvious, too, but that looks correct.

 

Maybe try setting up single-target conditions in addition to your multi-target condition? Regardless of other targets caught in the radius, from what you describe it sounds like it's trying to find a valid primary target apply it to and failing.

Link to comment
Share on other sites

Hunh. I figured it'd be something obvious, too, but that looks correct.

 

Maybe try setting up single-target conditions in addition to your multi-target condition? Regardless of other targets caught in the radius, from what you describe it sounds like it's trying to find a valid primary target apply it to and failing.

 

That's not my code, he's trying to help me as well. That code should work. At the dentist RN, will post my code when I get back. My mistake will probably be obvious.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...