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

Create text when gold mine generates gold

Status
Not open for further replies.
Level 7
Joined
Jun 23, 2009
Messages
297
So I have this trigger system which detects how many gold mines, and which type of gold mines, each 10 players have built. Based on this, they gain a certain amount of gold per second. I have everything working, I only lack some text that appears each second, in yellow, and fades out...
I'm not sure if use floating text, or game text... Or whatever...
 
Level 9
Joined
Mar 9, 2010
Messages
272
It will be floating text, game text apears on the screen. Its quite simple to have text appear on top the mine and then fade. Just use regions with conditions stateing which regions. The biggest problem you may encounter is to have the created text destroyed after a second or so. This is so the text will apear then fade and repeats itself while gold is being gathered. Also you dont want the text varibles building up on eachother becuase the trigger to remove the text takes too long. If you want i may be able to help more tomorrow.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If all sums up, I think you better use Game Text
If you want for +10 for each of the Gold Mine, just use Floating Text, created next/above of the Gold Mine saying "+10" in yellow color (this is just like RTS (Real-time Strategy where +"gold" is often used to each of the resource building) game)
 
Level 7
Joined
Jun 23, 2009
Messages
297
If all sums up, I think you better use Game Text
If you want for +10 for each of the Gold Mine, just use Floating Text, created next/above of the Gold Mine saying "+10" in yellow color (this is just like RTS (Real-time Strategy where +"gold" is often used to each of the resource building) game)


Yeah, but to create floating text, I gotta have a point, and I have no idea how to get the point of each gold mine created...
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
Well you will hardly want a gold mine that is not created yet to give you gold...

Or are you trying to tell us that these "gold mines" are not units (as normal gold mines are)?

If they are units, you can keep track of them in a group. If they are just points on the map, use a location array to hold them (and then loop through the used indicies).

To make floating text that fades...
Firstly make the floating text object.
Next set its text to the gold value mined.
Then set its position to that of the location or unit (whichever you use).
Then set its tint colour to the usual gold colour (you can get this from the same file that allows steep terrain creation in the editor.
Then set its size (warning, JASS sizes are in screens per character so a size of 1 is massive but GUI runs the sizes through a converter so 1 is very small)
Then set it so that it is not permanent.
Then set its fade point to the time you want it visible.
Finally make it visible (using GetLocalPlayer() so only the receiver of the gold can see it).
 
Level 7
Joined
Jun 23, 2009
Messages
297
Yeah these gold mines are units, but I meant by "created units", units which are already there, before the map begins, and not created by triggers...
Look, here's it is, when I click "select unit" It expects me to select a unit in the WE:


64803413.png
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
In that case you are after generating a unit group from all the gold mines. Then enumerate through the unit group (runs code for each unit in the unit group) and run your gold giving code for it.

To get initially placed goldmines, simply construct the group and then pass it through the native to enum units of a certain type (gold mine). Later when you create more gold mines via triggers (if you do) you can add each gold mine to the group as your create them. The end result is a neat little group containing all the gold mines on the map which you can enum through efficently.

Ofcourse, if gold mines can be removed you will want to remove them from the group at the same time (to prevent leaks and keep things running efficently).
 
Level 7
Joined
Jun 23, 2009
Messages
297
In that case you are after generating a unit group from all the gold mines. Then enumerate through the unit group (runs code for each unit in the unit group) and run your gold giving code for it.

To get initially placed goldmines, simply construct the group and then pass it through the native to enum units of a certain type (gold mine). Later when you create more gold mines via triggers (if you do) you can add each gold mine to the group as your create them. The end result is a neat little group containing all the gold mines on the map which you can enum through efficently.

Ofcourse, if gold mines can be removed you will want to remove them from the group at the same time (to prevent leaks and keep things running efficently).


Sorry man, I did not understood a word you said
 
Status
Not open for further replies.
Top