• 🏆 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!

Text

Status
Not open for further replies.
Level 7
Joined
Sep 19, 2020
Messages
190
Floating text maybe? Or a cinematic filter?

iqbw_wc3scrnshot_120320_161107_01.jpg
"Ban stage"
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
iqbw_wc3scrnshot_120320_161107_01.jpg
"Ban stage"
I see. Well, you need to use JASS because you can not move texts with GUI. Luckily though, you can use custom scripts in GUI:
  • Custom script: call DisplayTextToPlayer(Player(0), 0, 0, "your message")
Play around with both 0 integers to move the text.
Player(0) means Player Red in case you didn't know.

Edit: Actually, I think that's a floating text. Anyway, this is how you do it:
  • Floating Text - Create floating text that reads YourMessage above (Something) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
You would know if it's Floating Text because you could move your screen away from it.

So I don't think it's Floating Text, although that could be a viable option depending on what you wanted to do.

Otherwise, it's either doing what GIMLI said or using the Custom UI natives (BlzCreateFrame) to create a Text Frame.
 
Level 7
Joined
Sep 19, 2020
Messages
190
I see. Well, you need to use JASS because you can not move texts with GUI. Luckily though, you can use custom scripts in GUI:
  • Custom script: call DisplayTextToPlayer(Player(0), 0, 0, "your message")
Play around with both 0 integers to move the text.
Player(0) means Player Red in case you didn't know.

Edit: Actually, I think that's a floating text. Anyway, this is how you do it:
  • Floating Text - Create floating text that reads YourMessage above (Something) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
nice it's work tnx :)
 
Level 5
Joined
Jul 31, 2020
Messages
103
Creating the text posting ".create" in chat
vJASS:
function TrgCreateTextActions takes nothing returns nothing
    local framehandle someText = BlzCreateFrameByType("TEXT", "yourAdHere", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)

    call BlzFrameSetAbsPoint(someText, FRAMEPOINT_CENTER, 0.40, 0.53)
    call BlzFrameSetSize(someText, 0.15, 0.01)
    call BlzFrameSetScale(someText, 2.50)
    call BlzFrameSetText(someText, "Your Ad Here")
    call BlzFrameSetTextAlignment(someText, TEXT_JUSTIFY_TOP, TEXT_JUSTIFY_CENTER)
    call BlzFrameSetVisible(someText, true)

    set someText = null
endfunction

function InitTrig_CreateText takes nothing returns nothing
    set gg_trg_CreateText = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(gg_trg_CreateText, Player(0), ".create", true)
    call TriggerAddAction(gg_trg_CreateText, function TrgCreateTextActions)
endfunction

Changing it to something else with ".change":
vJASS:
function TrgChangeTextActions takes nothing returns nothing
    call BlzFrameSetText(BlzGetFrameByName("yourAdHere", 0), "Your Ad Will Never Be Here")
endfunction

function InitTrig_ChangeText takes nothing returns nothing
    set gg_trg_ChangeText = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(gg_trg_ChangeText, Player(0), ".change", true)
    call TriggerAddAction(gg_trg_ChangeText, function TrgChangeTextActions)
endfunction

Hiding it with ".hide":
vJASS:
function TrgHideTextActions takes nothing returns nothing
    call BlzFrameSetVisible(BlzGetFrameByName("yourAdHere", 0), false)
endfunction

function InitTrig_HideText takes nothing returns nothing
    set gg_trg_HideText = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(gg_trg_HideText, Player(0), ".hide", true)
    call TriggerAddAction(gg_trg_HideText, function TrgHideTextActions)
endfunction

Showing it with ".show":
vJASS:
function TrgShowTextActions takes nothing returns nothing
    call BlzFrameSetVisible(BlzGetFrameByName("yourAdHere", 0), true)
endfunction

function InitTrig_ShowText takes nothing returns nothing
    set gg_trg_ShowText = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(gg_trg_ShowText, Player(0), ".show", true)
    call TriggerAddAction(gg_trg_ShowText, function TrgShowTextActions)
endfunction

Yes, you can also change the text color using this native:
vJASS:
call BlzFrameSetTextColor(BlzGetFrameByName("yourAdHere", 0), 0x7409ae)
It uses hex codes, so 0x7409ae is some purple or something, my man eyes are bad at distinguishing these.

You won't be able to change font or font size directly using the native meant for it because it doesn't work during runtime for some reason. As far as I'm concerned it works if you make your own fdf though. That's why I'm using BlzFrameSetScale for size.

Also, this is just an example I put together in about 15 minutes, so obviously I could have put all this into one single trigger utilizing substrings, or I could have done many other things.
 
Level 7
Joined
Sep 19, 2020
Messages
190
Creating the text posting ".create" in chat
vJASS:
function TrgCreateTextActions takes nothing returns nothing
    local framehandle someText = BlzCreateFrameByType("TEXT", "yourAdHere", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)

    call BlzFrameSetAbsPoint(someText, FRAMEPOINT_CENTER, 0.40, 0.53)
    call BlzFrameSetSize(someText, 0.15, 0.01)
    call BlzFrameSetScale(someText, 2.50)
    call BlzFrameSetText(someText, "Your Ad Here")
    call BlzFrameSetTextAlignment(someText, TEXT_JUSTIFY_TOP, TEXT_JUSTIFY_CENTER)
    call BlzFrameSetVisible(someText, true)

    set someText = null
endfunction

function InitTrig_CreateText takes nothing returns nothing
    set gg_trg_CreateText = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(gg_trg_CreateText, Player(0), ".create", true)
    call TriggerAddAction(gg_trg_CreateText, function TrgCreateTextActions)
endfunction

Changing it to something else with ".change":
vJASS:
function TrgChangeTextActions takes nothing returns nothing
    call BlzFrameSetText(BlzGetFrameByName("yourAdHere", 0), "Your Ad Will Never Be Here")
endfunction

function InitTrig_ChangeText takes nothing returns nothing
    set gg_trg_ChangeText = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(gg_trg_ChangeText, Player(0), ".change", true)
    call TriggerAddAction(gg_trg_ChangeText, function TrgChangeTextActions)
endfunction

Hiding it with ".hide":
vJASS:
function TrgHideTextActions takes nothing returns nothing
    call BlzFrameSetVisible(BlzGetFrameByName("yourAdHere", 0), false)
endfunction

function InitTrig_HideText takes nothing returns nothing
    set gg_trg_HideText = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(gg_trg_HideText, Player(0), ".hide", true)
    call TriggerAddAction(gg_trg_HideText, function TrgHideTextActions)
endfunction

Showing it with ".show":
vJASS:
function TrgShowTextActions takes nothing returns nothing
    call BlzFrameSetVisible(BlzGetFrameByName("yourAdHere", 0), true)
endfunction

function InitTrig_ShowText takes nothing returns nothing
    set gg_trg_ShowText = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(gg_trg_ShowText, Player(0), ".show", true)
    call TriggerAddAction(gg_trg_ShowText, function TrgShowTextActions)
endfunction

Yes, you can also change the text color using this native:
vJASS:
call BlzFrameSetTextColor(BlzGetFrameByName("yourAdHere", 0), 0x7409ae)
It uses hex codes, so 0x7409ae is some purple or something, my man eyes are bad at distinguishing these.

You won't be able to change font or font size directly using the native meant for it because it doesn't work during runtime for some reason. As far as I'm concerned it works if you make your own fdf though. That's why I'm using BlzFrameSetScale for size.

Also, this is just an example I put together in about 15 minutes, so obviously I could have put all this into one single trigger utilizing substrings, or I could have done many other things.
I do not know about Jass and your code is not working for me
how to fixed?
 
Level 5
Joined
Jul 31, 2020
Messages
103
I do not know about Jass and your code is not working for me
how to fixed?

If by "not working for you", you mean it doesn't compile, you must be on a version older than 1.31, and in that case there is nothing you can do with my, actually correct, solution.

It's not floating text despite what Warseeker implied. I'd also not use DisplayTextToPlayer for this purpose simply because it's a terrible "solution", and just considering it makes me raise an eyebrow at you.

If you're indeed on an older patch, and can't make what I posted work, ironically, Gimli's idea with modified upkeep texts is the most feasible one.
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
You either use upkeep text, which has a bigger font size (like in the screenshot), or you create a textframe, which lets you change the font size to whatever you want. You cannot change font size of displayed text (you probably can, but that would change the size of other displayed text aswell)
 
Status
Not open for further replies.
Top