Player Resource Consortium

 

Author Topic: Using EVENT_ONPLAYERCHAT  (Read 6226 times)

0 Members and 1 Guest are viewing this topic.

November 11, 2010, 03:30:19 PM
  • Developer
  • ***
  • Posts: 220
  • Karma: +0/-0
    • View Profile

I just finished implementing and testing a system of commands that can be typed into the chat bar so that PnP Shifters can shift into and get info about known shapes using commands typed in the chat bar. I had it working pretty well using the Generic Listener in prc_in_listener.nss (which I had to modify a little), then noticed fairly recent changes supporting the OnPlayerChat event in PRC. Since this would be a better way to do this, I decided to try it out. It seems like it should work pretty well for me, except that the PRCModuleUpdater doesn't appear to install the prc_onplayerchat script for modules that it updates. Is this planned?


BTW, my main motivation for doing this was to have access to more than just the shapes in my Shifter quickslots when I was in combat. That worked out great, and I'm finding it really useful in other situations too.

It would be really cool to be able to cast spells from the chat bar also instead of having to wade through a bunch of radial menus or fill up all your quickslots with infrequently used spells, but I haven't been able to figure that out and think that it may not be possible, at least in the general case--although casting spells that way on yourself seems like it should be possible.


November 11, 2010, 04:28:50 PM
Reply #1

All the PRC include files are in the prc_include.hak which is not added by default. You only need the hak if you plan on modifying the PRC scripts. Just add it to the module's custom content list. You can place it behind prccraft2das.hak I know it does not cause any issues there.

If you need to know how to add it to your list just ask, but it sounds like you have an idea of what to do.

PS: You will need to use the PRC Script compiler, when compiling PRC scripts.
« Last Edit: November 11, 2010, 04:29:26 PM by KenquinnTheInsaneOne »


November 11, 2010, 04:34:48 PM
Reply #2
  • Developer
  • ***
  • Posts: 220
  • Karma: +0/-0
    • View Profile

Quote from: KenquinnTheInsaneOne

All the PRC include files are in the prc_include.hak which is not added by default. You only need the hak if you plan on modifying the PRC scripts. Just add it to the module's custom content list. You can place it behind prccraft2das.hak I know it does not cause any issues there.

If you need to know how to add it to your list just ask, but it sounds like you have an idea of what to do.

PS: You will need to use the PRC Script compiler, when compiling PRC scripts.


Don't worry, I understand all that. What I mean is that the PrcModuleUpdater changes many of the module events to call prc scripts, but it doen't do this with the OnPlayerChat event. I can do this myself with the Toolset, of course, but I don't want other people to have to do this to use the new feature I'm trying to add to the PnP Shifter.


November 11, 2010, 06:05:53 PM
Reply #3

DMFI uses that event.  Just saying cause I installed it in a module yesterday.
HEATSTROKE


November 12, 2010, 02:55:39 AM
Reply #4
  • Hero Member
  • *****
  • Posts: 1439
  • Karma: +27/-0
  • Gender: Male
    • View Profile

PRC will support OnPlayerChat event someday :) . Right now I was using it only for debug purposes, and I haven't updated the PRC Pack.hif till now.

Spellcasting from a chat bar can be a bit difficult to implement for scripted spellbooks, but it's not impossible.
« Last Edit: November 12, 2010, 02:56:47 AM by xwarren »


November 12, 2010, 10:02:29 AM
Reply #5
  • Developer
  • ***
  • Posts: 220
  • Karma: +0/-0
    • View Profile

Quote from: xwarren

PRC will support OnPlayerChat event someday :) . Right now I was using it only for debug purposes, and I haven't updated the PRC Pack.hif till now.

Spellcasting from a chat bar can be a bit difficult to implement for scripted spellbooks, but it's not impossible.


So just to be sure, you're saying you will put this new hif file in the 3.4 release? That would be great. I'll probably make a patch for my changes available today.


November 12, 2010, 04:45:25 PM
Reply #6
  • Hero Member
  • *****
  • Posts: 1439
  • Karma: +27/-0
  • Gender: Male
    • View Profile

Quote from: CapnQ

Quote from: xwarren

PRC will support OnPlayerChat event someday :) . Right now I was using it only for debug purposes, and I haven't updated the PRC Pack.hif till now.

Spellcasting from a chat bar can be a bit difficult to implement for scripted spellbooks, but it's not impossible.


So just to be sure, you're saying you will put this new hif file in the 3.4 release? That would be great. I'll probably make a patch for my changes available today.


Yes, it's already in my copy of SVN repository.


November 12, 2010, 06:24:12 PM
Reply #7
  • Developer
  • ***
  • Posts: 220
  • Karma: +0/-0
    • View Profile

Here's the promised patch: http://s3.amazonaws.com/NWN/nwnprc.patch

What it does:

Changed Natural Spell prerequisites
    No longer requires level 4 spells
    No either Druid's Wildshape or PnP Shifter's Greater Wildshape qualifies
    According to http://www.d20srd.org/srd/feats.htm, the prereqs should be "Wis 13, wild shape ability".
Fixed bug where starting a convo that was already started (e.g. Shifter Options convo) could make it impossible to exit the convo.
PnP Shifters can shift into and get info about known shapes using commands typed in the chat bar.
Improved OnPlayerChat command structure for expandability.
Various fixes & improvements to the Generic Listener (although I didn't end up using it).
Reset the PRC_NWNX_FUNCS flag on a Shifter PC saved using NWNX when it is opened without NWNX--otherwise shifting won't work.
    Doesn't compensate for any ability scores changed by NWNX in the non-NWNX game--for now, unshift before saving the game if you want to transfer.
Some modules load a creature template and then modify the creature. This no longer confuses the PnP Shifter when learning that shape.
Fixed, cleaned up, and commented the function that enforces the PnP Shifter alternate form prerequisite.


Details on the Shifter commands:

~~gw list [shape-name]
    Lists shapes that match [shape-name]; if [shape-name] is omitted, lists all known shapes.
~~gw shift [shape-name]
    Lists shapes that match [shape-name]; if an unambiguous match is found, shifts into it.
~~gw epic [shape-name]
    Lists shapes that match [shape-name]; if an unambiguous match is found, epic shifts into it.
~~gw info [shape-name]
    Lists shapes that match [shape-name]; if an unambiguous match is found, prints information about it.
~~gw unshift
    Unshifts back into true form.
[shape-name] must match a known shape, and can be:
    ".": matches the current shape we're shifted into
    A number: matches the shape with the given number. The numbers can be found found using command "~~gw list".
    "Q1" through "Q10": matches the shape in the specified quickslot
    A template resref: if you don't know what this means, ignore this option. The resref can be found found using command "~~gw list".
    Part of the name of a shape:
        If there is exactly one exact match, that will be used.
        Otherwise, if there is exactly one shape whose name starts with [shape-name], that will be used.
        Otherwise, if there is exactly one shape whose name contains [shape-name], that will be used.
        Otherwise, no shape matches and nothing will happen.


November 12, 2010, 10:40:57 PM
Reply #8
  • Associate
  • ***
  • Posts: 112
  • Karma: +2/-0
    • View Profile

How do I use the patch? Override?


November 13, 2010, 03:30:03 PM
Reply #9
  • Developer
  • ***
  • Posts: 220
  • Karma: +0/-0
    • View Profile

Quote from: barna10

How do I use the patch? Override?


Do you build the PRC from the source code? If not, you won't be able to use the patch unless someone builds it for you,and the next sentence probably won't make sense to you. If you do, you can either wait for xwarren to commit the patch in PRC's Subversion repository and get it from there, or use TortoiseSVN option ApplyPatch.... to apply it locally and then build a new PRC.

I could probably build a PRC with the patch for you if you need me to, but I would have to remove some experimental stuff first.


November 14, 2010, 08:22:42 PM
Reply #10
  • Associate
  • ***
  • Posts: 112
  • Karma: +2/-0
    • View Profile

I'd like to try it if someone can build it.