• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Chat Message

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
Well, as a user of Warcraft III Game, we all know how to perform a command "chat", right ?
Just simply press "Enter" and type your words and press "Enter" again, and pops out the word we typed
Well, that's not the point, anyhow...
Is it possible to "hide" Chat Message ?
I know by chatting in "Observer Chat" will ONLY shows the text to the player BUT, I want so that EVEN if you're chat in [Allies] or [All], it will still show the Chat Message to the Triggering Player ONLY
Don't ask me why do I need this, but I saw an RPG uses this system
When we normal chat, the words are displayed to all corresponding players
But when we do special command like:
-load XXX-ZZZ-CCC
That Chat Message didn't appear to other player, but ONLY to the triggering player
I suspect the usage of GetLocalPlayer, eh ?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
It was probably done with a small system and a bit of smart file importing.
At least, the systems I've seen worked like that...


After a bit of searching myself, I found this:

You need to import a text-file called "war3mapMisc.txt" with this in it:
Code:
[FontHeights]
WorldFrameChatMessage=0.001
This will make all chat-text dissapear (also in the logs).

Next thing you need to do is create some kind of system to mimic the regular chat (you read that correctly: we're going to redo warcraft's chat from scratch, just because we can).
We will use regular game-messages for this (or start out with regular game messages at least).
The problem is that they're a bit too big...

Remember the previous text-file? Well, let's add something...
Code:
[FontHeights]
WorldFrameChatMessage=0.001
WorldFrameUnitMessage=0.013
I added the last line so the size of the triggered messages is equal to the regular chat messages.

Now we will start with the actual triggers...
This is actually very easy, the first thing we're going to do is set up the player colors.

  • Initialize Colors
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Color Codes --------
      • Set Color[1] = |c00ff0303
      • Set Color[2] = |c000042ff
      • Set Color[3] = |c001CE6B9
      • Set Color[4] = |c00540081
      • Set Color[5] = |c00FFFC01
      • Set Color[6] = |c00FE8A0E
      • Set Color[7] = |c00FE8A0E
      • Set Color[8] = |c00E55BB0
      • Set Color[11] = |c00106246
      • Set Color[12] = |c004E2A04
These colors look real enough to me.

For the chat-function we'll start out simple, like this:

  • Chat
    • Events
      • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
    • Conditions
    • Actions
      • Game - Display to (All players) the text: ([All] + ((Color[(Player number of (Triggering player))] + ((Name of (Triggering player)) + :|r )) + (Entered chat string)))
So it displays: "[All]" + Player(x) + ": " + string.
(The player with the correct color).

Let's see how that turned out...


How it would usually look:

realchat.jpg



How it looks like:

fakechat.jpg

The only difference now is the spacing before the text and, obviously, that the channel "[All]" doesn't actually work correctly in our system.

You'll just have to forget about the spacing...
The "[All]" can be taken care of, but through other means.

For example: when a player types "-t [message]", the message will only be shown for his teammates, or when he writes "-load
Code:
", the message will only be shown for him etc.
All of this can be taken care of with a little help of substrings:

A simple example would be this:
[hidden=Simple substrings][trigger]Chat
    Events
        Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Substring((Entered chat string), 1, 2)) Equal to -t
            Then - Actions
                Set String = (Substring((Entered chat string), 4, (Length of (Entered chat string))))
                Game - Display to (All allies of (Triggering player)) the text: ([Team]  + ((Color[(Player number of (Triggering player))] + ((Name of (Triggering player)) + :|r )) + String))
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Substring((Entered chat string), 1, 5)) Equal to -load
                    Then - Actions
                        Set String = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
                        Game - Display to (Player group((Triggering player))) the text: ([Loading] |c00666fffCode:|r  + String)
                    Else - Actions
                        Game - Display to (All players) the text: ([All]  + ((Color[(Player number of (Triggering player))] + ((Name of (Triggering player)) + :|r )) + (Entered chat string)))
[/trigger][/hidden]

Wondering how it looks?
Here's an example:
[hidden=Example Chat][img]http://img859.imageshack.us/img859/402/fakechat2.jpg[/img][/hidden]
Better would be to parse the load-code back to the colorizer (so it shows the same colors as when you saved the code).
This is just a base example though, you can add whatever you want (PM's are also doable).


Test-map attached...
 

Attachments

  • FontTest.w3x
    17.1 KB · Views: 218
Status
Not open for further replies.
Top