Question about class overrides
Posted: Tue Feb 09, 2016 8:44 am
Hi,
i hope its ok that i bother you with questions about this example. But at the moment it seems like nobody is able to help me in the 2k and reddit modding forums. I think modders new to xcom 2 have just not enough experience to answer this kind of question so i hope you guys can help me.
What i try to achieve is to change the scamper behavior. I would like to let all units on the map scamper once in the direction of the player(but don't automatically attack, just taking cover). They should react like a normal military unit that gets the radio call "enemy is attacking from the south". Then they should not get any more free movements(because this brings too much randomness in to the matches and removes tactics like diversionary tactics combined flank attacks completely from the game.
I tried to make this changes in the Class XComGameState_Unit by overriding the function UnitAGainsKnowledgeOfUnitB and boiled the code down to make it as easily readable as possible:
It also has this Ini-Entry:
However: the red screen is never shown. And also if i copy the content of the original function it is never called.
I've uploaded the project here
https://www.dropbox.com/s/qiiu4czu2k...ement.zip?dl=0
Is it because the function is static? Or is it never called at all? Another modder gave me the tip that they probably call static function directly over the class name. For example "XComGameState_Unit.UnitAGainsKnowledgeOfUnitB(...)" and bypass all overrides by doing it.
That's why i searched for another function and found CanScamper in XComGameState_AIGroup. But again it does not want to work:
Any idea what I'm doing wrong? It shows no errors on compilation or something. Tried it for hours in various ways but i have no clue what could be wrong.
Would be nice if someone with a clue could give me a hint.
Thanks!
i hope its ok that i bother you with questions about this example. But at the moment it seems like nobody is able to help me in the 2k and reddit modding forums. I think modders new to xcom 2 have just not enough experience to answer this kind of question so i hope you guys can help me.
What i try to achieve is to change the scamper behavior. I would like to let all units on the map scamper once in the direction of the player(but don't automatically attack, just taking cover). They should react like a normal military unit that gets the radio call "enemy is attacking from the south". Then they should not get any more free movements(because this brings too much randomness in to the matches and removes tactics like diversionary tactics combined flank attacks completely from the game.
I tried to make this changes in the Class XComGameState_Unit by overriding the function UnitAGainsKnowledgeOfUnitB and boiled the code down to make it as easily readable as possible:
Code: Select all
// This is an Unreal Script
class XComGameState_Unit_Override extends XComGameState_Unit dependson(XComCoverInterface);
static function UnitAGainsKnowledgeOfUnitB(XComGameState_Unit UnitA, XComGameState_Unit UnitB, XComGameState AlertInstigatingGameState, EAlertCause AlertCause, bool bUnitAIsMidMove)
{
`RedScreen("Override Successfull");
}
Code: Select all
[Engine.ScriptPackages]
+NonNativePackages=NoReactionMovement
[Engine.Engine]
+ModClassOverrides=(BaseGameClass="XComGameState_Unit", ModClass="XComGameState_Unit_Override")
I've uploaded the project here
https://www.dropbox.com/s/qiiu4czu2k...ement.zip?dl=0
Is it because the function is static? Or is it never called at all? Another modder gave me the tip that they probably call static function directly over the class name. For example "XComGameState_Unit.UnitAGainsKnowledgeOfUnitB(...)" and bypass all overrides by doing it.
That's why i searched for another function and found CanScamper in XComGameState_AIGroup. But again it does not want to work:
Code: Select all
// This is an Unreal Script
class XComGameState_AIGroup_Override
extends XComGameState_AIGroup
dependson(XComAISpawnManager, XComGameState_AIUnitData);
private function bool CanScamper(XComGameState_Unit UnitStateObject)
{
return false;
}
Would be nice if someone with a clue could give me a hint.
Thanks!