Search Unity

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,993
    Thanks for letting me know. I'll get it fixed asap. Please send me an email if you want an advance copy.
     
  2. jim00

    jim00

    Joined:
    Feb 1, 2015
    Posts:
    57
    Hi, I have 2 questions:

    1) In Tower what the different between Effective Radius vs AOE Radius?

    2) TDSave.cs, where to I place this script and how to use it.

    thanks
     
  3. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Effective Radius is effective range of the unit base functionality. For turret it's how far they can attack, for support it's how far they can provide the buff, and so on. AOE Radius is the 'area of effect' radius for an attack. Anything hostile caught within the aoe radius of the attack target will be hit by the attack as well.

    You can't just use TDSave as it's. It's meant to be an example (or starting template) where you can write your own save function.
     
  4. Daedra92

    Daedra92

    Joined:
    Jan 21, 2015
    Posts:
    2
    Hi,
    found a little problem. Sometimes the background of the tooltip and the tooltip itself are completly offset to each other. Doesnt matter what resolution. Reproduced it, with a new project, where I only used the TDTK without changes.

    1920p.png 720p.png
     
  5. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I've just done some quick test. I didn't manage to reproduce the error. I have to say too that given the setting, I can't imagine what have gone wrong in your case. Can I know what version of unity and the target build platform you are using?
     
  6. Daedra92

    Daedra92

    Joined:
    Jan 21, 2015
    Posts:
    2
    Mainly I use Android, but I can also reproduce it, when I've selected Windows as build platform. Unity version is 2017.1.0f3
     
  7. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'll look into it. However I'm going to be away from office until next week so this will probably have to wait until I'm back. I hope you understand.
     
  8. jim00

    jim00

    Joined:
    Feb 1, 2015
    Posts:
    57
    Hi,

    I try to do Saving and Loading game progress during game pause and game quit.

    I use "Easy Save 2" from Asset Store (link: http://docs.moodkie.com/easy-save-2/guides/basic-saving-and-loading/). could you please help me on:

    How to I implement saving and loading in TDTK? How to save the game progress, Perk, Resources?

    I try to use TDSave.cs but still having trouble how to use it. I'm pretty new in coding, any help is appreciated. thanks.
     
  9. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    The code in TDSave.cs are meant to be example code. They are not linked to any part of the core framework. You have to add that yourself (create a button, add the callback function and so forth). They are very similar to easy save except they use the unity's default PlayerPrefs.

    I'm out of office for the day so I can't give you any further detail. But the example in TDSave should show you exact code how to save the game and perk prpgress.
     
  10. jim00

    jim00

    Joined:
    Feb 1, 2015
    Posts:
    57
    Please I really need your help, my coding skill is not very good. Please show me how to make it work. I have try many times and still can't make work. I'm not sure which saving code or loading code to goes where. I have keep trying and still not working. Please give me some working code showing, exactly how to save Perk, Resources, Prefab transform.

    Waiting for your reply, thanks.
     
    Last edited: Aug 18, 2017
  11. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm not sure if you are aware. Saving and loading is by no mean simple. And there's a lot of variable to consider in each case. Which is why there is no working-out-of-the-box solution available.

    The code in TDSave are working example code for persistent progress, which mean the perk and resource are carried from one level to the next. You merely need to call the save function when a gameplay level ended. Then at the start of a new level add the load to PerkManager and RscManager (the instruction are there in the TDSave.cs with each corresponding load function).

    If you are looking to save and load everything that is in the middle of the gameplay (the active tower/creep on the map, active wave, player's life, etc.), that's an entirely different level of complexity we are talking about. Even I myself would need to spend a great deal of time to get it working. So forgive me that I simply can't just give you a working solution.

    I should point out that despite the difference in complexity in both case, the principal of saving/loading is always the same. So the code to save/load is still the same. Just that you have a lot of stuff to load and save.

    Bottom line, the working code is there. You just need to try to really understand it. I'm very happy to help if you have more specific questions. But please understand I simply just can't give you a solution.
     
  12. jim00

    jim00

    Joined:
    Feb 1, 2015
    Posts:
    57
    Oh! sorry for the request, Maybe I’m asking too much.

    Ok, here what I did, and it’s not working. I use the code in TDSave.cs and put it into it respective places:

    SaveGeneralProgress() goes to ==> GameControl.cs under OnApplicationQuit()


    LoadRsc() goes to ==> RscManager.cs under Awake()


    LoadPerkRsc() and LoadPerk() goes to ==> PerkManager.cs under Awake()



    I also created 1 menu scene and 2 game scenes (all those scenes have been added to the Unity Build Setting) and when game 1 finished, it will run game 2 when “Continue” button is pressed.

    My problem is, I can’t get the purchased Perk to carry forward to the next game. Please tell what have I done wrong, thanks.
     
  13. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Right, I think the problem in this case is that you call SaveGeneralProgress() in OnApplicationQuit(). OnApplicationQuit() is only called when the user quit the application so probably nothing has been saved. Try call it in EndGame() instead, under the condition if(instance.playerWon).

    Perhaps it will help to make sure that the save/load function is actually called. You can put a Debug.Log("your message") in those functions so that you can check in the console.
     
  14. jim00

    jim00

    Joined:
    Feb 1, 2015
    Posts:
    57
    Hi,

    In Hierarchy -> TDTK -> Tower Manager under Inspector we can enable/disable Tower in "Show Tower List"
    How to do that by code? To enable/Disable Tower using code?
    Thanks
     
  15. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Do you mean doing it in runtime? When you enable/disable a tower when the game is not playing, you are merely editing a list corresponding to each tower. That list is then used to construct an actual list of buildable tower (buildableList in TowerManager) when the game start. That is why you can no longer edit it when the game start.

    To actually enable/disable tower in runtime, you will have to somehow have a list to reference what item is available and vice versa. Then you can simply edit the reference. An easy way would be to just add an additional bool list with each element correspond to an item in buildableList. Then of course you will have to edit the UI code to take account of this new list. So when the UIBuildButton.cs tries to generate the build button, you check the bool list you created, omit those tower that is not available.

    Make sense?
     
    Last edited: Aug 21, 2017
  16. jim00

    jim00

    Joined:
    Feb 1, 2015
    Posts:
    57
    Actually, what I’m trying to achieved is to have setup an in-app-purchase kind of thing. Where user can buy special tower, Perk, ability etc. I will use some plug-in for handing the purchase with app store but I need to know how to enable/disable those special items.

    Those purchase can be in game or in Main Menu (outside the game). Any idea on how to achieve that.

    Thanks
     
  17. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Well, the way I see it, you will still need a way to reference what item has been purchased/enabled via in app purchase. The towers, perks, abilities are added when the game started, each to their respective manager component. For tower, the buildableList in TowerManager. For Ability, abilityList in AbilityManager. For Perk, perkList in PerkManager. You will find them being filled up from item in db in Awake() of each manager component. If you have a reference of what's available from in app purchase, you can check against that and stop item that is not available from being added.
     
  18. karmik

    karmik

    Joined:
    Oct 8, 2014
    Posts:
    124
    I want to have planes attacking my base. Is there any scene, built in functionality to have planes attacking the bases with bombs gun etc and configure turrets to attack the planes
     
  19. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Can you clarify what exactly do you mean by base? Is it just towers in general? Or is it a specific building on the map and the planes will only attack it? By default you can have creeps that attack towers. There's an default creep prefab that do just that. However it will attack any tower that it comes across. If you want the creep to only attack a specific unit on the map, you will have to do some modification to the code.
     
  20. karmik

    karmik

    Joined:
    Oct 8, 2014
    Posts:
    124
    I am looking at prefabs flying over the towers and launching projectiles at them. Sort of fighter jets or Attack helicopters. Is that easily possible or would that need some coding.
     
  21. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Well, do they behave like creep? As in do they follow a fix path? If no, you will probably do some additional coding.
     
  22. alexsander890

    alexsander890

    Joined:
    Apr 15, 2013
    Posts:
    61
    Hi How to add a flame tower ? Effect shot attack always creates the effect anew.. Rotating Tower re-creates the effect of the attack. Need the following to effect the rotation of the tower. Sorry for my English
     
  23. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm afraid a specific flame tower type tower is not really supported at this point. I'll try to think of something in the next update.
     
  24. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    I say it's pretty capable. I was able to make one pretty easily by checking to see if a tower has a target or not and turning on an effect attached to the prefab. If it doesn't have a target, turn it off.
     
    Proto-G likes this.
  25. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm not saying that it's not doable, just that you can't really do it convincingly without have to do some modification or some extra scripting. :)
     
  26. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    This is the scripting I used for previous versions of TDTK. This will require additional changes for the new TDTK and will require changes to your fire effect to have an active/notactive state.
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class TargetEffect : MonoBehaviour {
    5.  
    6.     private TDTK.Unit unit;
    7.     private EffectSettings effectSettings;
    8.     private bool currentTarget;
    9.     private bool previousTarget;
    10.    
    11.  
    12.     void Start()
    13.     {
    14.         effectSettings = transform.GetComponentInChildren<EffectSettings>();
    15.         unit = transform.root.GetComponent<TDTK.UnitTower>();
    16.     }
    17.  
    18.  
    19.   void Update()
    20.   {
    21.        
    22.         if (unit.GetTarget() != null) {
    23.             currentTarget = true;
    24.         } else {
    25.             currentTarget = false;
    26.         }
    27.        
    28.         if ( previousTarget != currentTarget) {
    29.  
    30.             //change in target
    31.             if ( currentTarget ) {
    32.  
    33.                 effectSettings.IsVisible = true;
    34.             } else {
    35.                
    36.                 effectSettings.IsVisible = false;
    37.             }
    38.         }
    39.  
    40.         previousTarget = currentTarget;
    41.     }
    42. }
     
  27. PeteskiCamarginy

    PeteskiCamarginy

    Joined:
    Apr 18, 2013
    Posts:
    6
    Hi Sontan,
    I was unaware that you upgraded to V4. I purchased the upgrade just now but I can't see the option to use the FPS ability, has this been taken out as it was a main part of my games and I did not read it was removed from an upgrade?
    Reagrds
     
  28. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You are right, FPS mode has been taken out in TDTK4 at least for now. I don't think it's going to be missed by a majority of the user.
     
  29. PeteskiCamarginy

    PeteskiCamarginy

    Joined:
    Apr 18, 2013
    Posts:
    6
    That's a shame and without being rude it might of been good to let us know before hand. It is very hard to find out what is different from v3 to v4 until you purchase it on unity and possibly adding these notes to the unity page would be an idea.
    Kind Regards
     
  30. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm very sorry. I did remember making a post about dropping the feature, but not on the asset page. I'll do that later. Thanks for pointing that out.
     
  31. MCanot

    MCanot

    Joined:
    Dec 1, 2016
    Posts:
    3
    Hello,

    The enemies have an attack mode? (Not just going from point A to B, also attack my defense tower).

    Thank's
     
  32. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Yes, you can configure the creeps to attack towers if you wish.
     
  33. MCanot

    MCanot

    Joined:
    Dec 1, 2016
    Posts:
    3
    But come with the option and just is to mark the checkbox or i need to make the script?
     
  34. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You don't need any additional scripting. Everything can be done via the editor. However it's more than a check box since there are a bunch of other setting you will probably need to configure. This video may give you some idea -
     
    MCanot likes this.
  35. MCanot

    MCanot

    Joined:
    Dec 1, 2016
    Posts:
    3
    Thanks, good job.
     
  36. neapolitanstudios

    neapolitanstudios

    Joined:
    Feb 17, 2011
    Posts:
    75
    Hey Song, I have a couple of questions for you:

    I am wanting to use your latest TDTK, however I am unable to do something which I've achieved in the previous version. I'm working on a project where I want the tower platforms to be moving. In the old TDTK, I was able to do this by activated a script you had commented out which basically parents the tower to the platform, however I am unable to do this in the latest version. Is this possible in the new version? Or will I be stuck with the old?

    The commented code I am refering to is line 329 of buildmanager.cs:
    if(bInfo.platform!=null) towerObj.transform.parent=bInfo.platform.transform;

    One other minor question, before purchasing the latest version I read a comment that said there was a property in the tower editor for limited ammunition on towers, however I am unable to find it. Does that feature exist? Has it ever existed? lol

    Cheers! :)
     
  37. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm afraid you can't really move the platform during runtime in the current version (TDTK4). You can but the node are fixed this time so moving the platform won't help. I'll probably try to do something about that in the future but I can't promise anything right now.

    As for the limited ammunition, it's just a mechanic to create machine gun like tower, with short burst of fire for every shot and then pause. The tower will be able to fire indefinitely. In this version, this has been removed since you can achieve the same effect by setting assigning the same shoot-point to the shoot point list multiple time.

    Hope that answer your questions.
     
  38. neapolitanstudios

    neapolitanstudios

    Joined:
    Feb 17, 2011
    Posts:
    75
    No worries, I'll stick with the older version for this project. Hopefully I can sink my hands into TDTK4 in the future.

    Thanks for the prompt response! Love your work! :)
     
  39. beowulfkaine

    beowulfkaine

    Joined:
    Apr 3, 2014
    Posts:
    185
    Is there a way to integrate this to be used in virtual reality? I'm using the HTC-VIVE (steamVR) and I thought it would be interesting if the player could do all the stuff in the 2d menu in floating canvases and place the towers at specified locations.
     
  40. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I have to say I have zero experience when it comes to implementation of VR application. I know some user has attempt to do that unfortunately I don't know how those attempt turns out.

    Please take this with a pinch of salt, from what little understanding I have, you should be able to use the framework base functionality (the game mechanic) as it's. You just need to modify how the camera, the UI and user interaction works. I'm not sure how difficult will that be but it should be doable.
     
  41. beowulfkaine

    beowulfkaine

    Joined:
    Apr 3, 2014
    Posts:
    185
    I think the user interaction is probably the clincher. The user would have to be able to place objects on the board with a controller. There are many scripts for this so that's easy. I bought this asset a long time ago and am looking for a new VR project so I thought of this. I tried to put a VR camera in the scene and it works well. The problem I am having is that I can't integrate the upgrade system with a floating canvas. Plus I need the towers to snap to specific locations. Not sure how I'm going to do it or even if I can. I'm not much of a programmer. I'll tell ya though, a first person that comes up with a VR tower defense kit in the asset store probably would make a mint.
     
    Proto-G likes this.
  42. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    Hello
    1: I have set the grid size to 5 in the tower manager script & i have scaled up the towers and creeps to scale xyz = 2
    This seems to cause the towers not to work when a enemy passed by
    i suspect it is a range setting
    any suggestions how to fix this?
    2: how and where do i alter the interval of the spawn rate of a wave without changing the speed(tanks etc overlap due to scaling)
     
  43. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    The range of towers and creeps are not scaled to their transform scale. You need to adjust the vale of the tower range to match. I think what happen is you have increased their size way past their range. They should be a circle indicate a tower range when you select it. If you can't see it, chance are the range are too small (it has been obscured by the tower mesh).

    Open spawn-editor, in each sub-wave box there's a field named 'spacing'. That is interval (in second) between each individual unit spawned.
     
  44. RickP

    RickP

    Joined:
    Apr 4, 2010
    Posts:
    262
    Hello just purchased this package and really looking forward to using it. I'm an experienced programmer but I'm sure I'll have lots of questions :). First one is I thought I saw somewhere a different style of placing towers. This current one seems to be a drag and drop but I thought I saw where you click the tower slot and he ui popped up from there with the available towers. I prefer this style. Is there still support for that style of placing towers?
     
  45. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for your purchase. Yes you can change the tower placement style, just change the build mode on the game-object in the scene 'UI' to 'Point N Build'. If you want the build menu to pop up at where you clicked, make sure you enable the 'Use Pie Menu' option too.
     
  46. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    i found what i was looking for under Tower Editor>Level>Effective Radius.
    i cannot locate anything called subwave other than subwave count. and i cannot find a field name spacing
     
  47. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    i found the spacing field under scene>TD>TDTK>SpawnManager>inspector>Show Defualt editor>wavelist>subwavelist>Element0>spacing
    this seems to be the spacing between waves ...i was looking for spacing between creep.
    maybe this image can help describe the issue of the creeps overlapping
     
  48. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I see. Try uncheck the 'Generate On Start' option in the spawn editor. You should be able to see the wave by wave configuration. Then you should be able to see the 'sub-wave' and 'spacing' field that I was talking about.

    To clarify, you can procedurally generate the wave or manually configure it. When you have 'Endless Mode' or 'Generate On Start' option checked, the system will automatically switch to procedural generation mode and show the procedural generation setting (which is what you are seeing). Of course you can adjust the spacing between unit in this mode too. The parameter you should be adjusting in this case would be 'interval' for each unit. Try increase the 'Start Value' of 'Interval' and you will see the difference during gameplay.
     
  49. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    worked thanks
     
  50. RickP

    RickP

    Joined:
    Apr 4, 2010
    Posts:
    262
    I have a terrain and I place a platform on top of it. I also have Orthographic view setup. The terrain is at y = 0. I notice if the y value of the platform is <= 2.2 when I click it, the towers UI doesn't show up (I did what you suggested above), but if the y value of the platform is > 2.2 then the towers ui shows up when clicked. My concern is that it's not directly on the terrain so it would be viewed as being above it some. Is there something with Orthographicview and how this works?