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 
 
Set trap

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Sethan



Joined: 04 Oct 2008
Posts: 47

PostPosted: Sat Jun 25, 2011 21:48    Post subject: Set trap Reply with quote

I know we're not the first module to have this problem, but we're having an issue with a player setting traps in public areas and then logging out.

Since they're not logged in when the trap is triggered, it is difficult to determine who set the trap.

Did anyone ever hook set trap?

If I can log what PC/player is setting the trap and what area they are in, it will make this a lot easier to deal with.
Back to top
View user's profile Send private message
Lokey



Joined: 02 Jan 2005
Posts: 158

PostPosted: Tue Jun 28, 2011 11:37    Post subject: Reply with quote

Check events.

We've always distinguished between player and module created traps, but haven't gone further than that.
_________________
Neversummer PW NWNx powered mayhem Wink
Back to top
View user's profile Send private message
Sethan



Joined: 04 Oct 2008
Posts: 47

PostPosted: Tue Jun 28, 2011 11:53    Post subject: Reply with quote

If you're talking about NWNX_Events, unfortunately the ones in the SVN have no associated .nss file for Windows, so it is essentially useless to anyone who can't read the code and derive script source and .ini settings from it.

We're using the Terra_777 version of Events found here: http://nwvault.ign.com/View.php?view=Other.Detail&id=1429

...for precisely that reason - but it doesn't catch trap creation.
Back to top
View user's profile Send private message
Greyfort



Joined: 20 Jul 2010
Posts: 66

PostPosted: Wed Jun 29, 2011 19:24    Post subject: Reply with quote

You could alway add some code to your on_aquire, un_aquire Events, that tracks just traps ... player setting would trigger un aquire event then you could get[player, area set,location,etc]. It would do what you want 99% sure... i can try to scratch out a quick test version. if youd like.
Back to top
View user's profile Send private message
Sethan



Joined: 04 Oct 2008
Posts: 47

PostPosted: Wed Jun 29, 2011 19:43    Post subject: Reply with quote

Could work - I hate having to check every OnUnAcquire just to catch this one case, and not even every case where a trap kit is lost is going to be setting a trap (which means checking the area against all the possible trap triggers to see if one exists if the PC loses a trap), but it would do the job.

I was just hoping for a more elegant solution.

Thanks for the idea Smile
Back to top
View user's profile Send private message
Greyfort



Joined: 20 Jul 2010
Posts: 66

PostPosted: Wed Jun 29, 2011 20:02    Post subject: Reply with quote

object oPC = GetModuleItemLostBy();
object oItem = GetModuleItemLost();
int nTypeItem;//=GetBaseItemType(oItem);
// check if object valid...
if (GetIsObjectValid(oItem)){nTypeItem=GetBaseItemType(oItem);}
// check if trap...
if ( GetBaseItemType(oItem)==BASE_ITEM_TRAPKIT )
{
// set DB info
SetLocalString (GetModule(),"TrapSet_","player:="+GetName(oPC)+", area:"+GetName(GetArea(oPC))+", location: !" );//
// player char id
// area
// location
// trap
}

I placed this code ontop of nwn default on_unaquire and it worked when trap was set so its feesable, and you can have data goto log file what ever you want
Back to top
View user's profile Send private message
Sethan



Joined: 04 Oct 2008
Posts: 47

PostPosted: Wed Jun 29, 2011 21:13    Post subject: Reply with quote

Thanks Greyfort.

It occurred to me another way to go about this would be to change over the NWN standard traps kits to use a single custom trap kit with a custom OnActivate script that logs the info when the trap is actually set.

Different trap types could be differentiated by variables on the trap kit (and the kit renamed on the fly, accordingly.

Custom trap triggers would also have to be created, with an onDisarm script that created the custom kit based on variables on the trigger (said variables being transferred to the trigger from the kit on creation) - if my understanding is correct that OnDisarm fires for both disarm and recover.

Lots more work, but would avoid using the module OnUnacquire
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Page 1 of 1

 
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