logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Hooking
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Tue Jan 19, 2010 1:06    Post subject: Hooking Reply with quote

*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. Cool
_________________
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
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jan 19, 2010 1:45    Post subject: Reply with quote

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
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Tue Jan 19, 2010 1:46    Post subject: Reply with quote

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
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jan 19, 2010 1:46    Post subject: Reply with quote

er... yeah..
what he said. Lol
Back to top
View user's profile Send private message
Disco



Joined: 06 Dec 2006
Posts: 152

PostPosted: Tue Jan 19, 2010 13:38    Post subject: Reply with quote

I guess returning an event on a crit (preferably including the roll) would be sufficient, if that helps.
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Sat Jan 23, 2010 19:25    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Thu Jan 28, 2010 2:30    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Thu Jan 28, 2010 5:30    Post subject: Reply with quote

Nice. virusman should probably give you SVN access at this point. PM him with a username/password. Smile
_________________
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
View user's profile Send private message Visit poster's website
ArielT



Joined: 26 Jan 2010
Posts: 30

PostPosted: Thu Jan 28, 2010 10:50    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Thu Jan 28, 2010 13:18    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
Disco



Joined: 06 Dec 2006
Posts: 152

PostPosted: Fri Jan 29, 2010 15:20    Post subject: Reply with quote

Can you (or did you) determine the actual roll?
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Fri Jan 29, 2010 16:22    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Fri Jan 29, 2010 23:33    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Sat Jan 30, 2010 20:57    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Sat Jan 30, 2010 21:52    Post subject: Reply with quote

Correct, all criticals will cause the script to fire unless target has immunity to criticals. Very Happy
_________________
I dun have any signature, I'm happy anyway.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group