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

Floating text issue

Status
Not open for further replies.
Level 2
Joined
Jul 6, 2018
Messages
13
Hello there, the issue is; the floating text I created just won't disappear.

Here's what Ive tried so far:

Event: A unit is attacked

Condition: attacking unit equal to (my unit)

Set variable last created floating text
Create floating text above my unit
Wait 0.30 seconds
Destroy last created floating text (the variable)

However, that isn't functioning correctly at all, the issue is that the floating text will remain above the unit in questioning. Unless I start a new attack, only then and then will the last floating text be destroyed, creating new one above my attacking unit.

I will provide additional information if needed.
 
Level 39
Joined
Feb 27, 2007
Messages
5,016
You're setting the variable before you create the floating text so when it gets to the destroy line the variable is empty. The next time the trigger is run it sets the variable to the previous floating text then makes a new one, and deletes the one set in the variable (which id the old one because of the order you put the lines). Your method will break and never destroy the text if a unit attacks faster than every 0.50 seconds.

Set your variable right after you create the FT, not before. Instead of manually deleting them look at the rest of the floating text actions. There is one that says "disable permanence" which allows them to autodelete themselves. A different FT action lets you set the lifetime of the FT so it knows how long to keep them around. If you do that properly there's no need for the Wait and FT - Destroy actions you've used.
 
Level 2
Joined
Jul 6, 2018
Messages
13
You're setting the variable before you create the floating text so when it gets to the destroy line the variable is empty. The next time the trigger is run it sets the variable to the previous floating text then makes a new one, and deletes the one set in the variable (which id the old one because of the order you put the lines). Your method will break and never destroy the text if a unit attacks faster than every 0.50 seconds.

Set your variable right after you create the FT, not before. Instead of manually deleting them look at the rest of the floating text actions. There is one that says "disable permanence" which allows them to autodelete themselves. A different FT action lets you set the lifetime of the FT so it knows how long to keep them around. If you do that properly there's no need for the Wait and FT - Destroy actions you've used.

Oh I see, so I had to set the variable after creating the floating text. Also that permanency thingy didn't work for me, or perhaps I couldn't do it correctly, anyway thanks again :D
 
Level 2
Joined
Jul 6, 2018
Messages
13
Oh I see, so I had to set the variable after creating the floating text. Also that permanency thingy didn't work for me, or perhaps I couldn't do it correctly, anyway thanks again :D

Oh and I've got one more issue, if I may just write it down here instead of creating a new thread.

Basically I want an ability that reduces the target's armor on hit.
I tried with these triggers:

Event: A unit is attacked

Condition: Attackig unit equal to (my unit)
Condition: Level of ability equal to 1

Action: Set Variable - ArmorReduction = armor of attacked unit
Action: Set armor of Attacked unit to (the variable stated above) -3 (the armor)

That works to a certain degree, however I want it to trigger only once on attack. I tried to explain as best as I could. Will provide map or some additional info if that's not enough. Oh and a rep :D
 
Level 39
Joined
Feb 27, 2007
Messages
5,016
that permanency thingy didn't work for me, or perhaps I couldn't do it correctly
The FT - Set lifetime action doesn't work on permanent FT, so the order you do it in is important. Disable permanence, then set its lifetime to 0.30 seconds:
  • Floating Text - Change (Last created floating text): Disable permanence
  • Floating Text - Change the lifespan of (Last created floating text) to 0.50 seconds
Basically I want an ability that reduces the target's armor on hit.
Custom ability based on Item Corruption Bonus (from Orb of Corruption) will do what you want. You will need to modify a few of the fields. First set the damage bonus to 0, make it not an item ability, change the buffs/art to whatever your want, and set the armor reduction to 3. Finally change the "enabled attack index" to 0, so that it doesn't allow melee units to attack air units with a ranged attack like orbs normally allow.

This skill will not appear on the unit's command card (no item abilities do) so you'll need to make a dummy passive ability that does nothing that the hero can learn or the unit can display on its command card. I would probably use Brillance Aura with targets set to None and a 0 radius. If it's for a unit just give the unit both the new reduction ability and the dummy passive in the object editor. If it's for a hero, only give them the dummy ability to learn and then write this trigger:
  • Events
    • Unit - A unit learns a skill
  • Conditions
    • (Learned hero skill) equal to DUMMY_ABIL
  • Actions
    • Unit - Add CORRUPTION_ABIL to (Triggering Unit)
 
Level 2
Joined
Jul 6, 2018
Messages
13
The FT - Set lifetime action doesn't work on permanent FT, so the order you do it in is important. Disable permanence, then set its lifetime to 0.30 seconds:
  • Floating Text - Change (Last created floating text): Disable permanence
  • Floating Text - Change the lifespan of (Last created floating text) to 0.50 seconds
Custom ability based on Item Corruption Bonus (from Orb of Corruption) will do what you want. You will need to modify a few of the fields. First set the damage bonus to 0, make it not an item ability, change the buffs/art to whatever your want, and set the armor reduction to 3. Finally change the "enabled attack index" to 0, so that it doesn't allow melee units to attack air units with a ranged attack like orbs normally allow.

This skill will not appear on the unit's command card (no item abilities do) so you'll need to make a dummy passive ability that does nothing that the hero can learn or the unit can display on its command card. I would probably use Brillance Aura with targets set to None and a 0 radius. If it's for a unit just give the unit both the new reduction ability and the dummy passive in the object editor. If it's for a hero, only give them the dummy ability to learn and then write this trigger:
  • Events
    • Unit - A unit learns a skill
  • Conditions
    • (Learned hero skill) equal to DUMMY_ABIL
  • Actions
    • Unit - Add CORRUPTION_ABIL to (Triggering Unit)

That was easy :D Thanks a lot!
 
Status
Not open for further replies.
Top