Jump to content

Help with creating "simple" Flyover Visualization


DevilMod

Recommended Posts

Hello,

currently i am working on an update for my created custom class "LW Tank Class". He has a custom ability called "steadfast" which grants immunity to stun. The code for that is pretty simple, it triggers on mission start once a damage immunity for stun for the rest of the mission:

 

static function X2AbilityTemplate TankLWSteadfast()
{
	local X2AbilityTemplate				        Template;
	local X2AbilityTargetStyle                              TargetStyle;
	local X2AbilityTrigger				        Trigger;
	local X2Effect_TankClassLWSteadfast		        SteadfastEffect;

	`CREATE_X2ABILITY_TEMPLATE(Template, 'TankLWSteadfast');

	//Template.AdditionalAbilities.AddItem('TankLWSteadfastCreateEvent');
	//Template.AdditionalAbilities.AddItem('TankLWSteadfastFlyover');
	Template.AdditionalAbilities.AddItem('TankLWSteadfastPassiveInfo');

	Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_defend_panic";
	Template.AbilitySourceName = 'eAbilitySource_Perk';
	Template.eAbilityIconBehaviorHUD = EAbilityIconBehavior_NeverShow;
	Template.Hostility = eHostility_Neutral;

	Template.AbilityToHitCalc = default.DeadEye;

	TargetStyle = new class'X2AbilityTarget_Self';
	Template.AbilityTargetStyle = TargetStyle;

	Trigger = new class'X2AbilityTrigger_UnitPostBeginPlay';
	Template.AbilityTriggers.AddItem(Trigger);

	SteadfastEffect = new class'X2Effect_TankClassLWSteadfast';
	SteadfastEffect.BuildPersistentEffect(1, true, false, false);
	Template.AddTargetEffect(SteadfastEffect);

	Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
	//  NOTE: No visualization on purpose!

	Template.bCrossClassEligible = default.STEADFAST_AWC;

	return Template;
}

 

 

 

Here the code for the stun immunity:

 

class X2Effect_TankClassLWSteadfast extends X2Effect_Persistent;

function bool ProvidesDamageImmunity(XComGameState_Effect EffectState, name DamageType)
{
	return DamageType == 'stun';
}

 

 

 

The problem:

 

What i am trying to do now is to make a pop up about the soldier head (green flyover, something like: ("Steadfast: Immune"), every time this soldier would have been stunned, but steadfast saved him. The reason why I want to do this flyover is, to give the player a better gameplay feeling on how valuable this ability is. With such a flyover the player would know how often steadfast kicks or for example would know steadfast actually saved a soldiers life in a specific situation. In the vanilla game there is not such a mechanic. For example if you stun an avatar (which is immune to stun) nothing happens (no visualization, only the common damage visualization if the ability has also a damage effect, but nothing like immune). Sometimes stunlancers hit their targets without applying a negative effect. In this case the player would never know if it was a common "applychance miss" or steadfast saved the soldier.

 

Most flyovers in the vanilla game are created by activating an effect, ending an effect or on a tick. Some special popups like damage and miss is created in its own templates and i do not want to play with them (not overriting something). But it seems there is no common mechanic for what i am trying to do.

 

What i have tried so far:

 

working with bShowActivation and TypicalAbility_BuildVisualization (which triggers the ability friendlyname every time that ability is triggered). In my case I can not do this because the flyover would only trigger once at mission start (because my trigger is a UnitPostBeginPlay and i only add once the damage immunity).

 

my second attempt was to create only for the flyover a second ability with a different trigger. also with bShowActivation and SkipPerkActivation so he does only the flyover and not an animation. I tried the "ImpairingEffect" Listener as ability trigger, which worked to trigger the flyover, the problem is the "ImpairingEffect" Event not only triggers on stun but also on disorient and unconcious and the second problem is that "ImpairingEffect" only kicks if the negative effect is already applied, so a unit which is immune to stun cannot get impaired by stun.

 

My third attempt was a other event to listen and i tried the "UnitAttacked", which works better in this scenario. But in this case i have to make something like a condition to tell the game trigger only if the attack is a stuneffect or something like this, because "UnitAttacked" kicks, every time a unit in the game (also the soldier himself) is getting attacked (this can also be a medikit heal).

 

My Questions:

 

Does somebody know, how to make this happen or put me in the right direction?

 

Is there an easier way to make a "simple" flyover like this? In all my attemps the game would need to be interrupted i think (because technically i trigger an ability, if something happens), what is in my opinion not such a nice way of doing this. If so, am I on the right way to listen to a specific event with some conditions, to trigger that flyover? What I do not want is to override something in the basecode, to make it work.

 

Is it just impossible to make this in a "clean" way?

 

Can I create a custom event, or is that not possible and we are restricted to the events in the base game? Because i read in the LWS Forum a post from Amineri that we cannot create custom events.

 

Can give me someone an example on how that code must look? I am not such an advanced modder, i basically work with templates and some easy code. I am not 100% sure how gamestates, listeners and events are working.

 

Thank you all help is appreciated.

Edited by DevilMod
Link to comment
Share on other sites

  • Recently Browsing   0 members

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