How do I add a new action to a building?

perkyperky Join Date: 2012-08-31 Member: 157042Members
<div class="IPBDescription">I.e. adding a new button to observatory or phase gate?</div>I'm having some difficulty finding how to add a button the the commander GUI for a specific building. I've looked through the TechTree classes and MarineTeam class.
There's lots of references to kTechId.something however I can't find where these are declared.

I'm trying to add a button to phase-gates that when pressed will set that phase gate to top priority.

Comments

  • ChaosXBeingChaosXBeing Join Date: 2012-10-12 Member: 162114Members
    Hmm, try looking at the Arms Lab for reference since it doesn't have any other use, if you haven't already.

    Also, something like that may be in a mixin, and as I've been finding out the last few days mixins can be tricky to work with.

    Afraid that's all I can offer at the moment.
  • TontowTontow Join Date: 2012-11-14 Member: 171161Members
    I would love to know how to do this to so I can add my own tech and buildings.
  • HuzeHuze Insightful Join Date: 2003-11-12 Member: 22724Members, NS1 Playtester, NS2 Playtester, Squad Five Blue, Reinforced - Shadow
    edited November 2012
    1. Add your tech to TechTreeConstants.lua
    2. Add your tech to TechData.lua
    3. Add your tech to techtree in MarineTeam.lua
    4. Add your tech to Observatory.lua
    * line 177: GetTechButtons(techId) which calls
    * line 54: kObservatoryTechButtons table
    5. Make your tech do something. Look at other ones for examples

    Find in Files is your friend. The best way to learn something is search for it in the code. In this particular case, if you search for PhaseTech you'd find all of these files and locations where it's used.

    VV forgot that part, thanks
  • JimWestJimWest Join Date: 2010-01-03 Member: 69865Members, Reinforced - Silver
    And add the Tech to the building at :GetTechButtons(techId)
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    You will also want to make sure to add it in TechTreeButtons.lua or you will get spammed with a warning because it will have no icon.
Sign In or Register to comment.