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 
 
NWNX Events
Goto page Previous  1, 2, 3 ... 9, 10, 11, 12  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development
View previous topic :: View next topic  
Author Message
ExileStrife



Joined: 14 Mar 2008
Posts: 21

PostPosted: Tue Jun 01, 2010 1:08    Post subject: Reply with quote

I'd like to call attention to Cafall's request again for a hopeful wishlist item. The ToggleMode hook is only triggered when a player toggles the modes themselves, but nothing is called when the engine untoggles something due to an attack, conversation, item use, etc.

It would be excellent if an event hook could be discovered and made for those as well. One simple thing I'd like to do is color PCs with glows when they are in certain modes (and have the glow dissipate when the mode is canceled), but there would be other uses for this too.
Back to top
View user's profile Send private message
ExileStrife



Joined: 14 Mar 2008
Posts: 21

PostPosted: Tue Jun 01, 2010 1:13    Post subject: Reply with quote

Ooh, and another wish that I just remembered. An event for when you first hear and when you first spot a stealthed PC or NPC. I can't exactly guess the feasibility of this one off hand...like whether it could just be done with the Perception scripts or if there's no way from causing it to always trigger during engine spot and listen checks.
Back to top
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Sun Aug 01, 2010 3:24    Post subject: Reply with quote

Does anyone know how to catch the 'event' when a player spots a trap?
Can't find a way, however the PC must send something, because henchman can react to it:
Code:

        // ***********************************
        // * AUTOMATIC SHOUTS - not player
        // *   initiated
        // ***********************************
    case ASSOCIATE_COMMAND_MASTERSAWTRAP:
        if(!GetIsInCombat())
        {
            if(!GetAssociateState(NW_ASC_MODE_STAND_GROUND))
            {
                oTrap = GetLastTrapDetected(GetMaster());
                bkAttemptToDisarmTrap(oTrap);
            }
        }
        break;


So this must be some silent shout, probably hardcoded. Chat-plugin can't catch it. Any idea?
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun Aug 01, 2010 3:38    Post subject: Reply with quote

I dont know about Linux, but on windows this function appears inside the nwnserver.exe at 0x4D00F0

Code:

void __thiscall CNWSCreature::SawTrapInformAssociates(unsigned long)


Without doing any testing, I was able to see that it gets called from

Code:

CNWSCreature::UpdateTrapCheck(void)

0x495080


The UpdateTrapCheck function appears to take no arguments at all, and it seems to carry out the dice rolls internally etc, to determine if the trap is detected etc, and then, if it is, I think it calls the InformAssociates function.

Hooking the UpdateTrapCheck would likely not be advisable, as it seems to be called from the AIUpdate function, which would likely fire every frame of server time, or at least, very often.


Hooking the SawTrapInformAssociates(unsigned long) would likely be possible. Just a guess, but I think the data retrievable from this would be.

1. The creature who did the detection (the script would fire on them as OBJECT_SELF.)
and
2. the Unsigned Long, could be either the creature/associate to inform, or the Trap to be informed about. Im guessing it would be the object id for the trap being informed about, since it says Associates, and not Associate, im assuming it would inform multiple associates from a table of associates. eg - Party members.


Anyway, thats just some advice, I dont use linux, so I cant help with the hooking in this case.
Back to top
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Sun Aug 01, 2010 10:25    Post subject: Reply with quote

I see, thx. So it's really hardcoded. I would like to see this in this plugin Smile
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Sun Aug 01, 2010 21:06    Post subject: Reply with quote

Ack! Trap checks are very, very hardcoded, yes. What exactly would you want to use the hook for?
_________________
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
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Mon Aug 02, 2010 1:01    Post subject: Reply with quote

Well, i used to used HCR-items to search for traps. Now, i'm going back to basics: detect-mode, keen sense, walk near the traps and detect it (you know, the default way). But, afaik, this isn't the case with the secret doors. That needs triggers, waypoints, the door-objects, heartbeat script and such.
So i thought, that now we can create floor-traps from scripts, create it on the floor from script, and if the player spots it, destroy it, and create the secret-door. Smile

Ok, i know this isn't worth to make a plugin for it, i still can use the hcr-tool, but...it would be nice Smile
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Mon Aug 02, 2010 7:42    Post subject: Reply with quote

Ravine wrote:
That needs triggers, waypoints, the door-objects, heartbeat script and such.
1 trigger, 1 waypoint, 1 small pseudo heartbeat for each doors. Alternatively you can do it without waypoint but you would need GetFirst/Next area to initialize door placeable with trigger in on module load (which is way im using). HERE is good example, or I can show you my code...
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Mon Aug 02, 2010 10:32    Post subject: Reply with quote

Yeah, i know...i'm using something like this. But it doesn't take to account the keen sense, detect mode - which are active searches, which should check for secret objects in every 3 sec, even if You standing still. With a trigger, you have to run up and down to ... trigger Smile
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Mon Aug 02, 2010 16:46    Post subject: Reply with quote

Ravine wrote:
Yeah, i know...i'm using something like this. But it doesn't take to account the keen sense, detect mode - which are active searches, which should check for secret objects in every 3 sec, even if You standing still. With a trigger, you have to run up and down to ... trigger Smile
Well my system does automatic check while you are in trigger, and you can take keen senses into account, all through scripting. If you want, I will change my script to do that and share it.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Mon Aug 02, 2010 17:20    Post subject: Reply with quote

ShaDoOoW wrote:
Ravine wrote:
Yeah, i know...i'm using something like this. But it doesn't take to account the keen sense, detect mode - which are active searches, which should check for secret objects in every 3 sec, even if You standing still. With a trigger, you have to run up and down to ... trigger Smile
Well my system does automatic check while you are in trigger, and you can take keen senses into account, all through scripting. If you want, I will change my script to do that and share it.


Thank you, i appreciate it, but i think i'll stick to the hcr search-tool for now. I don't have the time to convert it actually Sad
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Mon Aug 02, 2010 21:59    Post subject: Reply with quote

You can do what you want, in conjuction with Keen Senses & Detect Mode & Pseudo HB.



There is working event scripts for 'mode toggles', which will allow you to set a local int on the character, to say they are detecting, or whatever,
and you can determine if they have the feat.


You simply set the Pseudo HB to check for these criteria, and if the player is in the correct toggle mode, and has the feat, then have your script reveal its secret door.

As far as hooking the trap detection itself, its very hacky, since it has no entry arguments for the main function it is called from, and the only entry place that looks worthwhile investigating, is the InformAssociates function, but this may or may not even fire, if you are a solo player, infact, Im not even sure if it fires for PC's at all, it may be a henchman only function, used to tell players what the henchman has detected.

If you do go down the avenue of using Pseudo HB's, I recommend you set them up so that they only run, when a player is in the area, it is a waste of Processor power, for it to run without a player in the same area, and Pseudo HB's can be dangerous if not handled correctly. Make sure that one Object only triggers one Pseudo HB at any one time. eg - one hb per one object. Forgetting to turn off the 'start' point of the Pseudo HB can lead to multiple HB's running per the one object, leading to an ever increasing amount of HB's running.
Back to top
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Tue Aug 03, 2010 10:49    Post subject: Reply with quote

Ok, thx Smile

The resman bug is more critical to me. Can someone test it? Happens to others too?
Back to top
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Fri Oct 08, 2010 23:03    Post subject: Reply with quote

Hello again. Happy to tell, i did the secret-door thing with nwnx.
I just drop a placeable door with a destination in the variables, and the area-onEnterscript handles all: creates an invis object with a fake-trap in the place of the secret-door, creates a trigger around the invis obj, and destroys the door itself. When the player spots the trap, and walks near it, it became usable (when he enters the trigger). And when he 'use' the trap, that creates the door ... works awsome, thanks to the nwnx (cannot do the trigger part without it Smile).

Now, i'm trying a new request (not really new, kucik asked this before): is there a way to catch the event, when a player disturb an inventory (adding/removing to an other inventory).

thx
Back to top
View user's profile Send private message
Squatting Monk



Joined: 28 Jun 2007
Posts: 76

PostPosted: Sat Oct 09, 2010 4:05    Post subject: Reply with quote

You mean besides OnDisturbed?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development All times are GMT + 2 Hours
Goto page Previous  1, 2, 3 ... 9, 10, 11, 12  Next
Page 10 of 12

 
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