View previous topic :: View next topic |
Author |
Message |
Sethan
Joined: 04 Oct 2008 Posts: 47
|
Posted: Sat Jun 25, 2011 21:48 Post subject: Set trap |
|
|
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 |
|
|
Lokey
Joined: 02 Jan 2005 Posts: 158
|
Posted: Tue Jun 28, 2011 11:37 Post subject: |
|
|
Check events.
We've always distinguished between player and module created traps, but haven't gone further than that. _________________ Neversummer PW NWNx powered mayhem |
|
Back to top |
|
|
Sethan
Joined: 04 Oct 2008 Posts: 47
|
Posted: Tue Jun 28, 2011 11:53 Post subject: |
|
|
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 |
|
|
Greyfort
Joined: 20 Jul 2010 Posts: 66
|
Posted: Wed Jun 29, 2011 19:24 Post subject: |
|
|
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 |
|
|
Sethan
Joined: 04 Oct 2008 Posts: 47
|
Posted: Wed Jun 29, 2011 19:43 Post subject: |
|
|
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 |
|
Back to top |
|
|
Greyfort
Joined: 20 Jul 2010 Posts: 66
|
Posted: Wed Jun 29, 2011 20:02 Post subject: |
|
|
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 |
|
|
Sethan
Joined: 04 Oct 2008 Posts: 47
|
Posted: Wed Jun 29, 2011 21:13 Post subject: |
|
|
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 |
|
|
|