Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

TowerDefense ToolKit 4

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

  1. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    You are refering to TBTK? No, none of the existing script is written to dsiplay the unit turn order.
     
  2. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    41
    Yes, sorry for posting on the wrong forum.

    On that note however, is it possible to display the list of creeps which will be coming in the next wave?
     
  3. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    Yes, it's possible. However it's not supported by default due to the many way the incoming wave can be setup. But it should be pretty straight-forward to do a custom solution.
     
  4. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
    Hi there,
    While you are in the process of fixing small bugs, I think I have found another one with SpawnEditor. It is related to Auto Generate. This is what happens:

    - If you enable 1 creep, auto generate will create levels with that creep
    - If you enable 2 creeps, auto generate will only create levels with the first creep
    - If you enable 3 or more creeps, auto generate will generate levels with all creeps except the last one

    So basically, it works for 1 creep. But if you have more than 1 creep, it won't pick up the last creep in the auto generation. (This is all with "Finite" as the option).

    It seems like it doesn't pick up all the creeps in the list properly, probably a simple thing I could fix myself, but I don't want to change the package code.

    Thanks
     
  5. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    Thanks for pointing this out to me. I'll check it out and get it fixed.
     
  6. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
  7. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    I took a look. Got it working just fine. Problem is you will have to change the animation import setting from legacy to generic otherwise it wont work. If you want the working prefab, please email me.
     
  8. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
    I have emailed you. I tried to make change the import settings, and I actually got the spider to animate. But it only showed the "Spawn" animation and then stopped moving.

    I would love to get your prefab to see all the fine tune settings. I think I am a bit lost with the model, the prefab, the animator, the animations, the root anim object, the CreepAnimatorControllerTemplate (do I need to create copies of this template for each creep? I just used it directly, but that might not work).
     
  9. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    Sent you the example.

    You dont need to create copies of the CreepAnimatorControllerTemplate. Just use the same controller for all the creeps. To sum it up, assign the controller to the animator, then assign the gameObject contaning the animator component as the root-anim-object, and specify the animation-clip to use. Both the assignment of root-anim-object and animation-clip can be done in the editor.
     
  10. fearfactory

    fearfactory

    Joined:
    Jun 11, 2013
    Posts:
    49
  11. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
    Hi there,
    I am starting to look forward to the bug fix version that was supposed to come in a few days a while back :) I am kind of stuck in my development until I get the update.

    I have another questions in the meantime. I have a prefab, that after import has decided to be located below the plan 0 in Y the axis. So I change the prefab to be positioned on 1 in the Y axis. That means the prefab is position correctly, right above the plane. When I just drag the prefab into a scene, it works great.

    But when the same prefab is spawned by your code, it seems to ignore my position of x:0, y:1 and z:0, and place the prefab below the ground anyway.

    What should I do?

    Thanks for the great support!
    Måns
     
  12. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    I'm trying to get the next update out as soon as possible. However there are other bugs that I have gathered up and need addressing as well. And I have other task on my hand that require my attention. So I hope you understand why's the delay. I'll try to finish it and upload the fix over the weekend. If you are referring to the procedural spawning bug, here's the fix: change line70 in TDTK_Class_WaveGenerator.cs to
    Code (csharp):
    1. int unitID=Random.Range(0, availableUnitList.Count);
    and that's it (-1 is removed).

    As for the prefab spawned position. I'm not sure which prefab exactly are you refering to (tower? creep?). But a general solution for this sort of problem without changing the code. would be introducing another empty transform as the parent to offset the position. Please refer to attached image. So the prefab would be spawned in (0, 0, 0), but your gameObject can be offset to whatever position you need.
     

    Attached Files:

  13. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
    Thx,
    I will wait for the update. My issues are mainly:
    - That I can't have perks that unlock towers of abilities, since they don't become available after purchase of the perk
    - That I can't have the perks global, since the perks don't get loaded in the beginning of the new level properly

    Great support as always, all my problems are solved so far, including the one above!
     
  14. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    The last update I did was on 6January. If I remember correctly, the two issues you mentioned has been fixed and included in the update.
     
  15. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
    Hi Song,
    Sorry about missing the software update on the 6th. I have now implemented the software update and I am afraid I am still experiencing similar issues (somewhat better now).

    I guess I am doing something wrong, but I don't know what.

    For Tower Perks this happens:
    - I can now have an ability that unlocks a tower
    - That tower then becomes available to choose, when I click on a platform (improvement from before)
    - But I can't select it. If I do, it still doesn't get built

    For Ability perks this happens (same as before):
    - I buy the ability that unlock the perk
    - The perk still doesn't show up in the list of perks
     
  16. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    I'll look into it. Regardless, I'll try to do an update either by this evening or tomorrow morning. I'll post again when it has gone live.
     
  17. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    Quick announcement: v3.0f4 has just gone live on AssetStore. :)
     
  18. fearfactory

    fearfactory

    Joined:
    Jun 11, 2013
    Posts:
    49
    I'd like to say that you're awesome and I bought this.

    I got an error like this and it was so clear what I had to do, that I didn't set the targetPoint:
    UnassignedReferenceException: The variable targetPoint of UnitCreep has not been assigned.
    You probably need to assign the targetPoint variable of the UnitCreep script in the inspector.

    I went and set it, done, good to go with my custom enemies.
     
  19. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    Hi All, Just a quick annoucement that a new update (v3.0f5) has just gone live. It's just bug fixes for the most part.

    The only change being an addition to the target mode which you can access from GameControl. The new option allows tower to clear it's target after each shot, forcing it to reselect a target for the next shot and thus enable the target selection priority to take effect for every shot, as oppose to the waiting until the target is destroyed or move out of range, despite the target no longer satisfy the criteria of the targeting priority.

    This is thanks to suggestion from Felisae.
     
  20. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Hey Songtan how would you make custom platform td or whatever you call it for the turret placement?
     
  21. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    You can use the default prefab (the one located in "TDTK/Prefabs/SceneComponent"). Simply adjust the scale in x and z axis to your liking and it's ready to go. If you want to you can disable the grid by disable the MeshRenderer component on the platform gameobject. If you want to add custom mesh, simply place it as the child object of the platform and adjust the scale to fit the collider. Make sure any custom mesh you add doesnt have any collider component on it.
     
  22. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Ok, and the game over menu is on the top right and not centred how would I fix it?
     
  23. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Also I am really confused about the mesh thing could you try to re-word it for me thx.
     
  24. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    So where do I put the prefab?
     
  25. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Here is a pic of my Hierarchy, What do I do for the platforms to work?
     
  26. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    even in the demo I can't click any grids I am using Unity 4.6.1f1
     
  27. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    Make sure your GameOverMenu's rectTransform setting is as shown in the image


    Please refer to the scene TDTK_FixedPath. All the platforms in the scene use a custom mesh (a simple cube). The mesh object is placed as child object to each of the platform. I hope the image below helps:


    Make sure the platform are properly assigned to BuildManager, or at least have the BuildManager auto-search for them. Please refer to the PDF documentation if you dont know how.

    Finally make sure your target platform in BuildSetting is not set to any mobile platform (iOS, Android, etc), the mouse control wont work in the editor under that setting.
     
  28. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Dude thank you so much man, but that still means I can export it to Android right?
     
  29. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Now that that is solved I have another issue now that I can actually click on the buildplatforms the cursor isn't really working with it, I point on the buildplatform but it will not recognize so I have to find somewhere else in the camera, basicly the cursor is off track.
     
  30. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    You can export it to Android yes. But when you switch to Android, it will only respond to touch input. So it wont work on desktop with mouse input.

    As for the platform, make sure your mesh's position and size matches collider's (in most case, make sure the mesh position is 0, 0, 0). Visually, you see the mesh but the platform detection for any input is based on collider. So if they are not matched, that means the platform is not where it appear on the screen.
     
  31. Trevinburgh

    Trevinburgh

    Joined:
    Jan 26, 2015
    Posts:
    29
    I'm having fun experimenting with TDTK. I've managed to do most things but can't work out how to buff creeps. I'd like to be able to define a creep buff and associated visual effect then set it for a creep. I've found things like 'Buff Effect' and 'Active Buf List' in the Unit Creep script but can't make them do anything. I'm guessing this is because the buffs in the demo are all for towers. Can I buff creeps?
     
  32. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    You dont need to access the code to buff creep. To buff creeps, you need to create creep prefabs that can do so. Fyi, there are three type of creeps. Normal, offensive and support. Normal is what you expect it to be. Offensive means you can assign a shootObject to it and it can fire at tower. Support creep is the creep that can buff other creeps, just like a support tower can buff other towers. Just check with CreepEditor, look for type. Once you set a creep type to support, you should see the relevant option. With that said, only creeps can buff creeps.
     
  33. Trevinburgh

    Trevinburgh

    Joined:
    Jan 26, 2015
    Posts:
    29
    Ah yes, I see it now. Thanks. Is it possible to assign a visual effect to show that a creep has a particular buff active?

    Edit: What I'm trying to do is set up a buff that a creep gets when it passes a particular point on the map. My idea is to put a collider there then have my code do whatever a support creep does!
     
    Last edited: Feb 9, 2015
  34. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    I'm afraid visual effect to a particular buff is not supported by default. But it's something you can add yourself with relative ease. You can just add your own script that check the buff effect in the creep and if a particular effect is there, show the effect.

    I'm not sure if this is a question or statement? Any any rate, here's how you do it. you can look at the SupportRoutine() of Unit.cs. That pretty much all a support unit does. Try adapt that code into your own code.
     
  35. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Alot of the ui is actually not in the screen and the coliders are on 0,0,0 position and it still isn't working.Also when I do find the platform somewhere in the screen, the tower selection is also of track.

    This is the gamescreen without the game started.
     
    Last edited: Feb 9, 2015
  36. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    The position of the UI when the game is not running matters not. They will reset to their intended position in runtime. Can you show me your platform. A screenshot of how they look in sceneview and inspector when selected. Then one with the mesh selected.
     
  37. Trevinburgh

    Trevinburgh

    Joined:
    Jan 26, 2015
    Posts:
    29
    Thanks for the quick responses, I now understand better how things work and should be able to work it out.
     
  38. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Sure, BTW I am using the default mesh,
    Inspector

    Scene: PS that's a placeholder tower

    Inspector Mesh: Not completely sure what you meant by the mesh selected but I think this is what you are asking for.

    BTW I downgraded from Unity Pro to Unity Free see if that would fix the issue but no and I haven't bothered to re-input the license.
     
  39. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    I'm sorry. I should have been more clear about this. When I said mesh, I meant the any child object your platform object might have. And can you please sent it in the format of the screenshot I showed you earlier, the selected object and it's properties in inspector (so I know which object is selected and what their properties are in Inspector), for both the parent and the child object. It's the setting and the relation between the object in hierarchy I need to see. Also it would be helpful if I can see where each of them are in the sceneview when selected.

    Also the 'mesh' you sent me is in fact a 'material'. Strongly recommend you go through this 2 links. Getting an understanding of it will certain help you in making sense of what is wrong.

    Fyi, in make no difference if you switch between Unity pro and free for the issue you are having.
     
  40. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Here is the mesh:

    It's using the default Plane mesh located at TDTK->Model_CustomMesh->SquareTile
    Here is the scene view with everything on it.

    and I got rid of the child objects to replace it with the prefab you were talking about. :/. Are the child objects needed? Sorry for the confusion.
     
  41. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    The child object are meant to be other 3D model if you want the platform to be more than just a square grid. If not, you can just leave it. It work just fine on it's own. Seems to me that everything is in order. So what is the problem exactly, the position of the UI doesnt match when play? Is the tower suppose to be build on top of the wooden wall? If so you need to place the platform on top of the way.. The tower will be build at where the platform is. The way you are placing it, the tower will be build on the ground and overlapping with the wall.
     
  42. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Yeah some of the ui is half of screen and the cursor selection for the platform is way off idk why it's doing that but yeah.About the tower and the walls I want there to automaticly make a wall when 2 towers are placed beside each other (as shown on the picture) is that possible?
     
  43. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    I guess the problem is with the screen resolution and the UI Scale setting. Do you have the same problem when running the example scene? What screen resolution you are using?

    By default, no. You will have to add that yourself.
     
  44. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    The ui is fine in example scenes and I am using 1920x1080 resolution.

    and how would I add that?
     
  45. Trevinburgh

    Trevinburgh

    Joined:
    Jan 26, 2015
    Posts:
    29
    Is there an option to have the creep HP bars show all the time rather than only after they've been hit? I've looked but can't find one. Currently I'm doing it by having a collider at the start of the path that calls ApplyDamage((float)0.01) but that seems a bit messy.
     
  46. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    Very sorry for the slow respond. For some reason I didnt get any notification about your post. Must have missed it.

    @Theekshana A, If the UI in the example scene is fine. I would suggest you just use the UI from the example scene. Just copy the UIObject in the scene and paste it to your scene. As for adding the wall, it depends. But it's certainly wont be straight forward. Are you building the towers on the same platform? Are the walls will only created between tower on the same platform? At any rate, you will need to determine if two tower has been built adjacent to each other. If yes, then instantiate the wall (you can make a wall prefab) between them. Also you will need to consider that the wall will need to be removed when the tower is sold. That means when placing the wall, you have to store the information which two tower it's tied to.

    @Trevinburgh, I'm afrad the the HP bar are coded to be appear dynamically for damaged unit. You will need to modify the code for it to show all the time. First, add if(onDamagedE!=null) onDamagedE(this); in Init() in Unit.cs and then remove the line if(overlay.barHP.value==1 && overlay.barShield.value==1) break; in _UnitOverlay() in UIOverlay.cs

    On another note, I'll be away starting on monday for 2 weeks. I apologize in advance for being slow in responding to your post or email. Thanks for understanding!
     
  47. Beremans

    Beremans

    Joined:
    Feb 18, 2015
    Posts:
    2
    Hey Song,

    Thanks for creating such an awesome product. I'm quite far in the development of a TD game now. I have a question regarding the Audiomanager. The sound effects seem to work fine, but the music won't play at all. Is there any known bug to this? I was scrolling through the code and some functions don't seem to trigger.
    Is there a solution to playing Background music?

    Thanks in advance

    Berend
     
  48. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    Hi Berend, it could very well be a bug. I'm away from office this few days. I'll look into it as soon as I can. Hope you understand.
     
  49. Trevinburgh

    Trevinburgh

    Joined:
    Jan 26, 2015
    Posts:
    29
    FYI: I think I've found a small bug. My custom ability descriptions weren't showing. In TDK_Class Ability.cs I added the lines "ab.useCustomDesp = useCustomDesp; ab.desp = desp;" to Clone() and this seems to fix it.
     
  50. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,631
    Thanks for pointing that out. I'll get it fixed. :)
     
unityunity