Zitat von
TopLayer
visualFX is a pointer to oCVisualFX object
So, if it is not zero you probably can read it's properties:
Code:
var int vobAttacker;
vobAttacker = MEM_ReadInt(visualFX + 1116);
Number 1116 is result of converting hex value
45C to decimal.
Thanks for help i tried to create new oCVisaulFx object and use visualFx as a pointer here then use it as a attackerPtr then PtrToInst as a vobAttacker but it wasnt effected.
With your solution all is fine only first tick doesnt contains any data because it must be written before i think. Then rest of ticks got needed data so its very good
It looks like this now:
Code:
var oSDamageDescriptor dmgDesc; dmgDesc = _^ (attackerPtr);
var c_npc oth; oth = _^(victimPtr);
var c_npc slf; slf = _^(dmgDesc.attackerNPC);
//Don't change anything if damage was not caused by NPC
if (dmgDesc.attackerNPC == 0)
|| (victimPtr == 0)
{
if (Hlp_StrCmp(MEM_ReadString(dmgDesc.visualFX + 1140), "spellFX_BreathOfDeath_Target"))
{
dmgDesc.attackerNPC = MEM_ReadInt(dmgDesc.visualFX + 1116);
dmgDesc.attackerVob = MEM_ReadInt(dmgDesc.visualFX + 1116);
dmgDesc.dmgMode = MEM_ReadInt(dmgDesc.visualFX + 1324);
dmgDesc.visualFXStr = MEM_ReadString(dmgDesc.visualFX + 1140);
};
return dmg;
};
For that first tick fix maybe i should use MEM_WriteInt? But which adresses IT would be?
I think the problem with this is because my OnDamage func is the post one so changing some dmgDesc pointers wont make any effect, that's what Lehona said in his thread. So he wrote a hook for pre damage func to make it edit those pointers. I mean this:
Code:
var int _DMG_DmgDesc;
func void _DMG_OnDmg_Post() {
EDI = DMG_OnDmg(EBP, MEM_ReadInt(MEM_ReadInt(ESP+644)+8), EDI, _DMG_DmgDesc);
};
func void _DMG_OnDmg_Pre() {
_DMG_DmgDesc = ESI; // I'm preeeeetty sure it won't get moved in the meantime...
};
func void InitDamage() {
const int dmg = 0;
if (dmg) { return; };
HookEngineF(6736583/*0x66CAC7*/, 5, _DMG_OnDmg_Post);
const int oCNpc__OnDamage_Hit = 6710800;
HookEngineF(oCNpc__OnDamage_Hit, 7, _DMG_OnDmg_Pre);
dmg = 1;
};
But unfortunately i have adresses only for hook post damage and dont have for pre for Gothic 1.