• 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.

[Trigger] Floating Text - Variables

Status
Not open for further replies.
Level 2
Joined
Jun 3, 2007
Messages
20
Hey there all,
I'm having some difficulty in a World Diplomacy map that i'm attempting to make, basically my thought is to put a floating text next to each city which when income comes around (every 365 seconds) it goes up by 20. And thus the longer you hold a city the more population you have and the more gold you get per turn. Heres what I attempted to do:

  • Player - Add Moscow to (Random player from MoscowPlayer) Current Gold
  • Set Moscow = (Moscow + 20)
  • Floating Text - Create floating text that reads (String(Moscow)) at (Center of Region 019) with offset and colour blah blah blah
  • Set MoscowFloat[Moscow] = (Last Created Floating Text)
  • Floating Text - Change the lifespan of MoscowFloat[Moscow] to 365 seconds
MoscowFloat = The Moscow Floating Text Variable With an Array of 1
Moscow = Integer with a value of 100
MoscowPlayer = A Player Group with one player, the player that controls Moscow

Now I pretty much stumbled through that lol not knowing what i was doing. However, what i'm really asking is how, or if i can set the floatingtext in Moscow to be in a variable so I can change it every time the income comes, and if I can do this simulatanously with other cities at the same time because i really hate using (Last Created).

Also I appologise if this is in the wrong forum, but I don't think it is.
 
Level 6
Joined
Mar 2, 2006
Messages
306
how, or if i can set the floatingtext in Moscow to be in a variable so I can change it every time the income comes

make a variable of type floating text by clicking big X in the trigger editor toolbar

save every floating text you create immediately after creation.
  • Set CityText[13] = (Last Created Floating Text)
use that variable after that. for example, when the new data is ready, do:
  • Floating Text - Change text of CityText[5] to [u]new number[/u] using font size 10.00
 
Level 2
Joined
Jun 3, 2007
Messages
20
The Problem is, if im doing lots of cities it may mix up populations because the last created floating text is another cities. I suppose I could put a one second delay at the start between each city, does anyone have a better way? Also next to CityText there is a number of what significance is this? I need to know what to input it as on my map.
 
Level 2
Joined
Jun 3, 2007
Messages
20
I wasn't planning on it :p due to the fact that I have little experience in variables and thus hadn't even thought of it, however now that you mention it, it might be a good idea. So let me get it straight, I can save one city as City[1] and one city as City[2] and access them by referring to their array number?
 
Status
Not open for further replies.
Top