1. Please be advised of a few specific rules and guidelines for this section.

RELEASED Four techs at once! - Ultratech

Discussion in 'Mechanics' started by SuperMandrew, Dec 9, 2013.

  1. SuperMandrew

    SuperMandrew Cosmic Narwhal

    Odd, someone reported this in the fire morphball thread as well. Are you using any other mods?

    EDIT: Just tried installing this on mine (since I had removed it), no problems like this at all.
     
    Last edited: Dec 11, 2013
  2. Med

    Med Phantasmal Quasar

    SuperMandrew likes this.
  3. Createse

    Createse Big Damn Hero

    Don't suppose I could pick your brain a moment could I SuperMandrew? I'm doing a rewrite of your mod and replacing Double Jump with the Gravity Neutraliser but cannot seem to get the Gravity Neutraliser to function on pressing [and holding] the "jump" key. I didn't want to be cheeky and request much more of you. I wouldn't learn anything that way either.

    Code:
    function init()
      data.holdingJump = false
      data.hoverRanOut = false
      data.jetpackRanOut = false
    end
    
    function input(args)
      if args.moves["jump"] and tech.jumping() then
        data.holdingJump = true
      elseif not args.moves["jump"] then
        data.holdingJump = false
      end
    
      -- I've been changing this section a lot trying to get this damn thing to work....
      -- FYI, Hover works.
      if args.moves["jump"] and not tech.canJump() and not data.holdingJump then
        return "hover"
      elseif args.moves["jump"] and tech.canJump() and data.holdingJump then
        return "jetpack"
      else
        return nil
      end
    end
    
    function update(args)
      local hoverSpeed = tech.parameter("hoverSpeed")
      local hoverControlForce = tech.parameter("hoverControlForce")
      local hoverEnergyUsagePerSecond = tech.parameter("hoverEnergyUsagePerSecond")
      local hoverEnergyUsage = hoverEnergyUsagePerSecond * args.dt
      local jetpackSpeed = tech.parameter("jetpackSpeed")
      local jetpackControlForce = tech.parameter("jetpackControlForce")
      local jetpackEnergyUsagePerSecond = tech.parameter("jetpackEnergyUsagePerSecond")
      local jetpackEnergyUsage = jetpackEnergyUsagePerSecond * args.dt
    
      if args.availableEnergy < hoverEnergyUsage then
        data.hoverRanOut = true
      elseif tech.onGround() or tech.inLiquid() then
        data.hoverRanOut = false
      end
    
      if args.availableEnergy < jetpackEnergyUsage then
        data.jetpackRanOut = true
      -- Commented out trying to get jetpack to work...
      -- elseif tech.onGround() or tech.inLiquid() then
      elseif tech.inLiquid() then
        data.jetpackRanOut = false
      end
    
      if args.actions["hover"] and not data.hoverRanOut then
        tech.setAnimationState("hover", "on")
        tech.yControl(hoverSpeed, hoverControlForce, true)
        return hoverEnergyUsage
      else
        tech.setAnimationState("hover", "off")
        return 0
      end
    
      if args.actions["jetpack"] and not data.jetpackRanOut then
        tech.setAnimationState("jetpack", "on")
        tech.yControl(jetpackSpeed, jetpackControlForce, true)
        return jetpackEnergyUsage
      else
        tech.setAnimationState("jetpack", "off")
        return 0
      end
      return usedEnergy
    end
     
    Last edited: Dec 12, 2013
  4. SuperMandrew

    SuperMandrew Cosmic Narwhal

    So you'd like the double jump removed, and simply using the hover mechanic instead?

    Look at jetpack.lua. In my mod, simply remove any code related to double jump, and use jetpack.lua code instead. You're doing a "return "hover"" or "return "jetpack"", and I'm not sure why you're changing the jetpack.lua code so much.

    Although jetpack.lua does a "return "jetpack"" - it's just saying that "jetpack" is the action currently happening. The animation file is defined in hover.tech (which points to hover.animation), and hover.animation has a stateType called "jetpack".

    Essentially, I think you're making it harder than it is. Does that make sense at all?

    EDIT: To further clarify, jetpack.lua is used for both the hover files and jetpack files, since they both require the same functionality, just different graphics.
     
  5. Createse

    Createse Big Damn Hero

    I noticed they share the same script, the same "action" ("jetpack"), the same control (jump when jumping). I've basicly been trying to access both functions from the same tech.tech, when by default they're one or the other.

    Press "Space" [and hold] to "jetpack" (where normally you'd simply just jump), press "Space" again to "hover" (default, unchanged). I'll also be adding the other two techs Dash and Blink. They shouldn't conflict so hopefully will be easy enough with your mod as reference, and the experience from getting "jetpack" and "hover" to work.
     
  6. SuperMandrew

    SuperMandrew Cosmic Narwhal

    Ah, I think I see now. So you want to press space to jump, holding space on that same jump would go to jetpack, then letting go of space and pressing it again would switch to hover mode?
     
  7. Createse

    Createse Big Damn Hero

    I had considered "jetpack" replacing the default jump action completely, but either way would be fine.

    Edit: Disregard the above, I think we're on the same page.
     
    Last edited: Dec 12, 2013
  8. SuperMandrew

    SuperMandrew Cosmic Narwhal

    Check out my post on the second page.

    So you need a way to tell jetpack to stop stealing all the inputs from hover, and to let hover get a chance to get some input. Thinking logically, this means that we need a way for jetpack to know that it's been "used" and to not work again until... I'll assume until you've touched the ground. The trick here is to use one of those flags I mentioned before. In your .tech file, add a parameter at the end (don't forget your comma):

    "jetpackOn" : true

    Now, in your LUA code, change your conditional which uses jetpack (or hover) to be what you need. For instance,

    Code:
    if args.moves["jump"] and tech.canJump() and data.holdingJump and jetpackOn then
      return "jetpack"
    elseif args.moves["jump"] and not tech.canJump() and not data.holdingJump then
      return "hover"
    However, we need a way to define jetpackOn, and set jetpackOn it to off. We shouldn't do that in the above part - why? Because if we do (in the first if before we return "jetpack") then the jetpack will last for a split second before turning off and can't be turned back on. Instead, the earlier conditional part should look like this:

    Code:
      
    local jetpackOn = tech.parameter("jetpackOn")
    
    if args.moves["jump"] and tech.jumping() then
      data.holdingJump = true
    elseif not args.moves["jump"] then
      jetpackOn = false -- the user has let go of the jump button, they can no longer jetpack until they land
      data.holdingJump = false
    end
    
    if tech.onGround() then
      jetpackOn = true --the user is grounded, they should be allowed to jetpack if they hold jump from here
    end
    
    ^ all this should come before the check for "jetpack" or "hover"

    I hope this helps! We may want to start a new thread to not derail this one if you need further help, which I don't mind providing.
     
  9. Createse

    Createse Big Damn Hero

    Excellent, I'll crawl all over this and keep you posted. I'm probably going to go a different way with regards to when the player can use jetpack.
    I've just come across a trove of .LUA files I can look through too, for predefined variables and functions (searching *.LUA in explorer). Should be fun.

    I also agree regarding a new thread. I'll create one if I've need of your assistance again. Thank you BTW.
     
    SuperMandrew likes this.
  10. yk999

    yk999 Subatomic Cosmonaut

    Sorry for bumping my own post, but i'd like to ask again. Would you make a blink+dash+double jump+gravity bubble version? Gravity bubble gives the player control, it's one of the greatest techs. I would try to make it myself, but techs are out of my league.

    If you can't, no big deal. The mod is already great as it is.
     
  11. SuperMandrew

    SuperMandrew Cosmic Narwhal

    Sure, I might not be able to get it done until around Friday though- I'll do my best!
     
  12. yk999

    yk999 Subatomic Cosmonaut

    Thanks, no need to hurry. :)
     
  13. axellslade

    axellslade Void-Bound Voyager

    Could you upload the hover alternative to some other server? I can't seem to download any attachment off this forum.
     
  14. SuperMandrew

    SuperMandrew Cosmic Narwhal

    Here you go! Not sure what's up with the attachments on the forum.

    http://www46.zippyshare.com/v/21139254/file.html
     
    axellslade likes this.
  15. Aknis

    Aknis Aquatic Astronaut

    Hello all, new here and trying to mod my game with the Tech mods. For some reason or another I am unable to see the recipe of either the hover or bubble ultraTech. I've placed the file and folder in the aforementioned location, but it refuses to show up in-game. I've tried changing the recipe location, and tried to change the recipe itself, but I am not skilled enough in lua to actually know what I am doing. Any help would be appreciated.
     
  16. SuperMandrew

    SuperMandrew Cosmic Narwhal

    Hey there Aknis, no worries!

    Have you edited your player.config file at all?

    EDIT: Ah.. I forgot I had included a player.config file with this mod. This mod uses an older version of player.config, so you'll have to manually add a line to the current version it in order to see the tech. However before we try that, what happens if you start a new character and then walk over to the tech station? Is the tech already available?
     
  17. Aknis

    Aknis Aquatic Astronaut

    I have. Under "tier1" I placed
    { "item" : "ultraTech" },
    but it never seemed to do anything. Unless there was another step that I missed?

    Edit: Didn't see your edit. To answer: no, there are no Techs at the tech station on a new character.
     
  18. SuperMandrew

    SuperMandrew Cosmic Narwhal

    And I'm assuming the tech file is placed properly at /assets/tech/ultratech/. Hm.. What happens if you make a new character? Does it work?
     
  19. Aknis

    Aknis Aquatic Astronaut

    The ultratech folder is in the tech folder under assets, but making a new character does not bring up the tech. I must have done something really weird for it to not work at this point.
     
  20. SuperMandrew

    SuperMandrew Cosmic Narwhal

    Right, so you can't craft the tech for some reason, after modifying player.config, and putting the ultratech folder in the right section. In the new character, instead of trying to craft, what happens if you go over to the tech station on the ship? I assume it's not there as well? (also I assume you're completely closing Starbound/re-opening it every time you change the files)
     

Share This Page