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

TurnBased-Toolkit (TBTK)

Discussion in 'Assets and Asset Store' started by songtan, Aug 11, 2013.

  1. JovanD

    JovanD

    Joined:
    Jan 5, 2014
    Posts:
    206
    Hello there seems to be problem with cover demo scene in unity 5.2, it won't render movement grid, error says some thing about already being in graphic rebuild loop, any idea how to fix it?
     
  2. choplee

    choplee

    Joined:
    Mar 19, 2015
    Posts:
    7
    When a unit has a spawn unit ability, and it spawns a unit using this ability - the unit is controllable by the player but the health/ap bars don't show up over the unit. I can provide a screen shot if needed. Any idea how to fix?
     
  3. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    Very sorry for not responding to any earlier post. For some reason I didn't get any notification. I hope it's not too late.

    They are scattered across different scripts I'm afraid. Most of them are in TBTK_Class_AttackInstance.cs, TBTK_Class_Ability.cs and Unit.cs.

    Have to say I'm not using 5.2 myself so I'm not aware of that. It could be an editor bug. Can you show me precisely what are the errors as shown in the log?

    I managed to found out what's wrong. A line is missing in UIOverlay.cs. Please following code in line112 - unitOverlayList[ i ].rootObj.SetActive(true);


    Just a heads up, I'm working on a major update which I hope will be ready in two weeks time. Basically the same thing I've done to another package of mine (TDTK). You can read this blog-post of mine to get an rough idea of what's coming next
     
    Last edited: Jan 10, 2016
  4. choplee

    choplee

    Joined:
    Mar 19, 2015
    Posts:
    7
    I added that line and it worked only after I spawned another unit. So if I spawned one unit, nothing happens, but if I spawn two units, it works for the first unit but not the second. I ended up doing the following in addition to what you suggested and it worked:
    unitOverlayList.rootObj.SetActive(true); //your suggestion
    try{
    unitOverlayList[i + 1].rootObj.SetActive(true); //this seems to get the job done. was a wild guess that the count function wasn't getting to the last element in the unit list array.
    }
    catch (Exception e){
    //in case index goes out of bounds
    }
     
  5. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    I'm very sorry. It should have been:
    Code (csharp):
    1. unitOverlayList[i].rootObj.SetActive(true)
    In my first post, [ i ] is interpret as italic sign and wasn't shown (just realize that when typing this post). Without the [ i ], that line I've given you wouldn't have compiled. The function is looping through all the overlay item looking for an unused one. If you use [ i+1 ], you would have got an argument out of range error when you reach the last item.
     
    Last edited: Jan 10, 2016
  6. choplee

    choplee

    Joined:
    Mar 19, 2015
    Posts:
    7
    Thanks for answering - one other question: the TextOverlay object that gets used throughout, where is the class for this? I want to increase the amount of time that the TextOverlay message remains on the screen.
     
  7. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    You will find the relevant code in UIOverlay.cs, in TextOverlayRoutine().
     
  8. Shturmovik

    Shturmovik

    Joined:
    Nov 5, 2014
    Posts:
    29
    Wow - an updated version would be perfect timing for me - just getting started using the toolkit in a real project, and there are some annoyances in the editors I would really love to see go away!

    Other than that, it's a fantastic toolkit that does almost everything I need for my project out of the box. :)
     
  9. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    Well, you will be happy to know that the update should be ready before the end of next week.

    Before that, can you elaborate what are the annoyances you are facing in the current version? I'll see if I can fix that, if I haven't already.
     
  10. Shturmovik

    Shturmovik

    Joined:
    Nov 5, 2014
    Posts:
    29
    Wonderful!

    I'll see if I can find a bit of time to note down some of the things I'm not completely happy with - but they're just editor issues, nothing major - and I'm really busy working on a proof-of-concept demo for the integration with another toolkit.

    Will post a video here as soon as I have it running! :)
     
  11. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    91
    I want to feed my own units(From ORK) into TBTK, what is the best way to approach this?
    Mostly what I need is to use my own stats for health, damage etc instead of ones in Unit class.
     
  12. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    I'm not sure to be honest. I have never use ORK and don't know much about it. It depends on how ORK works. But in most case, my guess is you will have to do a lot of changes to the code.
     
  13. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    91
    For example where should I look to see how TBTK handles health and damage?
     
  14. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    The value of the stats (health and damage) are stored in each unit instance (Unit.cs). When an attack occur, the calculation is done in AttackInstance.cs. Finally, the alteration of the value is done in ApplyEffect() in Unit.cs.

    Hope this help.
     
  15. KarmaTheAlligator

    KarmaTheAlligator

    Joined:
    Oct 16, 2015
    Posts:
    11
    Hiya, I'm new to Unity, and currently working on a project using your Kit (awesome job, by the way, tons of options to play with).

    I'm having a bit of a problem with the camera (using v2.0 of the Kit), it's way too sensitive when it rotates, and I don't see an option to change that: there's 'pan speed' and 'zoom speed' option but nothing for rotation. Am I missing something (since I saw it on a screenshot while searching the topic), or is it not available in v2? Or is it just a line of code that I missed?

    Anyway, another thing is: we're trying to decide if we want to have units as single model or as group (as in, whether we see 1 model per unit or 5, for example). So far I've built units by parenting separate models to the same Empty, and making the resulting group a prefab. The problem with doing this is that even when the models are the same, only one can have the animation applied to it (meaning only one out of 5 will actually run, the others don't move). Any idea on how to apply the animation to all the models?

    Cheers.
     
  16. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    There's a variable on CameraControl 'rotationSpeed' which control the rotate speed. However it's not exposed in the editor (my bad, I missed it). You can change the value by expand the show default editor option. However the value doesn't apply to mouse control (another mistake, my bad). I suppose if you are familiar with coding, it's not too difficult to add that.

    For the animation, You will need to modify the animation script. By default it only access one animator. You will need to create a list instead of it can be assigned with multiple animator. Of course, you will need to change the part where the script send a signal to the animator so that it send the signal to all those animators assigned.

    Hope this helps.
     
  17. KarmaTheAlligator

    KarmaTheAlligator

    Joined:
    Oct 16, 2015
    Posts:
    11
    Well the camera rotation was both for the mouse when building the scenes (although to a lesser extent), and touch screen when sent over to a phone (that's where the sensitivity really shows). I'll try both of your suggestions, thanks.
     
  18. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,074
    Hi Songtan,

    I just saw there was a new version that includes a new ability "overwatch". Can you explain what this does? Does it allow a unit to use action points to enable it to shoot at enemies during their turn when they become visible? If so, can you explain how you implemented it? I'd really like to add this to my current out of date version.
     
  19. Smazzolus

    Smazzolus

    Joined:
    Sep 21, 2014
    Posts:
    32
    Hi Songtan, thanks a lot for the release!
    Only one question, how can update my existing project?
     
  20. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    @Rajmahal, 'overwatch' works pretty much like its counterpart does in X-Com. The unit will consume an attack action to do nothing for the turn. But as soon as it spotted enemy movement, it will fire upon that enemy with a reduce hit chance (or not) to compensate the fact that enemy has broke cover (if cover system is used).

    I'm not sure if the same can be applies to your version since I've again made a lot of change in the latest update. I've done is as soon as a unit move into a new tile, a check is performed to see if there's any hostile unit is overwatching. If yes, the move will be put on hold and the overwatch attacks will take place. The move will only resumed once all attack is done. I imagine due to the way the older TBTK handle turn logic, it would be quite tricky to do this.


    @Smazzolus, You can just download the package again from AssetStore and import it into your current project. Just dont import "TBTK/Resources/TBTK_Data" folder if you want to keep your current setting. However, the current version is not exactly backward compatible as I've made a lot of drastic change. I would recommend you to import it into a new project instead.
     
  21. Smazzolus

    Smazzolus

    Joined:
    Sep 21, 2014
    Posts:
    32
  22. Magian

    Magian

    Joined:
    Nov 16, 2009
    Posts:
    91
    I see that you submitted an update to TBTK today. I also read your one blog post from this month where you submitted an extensive update to TDTK a few weeks ago. In a previous post here you indicate that the changes made to TBTK will be similar to those completed in TDTK: editor rewrites, editor layout, editor integration, the new UI, and code refactoring/optimization.

    Would you say with this release that this effort is largely finished, or is there more to come?

    Thank you.
     
  23. KarmaTheAlligator

    KarmaTheAlligator

    Joined:
    Oct 16, 2015
    Posts:
    11
    Hiya, new problem, although I'm not sure how that even happened or if you can help: When I go into the game in Unity, my mouse cursor has changed to the icon of one of the abilities, and I can't click anything on the grid (the UI buttons still work). The only changes since yesterday are that I've been experimenting with tile elevation, I changed the scale of the UI, and I changed the value for camera rotation in the 'show default editor' as you suggested yesterday. Still using v2.0

    Any help would be appreciated (even if it's just going back to the default settings or something), thanks.
     
  24. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    @Magian, Yes, I would say so. At least for now. The editors are UI are pretty much done (except from any bug fix I might do). In time I might add new component and do more optimization. But it wouldn't be so soon, at least not in a month or two from now.

    @KarmaTheAlligator, First I would check that if you haven't accidentally set the default cursor in PlayerSetting. If you haven't done that, try create a new TBTK scene (using the top panel Tools/TBTK/NewScene) and see if the new scene is still having the same problem. I would say the problem is probably due to something you have done to the UI. Changing the tile elevation and camera setting shouldn't have anything to do with the UI.
     
  25. KarmaTheAlligator

    KarmaTheAlligator

    Joined:
    Oct 16, 2015
    Posts:
    11
    That helped get it back to a normal looks, but I still can't click anything on the grid, in either the old or the new scene.

    OK, so it turns out I also changed the grid collider type to 'Individual' when experimenting with tile elevation (since that's what the documentation said to do), and that seems to have caused the problems, as I switched back to 'Master' and can now click things. Weird.

    In any case, thanks for the help.
     
  26. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    Sorry if this isn't made clear in the documentation, but everytime you change the collider type. You will have to regenerate the grid for the setting to take effect.
     
  27. KarmaTheAlligator

    KarmaTheAlligator

    Joined:
    Oct 16, 2015
    Posts:
    11
    Ah, I see, thanks for the explanation. Guess I should start and pay better attention.
     
  28. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,074
    Thanks for the explanation, Songtan. I'll download the latest version in a test project and try to understand how you did it. Hopefully, I can replicate it in my current version. Otherwise, I might consider upgrading to the newest version for my next project.
     
  29. KarmaTheAlligator

    KarmaTheAlligator

    Joined:
    Oct 16, 2015
    Posts:
    11
    Hiya, I just upgraded to 2.1, and I have a problem: the UnitEditor doesn't show an animation tab/menu, and even though I have the AnimationObject with the UnitAnimator (and the prefab with the Unit Animation script), the animation I added in the Clip Move doesn't work. This is the same unit where there are 5 models in the unit. At least in the last version I had one that moved.

    Am I overlooking something?

    Any help is appreciated.

    EDIT: I've also tried with a 1 model per unit, and still no luck.

    EDIT 2: Never mind, I've got it, I had forgotten to pick the Ani Root Obj. Sorry for the trouble.
     
    Last edited: Jan 29, 2016
  30. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    Sorry for the slow respond. Just to clarify, animation and audio setting for unit prefab is not shown on UnitEditor for the current version, yet. You will have to use Inspector to modify the setting on the prefab for the time being.
     
  31. Smazzolus

    Smazzolus

    Joined:
    Sep 21, 2014
    Posts:
    32
    Hi @songtan , I think I've found a bug:

    In the '' Unit editor ", the Hybrid Units have the values "Melee hit" and "Melee Crit." equal, that is, by changing "Melee hit" also changes "Melee Crit." and viceversa.

    And I have another question:

    I've imported my units made with the old TBTK and do not understand why I can not give more than a skill to each of them.

    I hope I was clear

    Thank you
     
  32. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    Thanks for pointing out the bug. I'll incorporate the fix in the next update. You can do that in advance by changing line379 of W_UnitEditorWindow to following:
    Code (csharp):
    1. if(unit.isHybridUnit) unit.critChanceMelee=EditorGUI.FloatField(new Rect(startX+spaceX, startY, widthS, height), unit.critChanceMelee);

    As for the adding ability to unit. I'm not sure why you can't do that. The only restriction, as far as I remember is that you can't have two or more similar abilities on a single unit. Otherwise you can have as much as 6 (due to the limitation of UI). Are you having the same problem with the default unit prefab?
     
  33. Smazzolus

    Smazzolus

    Joined:
    Sep 21, 2014
    Posts:
    32
    Thanks, it worked!
    Your prefab works right. I don't understand why my not.

    And I realized something.
    The'"UnitEditor" assigns me just the first skill that I've created in the Unit Ability Editor.
    If I select a skill that isn't the first that I've created in the Unit Ability Editor, by default the Unit Editor assigns to the unit the first ability of the 'UnitAbilityeditor" tab, and in addition, does not make me add other skills to the unit.
    I hope it was clear.
    Thanks!
     
  34. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    I'm sorry but I still don't quite get what is wrong. Perhaps you can export your prefab into a package and send it over to me so I can check what's wrong. If not, it's very hard to tell. Or if's that too much trouble, I would suggest you to just create new unit prefab to replace the old one.
     
  35. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    Just a quick announcement that I'll be away for 2 weeks starting tomorrow. During that period I may or may not have internet access so I might be a bit slow in respond on any issue/post. Also since I won't be having access to my work station, some issue will have to wait until I'm back. My apologies for any inconvenience in advance.
     
  36. gekidoslair

    gekidoslair

    Joined:
    Sep 7, 2012
    Posts:
    95
    just picked up this package, a few comments from my initial experiments:

    1) is there a reason why the UI classes aren't properly namespaced? UIButton (in particular) conflicts with NGUI's UIButton class which makes the whole thing explode if you are trying to use NGUI (as I am) - every other system is namespaces other than this, just wondering why you chose to not namespace the UI class?

    (of course NGUI not having a proper namespace as well drives me bonkers, but considering how popular it is, just thought I'd throw that out there as a potential gotcha for buyers).

    2) Your original TDTK had a 'base UI' class that was useful for handling custom UI implementation wrappers where necessary - would be nice to have something like this in the new kit, although I'd understand if you simply don't want to consider dev's that aren't using the new Unity UI. Still would be a 'nice to have' to make it simpler to replace the UI if necessary.

    And a 'real' question:
    3) does the system deal with overlapping grids / maps at all? I'm hoping to have multi-level buildings in some of my maps, and haven't found any mention of this kind of thing being supported - would this be feasible with the current grid system? What I'm hoping to do is the kind of multi-level navigation that XCOM has - so units can enter buildings, or optionally go up onto roof areas, under walkways - that type of thing. Ideas / thoughts?

    Thanx for yet another awesome kit!
     
  37. Alarconte

    Alarconte

    Joined:
    Jan 8, 2014
    Posts:
    29
    Hi there!

    Has been long time since I dind't work with new TBTK updates. Has Vertical Component dissapear? I've been searching and seems like there is no more Height default game interaction but... Automatic Grid composition in heights due to the terrain no longer works?
     
  38. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    Very sorry for the slow respond. Like I said in an earlier post, I'm currently away from office.

    @gekidoslair, thanks for you feedback and To answer your comment/question:

    1. There's no particular reason to that. It's just that I haven't thought about it right from the start. I'll do that in the next update.

    2. Tbh I can't really remember that. You said original, do you mean 1.0? I've been making lots of change since then. In fact I've just release 3.1 which involve a great deal of change for the UI code. Anyway, I'll keep your suggestion in mind.

    3. No, I'm afraid multi-level grid is not supported. The default grid generation system are design with single level grid in mind. So are the various game logic like line-of-sight and distance calculation. To add support for multi-level grid all of these will need to be changed. The thing is, the toolkit needs to be able to work with all sort of terrain/map. Adding multi-level grid will either complicate thing by a great deal, most likely making the system very clunky to work with. So until I can find an elegant solution to this, the toolkit is going to stay this way.


    @Alarconte, I'm afraid vertical component has been disabled since version2.0. You can still adjust the position (height) of the individual tile on the grid if you are using "Individual" for the grid collider type. However the height is no longer a factor in any of the game mechanic.
     
  39. KarmaTheAlligator

    KarmaTheAlligator

    Joined:
    Oct 16, 2015
    Posts:
    11
    Hiya, new problem.

    I set up a unit with a different animation for 'clip hit' and 'clip destroy' (which I assume is the death animation), but when the unit gets killed all I get is the 'clip hit' animation and the unit fades out, no 'clip destroy' animation plays. Am I missing something?

    Thanks in advance.
     
  40. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    Very sorry for the slow respond. I'm now finally back to my normal work schedule.

    Are you using the latest version. I've just tried it on my end and it works. Perhaps you can start by make sure the destroy animation works, by leaving out the hit animation and make sure the destroy animation get played when the unit is destroyed.
     
    Last edited: Feb 17, 2016
  41. eddyfosman

    eddyfosman

    Joined:
    Jan 18, 2016
    Posts:
    19
    I bought it, just so hype! I will write review later :D
     
  42. KarmaTheAlligator

    KarmaTheAlligator

    Joined:
    Oct 16, 2015
    Posts:
    11
    I am using version 2.1, and I just tried with just the death animation, nothing happens. The death animation works if placed in another spot (like the 'clip hit', for example), so I'm lost.
     
  43. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,074
    Hi Songtan,

    Does the current version have hybrid units with both melee and missile attacks? I remember you said that you'd removed this in a recent version but was going to put it back? I ask because I'm thinking of upgrading to the new latest version for my next game but having separate melee and missile attacks on the same unit is critical.
     
  44. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    @eddyfosman, Thank you!

    @KarmaTheAlligator, I'm not really sure why's that. Please give me sometime to check. If you dont mind, you can send me the model in question so I can check. Speaking of which, have you check with various model. Does happen on just one particular model or any model?

    @Rajmahal, Yes, the latest version support hybrid unit.
     
  45. KarmaTheAlligator

    KarmaTheAlligator

    Joined:
    Oct 16, 2015
    Posts:
    11
    Haven't tried with another model yet, I'll get another with the animations later. I sent you the files.

    EDIT: Tried with another model, same problem.

    EDIT 2: So, now that I have your example, I did the same for my models. The death animation works now for one unit, the other still doesn't work. The only thing that changed is the order in which I filled in the animation clips, starting with the death one and working up. I don't get it.

    EDIT 3: Is there a maximum time for total animation per unit? I got the death clip to work on the other one, but it cuts mid animation.
     
    Last edited: Feb 18, 2016
  46. ScottSummers

    ScottSummers

    Joined:
    Jul 12, 2015
    Posts:
    27
    [UPDATE: my problem was that I didn't notice that some data starts at 0, not 1.]

    Hi Songtan,

    When I modify by code a unit's data, the game behaves as if it hasn't been modified.

    Any suggestions? Thanks!
     
    Last edited: Apr 6, 2016
  47. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    Well, the question is, how you modify it and where did you place your code?

    Perhaps you can send me an email to explain the detail?
     
  48. ScottSummers

    ScottSummers

    Joined:
    Jul 12, 2015
    Posts:
    27
    Oh, I should have realized that some data starts at 0, not 1.

    Sorry for my mistake. Thanks!
     
    Last edited: Apr 6, 2016
  49. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    91
    Hello, what is the best approach to load custom units into battle in both sides. ?
    that is imagine this scenario. There are x units in a castle, and player has y units in his party. Player goes on world map to attack the castle and TBTK scene loads with X units from castle on enemy side and Y units from players party on players side.
     
  50. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,635
    In this case, I would suggest you first go through the documentation, under the section 'Integrating TBTK to your game'. That's the default approach to load units into a specific battle during runtime. Once you get the idea, please refer to the demo. Specifically, the script DemoCampaign.cs. That's the example code of using the API and load a specific line up of unit to the next scene. The script itself is reasonably commented so between that and the documentation you should be able to make something out.
     
unityunity