Jump to content

Detection Radius mod not working


Kregano

Recommended Posts

I decided to make an ability that lowers a unit's detection radius, pretty simple stuff. Mod builds with no errors, looks good on the strategy debug, but doesn't work at all on the tactical debug.

 

I deliberately copied some code from Shadowstep to display its icon while testing, but not only does the icon not show up, but the detection radius modified refuses to work either. I'm not certain of why that is, because it happens no matter what the modifier value is.

 

Code for reference:

class X2Ability_SlinkMaster extends X2Ability_RangerAbilitySet config(SlinkMaster);

var config float SLINK_DETECTIONRADIUSMODIFER;

static function array<X2DataTemplate> CreateTemplates()
{
	local array<X2DataTemplate> Templates;
	
	Templates.AddItem(SlinkMaster());

	return Templates;
}

static function X2AbilityTemplate SlinkMaster()
{
	local X2AbilityTemplate                 Template;	
	local X2Effect_PersistentStatChange		PersistentStatChangeEffect;

	`CREATE_X2ABILITY_TEMPLATE(Template, 'SlinkMaster');
	Template.AbilitySourceName = 'eAbilitySource_Perk';
	Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_NeverShow;
	Template.Hostility = eHostility_Neutral;
	Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_shadowstep";
	
	Template.AbilityToHitCalc = default.DeadEye;
	Template.AbilityTargetStyle = default.SelfTarget;
	Template.AbilityTriggers.AddItem(default.UnitPostBeginPlayTrigger);
	
	// Bonus to DetectionRange stat effects
	PersistentStatChangeEffect = new class'X2Effect_PersistentStatChange';
	PersistentStatChangeEffect.BuildPersistentEffect(1, true, false, false);
	PersistentStatChangeEffect.AddPersistentStatChange(eStat_DetectionModifier, default.SLINK_DETECTIONRADIUSMODIFER);
	Template.AddTargetEffect(PersistentStatChangeEffect);

	Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;

	return Template;	
}
[SlinkMaster.X2Ability_SlinkMaster]
SLINK_DETECTIONRADIUSMODIFER = 0.5f
Link to comment
Share on other sites

Fixed the icon problem - I accidentally omitted this:

PersistentStatChangeEffect.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.GetMyLongDescription(), Template.IconImage, true,,Template.AbilitySourceName);

Still haven't gotten any definitive sign that the ability is working.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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