View previous topic :: View next topic |
Author |
Message |
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Tue Jan 19, 2010 1:06 Post subject: Hooking |
|
|
*Endless gasp*
That aside, I'm looking to hook devcrit. I got some experience with nwnx and c++. I got some knowledge with Ollydbg and can most likely figure out a lot on my own. I assume it would be hooking "critical hit" and simply run a script and check for a fake-devcrit feat and administer saves/consequences within a ingame script instead of the usual fort or death. How hard/possible would it be to add to nwnx_events.dll?
Edit: Thread recycled. _________________ I dun have any signature, I'm happy anyway.
Last edited by Terra_777 on Wed Feb 24, 2010 14:27; edited 1 time in total |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Tue Jan 19, 2010 1:45 Post subject: |
|
|
hmm,
I've heard it said before that something like this, may cause lots of lag or sluggishness, because it would be hooking onto the combat message function.
At least, thats what I believe, I may be wrong, I have no experience making plugins per say.
Perhaps Zeb or virusman would have more insight. |
|
Back to top |
|
|
Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Tue Jan 19, 2010 1:46 Post subject: |
|
|
It's already in the Linux version of nwnx_events. Not sure about an ETA for the Windows version though... if ever. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Tue Jan 19, 2010 1:46 Post subject: |
|
|
er... yeah..
what he said. Lol |
|
Back to top |
|
|
Disco
Joined: 06 Dec 2006 Posts: 152
|
Posted: Tue Jan 19, 2010 13:38 Post subject: |
|
|
I guess returning an event on a crit (preferably including the roll) would be sufficient, if that helps. |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Sat Jan 23, 2010 19:25 Post subject: |
|
|
Alright, I've successfully hooked the fortitude roll that occurs upon devcrit (0x54D603). As it works now: devcrit savelessly kills everything without a roll mostly because the hook replaced the roll. How do I formulate the hook to manipulate the conditional jump marked on the picture to work if a certain variable is set to 1?
Code: | void DevastatingHookProc()
{
_asm { pushad }
if (!scriptRun)
{
_asm{
mov eax, edi
mov eax, [eax+4]
mov oPC, eax
}
if( oPC ){
events.FireEvent( oPC, 11 );
}
}
_asm { popad }
_asm { leave }
_asm { jmp DevastatingNextHook }
} |
_________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Thu Jan 28, 2010 2:30 Post subject: |
|
|
Hah, I totally figured out a solution myself. Where do I send the updated nwnx_event source? _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Thu Jan 28, 2010 5:30 Post subject: |
|
|
Nice. virusman should probably give you SVN access at this point. PM him with a username/password. _________________ Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/
<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.
<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for? |
|
Back to top |
|
|
ArielT
Joined: 26 Jan 2010 Posts: 30
|
Posted: Thu Jan 28, 2010 10:50 Post subject: |
|
|
Terra_777 wrote: | Hah, I totally figured out a solution myself. Where do I send the updated nwnx_event source? | Care to discuss what modifications you made?
Are you forcing it to fail the roll, then firing the script, or does ti kill the opponent no matter what? |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Thu Jan 28, 2010 13:18 Post subject: |
|
|
I hooked the function that determines if the weapon used to score a critical hit is prone for a devastating critical. Bioware default devastating doesnt happen, nwnx returns the item that scored the critical hit and GetAttackTarget() is used to get the target. Which means I've hooked critical hit since the check to determine devastating critical has to be done ingame instead. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Disco
Joined: 06 Dec 2006 Posts: 152
|
Posted: Fri Jan 29, 2010 15:20 Post subject: |
|
|
Can you (or did you) determine the actual roll? |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Fri Jan 29, 2010 16:22 Post subject: |
|
|
No, I wasn't able to get them. Data I got was the item that was used to whack the target. oPC = OBJECT_SELF, oTarget = GetAttackTarget( oPC ); and oItem = GetNWNXTarget( );. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Fri Jan 29, 2010 23:33 Post subject: |
|
|
Alright, I think I'll call it finished for now, get it here. Includes sourcecode, compiled dll, nwscript and ini-snippet. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
MaxRock
Joined: 24 Jan 2008 Posts: 196
|
Posted: Sat Jan 30, 2010 20:57 Post subject: |
|
|
If I understand correctly this doesn't merely hook dev crit but all criticals?
Which would be awsome for things like burst weapons (elemental damage on criticals).
In any case: Good work! |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Sat Jan 30, 2010 21:52 Post subject: |
|
|
Correct, all criticals will cause the script to fire unless target has immunity to criticals. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
|