Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

TurnBased-Toolkit (TBTK)

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

  1. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    Totally agree! and I appreciate ALL of your hard work!!
     
  2. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    @Songtan, basically what i'm trying to accomplish is a charge time type battle. Where each unit has a charge time of say 100, a characters speed would be how many "points" to increment after each unit movement.

    UnitA has a speed of 5
    UnitB has a speed of 10

    UnitB will have a turn twice before UnitA has a turn. The next step to that is I want to be able to have a ability to be able to raise/slow the speed of Unit[X] for [X] amount of turns. And the last step needed would be the option of being able to have charged ability. So lets say Ability[Charge Attack] takes 30% of your Charge time to fire then If UnitA starts a charge attack when it's his turn you would take the total charge time and minus 30% to it, then reorder the list to make it fire when his turn comes around again.

    Now that i'm typing this out... it may be too custom for your toolkit but I just wanted to see if something like this had the remote chance of being added... if not I'll try to implement it myself. Thanks again Songtan!
     
  3. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    Some of the thing you need, like increase/decrease unit speed for some turn can be done added easily to the current unity abililty system. However things like charge time, to be honest I still dont quite understand how exactly it works after reading your description. It sounds like a realtime speed based system, where unit with twice the speed gets to move twice as much. However how the "Charge time" comes to affect the move order, this is the part I dont get.

    I maybe able to try implment something along that line, despite whatever I've said about the restriction of round system and what not. However it may not be the same as what you expected.
     
  4. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    I'm trying to use hex grid manager/factions to generate enemy units and placement. I setup the faction area, and put in the units. But when I start the game view I get this error

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[Faction].get_Item (Int32 index) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    UnitControl.SwitchToNextUnitInTurn () (at Assets/TBTK/Scripts/C#/UnitControl.cs:323)
    UnitControl.OnNextTurn () (at Assets/TBTK/Scripts/C#/UnitControl.cs:589)
    GameControlTB+<OnNextTurn>c__IteratorD.MoveNext () (at Assets/TBTK/Scripts/C#/GameControlTB.cs:441)
     
  5. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    First, did you enable "RandomizeUponStart" flag in HexGridManager? Then when you say you setup the faction unit and put in the units, how exactly do you put in the unit? Do you place the unit on the grid? Or you assign the unit in UnitPrefabPool in the faction setup in HexGridManager? If you hand place your unit, you should uncheck "RandomizeUponStart".
     
  6. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    I added units under Faction. I changed it to 6, and I've tried both with and without RandomizeUponStart. Neither generated units for me. I also notice I could not place units with RUS because the painted tiles disappear.
     
  7. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    Yes, with RUS checked, everything will be regenerated upon play so you will lost the setup during runtime. Can you show me all the debug message you got on the log, including those that are not error. You have probably know this, but just to be sure, when you assign UnitPrefabPool for a faction, make sure all slots are filled up. If not you will get an "Unit assignment error" warning. And that's probably what causes the error you have.
     
  8. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    All unit slots were filled. I will open it and post other debug.log
     
  9. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    Warning: there's no player faction
    UnityEngine.Debug:Log(Object)
    UnitControl:InitFaction() (at C:/Users/Admin/Documents/TBTK102/Assets/TBTK/Scripts/C#/UnitControl.cs:124)
    UnitControl:OnBattleStart() (at C:/Users/Admin/Documents/TBTK102/Assets/TBTK/Scripts/C#/UnitControl.cs:545)
    GameControlTB:UnitPlacementCompleted() (at C:/Users/Admin/Documents/TBTK102/Assets/TBTK/Scripts/C#/GameControlTB.cs:142)
    <UnitPlacementCompleted>c__Iterator21:MoveNext() (at C:/Users/Admin/Documents/TBTK102/Assets/TBTK/Scripts/C#/UnitControl.cs:95)

    NullReferenceException
    AudioManager+<MusicRoutine>c__Iterator5.MoveNext () (at C:/Users/Admin/Documents/TBTK102/Assets/TBTK/Scripts/C#/AudioManager.cs:120)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    AudioManager:Awake() (at C:/Users/Admin/Documents/TBTK102/Assets/TBTK/Scripts/C#/AudioManager.cs:77)
     
  10. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    You know what....after all that I figured it out. I left the field "Number to spawn" empty.

    Suggestion though:
    Need improvements to the randomized encounter pool. Such as:
    % chance of each type - for example I have a really big monster I would like to have %<10
    Max of a unit to spawn - Because I have 5 slots, 6 prefabs to generate from and I put 1 unit in the prefabs twice and it generates 3 of them.
     
  11. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    I see. I'm glad now it has been figured out. Thanks for the great idea, I'll try to add that.
     
  12. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    Ugh.... I just facepalmed over and over again because I couldn't figure out what was wrong with my Unit Generator. I checked game controls, everything....then I thought of what it *might* be and was right....

    You can set the X/Y area to negative, but you allowed to create H/W squares with negatives...but if there is a negative you can't generate units!!! So frustrating. (suggest you make M/H positive only, or allow negative values to work)
     
  13. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    An added idea to the previous idea: Instead of "Add Area" making a new area....let it copy the previous used dimensions and location so the designer can move it around. (One step further, set default starting width height to 1/1 instead of 0)
     
    Last edited: Sep 29, 2013
  14. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    Fair point, I'll see what I can do.
     
  15. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    Hey Song,

    I tried to trace down this one on my own but I'm coming up blank. How do I set the default slider value for SFX and Music? I didn't see any obvious variables under audio manager script except audiolistener=0.8 but adjusting this would adjust the max volume as well right? I tried changing the UI sliders to 0 then running the game but some script somewhere is setting it to 1, but I have no idea which one.

    I could edit the mp3 file and lower it's volume...but again that changes the max volume and all I want to change is the default volume.

    Perhaps a public var under audio manager to set default slider values for SFX/Music should be created?
     
  16. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    Thanks for letting me know, I just realize that the music volume is set else where and it's a bit complicated to changed the starting volume. I'll change that and enable a public variable to set the initial volume.
     
  17. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    How can I create this ability in the unit editor: Deal 10 damage to all units around unit, and 15 damage to itself?
     
  18. arrested_games

    arrested_games

    Joined:
    Mar 17, 2013
    Posts:
    296
    I bought TDTK, and now I've bought TBTK :) Now.. for some reason, I have to wait for it to show up in my unity asset store.. its in my web profile...
    weird.. but - Can't wait to get going with it :)

    Thanks!
     
  19. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    @Bud, I'm afraid it's not possible at this point. But I'll try to see if I can make some change to make it possible.

    @arrested_games, thanks for your purchase. I'm not sure with what happen with the AssetStore processing, but I would suggest you to contact assetStore support team. If you still cant get it sorted, please let me know.
     
  20. arrested_games

    arrested_games

    Joined:
    Mar 17, 2013
    Posts:
    296
    its ok - sometimes it takes a bit to propagate out I think... I got it :)
     
  21. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    AWESOME! Thanks so much. One more touch though since you will be working in the UAE anyway: We really need a Fail chance/Miss Chance on unit abilities. Remember our talk about Melee/Range attacks being used in the UAE? Still would like to see that if able, but definitely need Fail % chance for things like Stun, Disarm and spells in general.

    PS. One more thing: Did you ever fix the Limit bug?
     
    Last edited: Sep 30, 2013
  22. johny

    johny

    Joined:
    Aug 31, 2011
    Posts:
    133
    Hey song I am just wondering if you got my emails regarding that for some reason changing the units icon is broken. It changes to the wrong image or doesn't change at all.

    Also removing the final unit in placement will create and end of exception error that will stop the game from running. Finally I am wondering how far off square grids are?
     
  23. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    I'm sorry to say I havent got any of your email. Can you please resend it again. In the mean time, I'll look into the issue you mentioned. The unit placement bug has been picked up by me and fixed but it's not in the release yet. Please ignore for the time being.

    Square grid is still in the making. I ran into some complication. I must say I cant guarantee a date, please dont hold your breath.
     
    Last edited: Oct 1, 2013
  24. johny

    johny

    Joined:
    Aug 31, 2011
    Posts:
    133
    Can I double check is your email : k.songtan@gmail.com?
     
  25. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    yes. what is your email?
     
  26. johny

    johny

    Joined:
    Aug 31, 2011
    Posts:
    133
    I pm'ed them to you.
     
  27. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    Did a search. Definitely never receive anything.
     
  28. johny

    johny

    Joined:
    Aug 31, 2011
    Posts:
    133
    Okay Ill try a different email.
     
  29. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Just purchased.
    Even though I don`t have an immediate use for it, it`ll come very handy in the near future.
    And I`m really grateful for your constant efforts to develop and improve your products.
    Thank you.
     
  30. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    I just thought of something at 2am this morning.

    HexGrid Manager > Faction > Areas. The pool of monster setting should include max cost to generate from said pool. 0 = infinite.
    Why: If I set it to generate 10 monsters, and fill it with 10 point unit, 20 point unit and 100 point unit, there's no telling how much in total cost (power) will be generated! But if it makes an army of 200 points then I could get 2x100, 1x100+2x20+6x10 etc. This is MUCH more useful!
     
  31. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    @Mark_T, Thanks a lot for your purchase!

    @Bud, Nice idea. I'll see what I can do about it. By the way, I've added the option to specifiy spawn limit for each unit. I dont see why the new idea should replace the existing one entirely. So I'll probably just add the new one, along with the existing one. It'll be up to you to choose.
     
  32. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    I'm confused by this response. At first it seems like your going to implement my idea, and then it's like no? It's not clear for me ;)

    Yours is also a great idea and creates a similiar random pool with limits. But yours has a weakness in the trade off. You get a tighter* pool but yours doesn't guarantee the balance like mine does.

    Example:
    With your method (which I like you should do it too) you can set it to spawn 10, and limit 100 to 1. So the most you will ever get is 1x100 but you could end up with 9x20 which is actually 280pts worth of enemies. Which would suck if the player is limited to a 200pt army.

    Whereas my system you could still get the 1x100 (because you specified it must spawn 10, so I also suggest a min field and max field instead of just 1 field) but the remaining pieces would be 8x10 and 1x20. Thus maintaining the power balance to the player's 200pt army. (and if it doesn't spawn a 100pt unit you get lots of combinations with the other pieces)
     
  33. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    I understand and sorry for the confusion. What I'm trying to say is I'm going to have both.
     
  34. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    Hi Song! @Bud has had some great ideas, and I'm wondering how hard it would be to have an Ability to spawn a new unit... my though process is because i'm using this tool kit for an RPG and want to have an ability to spawn say a pet, then i thought that that ability can also be used to spawn a turret (basically the same thing as a unit as far as turns and everything else, just not movable. but maybe it destroys itself after a set number of turns)
     
  35. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    Sounds like a cool idea. I'll give it some thoughts. But I must say it's not straight forward considering there are various turn mode that needs to be support the addition of new unit during the round. Anyhow, I'll be rather busy for the next few weeks. So we'll see.

    On that note, I'll be away for almost a week starting tomorrow. Not sure if I'll be having internet access so please forgive me if I dont respond to any post in a quick manner.
     
  36. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    Ya this is on my list of things to ask for. Someone else asked something similiar already. It didn't seem like a simple or easy request so I figured I would work around it and then if needed hire a developer to implement it. It is really cool but Song is super busy with so much other stuff and this is one of those things that could add more bugs.
     
  37. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    Unit Ability Icons
    Has anyone else been having problems getting Unit Ability Icons to show up in game? I've assigned them in the UAE to the ability. The ability works, the squares show up but many of the squares are blank. I'm using small PNG files. I've just now tried different file settings such as Texture, GUI, Cursor. Image size, compression size, 32bit.... can't seem to get it to work.
     
  38. johny

    johny

    Joined:
    Aug 31, 2011
    Posts:
    133
    Had the same problem. You have to also add them to the ngui atlas. Or you could just put your new image over the old one in the atlas.
     
  39. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    How come I can't like your post? What is this 1999?
     
  40. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    Can you give me a small tutorial on how to accomplish this? I see the "make new atlas" option under the NGUI tab but this probably doesn't work with the code as is right? And replacing his in photoshop might work, but is not very efficient and doesn't help me when I need even more icons than he has.
     
  41. Morlok

    Morlok

    Joined:
    Sep 9, 2012
    Posts:
    5
    Go to the NGUI drop down menu.
    Open the Atlas Maker
    -Select your atlas (NGUI default atlases are found under NGUI/Examples/Atlases) (The Default TBTK Atlas used is found under TBTK/NGUI_CustomAtlas)
    After selecting an atlas you should see a list of "Sprites" in the bottom of the Atlas Maker. (Clicking on the X to the right will remove a sprite/Texture)

    To add a new texture/sprite, just select it in the project folder. After it have been selected, the Atlas Maker will show an Add option, click this, and update all.

    Its also shown in one of their tutorials on this page http://www.tasharen.com/?page_id=197
     
  42. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    Thanks Morlok I will try this and see if it works with TBTK. Maybe ngui pre-cuts the sprites and TBTK works by letting you select the cuts. (probably the worst explanation ever). If that's the case then filling up 1 sheet and using icons will be easy. But what happens when you have more icons and need more sheets how will TBTK respond?
     
  43. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    WARNING: Do not add 800 icons to the custom atlas. It will break your project. And even if you delete the new atlas and re-import the old atlas the problem is not fixed! >_<
     
  44. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    So this is weird: Re-importing all NGUI resources did not help. Restarting Unity did not help. But restarting PC did. .... go figure.
     
  45. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    A custom sound for unit initialization (when it's the unit's turn) Unit Editor > Audio Setting

    GameControl> TurnMode> SingleUnitAll : Remove "AI Turn" and "Player's Turn" notification

    All modes: Add "AI: <Unit Name> Activates" notification.
     
    Last edited: Oct 9, 2013
  46. arrested_games

    arrested_games

    Joined:
    Mar 17, 2013
    Posts:
    296
    +1
     
  47. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    Howdy Song,

    So one thing I don't understand is that I can't combine unit placement with random maps. Because if I make unit placement squares, they just get erased by randomized enemies.

    On top of that I can't have a static map with random units.

    Plus you said you were working on a way to get the randomized map to not have landlocked spots.

    So here is my solution: Separate the options for randomizing the map Upon Start, with randomizing the units Upon Start.

    Summary: Add a 2nd checkbox under "Randomize Upon Start" and name it "Randomize Units Upon Start" and change "Randomize Upon Start" to "Generate Map On Start"

    Cheers!
     
  48. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    Hi guys, sorry for being away and not responding to any post. I'm now back. Thanks for helping me to sort out the issue with NGUI on my behalf.

    I understand there might be a concern of how the default UI implementation of a single atlas cope if you have a huge amount of icons. The logical thing of course would be to use multple atlas with multiple texture sheet. However this is not a one size fit all solution and I'm very much limited to how NGUI works. So for simplicity sake, I'll keep it simple and just use a single atlas. For user who are fairly new to Unity, this is easier to manage and it should be sufficient for most project of smaller scale.

    I'll add that to my list. :)

    Yes, you can have randomize maps and still have player unit placement. Check the scene named ExampleSingleSpace, you can enable RandomizeUponStart and you will still get to place your unit. You just need to check EnableUnitPlacement flag in GameControl and make sure you specify a valid area for PlayerPlacementArea in HexGridManager.

    But you are right, currently you cant have a static map with random units. I agree that would be a nice addition. Again, one more item to the list.
     
  49. Bud-Leiser

    Bud-Leiser

    Joined:
    Aug 21, 2013
    Posts:
    86
    How to make an ability that shoots 2 separate enemies without AOE?

    I expected chain ability to work, as long as the 2nd ability require target select was flagged. However that just hits the same target twice (Which I would expect if require target select was not flagged).
     
  50. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,402
    You cant shoot at 2 enemies without using aoe. The only way to shoot separately at multiple enemies would be using aoe and with ShootToAll shootMode. That said, all the target has to be within the aoe range.

    Chain ability is intend for abilities with contrasting effect or varying aoe. Like you want to heal friendly unit and damage hostile unit at the same time. The target tile of the first ability will always be used as the target tile for all the chained abilities.