Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

TowerDefense ToolKit 4

Discussion in 'Assets and Asset Store' started by Song_Tan, Apr 18, 2012.

  1. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    Try holding 'Control' while dragging/positioning the transform in SceneView. It will move the transform at a fixed 'step'.
     
  2. levi-jh

    levi-jh

    Joined:
    Jan 17, 2022
    Posts:
    1
    I created a new scene and am using everything as default. When I use "Free Form Mode" (TowerManager -> Inspector -> Free Form Mode checkbox) I cannot place any turrets. It pulses red "Invalid Pos", and when I try to place it I get "Invalid Build Point" as a game message.

    Any recommendations?
     
  3. nnoom1986

    nnoom1986

    Joined:
    Jan 9, 2018
    Posts:
    26
    Hey songtan, when using assigned paths, is there a way to have every single creep randomly choose which path they follow? Right now "groups" will randomly choose a path, but I'm wondering if there's a way to set it so that each individual creep will, without having to set them up as individual items in the editor. Thanks!!
     
  4. nnoom1986

    nnoom1986

    Joined:
    Jan 9, 2018
    Posts:
    26
    OK. I actually may have got it.

    SpawnGenerator.cs
    Code (CSharp):
    1. public static Path generatePath()
    2. {
    3.     List<Path> pathList = Path.GetAllStartingPath();
    4.     List<float> pathOddsList = new List<float>();
    5.     for (int i = 0; i < pathList.Count; i++) pathOddsList.Add(1);
    6.  
    7.     int randPath = ChooseOption(pathOddsList);
    8.     pathOddsList[randPath] *= 0.25f;    //reduce the chance of the path being used again
    9.     return pathList[randPath];
    10. }
    SpawnManager.cs
    Code (CSharp):
    1. for(int i=0; i<subWave.spawnCount; i++){
    2.     subWave.path = SpawnGenerator.generatePath();
    3. ...
    4. }
    Seems to work OK. You see any issues doing it this way? Maybe too intensive for each creep?
     
  5. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    @levi-jh, "Free Form Mode" allow you to build in any location with no collider. So if you are using default scene, you can build anywhere as long as it's not on the build-platform (build-platform are colliders). Have you try to build outside the build-platform? You can refer to the implementation in the scene 'Demo_Linear_FreeForm'.

    @nnoom1986, Your code is fine. The only problem is the reduce chance of repeating path is not really working. The reason is every time the function is called, a new oddsList is created. So modifying the current one will not change what the next function call is going to use. Honestly, I think the result should be randomised enough even without it.
     
    nnoom1986 likes this.
  6. thepiratebob

    thepiratebob

    Joined:
    Apr 22, 2018
    Posts:
    6
    Errors upon import into a blank 3d project:
    Capture.PNG
     
  7. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    These are not errors. Just warning for some code that I've disabled. You should be able to run the scenes just fine.

    I'll clean this up in the next update. Sorry for the confusion.
     
  8. Niki-4

    Niki-4

    Joined:
    Oct 29, 2017
    Posts:
    21
    Hello @songtan ) I have some problem with support tower, when some tower in the radius upgraded support tower stop apply an effect on this tower, I found commended lines in UnitTower 340-347 after uncommend it started working but I have interesting bug. If I upgrade tower once it works perfectly but next upgrade having same problem

    What can I do with it?

    Thanks in advance)
     
    Last edited: Feb 7, 2022
  9. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    Sorry for the bug. I'm guessing you are upgrading to the next level instead to the next prefab?

    You don't need line340-347. What you need to do instead is add NewTower(this); in UnitTower line218. Should be just before OnSupportTowerBuilt();. That fix it for me as far as I can tell.
     
  10. Niki-4

    Niki-4

    Joined:
    Oct 29, 2017
    Posts:
    21
    Its not a problem, thank you for fast answer) I will try to do it)
     
  11. Niki-4

    Niki-4

    Joined:
    Oct 29, 2017
    Posts:
    21
    Hello @songtan it's me again, problem with support tower totally solved thank you!

    I have one question if it possible can you please help me to implement 1 feature? I'm not so good with coding, but I can something)

    So is it possible and not so hard to change the color of damage numbers to red (for example) when tower deal crit damage?

    Thank in advance)
     
  12. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    I've sent you a package via pm. Check it out.
     
  13. Niki-4

    Niki-4

    Joined:
    Oct 29, 2017
    Posts:
    21
    Thank you! Have a nice day!
     
  14. Season_H

    Season_H

    Joined:
    Feb 12, 2022
    Posts:
    1
    Hello, developer, is there a more detailed description document for reference? There are so many parameters in it that sometimes I can't think of what it means directly.(although the video has been explained more, I still don't understand many detailed parameters, such as what is the specific function of shield?)
    If you have any documents, please send me one, thank you

    Email:498585442@qq.com
     
    Last edited: Feb 13, 2022
  15. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    The pdf documentation that include with the package is pretty much it. Regarding the individual parameters though, most, if not all of them has tooltip that explain what they do. Just hover your mouse over them if you need more information.

    About shield: it's an additional layer of HitPoint that regenerate when the creep has not taking damage for the specified duration. So you can configure the amount of shield, the regenerate rate and the time it takes to start regenerating.

    Hope this helps.
     
  16. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    Hello

    Is there any way to invert the zoom?
     
  17. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    Line263 in CameraControl.cs, just change currentZoom+zoomSpeed to currentZoom-zoomSpeed
     
  18. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    can i have the change to? Crit is important to show.

    Im strugling to change the Way entry and exit is shown to the Maze. I need a Way to show the user where the enemies Will Enter and exit Maze. As of right now they have to Quess it. How is it calculated in code?
     
  19. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    I've sent you the package for coloured crit popup text .

    I don't understand how you are having a problem with the maze entry and exit. There's the path indicator to show it. If you disable it, there's the editor gizmos. It's always the nearest node the to the connecting waypoint and it's fixed once you have the waypoint placed. So you should have no problem knowing where is it yourself and place some visual indicator.
     
    Niroan likes this.
  20. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    Its because i dont use the path indicator.
    I created a Unit that looks like a wisp that flys trow the maze. So all my users conplain that they dont know where the Unit Will Enter or exit.

    i really need some Way to detect it
     
  21. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    I'm not sure what to tell you. Having a maze with no path-indicator is probably not the best idea. Entry or exit point aside, how do the player even tell how the creep navigate through the maze?

    Anyway, like I said, the entry and exit point are fixed. There's nothing stopping you from pre-determined that yourself (You can just quickly play the scene in editor and see where the creep enter and exit the maze) and put some sort of visual marker on it.
     
    Niroan likes this.
  22. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    Yeah hehe, i know man.
    Im gonna try that, made a quad now.

    Can you explain to me how the code works in platform builder script?
    I changed the shader to URP Unlit, but now its not taking the material and copying it?
    The issue is that the shader particle is way to light and see trow.

    Can you help me make it possible to use URP Unlit as shader for the grid?
     
  23. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    mat.mainTextureScale=new Vector2(x, y);

    Its like this code is setting the new scale, but the shader is not copied on the other node
     
  24. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    I made it work, i forgot to repeat texture.
    And thanks for script to show critical damage song :)
    As always you are a god in this branch !
     
  25. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    is there a easy way to disallow diagonal movement? Like not crossing over corners BUT only go strait up and down?
     
  26. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    There's a AStar game-object in the scene which responsible for the pathfinding. Change the path-smoothing (P Smoothing) setting to None.
     
    Niroan likes this.
  27. jotracey

    jotracey

    Joined:
    Mar 16, 2020
    Posts:
    2
    hey @songtan ran into an odd issue and i have tried to look up to see if someone else hit this issue but can't seem to find anything. i cannot seem to get the "next upgrade" piece to work. i have done a fresh install of the latest package on unity version 2020.3.14f1. I added the "Assets/TDTK/Prefabs/Towers/Tower_Turret_Cannon II.prefab" to the tower list and added that tower to the "next upgrade" on the base cannon tower. once i upgrade it once it shows the "next upgrade" but it remains greyed out.

    i have tired marking it "hide in inspector" and not, tried enabling it on the tower manger and not, but all have same results. I also have tired locking it via perk and unlocking but still same effect. any help would be appreciated

    P.s. LOVE the Toolkit man, everything i could have hoped for
     
  28. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    It's a bug. I must have made the mistake when cleaning up. To fix this, you need to modify Line244 of UITowerSelect.cs to this (The exclamation mark is the difference here):

    if(!TowerManager.CheckTowerCounterLimit(nextTower.GetTypeID(), nextTower.limitInScene)){

    Sorry about this.
     
  29. jotracey

    jotracey

    Joined:
    Mar 16, 2020
    Posts:
    2
    Thank you! that fixed it for me. I apricate the quick response.
     
  30. blamet3x

    blamet3x

    Joined:
    May 24, 2021
    Posts:
    3
    Absolutely love TDTK! Is there any ETA on the next update?
     
  31. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    Hey @songtan
    Is there a easy Way to make UnitCreep Play idle animation while Stunned? Its like they are still running when getting Stunned?


    Thanks in advance
     
  32. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    Hello

    How do i make a enemy heal other enemies AOe??
     
  33. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    The only way a creep can heal other creep is to use a support creep with a heal effect. Like a damage over time effect in reverse.
     
    Niroan likes this.
  34. yiovy91

    yiovy91

    Joined:
    Jun 21, 2020
    Posts:
    1
    I bought this asset some time ago but never had time to work on it. I’m very excited that im finally using it and a have nothing wrong to say about it, in fact is perfect and very useful for my project but im really having trouble with two things. First the save system if any of you guys can share the script that would be awesome and second i need to save after wave cleared (i trying to make an endless game).
     
  35. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    I don't think there's a universally applicable save system, or a save system where you can just copy and paste from other game. Save system are often very specific to the game. Not only you have technical stuff like the save format, save location, you also have the the functionality like what get save and when. I'm afraid this is something that you have to solve yourself.
     
    Niroan likes this.
  36. WesterEggStudio

    WesterEggStudio

    Joined:
    Jun 19, 2017
    Posts:
    6
    Hi, is it possible to make a tower which will use more than 1 "grid square", for example, an ultra heavy cannon that uses "2x2 squares"?
     
  37. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    I'm afraid that is not supported. You can only have towers that occupy one node.
     
  38. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    You Can increase the size of the platform square. So it looks bigger.

    then under platform GO and deaktivate all other Towers, except the specific Tower you made. Then make your Tower and place the platform where you want. Now that platforms Tower is bigger and better
     
  39. blamet3x

    blamet3x

    Joined:
    May 24, 2021
    Posts:
    3
    If I wanted to enable/disable abilities from lets say a main menu which list would I have to access the abilities from? I see abilityList in the ability manager script but can't seem to add/remove abilities using this list nor see what abilities is stored in this list via debug when game starts. Am I going about this the wrong way?
     
  40. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    I'm afraid you can't. The availability of the abilities are set on AbilityManager Inspector in the game scene. The settings are self contained in each scene.

    If you want to set the availability of the ability in the main menu (or from other scene), you will have to modify the existing script. The way it works right now, the AbilityManager script loads the ability from the db (see Awake() in AbilityManager.cs) and add them to the active abilityList depends on the its setting from the Inspector. What you need to do is override that setting with the one you have from other scene.
     
  41. blamet3x

    blamet3x

    Joined:
    May 24, 2021
    Posts:
    3
    Okay thank you. I am going to mess around see if I can figure this out. No clue where to start with overriding the settings. There seems to be so many ins and outs of TDTK lol. I have a list that contains ability names that the user chose and I am going to try to enable disable those abilities in tdtk based off of the ability names.
     
  42. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    Hello @songtan

    Is there any way to make the creep stop for x seconds AFTER it successfull attacked?
    I want the creep to like stop and wait then after x seconds start moving again.
     
  43. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    Well, you can either have the towers applies a stun effect on attck, or you can hardcode the creep to get a stun effect when they are attacked.
     
  44. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    I think you miss understand?
    I want the monster to STOP after it has attacked and go in idle mode for x seconds then move on.
     
  45. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    I see. In that case you will have to do some custom coding. The easiest way would be to just start a coroutine each time the creep has done an attack. Have that coroutine stop the unit from moving and attack for however long you need before resuming.
     
  46. ceprowler

    ceprowler

    Joined:
    Oct 24, 2020
    Posts:
    18
    songtan, I'm looking to do 2 things.

    1) When my tower upgrades to the next prefab I'd like it to retain the target priority (nearest, closest to goal, etc.). I'm assuming that UnitTower script line 64 GetTargetGroup command pulls the default target group selected in the tower editor? Is there an easy way to have it retain the target group of the previous prefab that was selected prior to the upgrade instead of pulling from the one selected in the editor?

    2) Is there a way to have any new towers created default to not being available in the tower manager unless the checkbox is ticked? Currently any new towers are available by default so if I add a new tower I then have to adjust each scene to not display the new tower. I'm assuming there is a bool variable in the tower editor script or perhaps the TowerManager script?

    Any help or hints on these two items is very much appreciated.
     
  47. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    Yes they can be done with some slight code changes. Unfortunately I'm away from office for the next few days. I'll let you know when I'm back on monday.
     
    ceprowler likes this.
  48. benbarnard

    benbarnard

    Joined:
    Mar 22, 2022
    Posts:
    1
    Can anybody tell me whether this pack can be used to make a 2D tower defense game?
     
  49. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,854
    Yes, you can just lock the camera and use 2D sprite for the units. That said, the game still works in 3D space. So depends on the camera angle you are using, in some instances you might need to do a little script modification to stop the unit from rotating.
     
  50. Geoffc

    Geoffc

    Joined:
    Feb 4, 2013
    Posts:
    38