Jump to content

How to apply a buff/debuff to an alien


SpazmoJones

Recommended Posts

I've been going through the code trying to figure out how buffs and debuffs are applied to aliens, but it's been slow going. For example, if I wanted to apply a flashbang effect, or a blood call effect to an alien, which variables do I need to modify in the aliens XGUnit class? Also, where is the effect duration stored?

 

I tried to figure this out for flashbangs but I ended up going in circles. There's a particular flashbang class that "applies" the effect based on aliens in the blast radius, but it wasn't very clear as to which variables were being changed. Also I couldn't find any references to the disorientation penalties applied, and there seems to be more than one state of disorientation, so I'm a bit muddled.

 

Can anyone shed some light on how this works?

Link to comment
Share on other sites

I haven't looked deeply into this myself, but that's what I remember.

 

EXALT arrays apply Disabling Shot ability when hacked. This is done via static (i.e. object-independent) function XGAbility_DisablingShot.ApplyDisablingShot. It's EW specific, as EU class doesn't have any static functions, and most probably was coded in for this one purpose.

 

For other abilities you need to spawn the one you need and then apply the effect.

 

Also XGAbilityTree class (XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.m_kAbilities object in game) has ApplyEffectsToTarget function, but it also requires XGAbility_Targeted object to be spawned first.

Link to comment
Share on other sites

I haven't looked deeply into this myself, but that's what I remember.

 

EXALT arrays apply Disabling Shot ability when hacked. This is done via static (i.e. object-independent) function XGAbility_DisablingShot.ApplyDisablingShot. It's EW specific, as EU class doesn't have any static functions, and most probably was coded in for this one purpose.

 

For other abilities you need to spawn the one you need and then apply the effect.

 

Also XGAbilityTree class (XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.m_kAbilities object in game) has ApplyEffectsToTarget function, but it also requires XGAbility_Targeted object to be spawned first.

 

Thanks for the info!

 

This is unrelated, but I'm thinking you would know the answer to this one too.... :) Is it possible to change the type of an existing variable without breaking the game? I know you can change an int to an array of ints, but is it possible to reference a boolean variable as a byte (or maybe an int)?

 

Recently I discovered that it's possible to access "private" variables as if they're public when patching. I'm doing this now with my alien sight ring mod, which uses a private boolean variable as a "global" switch to enable or disable the ring display. If it's possible to reference the boolean as a byte I'd be able to use the same boolean variable to store many different flags.

Link to comment
Share on other sites

Yes, it is possible to change the type of variable and even it's owner, but you have to make sure it isn't used anywhere else, as calling the variable with the wrong type will cause CTD. You can use an old random pods mod as an example of such modifications. Also, feel free to post your code for me to check if you have any difficulties making it work.

 

Private and write protected (and some other) flags are relevant for compiler. They aren't actually checked in game, so you can write to private variable directly in bytecode. But again, those are made private for a reason. Setting the new value for such variables often requires a number of other recalculations. If you're fairly sure there are none or you can adjust all the related parameters manually, feel free to use this little cheat. :smile:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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