HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Floating Text Issue

08-06-2008, 04:31 PM#1
Archi
Greetings fellow community members!
My cousin "Archian" isn't here right now so I'm all by myself in the World Editor And I have a trigger issue which I really would like to have solved! I hope you guys can help me out here

The trigger I'm trying to obtain should do the following:

Every X seconds of game time a player who owns a specific unit type get's X amount of gold for each unit owned this way. When the gold is added to the player I want a floating text above each of the specific unit types saying how much gold there was added. That is how much the player got from each of the specific UNITs.

Here's what I have so far:

Trigger:
Farm 1
Collapse Events
Time - Every 10.00 seconds of game time
Conditions
Collapse Actions
Floating Text - Create floating text that reads |c0000FF00+ 5|r above Farm 0070 <gen> with Z offset 5.00, using font size 10.00, color (100.00%, 100.00%, 100.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 1.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 0.25 seconds
Player - Add 5 to (Owner of Town Hall 0051 <gen>) Current gold

The variable "(Last created floating text)" doesn't work when I copy this trigger to achieve the same effect twice...
I guess I'm kinda newbish to variables and "global effects" ^^'

Please any help that may lead to the fixing of my problem will be greatly appreciated
08-07-2008, 05:44 AM#2
Pyrogasm
Well, here's what I would do:
Trigger:
Collapse Events
Time - Every 10.00 seconds of game time
Conditions
Collapse Actions
Collapse Player Group - Pick every player in (All Players) and do (Actions)
Collapse Loop - Actions
Custom script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units owned by (Picked Player)) and do (Actions)
Collapse Loop - Actions
Set AddGold = False
Collapse If (All conditions are true) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked Unit)) equal to Farm
Collapse Then - Actions
Set GoldAmount = 5
Set AddGold = True
Else
Collapse If (All conditions are true) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
AddGold equal to True
Collapse Then - Actions
Add AddGold to (Picked Player) current gold
Floating Text - Create floating text that reads ((|c0000FF00+ + String(AddGold)) + |r) above (Picked Unit) with Z offset 5.00, using font size 10.00, color (100.00%, 100.00%, 100.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 1.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 0.25 seconds
Else
And then all you have to do to add new building types is copy the if-then-else statement:
Trigger:
If (All conditions are true) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked Unit)) equal to Farm
Collapse Then - Actions
Set GoldAmount = 5
Set AddGold = True
Else
And replace the checked unit-type and the added gold amount.
08-07-2008, 10:24 AM#3
DioD
Remember 99 text tag limit
08-07-2008, 10:56 AM#4
Archi
Thanks for your answer, both of you :)
Trigger:
Set GoldAmount = 5
Set AddGold = True
Which variable types do you use for these? Integer?

Sorry, do I make this a seperate trigger or do I add it to the same? Or what exactly do I do with this?
Trigger:
If (All conditions are true) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked Unit)) equal to Farm
Collapse Then - Actions
Set GoldAmount = 5
Set AddGold = True
Else
08-07-2008, 11:11 AM#5
SeruK
Quote:
Originally Posted by Archi
Thanks for your answer, both of you :)
Trigger:
Set GoldAmount = 5
Set AddGold = True
Which variable types do you use for these? Integer?
The first is an integer and the other a boolean. As for the other question I have no idea what you're asking.

Oh and Pyrogasm don't you mean

Trigger:
Add GoldAmount to (Picked Player) current gold

?
08-07-2008, 11:17 AM#6
Pyrogasm
Yeah, I meant that.

And that 2nd trigger thing is just me showing you what part you'd need to copy to add a check for different unit-types. You don't have to do anything with it.
08-07-2008, 01:24 PM#7
Archi
I thought it was some kind of diffrent trigger since you put it in another trigger tag. But I see now you were just pointing out some specifics :)

Thanks a lot! I'll try it right away
08-07-2008, 02:10 PM#8
Archi
Sorry, it didn't work - unless I'm doing something wrong

At first the floating text was displayed above every unit in the map except the Farms which was the only unit it was suposed to be displayed above :P
And no gold was added either :(

Then I tried changing something that I dont remember :P
And now nothing happens.

Here's the trigger I'm currently using:

Trigger:
Farm 1
Collapse Events
Time - Every 10.00 seconds of game time
Conditions
Collapse Actions
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Custom script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
Collapse Loop - Actions
Set AddGold = False
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Equal to Farm
Collapse Then - Actions
Set GoldAmount = 5
Set AddGold = True
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
AddGold Equal to True
Collapse Then - Actions
Player - Add GoldAmount to (Picked player) Current gold
Floating Text - Create floating text that reads (|c0000FF00 + ((String(GoldAmount)) + |r)) above (Picked unit) with Z offset 5.00, using font size 10.00, color (100.00%, 100.00%, 100.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 1.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 0.25 seconds
Else - Actions

Also I think perhaps you want to know this:
  • There is 8 players in this map, and I want this to work for all of them (so they each get X amount of gold regarding of how many Farms they control each)

Again thanks for your help

EDIT: And here's the variables I have.

Zoom (requires log in)
Attached Images
File type: pngvariables.png (8.3 KB)
08-08-2008, 02:30 AM#9
Eznce
Ok, i tried this out myself and i got it to work fine. Here is what i did:
Trigger:
Collapse Events
Time - Every 10 seconds of game time
Conditions
Collapse Actions
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop Actions
Custom Script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in units owned by picked player of type Farm
Collapse Loop Actions
If conditons are true do then else do else
Collapse If
Unit type of picked unit equal to Farm
Collapse Then
Player - add 5 to picked players current gold
Floating text - Create Floating Text that reads +5 above Picked unit
Floating Text - Set velocity of last created floating text to 64 towards 90 degrees
Floating Text - Change last created floating text to disable permanence
Floating Text - Change lifespan of last created floationg text to 5 seconds
Floating Text - Change fading age of last created floating text to 4 seconds
Else
I didn't add the color tag in ,but you get the picture =). It worked when i tested it, so if you do it right it should work. This adds 5 to the owning players gold, for each farm they have. If you have any more questions about anything, post them, and i'll try to help.
08-08-2008, 07:48 AM#10
Pyrogasm
Archi, your only problem was that the 2nd If/Then/Else block should not be nested inside the "Else" of the first one. Instead of this:
Trigger:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Equal to Farm
Collapse Then - Actions
Set GoldAmount = 5
Set AddGold = True
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
AddGold Equal to True
Collapse Then - Actions
Player - Add GoldAmount to (Picked player) Current gold
Floating Text - Create floating text that reads (|c0000FF00 + ((String(GoldAmount)) + |r)) above (Picked unit) with Z offset 5.00, using font size 10.00, color (100.00%, 100.00%, 100.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 1.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 0.25 seconds
Else - Actions
You should have this:
Trigger:
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Equal to Farm
Collapse Then - Actions
Set GoldAmount = 5
Set AddGold = True
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
AddGold Equal to True
Collapse Then - Actions
Player - Add GoldAmount to (Picked player) Current gold
Floating Text - Create floating text that reads (|c0000FF00 + ((String(GoldAmount)) + |r)) above (Picked unit) with Z offset 5.00, using font size 10.00, color (100.00%, 100.00%, 100.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 1.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 0.25 seconds
Else - Actions
08-09-2008, 09:08 PM#11
Eznce
Whoops, just noticed that, Pyrogasm is right.
08-11-2008, 12:03 AM#12
Archi
Thanks :)

However, I seem to have some trouble placing the 2nd If/Then/Else outside the "Else" of the first one
08-11-2008, 03:19 AM#13
Pyrogasm
Just drag it there.

If that doesn't work, drag the second one above the first one, then drag the first one above the second one.
08-11-2008, 09:01 AM#14
Archi
lol, that easy eh?

Anyway thanks. It seem to work fine now :)

Can I then have a trigger that disables this one and starts a new one with for example a higher income without any trouble? :)
08-11-2008, 08:25 PM#15
Pyrogasm
Yes, or you could just use a variable for the income from a farm:
Trigger:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Equal to Farm
Collapse Then - Actions
Set GoldAmount = FarmGold
Set AddGold = True
Else - Actions
And then in the second trigger:
Trigger:
Actions
Set FarmGold = (FarmGold +5)
Or something like that.