lumber/gold mill floatingtext

Cpt Victory

New Member
Reaction score
0
I'm trying to make a map with a lumber mill and gold mill that gives resources every 5 seconds. Is there a way to make a floating text appear over every mill, or a way to replicate how when wisps gather lumber theres a periodic +5 that appears over there head and then dissappears? any help would be greatly appreciated.
 

BAkil

New Member
Reaction score
9
Alrighty I've snapped something up quickly for you.

Here's what the trigger will look like:

Trigger:
  • Income01
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set UNITGROUP = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Footman))
      • Unit Group - Pick every unit in UNITGROUP and do (Actions)
        • Loop - Actions
          • Player - Add 5 to (Owner of (Picked unit)) Current gold
          • Floating Text - Create floating text that reads +5 above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 3.50 seconds
      • Custom script: call DestroyGroup (udg_UNITGROUP)
      • Set UNITGROUP = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Knight))
      • Unit Group - Pick every unit in UNITGROUP and do (Actions)
        • Loop - Actions
          • Player - Add 5 to (Owner of (Picked unit)) Current lumber
          • Floating Text - Create floating text that reads +5 above (Picked unit) with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 3.50 seconds
      • Custom script: call DestroyGroup (udg_UNITGROUP)


Below is an in-depth description of why I done what I done in the trigger.

Now I've used an event called Periodic Event: 5 seconds. What this means is that the trigger will automatically run once every 5 seconds and check the conditions or execute the actions on regular intervals.
There are no conditions, as none are required.
To start off, you need a variable called UNITGROUP. We need this to ensure that no memory leaks are caused in this trigger. We will have to erase the information store in the variables later.

The first action involves setting the UNITGROUP to all units in playable map area matching the unit-type Footman. This means that all footmen in the map will be stored in the UNITGROUP variable.
What I need you to do is replace the value for Footman with your Gold mill. The Footman is only used as an example in this post.

We then run a list of actions for every picked Footman (or Gold mill in your case), where will will include the actions to generate the gold and display the floating text.

First we simply add 5gold to the owner of the picked unit.
Now we create the floating text above the picked unit's head, displaying +5 in yellow. If you would like you can change the colour to something more goldish, or change the size to something bigger or smaller, it's all in that first floating text action.
Now we set the velocity of the floating text to 64 towards 90 degrees. This controls the speed and direction that the floating text will fly. 90 degrees is straight up, and you'll have to test to see if 64 is a speed that you'll like.
Next we must disable the permenance of the last created floating text. If the floating text is permenant, it will never dissapear, which is not what we want.
Next we set the lifespan of the floating text to 5 seconds. This controls when the floating text will automatically dissapear and be deleted.
Then we set the fading age of the floating text to 3.5 seconds. The fading age controls when the floating text will begin to fade out. It will continue fading out smoothly to eventually become completely invisible once it's lifespan expires. This means it will take 1.5 seconds to completely fade out, beginning after 3.5 seconds of existance.

And that's all for the Gold mill.
We then use a custom script to delete the information or data stored in the UNITGROUP variable. If we don't do this, your map will begin to delay and lag after particular durations of gameplay.

The next part is similar, we're picking all units that are Knights (to be replaced with a Lumber mill in your situation) and adding 5 lumber to their owner, and creating pretty much the same floating text but in green.
I suggest you select all of the above actions and copy/paste them to significantly speed up the process. To do this select the first action, which is the one which sets the UNITGROUP to all Footman, hold SHIFT and select the last action, which is the one to erase the information in the variable. This then selects all of the actions in between. Press CTRL + C to copy, and then CTRL + V to paste. Make sure you paste it either on the bottom of the action list, or right at the top.
Then just change the Gold mill or whatever in the unit-type into your Lumber mill, change the player property from gold to lumber, and change the colour of the floating text to green.

If you do all of that correctly, you hopefully shouldn't have a problem. However if you do and if I made a mistake, please let me know.
Sorry if that was too much to read =(
If you need any more help or further clarification, just get my attention and I'll do my best to help ya!
 

BAkil

New Member
Reaction score
9
The unitgroup one is for unitgroups. Unit-type is fine because it doesn't cause any memory leaks.
 

Cpt Victory

New Member
Reaction score
0
another question, i may have a lot. how do you create a custom script? i'm finally committing to seriously make a good map, so i'm pretty new.
 

BAkil

New Member
Reaction score
9
Haha can't blame you it's a pretty daunting list. Something of that size is bound to confuse people. Hit me with as many questions as you want, I'll be glad to answer them. Just excuse some possible delays on relpies =(
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top