• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Txt

Status
Not open for further replies.
Level 9
Joined
Aug 1, 2008
Messages
453
i know how to do this with lots of triggers but how would i do it with one


-----first it displays--------

One |||

---then-----

One day|||

---then-----

One day i |||

---then-----

One day i was |||

---then and so on----

One day i was born|||

kinda like a tyep writer??

kinda like the intro txt in this map

Thanks will +rep if helped
 

Attachments

  • GPS 2.56 beta.w3x
    138.2 KB · Views: 55
Last edited:
Level 14
Joined
Nov 23, 2008
Messages
187
Function at jass:

JASS:
function ShowText takes player p, string str, real speed returns nothing
  local integer i = 1
  local integer j = StringLength(str)
  local real  spd = 1. / speed
  loop
    call ClearTextMessages()
    call DisplayTextToPlayer(p, 0., 0., SubString(str, 0, i) + " |||")
    call TriggerSleepAction(spd)
    set i = i + 1
    exitwhen i > j
  endloop
endfunction

Incrementally displays string str for player p. The bigger value speed contains, the faster function will display the text.
 
Level 11
Joined
May 31, 2008
Messages
698
Maybe this will work. Not tested but i think it might be helpful, test it out

  • text
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) for 30.00 seconds the text: One |||
      • Wait 0.50 seconds
      • Cinematic - Clear the screen of text messages for (All players)
      • Game - Display to (All players) for 30.00 seconds the text: One day |||
      • Wait 0.50 seconds
      • Cinematic - Clear the screen of text messages for (All players)
      • Game - Display to (All players) for 30.00 seconds the text: One day I |||
      • Wait 0.50 seconds
      • Cinematic - Clear the screen of text messages for (All players)
      • Game - Display to (All players) for 30.00 seconds the text: One day I was |||
      • Wait 0.50 seconds
      • Cinematic - Clear the screen of text messages for (All players)
      • Game - Display to (All players) for 30.00 seconds the text: One day I was born ...
You might also want to fool around with the times or even make it so it types one letter at a time. But for the times make some shorter and some longer (maybe in between sentences) to make it look like someone is actually typing.
 
Level 11
Joined
Dec 31, 2007
Messages
780
perhaps you should use an string array variable and a loop

variable text of type string and array (the size of the array depends on the words you wanna write)

then in the trigger

somewhere in your map you will have to initialize the array
text[1]= one
text[2]= one day
text[3]= one day i
text[4]= one day i was
text[5]= one day i was born
etc

  • actions
    • for each integer X from 1 to (number of words) do
      • loop
        • game display for player (text[X])
        • wait Y seconds
using the same idea... you may do it differently... this is just 1 way to do it
 
Level 9
Joined
Aug 1, 2008
Messages
453
in the map i linked it has a trigger that all you have to change is


n Trig_test_Actions takes nothing returns nothing
local integer i = 1
loop
exitwhen i > 125
call CreateNUnitsAtLoc( 1, ChooseRandomCreepBJ(-1), Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRandomLocInRect(GetPlayableMapRect()), GetRandomDirectionDeg() )
set i = i + 1
endloop
call TriggerSleepAction( 0.50 )
call text_print (1, "Ok, for open GPS type '-##', where ## is a odd number from 1 to 15. For questions send me email: [email protected]", 0.75, 0.50, 0.08, 45, 6)
endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
set gg_trg_test = CreateTrigger( )
call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction

and all you have to change is the underlined part and the print txt changes too but it has a bunch of stuff in header i dont what in the header i need to use to make it work
 
Level 4
Joined
Mar 6, 2008
Messages
73
This may not be right, but I think hawk means you should make a trigger that activates another trigger (the first trigger is to store some variables) that has an the event Every x seconds of the game and an action that adds text by text to your liking. To let the game know when to turn off the trigger, set an Integer variable that is set at 0 in the first trigger and in the second trigger, set that integer variable to add itself by 1. After that, you can just place the action where the trigger waits for the integer to become the number where you need it to stop and turn the trigger off and removing any leaks
 
Level 14
Joined
Nov 23, 2008
Messages
187
Well, there is a variant to copy this function in custom code, or somewhere else (but before the trigger that actually uses this function).

Then, you can use it both in Jass and GUI. For example:

  • Custom script: call ShowText(Player(0), "One day I was born... <full string here>", 2.5)
Will show message for red player, with appearance period of (1 / 2.5) = 0.4
If you want to display text not in standard position, there is another variant of function (with x and y parameters).
 
Status
Not open for further replies.
Top