Showing Tower Range

BlackRabbit

New Member
Reaction score
3
I've seen some Tower Defense games online [like, flash games which, btw, don't cut it in comparison!] that show a tower's range in a circle around the tower. Is there any way to do that? Like, how a unit shows it's selection circle, would it be possible to either make the selection circle big enough [and stay accurate] or to find another way to do so?
 

TomTTT

New Member
Reaction score
44
You can simply change the selection circle's scale - it's in Art - Selection Scale. Just try and it will work out. You can also create a unit that it's model is either an Aura model or dowloaded selection-circle-like unit, and a player selects it, it appears. (simple trigger)
 

BlackRabbit

New Member
Reaction score
3
Mad props to you Tom for answering all my strange questions.

I tried the selection circle thing, but it makes it look crappy, makes the health bar for the tower GIANT, and I'm thinking about doing up an ability that shows a tower's range with just a short animation if you click to see it. Any ideas?
 

Moradiae

TH.net Regular
Reaction score
14
Just gonna throw out an idea of how I think they (like etd) did it here:

basically creating bunch of units (with locust) or special effects around selected unit when player type a certain command

I'll go with special effects here

Number of special effects placed along the circumference will depends on how big it is, which depends on the range.

for MUI version, see this post, it's basically done using the same formula, but different removing special effects method :p
Trigger:
  • create effect
    • Events
      • Player - Player 1 (Red) types a chat message containing -range as A substring
    • Conditions
    • Actions
      • Set range = (Real((Substring((Entered chat string), 8, 11))))
      • Set circumference = (3.14 x range)
      • Set spacing_constant = 50
      • -------- determine how far apart each special effects will be ALONG the circumference, the smaller the neater, but just don't set this to 0 --------
      • Set numberOfUnitAroundCirc = (((Integer(circumference)) / spacing_constant)
      • Set angle = (360.00 / ((circumference / Real(spacing_constant)))
      • -------- For the sake of minimizing rounding inaccuracies, angle is set with each term expressed as real number, so direct reference to numberOfUnitAroundCircle is not used here --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • range Less than or equal to 2000.00
        • Then - Actions
          • For each (Integer A) from 1 to numberOfUnitAroundCirc, do (Actions)
            • Loop - Actions
              • Special Effect - Create a special effect at (Position of (your unit)) offset by range towards (angle x (Real((Integer A)))) degrees) using (your effect)
              • Set rangeeffects[(Integer A)] = (Last created special effect)
              • Countdown Timer - Start rangeTimer as a One-shot timer that will expire in 4.00 seconds
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: No more than 2000 r...
          • -------- just an error message when player asks too show a range too big --------


and destroy effect trigger:
Trigger:
  • des
    • Events
      • Time - rangeTimer expires
    • Conditions
    • Actions
      • For each (Integer A) from 1 to numberOfUnitAroundCirc, do (Actions)
        • Loop - Actions
          • Special Effect - Destroy rangeeffects[(Integer A)]

damn, I miss the wc3 tag :(

result:
both with special effect Spell Steal
-range 300 (spacing constant = 100)
attachment.php


-range 500 (spacing constant = 60)
attachment.php

note: these 2 screenshots are from the old codes (not available in this post now) with the special effect missing on the right
 

Attachments

  • 300.JPG
    300.JPG
    34.5 KB · Views: 386
  • 500.JPG
    500.JPG
    57.7 KB · Views: 415

BlackRabbit

New Member
Reaction score
3
That is precisely what I'm looking to do. Now, turn that from a chat substring to an ability [easily done] and one that automatically pulls the range of the tower's attack. If that's not possible, I'll just make the same ability for each range I have in the game.
 

Moradiae

TH.net Regular
Reaction score
14
that's not the best of triggers mind you :D
there's also a little problem with showing more than 1 at the same time
and there's the missing effects on the middle right part (2nd picture) (maybe fix by turning everything to real except numberOfUnitAroundCirc because there're already too much roundings and also the fact that real only handle up to 2 decimal places, thus 6.28 - -)
 

TomTTT

New Member
Reaction score
44
What Moradiae showed was awesome, I had no idea how to do this... But I guess what you need to show multiple ranges at once is create a hashtable. When the unit casts the ability, save all special effects made, set time (integer) to the time you want, and add the unit to a unit group. Then make a 1.00 second periodic that picks every unit in those units, set the time to Time - 1 and save it again in the hastable after changed. Then, check if time is equal to 0, if it is then destroy all special effects. If it's too much I can give it a try. I'm kinda bored :p
 

Moradiae

TH.net Regular
Reaction score
14
lol, was trying to figure out how to solve that but couldn't find a way, I guess I need to look into hashtables here
I am current in the stage of moving away from using the wait function although I think wait still wouldn't work here

now there's this(hash), and jass :p

edited

--> if you want to make this only visible to you, one option would be to create unit instead and give them locust and perma invis ;)
 

TomTTT

New Member
Reaction score
44
Ok, now it's official: I'M STUPID!!!
I was really about to finish that darn thing, and guess what - I was corious to find out what is in hashtable Hastable - Save Eventid handle
And guess what! THE BLOODY CRAP CRUSHED!!!! So I'm starting all over again now..

EDIT: HAHA!!! Made it :) I'm not sure if it was acctually necessery, but I was bored.
I made the ability, and caused the range to be the Point-Value of the unit, so remember to change it to the range.
 

Attachments

  • Show Range MUI.w3x
    18.5 KB · Views: 185

Moradiae

TH.net Regular
Reaction score
14
Improved (I think)

In the old trigger, somehow there's a lot of effects missing for some large values for range

screenshot attached, new code see 2nd post (i'll edit it right after I post this)

@TomTTT
although I have not a clue what you were saying there, I wouldn't put ignorance within the same category as stupidity :p
tho I can still rely on you for fixing the removing special effect issue here right?:eek:

edited:
neat! your map will be my first resource for learning hashtables :p
 

Attachments

  • new.jpg
    new.jpg
    120.3 KB · Views: 209

TomTTT

New Member
Reaction score
44
@Moradiae
Woah thanks! :D
After getting the concept of Hastables, it's really easy. all I'd tell you is that what you need is to understand WHAT it is and HOW does it work. Then, all what you need is a simple logic. (If you want me to tell you, I'll be glad to, because as I said before - I'm waaay to bored...)
 

Moradiae

TH.net Regular
Reaction score
14
Haha, ok,
just one question here (I don't think it deserves a new topic :p)

I just remember vaguely that one map can only hold one hashtable, is that true?

because I was looking at the variable and saw that Range_Hash is a variable hashtable, and when you add, you add it in Range_hash, so many hashtable per map make sense
 

TomTTT

New Member
Reaction score
44
Haha, ok,
just one question here (I don't think it deserves a new topic :p)

I just remember vaguely that one map can only hold one hashtable, is that true?

because I was looking at the variable and saw that Range_Hash is a variable hashtable, and when you add, you add it in Range_hash, so many hashtable per map make sense

Ahh In fact I think you can use up to 512 Hastable (lol) within 1 map. I think Ryushi once started a thread asking that, not sure. But anyway, you can more than one.
 

BlackRabbit

New Member
Reaction score
3
All this got way over my head real fast...
Just looking for an ability that does it, so if I happen to want to see the range of a tower, I just use it's ability. I don't want it to happen when a unit is selected or anything, and it doesn't really matter to me if it's shown to just the using player or to everyone. I'm not too concerned about that part. There was a tower defense that did this that I used to play a while back. Possibly gem TD? I'm not sure...
 

Moradiae

TH.net Regular
Reaction score
14
Well, that's what's exactly in TomTTT's map above, (I guess that 1 view is mine huh?)
Just take a look :D

that was a long maintenance just now but the site loads pretty damn fast now :)

==== edited

here's the same map but I just use a new formula which works a lot more nicely now

Just remember that Point-Value is used instead so set it equal to the tower's range
 

Attachments

  • Show Range MUI.w3x
    19.6 KB · Views: 203

BlackRabbit

New Member
Reaction score
3
To be honest, I completely thought ab out this thread, and just checked back in on it today XD I'll check out the map right now. Judging my setting it to the tower's range, I would have to create the same ability, only for different ranges? That doesn't bother me much, just wanted to be clear. -opens map editor and plugs away-
 

Moradiae

TH.net Regular
Reaction score
14
nope, you only need 1 ability "Show Range" for your whole map,
only that for every tower you have, you have to also set its Point-Value to the same as its range

because what the trigger does is simply
set Range = ((Point-Value) of Triggering Unit)
 

BlackRabbit

New Member
Reaction score
3
Sounds simple enough. You two have helped me significantly. I appreciate it! I'll check it out and see what I can do.

Edit: Just implemented this into my map. It works great, but interferes with my Sell Tower ability. It awards three quarters of said tower's point value [previously set to it's cost in gold, now set to its first attack's range] back when a tower is sold. Any way I can convert this to gold cost?
 

TomTTT

New Member
Reaction score
44

Does all of your towers have the same shooting range? If so, just set Range in the map I uploaded to that range, and set the point value to the amount you want. Otherwise, I would suggest maybe MP? (Though I'm not sure towers can have MP)
 
General chit-chat
Help Users
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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