Search Unity

TurnBased-Toolkit (TBTK)

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

  1. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Bought it and have started playing around with it. Seems very promising. I'll go through the instructional video shortly.

    Regarding the camera controller script, is there an easy way to have the camera hover above the active unit / unit performing an action? I didn't see that as a toggle.

    Not sure if you're still taking any requests for further development, but adding that option to the camera controller script would be very helpful for me.

    Many thanks,
     
  2. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I've had a missile occasionally fly off screen and returns several seconds later. It's not a game stopper as it does return, but I am wondering if anyone else has encountered this or if I broke it with my modifications.
     
  3. Grendal1971

    Grendal1971

    Joined:
    Oct 22, 2013
    Posts:
    14
    If you watch the TBTK overview video (youtube TBTK) it shows the grid manager painter being able to remove hexes from a large grid to make a non-standard grid layout. I haven't tried it, but from what I understand only the ones that remain would affect performance and the 40x40 suggested limit is overall (ones you left after edit) and not initial grid size. I would think it would work excellent for a dungeon, just overlay your wall segments over a large grid and then use painter to cut out where walls are.
     
  4. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I am trying to set it up so the player doesn't pick units but still places them on the map. I thought maybe just creating a very simple script with a "selectedUnitList" and assigning the units to it would be all it took, but, alas, that doesn't work. What's the best way to do this?

    Thanks!
     
  5. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Awesome ... yes, I think you're right. Thanks!
     
  6. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    I've had some time to play around with it and have looked at a couple of the videos. A few beginner questions:

    - How do I modify the speed at which units move from tile to tile? The default speed is a little fast for my taste. If there isn't one already, a variable on the unit manager would be great. That way you can tailor the speed the unit moves to the animation being used during movement for something that looks more natural.

    - Is there any way to have units be more vulnerable if attacked from an adjacent or rear tile? I'm not sure whether direction of facing is used or not but for most turn-based games set in a medieval period or earlier, being attacked from a flank or rear would be a major deciding factor to victory.

    Otherwise, I'm really liking what I've seen so far. Great stuff!
     
  7. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Make move speed public in UnitTB.cs (line 327) You'll have to set it in the inspector and not the unit set up.
     
  8. Grendal1971

    Grendal1971

    Joined:
    Oct 22, 2013
    Posts:
    14
    Not sure I understand completely what your trying to do, but the gamecontrol has a script attached to it that lets you set up the player units for the current scene. Make sure you also check the "Enable unit placement" check box. You can use the gridmanager to place unitplacement hexes for faction 0 (player), when match starts the player will be told to place units and see highlighted area.

    If your gamecontrol doesn't have the gamecontrolTB script just drop it into it from scripts folder.



    On a side note: I did a stress test with a 50x50 grid and 2 AI factions of 50 each. Ran well on my mediocre PC. The American's won by a slim margin due to the slightly higher crit chance of the Fireflys. :)
    https://www.dropbox.com/s/tenwafasqsuawax/Screenshot 2014-02-01 03.36.41.jpg
     
    Last edited: Feb 1, 2014
  9. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Oh, wow. I totally missed that. Thanks! I'm so used to digging into the code now that is my first inclination. I forgot I was using an excellent kit that did things like this. :confused:

    Please post stats. I would like to know the details of your stress test: draw calls, tri count, frames per second, all that.
     
  10. JeromeF

    JeromeF

    Joined:
    Feb 1, 2014
    Posts:
    5
    Hi,
    just bought this asset some days ago and it's pretty amazing :)
    Is it possible to implement a unit stack system or a level system for each unit ?

    I'm thinking about king's bounty : each unit on the battlefield represent troops. So we have to multiply HP, damage etc. by the number of units present in the troop. But how ?
    For the level system, I'm thinking about turn based rpg. We have to multiply stats of the unit by his level.

    These two approaches are similar, but unlike the RPG system, the king's bounty system brings units that have suffered losses have a stats decrement (i.e. 10 elves are stronger than 6 elves). With the rpg system, one unit = one creature, the stats are statics until the unit dies. It's just a kind of multiplying factor, I guess.

    I'm a newbie in c#, I'm interested by the RPG approach. Someone can help ?

    Anyway, Imho, this 2 things should be implemented in this awesome asset.

    Thank you :)

    Edit : For the rpg system, I guess the unit level will have an effect on HP stats, min / max damage and perhaps damagereduction (is it a dodge % or a subtraction ?). A unit with 10 hp at level 1, will have 60 hp at level 6.
     
    Last edited: Feb 2, 2014
  11. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Having a lot of fun playing with this tool kit. I really like the animation configurator in the unit editor. Is there any way to assign an animation for a unit to play whenever they use a unit ability in the same way there is for attacks / moves / damage, etc? If not, that would be a very helpful addition.
     
  12. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Thanks for your help. I haven't yet delved into the code. I'll get to that soon ... just want to wrap my head around the editor options first.
     
  13. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Here's how I did it:

    Basically, add that code and rename your animations to the same name as the ability it's for.
     
  14. Grendal1971

    Grendal1971

    Joined:
    Oct 22, 2013
    Posts:
    14
    I wasn't trying to be efficient and the tanks were probably pretty triangle heavy but here is what I got:

    50x50 grid
    100 units (6 different models)
    FPS 69.9 average
    480-550 draw calls (zoomed out with basically all models on screen, mid 500s when effects, smoke, gun fire, explosions etc. activated)
    351,000 tris (with all tanks on screen)
    24mb textures
    1203x910 resolution (in unity editor window)
    12.5mb VRAM

    I have done a 100x100 but it takes a few minutes to load initially. I would think you could use TBTK to make a pretty large scale "Steel Panthers" style game.. the 50x50 looks similar to the old SP maps.



    Awesome stuff, this is definitely an animation define that needs added to the unit set up animation page.
    Seems like we also need a "unit healed" animation drop as well for when I raise the unit up in a slow circle Disney style with heart felt music and soft spotlighting...

    TBTK doesn't even come close to doing what you are looking for out of the box. However, it will do a crap ton of the other work you will need. That said, I hate programming as much as the next artist/designer so if I wanted to tackle your problem I would look at Playmaker.
    Playmaker has a GetProperty and SetProperty action that will allow you to manipulate the script data via a simple state machine. I would have each unit perfab equipped with a FSM that changes whatever stat based on its current HP. The info should carry over to the next level as well if the carry data to next level option is checked. Plus as a bonus you could have the FSM generating particle effects or gui popup over unit at each unit stg level.. and more.
     
    Last edited: Feb 2, 2014
  15. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks a lot guys for helping me answering most of the question. I'll just address those that are unanswered.


    You mean let the camera centered on the selected unit? No I'm afraid that is not supported yet. I could easily add that. But you are going to have to wait until I get back to office next week.


    I think this is an old bug that I've already fixed. I cant quite recalled if I really did. But I dont remember seeing this for quite some time now.


    Currently no, unless you are using the cover system. With cover system enabled, unit behind a cover is harder to hit and crit while on the other hand flank and rear attack carry hit and crit bonus. I did thought about the idea of attack bonus that is solely based on direction. The problem is then you will need to be able to choose the facing direction of each unit. I will probably try to see if I can fit that to the current control scheme in the future. But for now, this is not supported.


    I afraid these is not a trivial question that can be answered with some short instruction. What you need is to redesign the stats system. The current one is pretty simple so if you are some what adequate about c# you should be able to understand the current code and do the required modification. I'm not sure about Playmaker but from what I understand it doesnt just work right out of the box with any other scripts so it's likely that you will need to put some work in before it can 'talk' to TBTK.

    Fyi, DamageRedection is a a subtraction for the damage dealt.
     
  16. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Thanks for that stat info!

    I've managed to do some heavy editing on the code. So far (besides what I've mentioned earlier)
    • I've altered it so the Miss and Fail chances of abilities use the ranged attack skill and a new one I set up called willpower. The will power checks the target's willpower a well
    • Set it up so I can make the AI ignore cover. Some units are just too stupid to se cover and I wanted other's to do so,
    • Set up a check at the end of a battle so all surviving player units keep track of how many battles they'd survived and raises their skills slightly with each one. I even have a system for adding new abilities after X number of battles.
    • Hooked it into the Okashi ROle Playing Kit to handle all my non-combat as well as saving the information. I even have a working inventory transfer but I am not currently using that. And it transfers skills.
    • Made it use animated sprites instead of 3d models (again, not in use in current project). Each animation has four "sides" so on square tiles it looks like they are facing the correct direction.
    • Made some units so they can only be picked one from the selection scene.

    Well, that's about all I can think of. Some things I would still like to do are to
    • Make a "knockback"
    • Have abilities use criticals
    • Have a bonus if a two units are on opposite sides of the same target In melee that is.
    • In cover animations. I think I can do that pretyt easy but jsut haven't proritized it.


    @Song, I was using 105. I forgot. I went back to that for a while after I discovered the bug with the end of battle. Explains why no missiles have flown off screen lately. I just thought it hadn't happened yet. :)
     
  17. Grendal1971

    Grendal1971

    Joined:
    Oct 22, 2013
    Posts:
    14
    I decided to put my theory to the test and loaded my Playmaker into my tank scene. I selected my Firefly Sherman prefab and created an empty FSM and gave it an empty state. I drug the header from inspector for the "Game Control TB (script)" and dropped it on the actions panel of the state. I made an action using GetProperty and selected hitpoints from the list and told it to store it in variable Hitpoints. In the same state I did a comparison action that checked to see if Hitpoints were less than 25 and finished state if so. I created a second state that used SetProperties (on the Game Control TB script) to change RangedDamMin and RangedDamMax from 10 and 30 (what it was) to 30 and 50. This finished and closed the loop with the first state.

    I started my scene and clicked the Firefly Sherman in the inspector that it spawned, it showed the FSM running on state 1. During the match one of my Fireflies got reduced to 19hp and the state instantly switched to state 2 and the Inspector showed the RangeDamMin/Max had changed to 30 and 50 in the control script. Sweet sauce!

    I explained step-by-step in case someone else with Playmaker wanted to do the same.
    It looks like Playmaker and TBTK may play nice together out of the box, which is good for people like me who hate scripting. :)
     
    Last edited: Feb 2, 2014
  18. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Thanks for the quick replies ... guys, very helpful.

    I'm running into something a little odd. I'm trying to set the Target Point for a unit to be a point slightly above the middle of the tile to correspond to the approximate torso position of the 3d model I have to represent the unit. I created an empty game object with a transform and attached it to the unit prefab. However, I try to drag that game object to the Target Point field but it won't accept it even though it's supposed to accept transform objects. Can anyone let me know what I'm doing wrong?
     
  19. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Are you trying to drag it from the Project tab or the Hierarchy? I just tried and you can only drag it from the Project tab.
     
  20. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    That worked perfectly ... thanks. I was trying to drag from the hierarchy pane.
     
  21. Pathlesspath

    Pathlesspath

    Joined:
    May 8, 2013
    Posts:
    13
    Problem can't solve.
    .- Anyone edit animation to use with Animator ?
    I'm use sprite animation with unity2D new feature.
    Animator work fine and got animation clip.
    Problem, I can't play animation clip when add animation component .

    Any idea :confused:? , Thanks in advance.
     
    Last edited: Feb 4, 2014
  22. BBORNCR

    BBORNCR

    Joined:
    Jul 28, 2013
    Posts:
    16
    I am using 1.06 and I still see this richochet every once in awhile. Since it doesn't stop the game its been low on my TODO list.
     
  23. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Quick question to anyone ... does the AI currently use unit abilities if it has sufficient AP? I haven't seen it do so even when I assign the AI a unit with an ability.
     
  24. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Just want to say that this is an absolutely amazing tool kit. I've made more progress in 2 days of using this kit than I had in 6 months of hobby coding. Fantastic product ... well worth twice the price.
     
  25. BBORNCR

    BBORNCR

    Joined:
    Jul 28, 2013
    Posts:
    16
    No, there is no reference of the AI using unit abilities that I can see in AIManager.cs
     
  26. Darkworth

    Darkworth

    Joined:
    Jan 19, 2011
    Posts:
    41
    Hey there, kit looks great so far, am considering this for a project I have had sitting on the backburner for awhile. Had a quick question about unit setup first though. I notice in the video and screenshots that you set basic animations for the unit in the UnitTBEditor, that seems to limit it to one animation for attacking (and only saw a slot for range attack in the shots). Can you set a separate animation per ability though?For example, if I had an ability that does a regular sword attack I would want it to play one animation, but if I had an area attack with the sword, I would want to play a different animation for that ability.

    Also just to verify, this only uses the legacy animation system correct? There is no mecanim support for retargetable animations?

    Thanks
     
  27. BBORNCR

    BBORNCR

    Joined:
    Jul 28, 2013
    Posts:
    16
    Legacy animation only.
    Multiple animations can be assigned to any of the animation slots. They play back at random. For example you can have several Idle animations or different Shoot animations and they randomly playback when called, mixing things up a bit.
    Drewradley posted a quick fix in this same thread a couple of pages back that allows Ability-specific animations to be played.
     
  28. Grendal1971

    Grendal1971

    Joined:
    Oct 22, 2013
    Posts:
    14
    Adding on what BBORNCR said, when you change the number below the animation button to anything besides 0 it adds that many animations slots below it for multiple animations of the type.
     
  29. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Quick question ... how can I adjust the elevation of the action cam? The inspecter allows for changing the distance but is there an easy way to adjust the height?

    Also, when I set up an ability with a debuff effect, I don't seem to notice it working on units. I set up an effect with 1 damage for a duration of 3 rounds but it doesn't seem to do anything.
     
  30. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I'm also working on a sprite tutorial. And as I recall, the new sprite system is basically the same as mecanim so maybe I'll do that next.
     
  31. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Never mind ... figured it out. Pretty easy tweak in the code. Change the dir vector's y value on line 106 of the CameraControl script for anyone that was curious.
     
  32. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    I noticed that the number of attacks a unit has doesn't distinguish between melee and missile attacks. So if a skilled artillery unit has 10 missile attacks, it also has 10 melee attacks. Would it be possible to change this in a future update and allow for assigning a number of melee and missile attacks to a hybrid melee / missile unit? That would be very helpful for the type of game I'm working on and I'm sure would be useful for most strategy games of this nature.

    Also, including animations to abilities would be fantastic within the editor. I haven't tried the fix that was posted earlier but it would be great if you could include 10 or so animation slots for abilities 1 to 10. That way, you could assign spell casting style abilities to use a unit's spell casting animation and melee abilities to use a unit's specific melee animation and so forth.
     
  33. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Well, here is my tutorial for adding animated top-down sprites. I've tested it pretty thoroughly but still use at your own risk! I recommend you try it on a fresh TBTK project rather than trying it in your current project. I've included the script you need as well as showing you how to edit the TBTK scripts (two of them) to use the sprites. I even provide a link to a sample set of sprites you can use, should you want. They aren't the best and some of them have quite a few frames but they work and will give you a good starting point for adding your own. This should not break anything currently there so you can mix 3d and 2d units with no problems if you wanted to. PM me here if you have any problems or questions. I don't show you how to actually make the sprites or how to use the toolkit and assume you already know how to do both those. There are plenty of tutorials on using sprites already.

    https://docs.google.com/document/d/1uqM92Xv1Si-cjqL159JSbyVrXB3-mK3Qb43eIJKhZu0/edit?usp=sharing

    edit: I made a minor update to it this morning.
     
    Last edited: Feb 5, 2014
  34. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Another question ... I noticed in the GUI that is created when you perform the function to auto-build a new scene, there is a ActiveEffectBox in the unit info box that appears when you right click on a unit. However, the active effect box never seems to come up even when I have applied an ability to a unit that should give them an active effect. I've tried in the demo scene as well in the web player and there doesn't seem to be any way to bring up the active effect box. Anyone know how to make this displayed?
     
  35. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Actually, after looking at the code, I believe this is a bug. I fixed it by adding the following line of code:

    Utility.SetActive(effectBoxObj, true);

    within the else {} statement on line 179 in the UINGUIUnitInfo script. Apologies if this had already been identified earlier in the thread.
     
  36. shocksofmighty

    shocksofmighty

    Joined:
    Sep 16, 2013
    Posts:
    4
    Has anyone gotten terrain based movement costs implemented on this? I took a quick crack at it and found that doing this just for finding walkable tiles to be complicated. The only discussion was way back on page 1.

    EDIT: I actually managed to get GetWalkableTilesWithinRange to handle different terrain (tile) costs if anyone is interested.
     
    Last edited: Feb 5, 2014
  37. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Oh, absolutely. That's on my list of things to do. You could save me some work!
     
  38. moure

    moure

    Joined:
    Aug 18, 2013
    Posts:
    184

    Thanks a lot drewradley for this piece of tutorial (saved me a lot of time today), the only think i had to add was to bypass the initialise call in the start function in UnitTBAnimation.
    Cheers!
     
  39. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    You are welcome! Why did you need to bypass the initialize?


    I missed a step. I'll fix that now. I had idle set to my default state in the animator so I didn't notice that it would play whatever was the default at first.

    edit: I've updated my tutorial so it now starts the idle animation.
     
    Last edited: Feb 5, 2014
  40. JeromeF

    JeromeF

    Joined:
    Feb 1, 2014
    Posts:
    5
    Hi !
    What's the differences between TBTK base and TBTK ngui ?It is necessary to use Ngui ? (I ask this question because there is df-gui on sale with a good price) :)
     
    Last edited: Feb 5, 2014
  41. BBORNCR

    BBORNCR

    Joined:
    Jul 28, 2013
    Posts:
    16
    Yes, please share! This would add a great dimension to the toolkit.
     
  42. BBORNCR

    BBORNCR

    Joined:
    Jul 28, 2013
    Posts:
    16
    I would appreciate any advice from those of you with more experience:

    In order to flesh out the game I have created a Main Menu in a separate scene and was thinking that the cut scenes would also be managed in their separate scenes in between the levels. However, at the beginning of a level I would like to zoom around the battlefield giving a brief overview and introduction. Where would be the best place(s) in the script to do this?

    Thanks,
     
  43. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I seem to have found an error. I was playing around with abilities and noticed that no matter what I checked in the miss "Stack With Dodge" it was ALWAYS stacking with dodge. When I set the bool to false there where it is setup, it NEVER stacked, no matter what I put. I simply put "UAb.stackMissWitDodge=stackMissWithDodge;" in the ability manager script down where all the others like it are and it seemed to have fixed the problem. It's also possible that any problem I am having is due to my edits but I found nowhere in my edits I changed this.
     
  44. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Found a couple of bugs and the corresponding fixes.

    In the unit info screens in the GUI, when you select a unit with an ability and then select another unit with fewer or no abilities and then go back to the first unit, the first unit's abilities no longer show up. Essentially, the number of abilities to show in the unit info box was shrunk to the number of abilities of the one with the fewest abilities. This was the same for the effected by abilities info box for when units are affected by buffs or debuffs.

    The fix for this is the following:

    In the script UINGUIUnitInfo, add the statement "Utility.SetActive(abilityItems.rootObj, true);" on line 170 in the "if(i<abilityList.Count){...}" area.

    Similarly, add the statement "Utility.SetActive(effectItems.rootObj, true);" on line 186 in the "if(i<activeEffectList.Count){...}" area.

    Hope that helps!
     
  45. shocksofmighty

    shocksofmighty

    Joined:
    Sep 16, 2013
    Posts:
    4
    As a preface, this isn't really general for the toolkit. It will likely have to be specific for each game and mechanic you want to implement. I haven't tested it all that much yet.

    I've basically done three things:

    1. I have terminator tiles. Units can move into them but it terminates movement.

    2. I have tiles that cost more movement than others.

    3. I have roads. If all of the movement occurs on a road (from start to finish) the unit gets to move one more hex. Bonus tile does not have to be road.

    This is also the first time I am using C# so there may be easier (and cleaner) ways to do things.

    I added five public variables to Tile.cs
    bool isTerm=false;
    bool isRoad=false;
    int tilecost=1; //cost of tile, defaults to 1
    int cum_cost=0; //cumulative cost
    int contig=0; //contiguous road, should just change this to bool

    To be on the safe side I've also added:
    tile.cum_cost = 0;
    tile.contig = 0;

    around line 900 in GridManager.cs to ClearWalkableList

    Here is the main function:

    Code (csharp):
    1.  
    2. public static List<Tile> GetWalkableTilesWithinRange(Tile rootHT, int range){
    3.         if(range==0) return new List<Tile>();
    4.        
    5.         //Just easier to follow
    6.         bool roadtest=false;
    7.         if(rootHT.isRoad) roadtest=true;
    8.        
    9.         List<Tile> tileNeighbours=rootHT.GetNeighbours();
    10.         //add roadtest condition
    11.         if(range==1){
    12.             List<Tile> list=new List<Tile>();
    13.             for(int i=0; i<tileNeighbours.Count; i++){
    14.                 if(tileNeighbours[i].walkable) list.Add(tileNeighbours[i]);
    15.             }
    16.             //Still need to test this...
    17.             if(roadtest) {
    18.                 foreach (Tile neighbors in list) {
    19.                     if (neighbors.isRoad) {
    20.                         List<Tile> extra=neighbors.GetNeighbours();
    21.                         for(int i=0; i<extra.Count; i++){
    22.                             if(extra[i].walkable) list.Add(tileNeighbours[i]);
    23.                         }
    24.                     }
    25.                 }
    26.             }  
    27.            
    28.             return list;
    29.         }
    30.  
    31.         List<Tile> closeList=new List<Tile>();
    32.         List<Tile> openList=new List<Tile>();
    33.         List<Tile> newOpenList=new List<Tile>();
    34.        
    35.         foreach(Tile neighbour in tileNeighbours){
    36.             if(neighbour.walkable  neighbour.unit==null  !newOpenList.Contains(neighbour)  !neighbour.isTerm){
    37.                 neighbour.cum_cost = neighbour.tilecost;
    38.                 //if starting tile was road, and current tile is road, set contig
    39.                 if(roadtest  neighbour.isRoad) neighbour.contig = 1;
    40.                 newOpenList.Add(neighbour);
    41.             }
    42.             //Just add it to closeList if it is a terminator
    43.             if (neighbour.isTerm) closeList.Add (neighbour);
    44.         }
    45.        
    46.         for(int i=0; i<range; i++){
    47.  
    48.             openList=newOpenList;
    49.             newOpenList=new List<Tile>();
    50.            
    51.             foreach(Tile ht in openList){
    52.                 foreach(Tile neighbour in ht.GetNeighbours()){
    53.                     //important to check if cum_cost, make sure it hasn't been set
    54.                     if(neighbour.walkable  neighbour.unit==null  !newOpenList.Contains(neighbour)  neighbour.cum_cost == 0) {
    55.                         neighbour.cum_cost = ht.cum_cost + neighbour.tilecost;
    56.                        
    57.                         //establish if contig met
    58.                         if(roadtest  ht.contig == 1  neighbour.isRoad) neighbour.contig = 1;
    59.                        
    60.                         //if cumulative cost is less than range, can add it to the list to continue checking
    61.                         if (neighbour.cum_cost < range  !neighbour.isTerm) {
    62.                            newOpenList.Add(neighbour);
    63.                         }
    64.                         //Terminate it if we have reached range
    65.                         if (neighbour.cum_cost == range) {
    66.                             //Debug.Log (neighbour.cum_cost);
    67.                             closeList.Add (neighbour); 
    68.                         }
    69.                         //If it is a terminal hex, add to close list
    70.                         if (neighbour.isTerm) closeList.Add (neighbour);
    71.                            
    72.                     }
    73.                 }
    74.                
    75.                 //reset contig flag for ht tiles when we are done with them so they don't get in the way later
    76.                 ht.contig = 0;
    77.            
    78.             }
    79.            
    80.            
    81.             foreach(Tile t in openList){
    82.                 if(t!=rootHT  !closeList.Contains(t)){
    83.                     if(!t.walkable) Debug.Log("tit");
    84.                     closeList.Add(t);
    85.                 }
    86.             }
    87.         }
    88.        
    89.         //prior to returning list, check if there are any tiles with contig flag
    90.         //If so, find tiles that are neighbors, determine if walkable and add
    91.         if(roadtest) {
    92.             List<Tile> bonustiles=new List<Tile>();
    93.             foreach (Tile final in closeList) {
    94.                 if (final.contig == 1) {
    95.                     List<Tile> extra=final.GetNeighbours();
    96.                     for(int i=0; i<extra.Count; i++){
    97.                         if(extra[i].walkable  !closeList.Contains(extra[i])) bonustiles.Add(extra[i]);
    98.                     }
    99.                     Debug.Log (final.name);
    100.                    
    101.                 //reset contig
    102.                 final.contig = 0;
    103.                 }
    104.             }
    105.            
    106.             foreach (Tile bonus in bonustiles) closeList.Add (bonus);
    107.         }
    108.        
    109.        
    110.         return closeList;
    111.     }
    I hope that helps some folks.
     
  46. Pathlesspath

    Pathlesspath

    Joined:
    May 8, 2013
    Posts:
    13
    It isn't necessary to use Ngui . You can use any df-gui .
    TBTK base create gui by code but TBTK ngui create with Ngui free or full version.
     
  47. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Also, I noticed what I think is another bug. When I create an ability that uses a particle effect that applies to either a target unit or the unit using the ability, the particle effect does not move with either the target or the unit in later rounds. It seems to be designed only for particle effects that destroy themselves once cast. I'd like to have some effects stay visible for the duration of the ability rather than just appear and disappear once cast.

    I'm going to try and have a look today at the code and see if I can make that change.
     
  48. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Regarding how this kit uses the older style of animations, I'm perfectly fine with that as most of my models use the legacy animation system. However, I have a few that use the new system. Is there a way to convert a model within unity to use the old system?
     
  49. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    You can always try to set the rig to Legacy but there is a good chance you will lose all your animations.
     
  50. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    That worked perfectly ... many thanks!