How to do multiple floating text???

  • Thread starter Thread starter dm0n
  • Start date Start date
D

dm0n

Guest
Some things that should be easy to do sure arn't.

I made a 20% chance for a random amount (between 20 and 100) of gold to drop from creeps. I used the gold coin model and it looks nice. So then I wanted to have a floating text rise up above the hero stating the amount of coin he found, then have it dissapear in 2-3 seconds.

Problem is when multiple coins drop off of creeps, then the hero picks them up close to the same time.

Since the only way to destroy floating text is "destroy - last created floating text", it will only destroy the last one, and the first one(s) he picks up will continue to float up to the top of the screen.

Example of code:

Coin
Events
Unit - A unit owned by Player 1 (Red) Acquires an item
Unit - A unit owned by Player 2 (Blue) Acquires an item
Unit - A unit owned by Player 3 (Teal) Acquires an item
Unit - A unit owned by Player 4 (Purple) Acquires an item
Unit - A unit owned by Player 5 (Yellow) Acquires an item
Unit - A unit owned by Player 6 (Orange) Acquires an item
Unit - A unit owned by Player 7 (Green) Acquires an item
Unit - A unit owned by Player 8 (Pink) Acquires an item
Conditions
(Item-type of (Item being manipulated)) Equal to Gold Coins
Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 8 (Pink)
Then - Actions
Set random = (Random integer number between 20 and 100)
Player - Add random to Player 8 (Pink) Current gold
Floating Text - Create floating text that reads (+ + (String(random))) above (Triggering unit) with Z offset 0.00, using font size 11.00, color (100.00%, 82.00%, 0.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
Wait 3.00 seconds
Floating Text - Destroy (Last created floating text)
Else - Actions
Do nothing

----------------------------------

Anyone know how to solve this?
 
LOL yepp but its a pain! Ryoko TD sells lotto tickets. Then creates floating text. my problem was, multiple people were buying tickets. I did exactly what your tryin to do.

Start your trigger with this.

Custom script: local texttag TEXTVAR (thats my variable name)

Then convert your trigger into custom text. Copy it in notepad. Then 'undo' the custom text command. You just need to know what the text lines will be. (The trigger doesn't have to stay that way.)

Then in every instance where you create the text, change the velocity, and destroy it, say this instead:

Custom script: (Paste that line here)

And change the original variables "getlastcreatedtextag()" to just TEXTVAR.

Then you can delete the standard GUI lines for floating text.

Try it. I'll paste mine in a few hours if need be.
 
I tried to do what you say, not sure if I'm following you on everything though.

I'm getting compile errors.

"expected endif"
"expected name"
"expected name"

I get 24 of those.
 
I just thought of this and seeing how complicated that can get I might just take the easy way out. hehe

I'm just going to add a "floating text - destroy last created floating text" before the new one gets created. So if one already exists, it will be erased before the new one appears.

Since my script is already per player, multiple players won't fudge it up.

So if people want to see how much coin they got, they just need to not pick up the next one as quickly :P

I would still be interested in seeing how to do it though, as I know this situation will come up again in the future. :)

Thanks for the quick reply and help!

- dm0n
 
haha, yes I would appreciate it if you do. also, I had to add a little more to my code to make it so the second floating text didn't get deleted by the first floating texts delete call. the second floating text sometimes got deleted immediatly due to that.

So I did this:

Then - Actions
Floating Text - Destroy (Last created floating text)
Set coinx8 = (coinx8 + 1)
Set random = (Random integer number between 20 and 100)
Player - Add random to Player 8 (Pink) Current gold
Floating Text - Create floating text that reads (+ + (String(random))) above (Triggering unit) with Z offset 0.00, using font size 11.00, color (100.00%, 82.00%, 0.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
Wait 3.00 seconds
Set coinx8 = (coinx8 - 1)
If (coinx8 Greater than 0) then do (Skip remaining actions) else do (Do nothing)
Floating Text - Destroy (Last created floating text)

There is one of these for every player number and an integer variable (coinx#) for every player.

That way it will skip the destroy text call if there is more then enough destroy calls in the queue. heh
 
Actions
Custom script: local texttag FTTICKET
Set Lotto_Ticks[(Player number of (Triggering player))] = (Random integer number between 1 and 15)
Set Lotto_Jackpot = (Lotto_Jackpot + 3)
Player - Add -10 to (Owner of (Triggering unit)) Current gold
Custom script: call CreateTextTagUnitBJ( "TICKET", GetTriggerUnit(), 10.00, 10.00, 100, 100, 100, 0 )
Custom script: set FTTICKET = GetLastCreatedTextTag()
Custom script: call SetTextTagVelocityBJ( FTTICKET, 64, 90 )
Wait 3.00 seconds
Custom script: call DestroyTextTagBJ( FTTICKET )
 
I still get errors :(

says the same thing

expected 'endif' and it highlights the Custom script: local texttag textvar

expected 'name' and it highlights the next custom script

then expected 'endif' and it highlights the last custom script.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    LOL! A tweak job!
  • The Helper The Helper:
    this is the fix I get from that yeah this is hard to control. disabling bots is pretty much necessary as ai and other bots would push really old threads to the top. reduce weight of view count. disable guest view tracking if you really want to push active threads to the top. a bit of tinkering for a few days with the weights and other settings should get you a decent trending widget box.
  • Ghan Ghan:
    I changed the settings a bit.
  • Ghan Ghan:
    Narrowed it to 7 days for the half-life and set views to 0 weight.
  • The Helper The Helper:
    I dont think Trending would work for this forum it would be better to just have the last 5 posts from anywhere
  • Ghan Ghan:
    Probably will have to give it some time to update.
  • Ghan Ghan:
    I'm guessing it is not retroactive.
  • Ghan Ghan:
    Next on the punch list: Update the server to Ubuntu 24.04.
  • The Helper The Helper:
    Mad Lads is new I see it displays original post date
  • The Helper The Helper:
    as long as it changes it is good - it is good now it updated and its new stuff
  • The Helper The Helper:
    One thing I have noticed and I dont know if it is by design but like 1 out of 3 times I come to the site the Anubis screen just hangs open, if I refresh it will go away but sometimes it hangs
  • Ghan Ghan:
    I've seen that as well.
  • The Helper The Helper:
    Wow - the change in the stats are major. I kind of knew it was all bots but wow, to see the effect. Why the social media sites cant do something like this I have no idea.
  • Ghan Ghan:
    Probably inflates their numbers so they look better to advertisers.
  • The Helper The Helper:
    Yeah google does not filter those bots. I remember when Apex was doing Google ads I saw the same IPs in there as I was seeing here - google is totally tracking all those bots as traffic and most google traffic, at least ours, was all bots
  • The Helper The Helper:
    oh wow, i bet i can post x links now and do the webp pics now giggity
  • The Helper The Helper:
    ahh anubis blocks anyone that has javascript turned off
  • The Helper The Helper:
    Robot: HTTP client library - i love the new robot :)
  • The Helper The Helper:
    New Science News Forum and it starts out with 420 threads :)
  • The Helper The Helper:
    Technical Support forum name changed To Technology News, there is now a Tech, sci/tech and science forums now :)
  • The Helper The Helper:
    Happy Saturday! Hope everyone has a fantastic weekend!
  • Ghan Ghan:
    We are now on Ubuntu 24.04. Had some issues with the style after the OS/PHP upgrade but now resolved.
    +1
  • Ghan Ghan:
    PHP 8.3 now live
    +1
  • The Helper The Helper:
    Weekend went by too fast. Next weekend I am going to try to do a nature thing - buddy of mine lives by the Colorado river and has some kayaks and invited me to do some kayaking from a place he knows to get on the river.
  • Ghan Ghan:
    That sounds like an adventure.

The Helper Discord

Members online

No members online now.

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top