Aller au contenu

Photo

Disable Shout Channel in One Area


  • Veuillez vous connecter pour répondre
14 réponses à ce sujet

#1
Birdman076

Birdman076
  • Members
  • 186 messages
Is there a scriptable way to disable player shout ability in one area?

#2
Baragg

Baragg
  • Members
  • 271 messages
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.

#3
Birdman076

Birdman076
  • Members
  • 186 messages
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?

#4
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

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.

#5
Birdman076

Birdman076
  • Members
  • 186 messages
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?

#6
The Amethyst Dragon

The Amethyst Dragon
  • Members
  • 1 878 messages

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.

#7
Birdman076

Birdman076
  • Members
  • 186 messages
Thank you Amethyst thats what I'm looking for. :)

#8
Birdman076

Birdman076
  • Members
  • 186 messages
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 .


#9
NorthWolf

NorthWolf
  • Members
  • 86 messages
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 .


#10
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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);
         }
    }
}

 

#11
NorthWolf

NorthWolf
  • Members
  • 86 messages
Apologies. x_x;; Lightfoot is right; use his functions.

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


#12
Birdman076

Birdman076
  • Members
  • 186 messages
Worked like a charm, thank you very much!

#13
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
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?

#14
Baragg

Baragg
  • Members
  • 271 messages
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 .


#15
NorthWolf

NorthWolf
  • Members
  • 86 messages
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 .