CaptainLost
Oberleutnant
I am getting into SDK modding now and fiddling around with the ranged combat system brought me to this spot:
This is where the actual animation for the range strike is handled. MISSION_RANGE_ATTACK seems to be hidden within the DLL or EXE somewhere you can't get to it, and it does this:
Unfortunately this seems impossible. As far as I can tell by digging around in all of the SDK files, CvMissionDefinition - which is in CvStructs - just defines the variables required for the mission, and it's actually handled within getEntityIFace, which is defined in CvDLLUtilityIFaceBase.h but has no moddable counterpart anywhere else. The actual movement of the entity seems to be attached to ENTITY_EVENT_BOMBARD, which is used for both bombarding and ranged attacks.
I have tried
So, anyone know anything I could do to modify the animation path? I have had some ideas:
Code:
if (pPlot->isActiveVisible(false))
{
// Range strike entity mission
CvMissionDefinition kDefiniton;
kDefiniton.setMissionTime(GC.getMissionInfo(MISSION_RANGE_ATTACK).getTime() * gDLL->getSecsPerTurn());
kDefiniton.setMissionType(MISSION_RANGE_ATTACK);
kDefiniton.setPlot(pDefender->plot());
kDefiniton.setUnit(BATTLE_UNIT_ATTACKER, this);
kDefiniton.setUnit(BATTLE_UNIT_DEFENDER, pDefender);
gDLL->getEntityIFace()->AddMission(&kDefiniton);
//delay death
pDefender->getGroup()->setMissionTimer(GC.getMissionInfo(MISSION_RANGE_ATTACK).getTime());
}
This is where the actual animation for the range strike is handled. MISSION_RANGE_ATTACK seems to be hidden within the DLL or EXE somewhere you can't get to it, and it does this:
- Move defender entity to face the attacker entity. (Not an animation! If you change the animation for movement ("Run") it will still move the entity, it will just animate them running differently. Movement seems to be hidden in the EXE.)
- Animate the attacker shooting at the defender, and the defender taking damage. (This calls KFs which you can change in the KFM using Esemjay's KFM converter, but the actual call itself seems to be hidden in the EXE too.)
- Add a graphical effect for the explosion on the tile - this is controlled in EntityEventInfos, calling an effect in EffectInfos, and you can change or remove the effect as you please.
- Move the entities back into their positions. (Not an animation, see #1.)
Unfortunately this seems impossible. As far as I can tell by digging around in all of the SDK files, CvMissionDefinition - which is in CvStructs - just defines the variables required for the mission, and it's actually handled within getEntityIFace, which is defined in CvDLLUtilityIFaceBase.h but has no moddable counterpart anywhere else. The actual movement of the entity seems to be attached to ENTITY_EVENT_BOMBARD, which is used for both bombarding and ranged attacks.
I have tried
- Changing the animations called at different points in the kfm using Esemjay's converter. This does not affect the actual movement of the unit entity, but does make things funny.
- Setting pDefender to NULL in kDefinition.setUnit() in the snippet above. This works, and the defender does not rotate - but the attacker no longer fires its gun, either!
- Changing the mission type, the entity used for the mission, and so on - all of that seems to just result in a CTD.
- Setting the defender entity to be invisible (using setVisible, not the submarine/spy invisibility stuff but the actual entity itself) before starting the mission seemed to do nothing whatsoever - I assume the mission sets the entity to be visible when it is triggered.
- If you comment out the whole snippet I posted, then there are no animations at all, which sort of solves the problem but not in any satisfying way.
- There seems to be no way to trigger the animation manually - any way to trigger it has to go through the animation path ANIMATIONPATH_RANGED_STRIKE, which bundles the movement/facing/firing/animation all together itself.
So, anyone know anything I could do to modify the animation path? I have had some ideas:
- Spawn another defender temporarily in the same direction the attacker is shooting at, but really far away so the player doesn't see it - then use that one for the kDefinition and manually apply the explosion effect to the tile for the actual defender. Really not ideal but I think it would fake it okay.
- Edit the actual EXE file? Is that even a thing? Edit: No, no it is not.
- If there is a way to call specific KFs without going through the normal Civ4 methods that would do it too. But I know of no way.
- Rewrite the functions for animation paths in the SDK, maybe as overloads of the inaccessible functions, and use trial and error to figure out what they do? That's probably not possible
Last edited: