Search Unity

TurnBased-Toolkit (TBTK)

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

  1. chainsawpenguin

    chainsawpenguin

    Joined:
    Sep 28, 2014
    Posts:
    106
    Good evening, team!

    It's a little hard to search a single thread for a question, so please do forgive me if this has been asked before, BUT if I have two different units, and want them to have different animations, how would I implement that? In other words, if I update the Attack animation for the UnitAnimator (to a custom attack animation called, say, Attack_7), won't that animation thereafter be applied to all of the models using that Animator Controller? I guess what I'm asking is, does the name UnitAnimator have to be constant for this to work, or should I create copies of it (with the same trigger and boolean transitions) as I need to for different animations for different units?

    UPDATE WITH MORE QUESTIONS: My units are not triggering any of the animations, actually, though they ARE playing their idle animations (which are not the built in idle animations), so I'm sure that they're seeing the animator controller. Any ideas? Also, I'm trying to STRICTLY do melee, and my characters still seem to be shooting at one another (at range of 1), and do not play the melee animation. I'm positive that I'm just missing something...

    UPDATE UPDATE: Okay! I added the Unit Animation script to my units, and now I can, in fact, assign different animations to each unit! I don't know how I missed that. I'm actually pretty sure most of this is resolved, but if you read through this and think of anything I might be missing (or can point me to any examples of good melee scenes using this tool) it would be appreciated!!

    Thanks in advance for any feedback/suggestions/guidance!

    ~~ chainsawpenguin ~~
     
    Last edited: Mar 4, 2016
  2. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Looks like you have just found out how to do things the right way. :)
     
  3. chainsawpenguin

    chainsawpenguin

    Joined:
    Sep 28, 2014
    Posts:
    106
    Okay, I have another question! When my units spawn in a game, they all face the same direction (meaning, the units for the player AND the enemy ai are all facing the +ve on the Z-axis). When they move and face for attacks, they are behaving exactly as I expect. Is there a setting somewhere to change the default orientation based on the faction (or something like that)?
     
  4. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    I'm afraid there's no such setting available yet in the current version. I'll remedy that in the next update. Shouldn't be too long until then (a week, 2 week max). Thanks for your patient.
     
  5. JessieK

    JessieK

    Joined:
    Feb 4, 2014
    Posts:
    148
    Hey curious of a few things just to know if they are possible or not, any help would be amazing

    1) In the demo campaign which I am using somewhat as a base, is it possible to stop the player clicking "battle" before they have even bought a single unit? Also where is the players progress saved? For example if I loaded in to the campaign scene, played a battle, loaded in to a scene which was purely for a cut scene with no TBTK content in it at all and then loaded back in to the campaign wanting to keep the players progress what files would I need to look at to do this?

    2) Is it possible to unlock a unit via the perk menu at all? I see there is away to unlock a new faction ability and a new unit ability but I'd like to be able to unlock units via this means as well, is that in anyway possible?

    3) Is it possible to have units cycle through attack animations so the animation isn't always the same?


    Thank you for any help you can give me!
     
    Last edited: Mar 5, 2016
  6. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    1. The unit line up as shown in the campaign menu are saved using PlayerPref. It will remain there until you clear all progress (even if you close the game or load other irrelevant scene). However that is all build for demo purpose. Different game may need or use different solution. For this reason, when loading into battle, the line up isn't load from PlayerPref. Instead, it's saved as temporary runtime data, intended to be read when the battle scene is loaded. Please refer to DemoCampaign.cs and TBTK_Class_Data.cs for actual implementation.

    2. At the moment, I'm afraid that is not supported. The closest thing you can do is to unlock an ability which allows the player to deploy the new unit. The perk system is designed to alter things that affect immediate gameplay. You can unlock an ability and use it straight away mid-game but unlocking a new unit will not change anything in the on going battle. Plus, unit availability is more to do with the meta game progression. Something I guess most developer wants to have their own custom system (like the demo campaign). So the perk system can't account for that as it is not a default feature of TBTK. However, once you have your own system, you can easily extend the perk system to interact with your own system to unlock new unit.

    3. Again, it's not supported I'm afraid. However you can modify UnitAnimation.cs to remedy that. Shouldn't be too complicated if you are familiar with coding. You can refer to this link. The script UnitAnimation.cs itself is always pretty self explained.
     
  7. chainsawpenguin

    chainsawpenguin

    Joined:
    Sep 28, 2014
    Posts:
    106
    Is it possible to play an animation for a Unit Ability?
     
  8. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Not by default. With the way unit ability works, it's hard to assign animation since any ability can be assigned to any unit. This can only work if all the units shares the same skeleton, which is unlikely the case for most user.
     
  9. chainsawpenguin

    chainsawpenguin

    Joined:
    Sep 28, 2014
    Posts:
    106
    Ah, okay. I added a state called "Ability" to the UnitAnimator, then added logic for overwriting that clip in UnitAnimation, and then changed the call for PlayAttackAnimationNSound in AttackRoutineAbility to a new (but nearly identical) PlayAbilityAnimationNSound, and there I fire the trigger that plays the Ability animation. Right now, it will play that animation for every ability (in my case, the only non-attack ability I have so far is to throw a grenade, so this is actually working fine for me for the moment), but I will have to sort out having it play different animations depending on the ability. Not quite there yet, but this is still really good progress! In my case, all of the units DO share the same skeleton, since it's always hot human-on-human action. :)

    I had, as I always do, another question! When I look at the prefab for the ability AOE Damage (...as I mentioned, I'm playing with grenades!) I see that there is only one Visual Effects setting (Ability_AOE_Shockwave). When I use this ability, I can see that it is somehow first playing SO_Projectile_Bolt, and THEN playing the Shockwave when it hits, but I don't see where this SO_Projectile_Bolt is set. If I copy the ability settings EXACTLY, my new ability does not play this. If I use the "Clone Selected" tool, it DOES play this... so I assume it's baked in there somewhere, but I can't figure out how to get to it.

    If I want to change the SO_Projectile_Bolt to a different shoot object for the AOE Damage ability, how would I do that?

    Also, this is an EXCELLENT product. I've spent quite a lot on products from the asset store (strictly as a hobby), and this is hands-down one of the best toolkits I have purchased, and having the code exposed is the best part. Seriously, I rank this up there with UFPS in terms of complete toolkits. It does exactly what it says, quickly and cleanly, and it looks amazing right out of the box AND it's super easy to edit (see above, for example!).

    So thanks! :)
     
    Last edited: Mar 7, 2016
  10. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Thanks for the glowing endorsement! :)

    I think you must have overlooked the setting in TargetingSetting section for the ability. You should know that you can set an ability to either act on its target straight away, or have the casting unit 'shoot' at it (like a normal attack). This is all done in TargetingSetting section by checking or unchecking the option 'Normal Attack'. When 'Normal Attack' is checked, you will have the option to assign a ShootObject, which is SO_Projectile_Bolt in your case. The shoot object is not treated as a visual effect since it's an integral part of all the attack sequence. That's why the shock wave won't show up until the shoot object hits.
     
  11. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Wahey, new update is up! I've add some really nice visual candy in this update, as well as new collectible system. Check it out!

    However, please note that all the model in the prefab (both towers and creep) has been replaced with the new model so if you intend to use the default model in your project, I would strongly advise you to make a backup.





     
  12. Frogames

    Frogames

    Joined:
    Jun 10, 2005
    Posts:
    195
    Long time since my last update. Farabel is still in dev, and is expected to be released next september!





    Take a look at www.farabel.com for more info!
     
    ponasoft likes this.
  13. HaChau

    HaChau

    Joined:
    Mar 15, 2016
    Posts:
    1
    Hi SongTan! Thanks for your very powerful toolkit
    I've some problem about the animation!
    i cant find animation here. How can i add my own animation?
    upload_2016-3-15_16-47-2.png
     
  14. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    The animation setting is currently not available on UnitEditor due to the update work I've been doing recently. I'll add that back in the future update. For the time being, you will have to manually add the UnitAnimation script to the unit prefab and configure it using the Inspector.

    I've also responded to your email, please look that up.
     
  15. whapislove

    whapislove

    Joined:
    Mar 16, 2016
    Posts:
    1
    i just bought asset pack and switched platform to android. I got these errors. Anyone know how to fix them?
     
  16. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Ah. My mistake, I forgot to remove the unused code which causes the error. You can fix the errors by deleting line68 to line72 in I_CameraControlInspector.cs. As for the rest, they are harmless so please ignore them for now. I'll fix them in the next update. Sorry for the trouble.
     
    whapislove likes this.
  17. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    76
    Is there a 1 attack per turn limit on AI?
    I set movement and attack per turn to 3 but AI only moves and attacks once.
     
  18. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Well, it's not really a limit. The problem is the current AI algorithm only attacks once per turn. I'll see if I can modify that in the next update. Sorry for the inconvenience.
     
  19. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    162
    Is there the option to upgrade a unit with different levels? Much like the TDTK.
     
  20. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    I'm afraid there's no such option. The only way to upgrade a unit is to use the perk system.
     
    maxaud likes this.
  21. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    162
    Thank you for the prompt response.
     
  22. ponasoft

    ponasoft

    Joined:
    Oct 6, 2013
    Posts:
    40
    This is first asset i bought. i wanted to buy before but i did not had money and i saw its on sale yesterday then i decided to postpone my idle game that i am busy for couple weeks :)
    It would be very good if there is a roadmap something like this:
    https://trello.com/b/qXRx5Y0R/ccg-kit-development-roadmap
    and level system is really awesome idea.
     
  23. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Thank you for your purchase, I hope you enjoy it. :)

    I'll try to look if I can do something like what you suggested. Might need to do a bit of research. I hope you understand that I can't promise anything though.
     
  24. ponasoft

    ponasoft

    Joined:
    Oct 6, 2013
    Posts:
    40
    No need promise :) its just idea so people can know about what changes will be made in future end when? if its cricital chage like new unity version or gui to uGui etc. we can wait and focus other areas. I am not expert and a bit messy while coding i always having problems with updates in normal C# projects and sometimes need to write codes again i will check this asset to find best way to add some additional codes that wont effect updates.
     
  25. bullardo

    bullardo

    Joined:
    Jan 5, 2013
    Posts:
    46
    I just picked this up and it's great, do you have any plans to build in any multiplayer support? I will probably pursue it since you provide the code but was wondering if it's on your radar.

    Thanks!
     
  26. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Thanks for your purchase. There is hotseat multiplayer support but that's about it. I would like to do a cross machine multiplayer support however I don't really know much about networking or coding for it to be honest. So it will be quite sometime before it's done even if I have any concrete plan for it. If you want to have a go, please be my guest.
     
  27. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    76
    Hello, I want to feed faction custom faction ability list when loading a scene. What is the best way to do that?
    (I don't want to assign available faction abilities from faction manager)
     
  28. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Assuming your are still using the faction abilities from the DB, the best way to do it would be to fill up the availableIDList in Faction.abilityInfo before the Start() is called in AbilityManagerFaction. The list is basically a list of ID of the ability assigned to the faction (what you configure in the editor window). You will need to replace that list of the ID of the abilities you want to assign to the faction. So maybe you can store the list as some static variable, then fill them into the abilityInfo instance of the faction at the start of the Start() function in AbilityManagerFaction. Make sense?
     
  29. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    76
    Ah thanks that should work. I was trying to add it directly to AbilityList of the faction, but all manner of weird stuff was happening there.
     
  30. casimirsmets

    casimirsmets

    Joined:
    Feb 15, 2016
    Posts:
    2
    Hey all,

    I'm another happy customer of the TBTK.

    I am using the toolkit to build my own game (like most here).
    I'm trying to do this with subclassing as much as possible, to support the updates of TBTK.

    We're not able (yet) to override some methods, due to them not being virtual, or due to variables that are private, WITHOUT changing the code of TBTK itself.

    I've talked about this with Song, and he will look what he can do about it, to support it in a future version.
    This means making the methods virtual, and the variables public.

    It's not certain (I think), yet I found this interesting enough to share with you.

    Greetings,
    Casimir Smets
     
  31. ponasoft

    ponasoft

    Joined:
    Oct 6, 2013
    Posts:
    40
    Thank you both :) i had same thought and i wrote i am trying to find best way for updates couple posts ago.
     
    casimirsmets likes this.
  32. casimirsmets

    casimirsmets

    Joined:
    Feb 15, 2016
    Posts:
    2
    Your idea about a roadmap seems pretty nice as well! :D
     
  33. JessieK

    JessieK

    Joined:
    Feb 4, 2014
    Posts:
    148
    Hey I was just curious, do you ever plan to allow the AI of the kit to use abilities?

    Right now they can basically only move and attack it seems, it makes any VS AI game quite basic.
     
  34. rcchang

    rcchang

    Joined:
    Apr 6, 2016
    Posts:
    2
    Hi there,

    Nice kit! I played the demo and I really liked it. The UI looks nice, but I would like to change it a bit to fit my game better. If I purchase NGUI, can I use it to make changes to your UI?
     
  35. Ronin-Ra

    Ronin-Ra

    Joined:
    Jul 7, 2012
    Posts:
    42
    Love the kit! Currently testing it out to see if it fits our Lovecraft meets XCOM game in development, Paranormal Intelligence Bureau.

    One thing the kit don't allow that we need is movement over several levels, as the game will feature mansions with with balconies and such.

    One way to solve this would be to add an integration to other solutions like Apex Path, do you have any plans for adding any such integration in the near future?

    I'm currently looking into using Apex Path instead of the built-in A-star solution when moving a unit myself, but would be nice with an "official" integration :)
     
  36. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    140
    Just bought the kit, and while playing around with it I tried to add my first unit prefab to the unit editor, and I kept getting this error, without it being accepted in the editor:
    Your script should either check if it is null or you should not destroy the object.MissingReferenceException: The object of type 'Unit' has been destroyed but you are still trying to access it.

    After this happened several times with my prefab, I tried to add one of your demo prefabs to the editor, and got the same error. Using Unity 5.3.4f1.
    Cheers.
     
  37. JoshC

    JoshC

    Joined:
    Nov 20, 2013
    Posts:
    5
    I think there is something wrong with this latest build. I was using 2.1.1 and had just downloaded 2.1.1 f1 and it broke my unit animations, the GridManager scripts UI isn't accessible anymore (unless I am missing something), and the documentation has parts that don't match the current framework.

    I think this project is still undergoing some massive updates, so it might be in a strange state right now.
     
  38. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    140
    You could be right, but we'd know for sure if Song would drop in and give us some feedback :cool:
     
  39. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Very sorry for the slow respond. For some reason unity has stop sending notification to me so I don't realize there has been new post here.

    @JessieK, honestly it's very tricky to do AI that use abilities, considering the abilities can be customized to do many different thing. How would the AI know when is the best time to use an ability and how best to use it. I think this is better left for user to implement them, since they know are the abilities in the game.

    @rcchang, definitely. The UI is very much separated from the core game code. You can remove all the default UI element and replace it with your own UI.

    @Ronin-Ra, unfortunately I have no plan to integrate the toolkit with any 3rd party, nor plan to add vertical component to the grid, not in the near future anyway.

    @wheelbarrow, can you please show me the full error message so I can know where the error is originated from? At the mean time, I'll try to replicate the error myself.

    @JoshC, thanks for your input. I'll check again.
     
  40. JoshC

    JoshC

    Joined:
    Nov 20, 2013
    Posts:
    5
    Thanks for the response Song! Maybe if i give you some more information it might help.
    To add custom animation to prefabs, I need to set the Ani Root Object to the model that is contained within the prefab? And should the animations be added to that model and NOT the prefab itself?

    Also, i think a lot more things in some scripts might be public? This is what the GridManager and UnitScripts look like in the inspector now:

    GridManagerInspector.JPG UnitScriptInspector.JPG
     
    Last edited: Apr 13, 2016
  41. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    For the animation, if your model has any animation, they should have a animator or animation component on them. That is the reference that UnitAnimation need. AniRootObject is simply referring to the game-object that containing the animator component. Under most circumstances, the model is set as the child object of the prefab. UnitAnimation on the other hand, has to be on the prefab itself (the same game-object that contains the unit component).

    What happen to your GridManager inspector is not an error or bug. You have simply turn on the inspector debug mode. Just switch it back to normal (refer to image). You can bring up the menu by clicking on the little drop down icon on the top-right corner.

     
  42. JoshC

    JoshC

    Joined:
    Nov 20, 2013
    Posts:
    5
    Oh jeez I cant believe I missed that I was in Debug! Apologies for that! :)

    So I think I am missing something when I am trying to set my unit animations. My unit sits in the Idle animation and doesn't walk or attack. The unit will still pivot to aim, and the attack still happens, but it remains stuck in idle. Here is how I have the prefab set up:

    Prefab.jpg Model.jpg
     
  43. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    Well, two things.

    First, TBTK only works with Animator component, not Animation component. So you will have to replace that with Animator (and remember to assign the controller to it, refer to documentation).

    Second, you will need to assign the game-object that contain the animator component to UnitAnimation, to the AniRootObj slot. If you haven't got an Animator component, this won't work.

    I would recommend you to go through the documentation if you haven't already.
     
  44. Ronin-Ra

    Ronin-Ra

    Joined:
    Jul 7, 2012
    Posts:
    42
    Okay, I'm looking into using Apex Path myself. Maybe I'll post my solution here or on my blog when I'm done if peeps are interested :)
     
  45. JoshC

    JoshC

    Joined:
    Nov 20, 2013
    Posts:
    5
    @songtan Ah! Ok I was a little confused when I was trying to follow the documentation. I started going down the wrong path when I was trying to use Legacy Animations. I overlooked that Legacy Animations don't work with the Animation Component. Now that I am not using Legacy Animations and followed your instructions, everything is working and I can move forward!

    Thanks for helping me out!
     
  46. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    You are welcome. Have fun!
     
  47. Rajmahal

    Rajmahal

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

    I'm running into a problem with my early version. I have several AI units that summon other creatures using a SpawnUnit ability. This works great except that the spawned unit isn't visible after it is spawned. I have Fog of War enabled. If I disable Fog of War, then the unit is visible as soon as it is spawned.

    Is there something I can call after the insert unit function that will force all units to refresh line of sight against that unit now that is there?
     
  48. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,051
    By the way, I'm working on my second game using TBTK. This is the sequal to my first game (Demon's Rise). Here are some WIP pictures:

    SpiderBattle by Rajpreet Dhillon, on Flickr

    SpiderBattle2 by Rajpreet Dhillon, on Flickr
     
  49. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,464
    That invisible spawned unit sound like a bug to me. Are you using the latest version of TBTK? Are you spawn the new unit using conventional mean (abilities) or by addtional scripting? I'll look into it myself and let you know.

    The game looks awesome btw!
     
  50. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,051
    I'm using a really old version. I don't think I've done any code changes that would cause this to happen though so perhaps it's still applicable in yours.

    What I did is that I added some code that allows the AI to use the spawnunit ability to create a new unit. Therefore, I'm not sure if you will be able to re-produce it easily. Perhaps you could just give me some thoughts on what would need to be done to refresh unit visibility? Alternatively, I could send you my code?

    Thanks ... also, my first game should be hitting Android soon. Just doing final rounds of testing on devices.
     
unityunity