Search Unity

TowerDefense ToolKit 4

Discussion in 'Assets and Asset Store' started by Song_Tan, Apr 18, 2012.

  1. lpye

    lpye

    Joined:
    Aug 2, 2012
    Posts:
    30
    Will do...

    Also, I added a new ShootObject._Type, Lightning. I then used some LineRenderer based code someone posted to create lightning effects, combined it with hue-modified versions of your Red, Green, and Blue Beam images, and created some Lightning ShootObjects, with 1, 2, and 3 lightning bolts (so a total of 9). It's pretty easy to set up but required modifying your original code. Is there a less invasive way that I could go about adding a new type? I'd prefer not to have to recall which files need merging when I pull updates. If not, I understand.

    Additionally, I wanted to be able to drop "static", non-moving creeps on the board, Turret creeps, which block tower placement and will shoot at whatever is in range. I had to make a modification to UnitCreep.cs to allow the "static" creep to be destroyed but not cause the Destroyed() method to fail. The change is, I believe, at line 623 of UnitCreep.cs. My copy reads as follows:

    Code (CSharp):
    1.  
    2.         public override void Destroyed(bool spawnEffDestroyed=true){
    3.             if(path!=null) path.OnCreepExit(this);
    4.             // ... rest of function below
    5.  
    I do this because I don't want to register the "static" creep as following a path and thus moving, so path is null. This just protects against it to prevent an exception being thrown. Would that be a reasonable change to incorporate into the source?

    Thanks.
     
  2. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    If you want to add new ShootObject type, modifying ShootObject.cs is the probably the only way to go. But the script itself is pretty sell-segmented to start with so you should be able to separate the existing code with the additional code.

    For non-moving creep, you will need more than that. If you are going to pre-place the creep in the scene, or add it using unconventional method, you will need to register it to SpawnManager by calling SpawnManager.AddActiveUnit(unitInstance). Otherwise it won't be targeted by the towers at all. Other than that, you modification is fine.
     
  3. lpye

    lpye

    Joined:
    Aug 2, 2012
    Posts:
    30
    I actually created a RegisterStaticCreep script to perform the registration in Start(), to avoid having to alter UnitCreep or Unit. :)
     
  4. primarygod

    primarygod

    Joined:
    Jan 16, 2017
    Posts:
    9
    hey another question comes from me. I want to understand better the AOE/Perk multiplier formula so I will speak with examples and correct me if I am wrong.

    I have tower X dealing 50-100 damage and having 500 health with 10% critical chance
    now I have AOE which increments the damage by 20%, should I submit 0.2 or 1.2 or 0.8 for damage increment

    and another example is decrement, I have a creep with same stats and again an AOE but I want to decrement the stats of the creep. For 20% health decrement should I multiply by 0.8 or by 0.2 or by 1.2.
     
  5. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    The clue is in the name 'multiplier'. The value you specified will be used to multiply the base value. So if you want something to increase by 20%, it's 1.2. To decrease by 20%, it's 0.8.

    On the other hand, 'modifier' is used to add to the base value.
     
    primarygod likes this.
  6. lpye

    lpye

    Joined:
    Aug 2, 2012
    Posts:
    30
    I would like to create an Ability which would spawn friendly "creeps" that would either start at the end point and move backwards down a path or start where you drop them and do so. The purpose would be to deploy ground troops that would attack actual creeps for you until they died (either due to a timer expiration or because they took damage).

    Is that supported?
     
  7. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Well I'm afraid not. The only friendly unit supported by the framework are towers. Adding mobile troops that can engage the creep would open up another whole bunch of technical/design issues that needs to be solved. It would also add a lot of complexity. Not something that I think is feasible to do for a framework of this kind.
     
  8. lpye

    lpye

    Joined:
    Aug 2, 2012
    Posts:
    30
    Okay... what about allowing multiple effects to trigger for an attack? I would like support units to be able to deploy multiple buffs (stretch goal, weighted random selection from among the selected buffs), attacking units to deploy multiple debuffs, and abilities to be able to do either. At present unit immunities work this way, allowing a unit to be immune to multiple effects.
     
  9. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    That is something that can be added. I'll see what I can do.
     
  10. lpye

    lpye

    Joined:
    Aug 2, 2012
    Posts:
    30
    I'm really struggling to implement an Ability.

    What I'm trying to achieve is an Ability that damages all hostiles on the screen:
    upload_2018-5-21_4-59-58.png

    As you can see, I have added an 'On Target Effect' to create a little lightning strike graphic effect.

    This lightning is intended to start 3.0 units above a given creep and then strike them from above.

    As currently implemented, it looks like any given creep only gets the graphical effect AT MOST once, sometimes not receiving it at all. Also, if a creep dies as a result of the damage, they NEVER receive the graphical effect.

    Checking the console and using some simple Debug.Log calls, it seems as though the 'On Target Effect' only ever gets an 'Awake' event once per creep. Yet, as you can see, I set the duration to only a half a second.

    I can provide the 'On Target Effect' prefab and script if needed.

    Thanks
     
  11. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I think there's two part to this. First for the destroyed creep doesn't get any effect. I think there's a bug with the existing code. In Ability.cs, function AbilityEffect(), you need to switch the order of line183 and 184, to this:
    Code (csharp):
    1. effectOnTarget.Spawn(tgtList[i].GetTargetPoint(), Quaternion.identity);
    2. tgtList[i].ApplyAttack(new AttackInfo(this, tgtList[i], false));
    Then to clarify, the effect only spawned on each target once. So it sounds right that you only get one Awake() call. If you want multiple instance of effect to be spawned on each target, the best way to go about this without modifying the existing code, is create a spawner that spawn the actual effect, then assign the spawner as the effect to the ability.
     
  12. STARGATEBG

    STARGATEBG

    Joined:
    Dec 12, 2016
    Posts:
    1
    I'm trying to use a Perk to modify a tower to change it's dmg type or to add another dmg type on top of it. In the modify tower perk there is no option to change the dmg type so I'm trying to use effect on hit. I created a new effect selected modifier and the dmg type I want and tried to use Hitpoint rate -x and/or Damage min/max and the effect don't seem to do anything. The perk is being applied for sure because the price of the tower is increasing. Any easy solution?
     
  13. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm sorry to say that there's no way to modify or add a damage type to a tower via perk. The 'effect on hit' on the perk is to be applied to the target of the tower, not the tower itself.

    The only solution to this would be add damage type option to the perk and apply the value to the target tower. The problem is the damage table doesn't support multiple damage type. So each unit can only have one damage type but there can be multiple perks all trying to change the unit damage type. This is the reason why I didn't implement this in the first place.
     
  14. lpye

    lpye

    Joined:
    Aug 2, 2012
    Posts:
    30
    I may have run into a bug but wanted to ask if perhaps I'm not doing it correctly.

    I am working on levels now and for the first level I want to keep it very simple. One tower, no perks, no abilities.

    But if I create a brand new Unity project, import TDTK, create a new TDTK scene from the TDTK menu, and go to AbilityManager and PerkManager and click 'Disable All' in both, then when I run the scene I get the following NullReferenceException in the Console:

    NullReferenceException
    UnityEngine.Transform.get_localPosition () (at /Users/builduser/buildslave/unity/build/artifacts/generated/bindings_old/common/Core/TransformBindings.gen.cs:41)
    TDTK.UIPerkScreen.OnItem (UnityEngine.GameObject butObj, Int32 pointerID) (at Assets/TDTK/Scripts/UI/UIPerkScreen.cs:146)
    TDTK.UIPerkScreen.Start () (at Assets/TDTK/Scripts/UI/UIPerkScreen.cs:117)

    The game scene still runs but in the bottom right there is an "empty" somewhat grayed out Ability button which I'm guessing is the default Ability button.

    Is there a better or more appropriate way to indicate no Perks or Abilities are desired for a given level?
     
  15. lpye

    lpye

    Joined:
    Aug 2, 2012
    Posts:
    30
    For what it's worth, I *think* I've fixed it. I'm posting the code; please have a look and let me know if you think it's alright.

    UIPerkScreen:48-51
    Code (CSharp):
    1.             if(!PerkManager.IsEnabled() || PerkManager.GetPerkList().Count == 0){
    2.                 thisObj.SetActive(false);
    3.                 return;
    4.             }
    UIAbilityButton:34-42 (preceding and following lines shown, inserted the middle block)
    Code (CSharp):
    1.             List<Ability> list=AbilityManager.GetAbilityList();
    2.  
    3.             if (list.Count == 0)
    4.             {
    5.                 UIAbilityButton.instance.gameObject.SetActive(false);
    6.                 return;
    7.             }
    8.  
    9.             for(int i=0; i<list.Count; i++) AddAbilityButton(i, list[i].icon, list[i].GetUseLimitText());   //list[i].name);
    UIHUDButton:32-40 (added the check against PerkManager.GetPerkList().Count)
    Code (CSharp):
    1.             if(PerkManager.IsEnabled() && buttonPerk.rootObj!=null
    2.                && PerkManager.GetPerkList().Count > 0
    3.               ){
    4.                 buttonPerk.Init();
    5.                 buttonPerk.SetCallback(null, null, this.OnPerkButton, null);
    6.             }
    7.             else{
    8.                 if(buttonPerk.rootObj!=null) buttonPerk.rootObj.SetActive(false);
    9.             }
     
  16. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    To get rid of the error, try deactivate or delete the game object Canvas_AbilityButtons and Canvas_PerkMenu in UI. That should remove the error. You will probably want to deactivate or delete the perk button too in Canvas_HUDButtons. You have no need of this component when there are no perk or ability involved in the scene.

    An easier way would be just deactivate or delete AbilityManager and PerkManager from the scene. The UI will automatically remove the relevant component when no AbilityManager and PerkManager is detected. I think I've mentioned this somewhere in the documentation.
     
  17. lpye

    lpye

    Joined:
    Aug 2, 2012
    Posts:
    30
    Well that was an oversight on my part. :)

    I'd prefer to not have to remove them so I think I'll keep my modifications, but that's good to know going forward.
     
  18. lpye

    lpye

    Joined:
    Aug 2, 2012
    Posts:
    30
    In the definition of RscItem in RscManager.cs, should regenRateMultiplier be initialized to 1? It's currently initialized to 0 such that if I grant a RscGain via Perk for that resource nothing happens (the multiplier zeroes it out).

    Also, in the I_RscManagerEditor.cs, regenRate and regenRateMultiplier are not present to be edited. Is that intended?
     
  19. lpye

    lpye

    Joined:
    Aug 2, 2012
    Posts:
    30
    I was experiencing a problem... I created a resource (Mana) that ordinarily does not regenerate, though you can get it by killing certain types of creeps. I wanted a Perk that would allow the player to regenerate Mana without needing kills, opening a more spell oriented mode of play. I created a Perk of type RscRegen of type Modifier (not Multiplier) and set the Mana regen value to 5 to make sure I would see it while testing.

    I initially found that even after purchasing the Perk my Mana was not regenerating, even during gameplay. That led to investigation which resulted in the email above. After some more digging and testing, I modified RscManager.RegenerateRsc() as follows:

    Code (CSharp):
    1.         public void RegenerateRsc(){
    2.             if (GameControl.instance.gameState != GameControl._GameState.Playing) return;
    3.  
    4.             if(!regenerateRsc) return;
    5.  
    6.             bool requireUpate=false;
    7.            
    8.             for(int i=0; i<rscList.Count; i++){
    9.                 if(Mathf.Abs(GetRegenRate(i)) < Mathf.Epsilon) continue;
    10.                 regenCachedList[i]+=GetRegenRate(i)*Time.fixedDeltaTime;
    11.                 if(regenCachedList[i]>1){
    12.                     float gain=Mathf.Floor(regenCachedList[i]);
    13.                     rscList[i]+=(int)gain;
    14.                     regenCachedList[i]-=gain;
    15.                     requireUpate=true;
    16.                 }
    17.             }
    18.  
    19.             if(requireUpate) TDTK.OnRscChanged(rscList);
    20.         }
    Primarily this did two things. The newly inserted first line seems to prevent the regeneration from taking place except while playing. I also modified line 91 to call GetRegenRate(i) in order to allow a player to go from zero to positive regeneration through mods and multipliers (i.e. a multiplier of zero would effectively negate any further regeneration until removed).

    This is inclusive of the change to initialize the RscItem.regenRateMultiplier to 1 rather than 0.

    Can you tell me if this seems like a reasonable set of changes or if I've made some non-obvious (or obvious!) error?

    Thanks
     
  20. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You are absolutely right. This is definitely not intended. In fact the feature seems incomplete. I probably forgot about it. I'll get it fixed.
     
  21. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    199
    What are the changes in the newest release I dont see a release notes for the 4.0.2?
     
  22. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You can find the change log on the asset page. If you are using the old asset store layout, there is a version label, shown along with the publisher email and website, just after the images. Clicking on the version number should show the change log. If you are using the new layout, just expand the release tab on the left hand side of the page.

    For 4.0.2, the changes are as follow:
    • Attack and ability can now apply multiple effects
    • Perks can now be set to override or add on to existing effects of attack and ability
    • Fixed an issue on resource regeneration
    • Fixed a bug on path-finding where it breaks completely when no path-smoothing is used
    • Fixed some minor editor bugs
     
    Chaz32621 likes this.
  23. Chaz32621

    Chaz32621

    Joined:
    Apr 17, 2015
    Posts:
    199
    Song think we will see an update to the ability system? I wouldn't mind seeing a line casting spell with some cool indicators.
     
  24. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    'line casting spell'? I'm not really sure what you mean and how does that work in the context of TDTK.

    Anyway, I don't think I'll be working on any update anytime soon except when it's for bug fix. I've quite a few things going on and will be quite busy for the next few weeks.
     
  25. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    hello im back to solving an old issue i though i solved ....building platforms at runtime.. those dots on the dynamically built platforms doesn't seem to appear at runtime unless they are pre built into the scene..they are piers and i want to have platforms on them where cannons can be placed but ..it dosnt seem to be working...i havent updated the code in a year or so.keep that in mind ..because i made some core edits allowing creep to be instantiated by the player

    scnene notes the peirs that are white are built into the scene..the one thats pink is placed there dynamically ..the cannon was placed on the pier at runtime but i cant seem to make it work for the dynamically made pier in pink.. any ideas?
     
  26. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    My question for you is how do you create those platform during runtime? For the pre-placed platform, the function Format() is called on the BuiltPlatform component of those platform. You will need to do that as well for your runtime platform. Also the reason your platform appear pink is because the material on the renderer is missing. Again this goes back to how you create the platform in the first place. If you instantiate it, which prefab/game-object are you using?
     
  27. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    right now they are made threw your system where you purchase them and drag and drop them...the cannons are made by this script..inventory pro drops a gameobject and runs this script

    the white ones are the literal prefabs of the towers..i turned off the mesh rendering for obvious reasons when not debugging ..its a non issue i think.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using TDTK;
    5. using Devdog.InventoryPro;
    6.  
    7.  
    8. public class TowerDropper : MonoBehaviour {
    9.     public UIBuildButton towerbutton;
    10.     public UnitTower drop;
    11.     public InventoryItemBase itemPrefab;
    12.     // Use this for initialization
    13.     void Start () {
    14.    
    15.         //towerbutton.OnBuildButton (drop,0);
    16.         TowerManager.BufferItem = itemPrefab;// user interfaces/towerdefence/canvas build button/uibuildbutton
    17.         TowerManager.CreateDragNDropTower(drop);
    18.         DestroyImmediate(this,true);
    19.         //UIBuildButton.
    20.         //OnBuildButton(,);
    21.     }
    22.  
    23.     // Update is called once per frame
    24.     void Update () {
    25.    
    26.     }
    27. }
    28.  
     
    Last edited: Jun 21, 2018
  28. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I don't think we are understanding each other here. I mean how do you place the platform, not the towers.

    I don't quite understand your code here since I'm not sure what InventoryItemBase is and how TowerManager.BufferItem plays into all this. But as far as I can tell you are creating tower. Not build platform. And I thought the problem is why the platform doesn't work when they are created in runtime?
     
  29. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    i took a bare bones project and took your block and put a platform on the block prefab tower. what is it going to take to make that an active platform in the game so i can ad platforms at runtime? i swear ive done this before.. i think what you mentioned is im going to have to que this format thingy your talking about....
     
  30. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    that code is instantiating a cannon from the inventory pro system..its just instantiation..the cannon goes on the screen and then uses your drag and drop system..all im trying to do is make a tower/block with a platform on it at runtime and then place a gun or a cannon on the tower/block. .
     
    Last edited: Jun 21, 2018
  31. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    im in unity 2017.3.of1 and started a bare bones project and TDTK is broken right out of the gate using the demo platform scene. when building blocks the progress bar won't go away its seem broken ..no errors....i cant really demostaright what im trying to do if tdtk is broken... reguarding my earlier post..after using the newer unity on my older project thats when thing went all haywire..i had no issue a year or so agoe making platforms attached to towers at runtime so you can stack towers.. you might want to review you code and do some updates ..or maby im just off and doing somthing wrong and don't realize it
     
  32. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    First thing first, I've just done a quick test (download TDTK from AssetStore and run the demo scene). Everything seems to be working fine. Granted I'm using Unity2017.2 but I don't think that is a problem here. Are you using the latest version of TDTK (v4.0.2)?

    Also I'm pretty sure I press the 'post reply' button earlier but somehow my respond doesn't get posted. What I meant to say was what you are doing is fine. The problem is drag and drop tower doesn't account for a build-platform that get instantiated with it. And you need to call Format() on that BuildPlatform instance to get it working properly. You can try add this function to TowerManager.cs.

    Code (CSharp):
    1. public static void FormatPlatform(BuildPlatform platform){
    2.     platform.Format(GetGridSize(), instance.autoAdjustTextureToGrid);
    3. }
    Then you should be able to format the platform by calling it. You can try using your exisitng code. Something like this:
    Code (CSharp):
    1. UnitTower tower=TowerManager.CreateDragNDropTower(drop);
    2. BuildPlatform platform=tower.transform.GetChild(1).gameObject.GetComponent<BuildPlatform>();
    3. TowerManager.FormatPlatform(platform);
     
  33. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    thanks.. i think i have enough clues to work with to figure it out. my internet has been wonky all day..it may just be this site
     
  34. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    i think it would be easier to make a script on the platform that formats itself on creation like in a void start
     
  35. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    ohh yeah im using the latest build off the site and the build progress bar is not working right...
     
  36. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I suppose that could work too. The reason I didn't do that in the first place is just in case there are issue with the script execution order. Just make sure you place the code in Start(), not Awake().

    That's strange. Everything is working fine for me as far as I can tell. Before you have this problem, what are the version you are running?
     
  37. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    im running 2018 now and everything is fine...i was reading that release was bad and it breaks alot of stuff ..
    2018 breaks alot old stuff and fixed alot the errors i was getting..the roller coaster of updates..arrrgggg! ill settle in and get comfortable ill figure this all out again..i have a involuntary 1-2 years break but im back..you have given me the tools to make this happen thanks
     
  38. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    im going to have to do somthing in the unitTower files using if == preview ..when the tower is placed it will see it is no longer in preview and format it...then im going to have to deal with destroying it..that sounds like a challenge
     
  39. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    hello im having issues with disabling towers on platforms.
    when i choose to disable the gun it disable 3 in all
    ...any ideas
     
  40. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    the answer is that each tower has a prefab id that may need to be changed manually...these items may have the same prefab id
     
  41. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Sorry for the slow respond but you have just answer your own question there. I'm not sure how it happen as the editor will always make sure the prefab is assigned a unique prefabID when it's added to the list. Anyway, just manually reassign the prefabID of those prefab with some unique ID will fix the problem.
     
  42. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    the problem occurs in they way i build towers and creep i duplicate them in explorer and modify them. then i get recurring prefab ids
     
  43. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    so i think ive created my self issues.. ive made it so you can build block as walls and towers and there exact function is that of blocks with platforms on them so you can build turrets on top of them...i am not understanding the targeting for the turret towers..and where it is controlled and it radius and all that jazz. and if it 2d or a sphere or what..and hints? fyi those are cannons and guns on those walls and i need to know how the range works and where its controlled
     

    Attached Files:

  44. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    The targeting range works like a sphere in a 3D space. The red circular plane shows the radius of the sphere in horizontal plane, but the turret will targeting anything within that radius regardless of the direction. You can adjust the value of individual tower's targeting radius on TowerEditor. If you are want to modify the code, you can find the code in ScanForTarget() in Unit.cs.
     
  45. wethecom

    wethecom

    Joined:
    Jun 24, 2015
    Posts:
    75
    Is that unit radius? when i modified that to 200 it allowed things far away to hit me..it didn't seem like its attack radius

     
  46. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    No, that's just the size of the unit used to determine when a shoot-object 'hit' the unit. What you are looking for is EffectiveRadius in the blocks in the section 'Tower Stats and Upgrade'. Each block is a set stats for a particular level of that tower, each level can have a unique EffectiveRadius.
     
  47. Artlekks

    Artlekks

    Joined:
    Mar 5, 2015
    Posts:
    3
    Hello Song,
    First I would like to say thank you for this great asset, it has everything I need to kickstart my TD game but I would like to
    change something and I'd like to know if it is possible (I am using the Pie Menu) :

    - When I click on a grid, the pie menu pops up.
    - Instead of having to select a tower with the cursor, I want to be able to select a tower simply by moving in the direction of this tower, like the Pie menu of Maya (3D Software).
    So lets say I have a pie menu setup with 8 towers, each of them corresponds to a direction (North, East, West, South, NE, NW, SE, SW).
    - When I click on a grid, the pie menu pops up, I move my cursor to the North for example and it selects the tower I placed there (Lets say The Laser Tower).
    - Once I "selected" the Laser Tower, a prefab of it replaces the cursor, so now I have a laser tower that I can place anywhere I please on the grid.
    - When I click on any grid, a Laser Tower is built and I can continue to build this same tower as long as I have money of course, without having to reselect it.
    Basically, after selecting that tower, each time I click on the grid, it builds one, so 10 clicks, 10 towers.
    - If I want to select another tower, I would have to click on a grid but for lets say 0.5 seconds and then the Pie Menu repops up and allow me to select another tower.
    It allows the Player to quickly build up his "maze" and prevent having to choose the same tower to build.

    - Is it possible to do within this Framework and if so, how would you go about doing this ?

    I am a 3D Artist but I don't mind having to get my hands dirty but since I don't have enough programming knowledge, I would like to know if it's possible to do so before spending lots of time on searching for ways to do it.

    Thank you for your time,
    Kind Regards,

    Alex
     
  48. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Hi Alex, glad you like the framework. I have to say what you are asking is not possible with the current framework. You will have to make some major change to the existing 'pie menu' code (in fact most of it). I would say that it's probably not so easy to do either if you have just entry level coding skill. It's not complicated, just that it has a lot of ground you need to cover.

    First I would suggest you to add right click to cancel the 'build-phase'. With that you can get rid of the 0.5sec click to re-select a tower. Then you set up a state machine driven by the mouse click. From first click to bring up the pie menu (bring up the menu and record the cursor position), then when a direction is selected (which you can determined from the recorded cursor position), and subsequently placement of the tower (determine if the tile is valid, if player has sufficient cost, etc.). And of course the right-click at any time to reset the state machine to initial state.

    Hope this make sense.
     
  49. Artlekks

    Artlekks

    Joined:
    Mar 5, 2015
    Posts:
    3
    Thank you Song, first for the swift reply and then for your directions :)

    I don't mind having to make heavy changes to the 'pie menu' code (With the help of friends with a more programming background), I just wanted to make sure that those changes wouldn't 'break' or wouldn't cause interference with the rest of the framework !

    Have a nice Weekend and GL on MechCorp :D
     
  50. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thank you!

    I should point out that the code of the framework is structured in a way that the core function is separated and not dependent on the UI code. So you can go nuts with the UI. :)