Hey. How to remove current focusing, if player is holding action key while drawing weapon?
Your code works, but not for this case. I should hook new function for "EV_DRAWWEAPON", or there is more efficient solution?
Cheers
What do you want to accomplish?
Stopping player from executing a killing blow?
Then this code will stop the player from being able to do it (Gothic 2 only)
Spoiler:(zum lesen bitte Text markieren)
Code:
func void _AlternativeUnsterblichkeit_Hook() {
const int oCAIHuman__offsetNpc = 300;
if (EDI == TRUE) {
var oCNpc her; her = _^(MEM_ReadInt(ESI + oCAIHuman__offsetNpc)); // oCAIHuman->npc
var C_NPC focus_Npc; focus_Npc = _^(her.focus_vob);
if (!Npc_CanDie(focus_Npc)) {
// Npc_CanDie is just a function that returns TRUE or FALSE depending on if the NPC should be killable
EDI = 0; // No Killing Blow
};
};
};
func void AlternativeUnsterblichkeit_Init() {
const int oCAIHuman__FightMelee_doFinish_G2Controls = 6912896; // 00697b80
const int oCAIHuman__FightMelee_doFinish_G1Controls = 6910260; // 00697134
HookEngineF(oCAIHuman__FightMelee_doFinish_G2Controls, 6, _AlternativeUnsterblichkeit_Hook); // G2 Steuerung
HookEngineF(oCAIHuman__FightMelee_doFinish_G1Controls, 8, _AlternativeUnsterblichkeit_Hook); // G1 Steuerung
};
Or do you simply want to re-focus (i.e. stop the player from focus-glitching by using the action button)
in this case, a hook for EV_DRAWWEAPON seem like a better plan.