Chracer Posted June 10, 2016 Share Posted June 10, 2016 Hello, I was able to create an ability that regenerates ShieldHP instead of HP by copying from the Regeneration Effect that is used by the Faceless. It works as long as the shield is not depleted. To be more specific: I have an Ability that adds two effects to the unit. The first one is the EnergyShield, that triggers only at the beginning of the game. The second one is the Regeneration, that triggers every turn and restores a part of the shield. //set up Shield at the beginning static function X2Effect_EnergyShield CreateShieldEffect(string FriendlyName, string LongDescription) { local X2Effect_EnergyShield ShieldEffect; ShieldEffect = new class'X2Effect_EnergyShield'; ShieldEffect.BuildPersistentEffect(1, true, true); //infinite effect, set up at beginning ShieldEffect.AddPersistentStatChange(eStat_ShieldHP, default.SHIELDVEST_POWER); return ShieldEffect; } //regenerate shield static function X2Effect_Persistent CreateShieldRegenerationEffect(X2Effect_EnergyShield ShieldEffect, string FriendlyName, string LongDescription) { local X2Effect_ShieldRegeneration ShieldRegenerationEffect; ShieldRegenerationEffect = new class'X2Effect_ShieldRegeneration'; ShieldRegenerationEffect.BuildPersistentEffect(1, true, true, false, eGameRule_PlayerTurnBegin); return ShieldRegenerationEffect; } I am not completely shure what causes the problem, but I think it is because the shield effect is removed when the unit takes enough damage (in XComGameState_Unit). Therefore there is no shield that can be refilled. I tried to reapply the first effect (within the second when ShieldHP < 1), but I think this still does not trigger it. And as I created it to be triggered only once, this does not help. Is there a simple way to trigger effects to be applied? I know there is a system to trigger events and listen to it, but I am not that far in the understanding of the code. Many thanks - also for your mods! Link to comment Share on other sites More sharing options...
NotSoLoneWolf Posted January 1, 2017 Share Posted January 1, 2017 Can you provide the rest of your code? I'm trying to replicate this for my own regeneration effect and I'm stuck on the: static function X2Effect_Persistent CreateShieldRegenerationEffect(X2Effect_EnergyShield ShieldEffect, string FriendlyName, string LongDescription) Specifically, the first parameter "X2Effect_EnergyShield ShieldEffect". When I call the function, I obviously put the name and description as parameters 2 and 3, but how do I write parameter 1? Link to comment Share on other sites More sharing options...
Chracer Posted January 2, 2017 Author Share Posted January 2, 2017 Though it has been a while, I still couldn't make the shield reappear. It seems I don't even use this parameter in the code. I removed it. Just write static function X2Effect_Persistent CreateShieldRegenerationEffect(string FriendlyName, string LongDescription) instead. Link to comment Share on other sites More sharing options...
Recommended Posts