Author Topic: Disable Shout Channel in One Area  (Read 613 times)

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
Disable Shout Channel in One Area
« on: December 07, 2010, 01:06:34 am »


               Is there a scriptable way to disable player shout ability in one area?
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #1 on: December 07, 2010, 01:16:34 am »


               Yep,



// Get the volume of the last player chat(text) message that was sent.

// Returns one of the following TALKVOLUME_* constants based on the volume setting

// that the player used to send the chat message.

//                TALKVOLUME_TALK

//                TALKVOLUME_WHISPER

//                TALKVOLUME_SHOUT

//                TALKVOLUME_SILENT_SHOUT (used for DM chat channel)

//                TALKVOLUME_PARTY

// Should only be called from a module's OnPlayerChat event script.

// * Returns -1 on error.

// Note: Private tells do not trigger a OnPlayerChat event.

int GetPCChatVolume()



&



// Set the last player chat(text) volume before it gets sent to other players.

// - nTalkVolume: The new volume of the chat text to be sent onto other players.

//                TALKVOLUME_TALK

//                TALKVOLUME_WHISPER

//                TALKVOLUME_SHOUT

//                TALKVOLUME_SILENT_SHOUT (used for DM chat channel)

//                TALKVOLUME_PARTY

//                TALKVOLUME_TELL (sends the chat message privately back to the original speaker)

// Note: The new chat message gets sent after the OnPlayerChat script exits.

void SetPCChatVolume(int nTalkVolume=TALKVOLUME_TALK)



Along with a call to the area the pc is in should do the trick.
               
               

               
            

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #2 on: December 07, 2010, 01:56:24 am »


               Thanks for the info, will this be permanent in the area or will I have to loop it to keep them from shouting while there?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #3 on: December 07, 2010, 02:04:56 am »


               

Birdman076 wrote...

Thanks for the info, will this be permanent in the area or will I have to loop it to keep them from shouting while there?


Nither.

Both of the functions have to be used in the Module PCChat Event. 
so you will need to write a script to check the area they are in and change there ChatVolume if they are shouting in the area you do not want them to shout from.
               
               

               
            

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #4 on: December 07, 2010, 02:23:40 am »


               Understandable, but will the ChatVolume remain changed as long as they are in that area or will it change back to shout if they choose shout for thier next chat?
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #5 on: December 07, 2010, 04:24:00 am »


               

Birdman076 wrote...

Understandable, but will the ChatVolume remain changed as long as they are in that area or will it change back to shout if they choose shout for thier next chat?

It'll remain changed for anyone attempting to shout from that area, for every time they enter anything into the shout channel.  It doesn't actually change their selected chat channel/volume, it just changes the chat output while the PC is within that select area.
               
               

               
            

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #6 on: December 08, 2010, 01:59:11 am »


               Thank you Amethyst thats what I'm looking for. '<img'>
               
               

               
            

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #7 on: December 28, 2010, 01:32:24 pm »


               Well, after numerous hours of hair pulling and trying to write something without script gen, I thought I had it but this script kills all chat in the module regardless of area. Can someone tell me where I went wrong? I just want shout disable in the oArea...



void main()
{
object oPC = GetEnteringObject();
object oArea = GetArea(oPC);
    
    if (!GetIsPC(oPC)) return;
  if( GetLocalInt( oArea, "iNOCHAT" ) == 1 )
GetPCChatSpeaker();
GetPCChatMessage();
GetPCChatVolume();
SetPCChatVolume(TALKVOLUME_TALK);
SetPCChatMessage("");
}

               
               

               


                     Modifié par Birdman076, 28 décembre 2010 - 01:33 .
                     
                  


            

Legacy_NorthWolf

  • Full Member
  • ***
  • Posts: 143
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #8 on: December 28, 2010, 01:49:48 pm »


               It can't go in the OnAreaEnter script. The functions you're using are intended to be used in the OnPlayerChat event. That's a module event, not an area event. This is a script that should do what you want:

void main(){
        object oPC   = GetPCSpeaker();
        object oArea = GetArea(oPC);

        int bNoShout = GetLocalInt(oArea, "iNOCHAT");

         if(bNoShout){
          int nChatVolume = GetPCChatVolume();
                 if(nChatVolume == TALKVOLUME_SHOUT) SetPCChatVolume(TALKVOLUME_TALK);
         }
}


Alternatively, you could simply kill their message and inform them they can't shout in that area:

void main(){
        object oPC   = GetPCSpeaker();
        object oArea = GetArea(oPC);

    int bNoShout = GetLocalInt(oArea, "iNOCHAT");

    if(bNoShout){
         int nChatVolume = GetPCChatVolume();
         if(nChatVolume == TALKVOLUME_SHOUT){
             SetPCChatMessage();
             FloatingTextStringOnCreature("You cannot shout in this area.", oPC, FALSE);
         }
       }
}


               
               

               


                     Modifié par NorthWolf, 28 décembre 2010 - 01:54 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #9 on: December 28, 2010, 05:34:12 pm »


               NorthWolf used the wrong function to get the PC.  Here are the corrected scripts  
 

void main(){
     object oPC = GetPCChatSpeaker();  
     object oArea = GetArea(oPC);

     int bNoShout = GetLocalInt(oArea, "iNOCHAT");

      if(bNoShout){
          int nChatVolume = GetPCChatVolume();
          if(nChatVolume == TALKVOLUME_SHOUT) SetPCChatVolume(TALKVOLUME_TALK);
      }
}


Alternatively, you could simply kill their message and inform them they can't shout in that area:

void main(){
     object oPC = GetPCChatSpeaker();
     object oArea = GetArea(oPC);

    int bNoShout = GetLocalInt(oArea, "iNOCHAT");

    if(bNoShout){
         int nChatVolume = GetPCChatVolume();
         if(nChatVolume == TALKVOLUME_SHOUT){
             SetPCChatMessage();
             FloatingTextStringOnCreature("You cannot shout in this area.", oPC, FALSE);
         }
    }
}

 
               
               

               
            

Legacy_NorthWolf

  • Full Member
  • ***
  • Posts: 143
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #10 on: December 28, 2010, 06:21:07 pm »


               Apologies. x_x;; Lightfoot is right; use his functions.
               
               

               


                     Modifié par NorthWolf, 28 décembre 2010 - 06:21 .
                     
                  


            

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #11 on: December 29, 2010, 12:31:45 am »


               Worked like a charm, thank you very much!
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #12 on: December 31, 2010, 02:15:56 pm »


               This is a nice script ..my question would be could you do this for tells if in a "Jail" area or tells cannot be turned off?
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #13 on: December 31, 2010, 02:59:09 pm »


               With Vanilla I don't think you can catch the tell messages.


// Get the volume of the last player chat(text) message that was sent.
// Returns one of the following TALKVOLUME_* constants based on the volume setting
// that the player used to send the chat message.
// TALKVOLUME_TALK
// TALKVOLUME_WHISPER
// TALKVOLUME_SHOUT
// TALKVOLUME_SILENT_SHOUT (used for DM chat channel)
// TALKVOLUME_PARTY
// Should only be called from a module's OnPlayerChat event script.
// * Returns -1 on error.
// Note: Private tells do not trigger a OnPlayerChat event.
int GetPCChatVolume()
               
               

               


                     Modifié par Baragg, 31 décembre 2010 - 02:59 .
                     
                  


            

Legacy_NorthWolf

  • Full Member
  • ***
  • Posts: 143
  • Karma: +0/-0
Disable Shout Channel in One Area
« Reply #14 on: December 31, 2010, 06:33:48 pm »


               With vanilla Neverwinter Nights, no, you cannot catch tells. However, using NWNX you can. The plugin is nwnx_chat and it's generally more powerful than the existing system in Neverwinter Nights, though a bit more technical.
               
               

               


                     Modifié par NorthWolf, 31 décembre 2010 - 06:34 .