| 11-24-2006, 05:37 PM | #1 |
Is there a way to regulate chat between players in a game? Like controlling who receives whose messages? And possibly making a person's messages only be received by the owners of heroes that are near that person's hero? I thought about trying to do a floating text chat system, but I would still want to remove the normal chat text that appears. |
| 11-24-2006, 05:46 PM | #2 |
Whenever someone enters a text message, store it to a string variable, then use this function: Trigger: Cinematic - Clear the screen of text messages for (All players)Then you can either use floating text, or you can use the Game - Display Text function to show it to the people you want. |
| 11-24-2006, 05:51 PM | #3 |
But, the only chat message event I have in the GUI is Player types a message containg X as an exact match or substring. Is there a JASS function I can use? If so... I wouldn't know how to use it. >< |
| 11-24-2006, 05:55 PM | #4 |
use a "empty" substring, will work for every chat massage |
| 11-24-2006, 08:53 PM | #5 |
Would look like this in JASS JASS:function ChatFilter takes nothing returns boolean return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) endfunction function Chat_Actions takes nothing returns nothing local group g = CreateGroup() local boolexpr bx = Condition(function ChatFilter) local unit u local string s = SubString(GetEventPlayerChatString(),0,200) call ClearTextMessages() call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),bx) set u = FirstOfGroup(g) call GroupClear(g) call GroupEnumUnitsInRange(g,GetUnitX(u),GetUnitY(u),200) // change 200 to adjust how close the heros would have to be loop set u=FirstOfGroup(g) exitwhen u==null if GetOwningPlayer(u)!=GetTriggerPlayer() then call DisplayTextToPlayer(GetOwningPlayer(u),0,0,s) endif call GroupRemoveUnit(g,u) endloop call DestroyGroup(g) call DestroyBoolExpr(bx) set g=null set bx=null endfunction function InitTrig_Chat takes nothing returns nothing local integer i=0 set gg_trg_Chat = CreateTrigger( ) loop exitwhen i>11 call TriggerRegisterPlayerChatEvent( gg_trg_Chat, Player(i), "", false ) set i=i+1 endloop call TriggerAddAction( gg_trg_Chat, function Chat_Actions ) endfunction This is assuming only 1 hero per player in your game; otherwise, you would need to make sure to display only once. |
| 11-24-2006, 09:18 PM | #6 | |
Quote:
|
