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

    What happens if you start a new character? Does it also crash when crafting/equipping the tech then?
     
  2. LimiterDrive

    LimiterDrive Space Spelunker

    I can't access the character creation menu, it crashes as soon as I try to load the character list screen screen. The normal script works fine, though. It seems to just crash if I try to use my modded script.
     
  3. SuperMandrew

    SuperMandrew Cosmic Narwhal

    I haven't tried this, but I did a quick edit and I'd imagine this would work:

    Code:
    function checkCollision(position)
      local collisionBounds = tech.collisionBounds()
      collisionBounds[1] = collisionBounds[1] - tech.position()[1] + position[1]
      collisionBounds[2] = collisionBounds[2] - tech.position()[2] + position[2]
      collisionBounds[3] = collisionBounds[3] - tech.position()[1] + position[1]
      collisionBounds[4] = collisionBounds[4] - tech.position()[2] + position[2]
    
      return not world.rectCollision(collisionBounds)
    end
    
    function blinkAdjust(position, doPathCheck, doCollisionCheck, doLiquidCheck, doStandCheck)
      local blinkCollisionCheckDiameter = tech.parameter("blinkCollisionCheckDiameter")
      local blinkVerticalGroundCheck = tech.parameter("blinkVerticalGroundCheck")
      local blinkFootOffset = tech.parameter("blinkFootOffset")
    
      if doPathCheck then
        local collisionBlocks = world.collisionBlocksAlongLine(tech.position(), position, true, 1)
        if #collisionBlocks ~= 0 then
          local diff = world.distance(position, tech.position())
          diff[1] = diff[1] / math.abs(diff[1])
          diff[2] = diff[2] / math.abs(diff[2])
    
          position = {collisionBlocks[1][1] - diff[1], collisionBlocks[1][2] - diff[2]}
        end
      end
    
      if doCollisionCheck and not checkCollision(position) then
        local spaceFound = false
        for i = 1, blinkCollisionCheckDiameter * 2 do
          if checkCollision({position[1] + i / 2, position[2] + i / 2}) then
            position = {position[1] + i / 2, position[2] + i / 2}
            spaceFound = true
            break
          end
    
          if checkCollision({position[1] - i / 2, position[2] + i / 2}) then
            position = {position[1] - i / 2, position[2] + i / 2}
            spaceFound = true
            break
          end
    
          if checkCollision({position[1] + i / 2, position[2] - i / 2}) then
            position = {position[1] + i / 2, position[2] - i / 2}
            spaceFound = true
            break
          end
    
          if checkCollision({position[1] - i / 2, position[2] - i / 2}) then
            position = {position[1] - i / 2, position[2] - i / 2}
            spaceFound = true
            break
          end
        end
    
        if not spaceFound then
          return nil
        end
      end
    
      if doStandCheck then
        local groundFound = false
        for i = 1, blinkVerticalGroundCheck * 2 do
          local checkPosition = {position[1], position[2] - i / 2}
    
          if world.pointCollision(checkPosition, false) then
            groundFound = true
            position = {checkPosition[1], checkPosition[2] + 0.5 - blinkFootOffset}
            break
          end
        end
    
        if not groundFound then
          return nil
        end
      end
    
      if doLiquidCheck and (world.liquidAt(position) or world.liquidAt({position[1], position[2] + blinkFootOffset})) then
        return nil
      end
    
      if doCollisionCheck and not checkCollision(position) then
        return nil
      end
    
      return position
    end
    
    function findRandomBlinkLocation(doCollisionCheck, doLiquidCheck, doStandCheck)
      local randomBlinkTries = tech.parameter("randomBlinkTries")
      local randomBlinkDiameter = tech.parameter("randomBlinkDiameter")
    
      for i=1,randomBlinkTries do
        local position = tech.position()
        position[1] = position[1] + (math.random() * 2 - 1) * randomBlinkDiameter
        position[2] = position[2] + (math.random() * 2 - 1) * randomBlinkDiameter
    
        local position = blinkAdjust(position, false, doCollisionCheck, doLiquidCheck, doStandCheck)
        if position then
          return position
        end
      end
    
      return nil
    end
    
    function uninit()
      tech.setParentAppearance("normal")
    end
    
    function init()
      data.multiJumps = 0
      data.lastJump = false
      data.mode = "none"
      data.timer = 0
      data.targetPosition = nil
      data.airDashing = false
      data.dashTimer = 0
      data.dashDirection = 0
      data.dashLastInput = 0
      data.dashTapLast = 0
      data.dashTapTimer = 0
      data.lastBoost = nil
      data.ranOut = false
    end
    
    function input(args)
      local currentJump = args.moves["jump"]
      local currentBoost = nil
    
      if args.moves["jump"] and not tech.jumping() and not tech.canJump() and not data.lastJump and data.multiJumps < tech.parameter("multiJumpCount") then
        data.lastJump = true
        return "multiJump"
      elseif args.moves["special"] == 1 then
        return "blink"
      else
        --data.lastJump = args.moves["jump"]
        data.lastJump = currentJump
        if data.dashTimer > 0 then
          return nil
        end
    
        local maximumDoubleTapTime = tech.parameter("maximumDoubleTapTime")
    
        if data.dashTapTimer > 0 then
          data.dashTapTimer = data.dashTapTimer - args.dt
        end
    
        if args.moves["right"] then
          if data.dashLastInput ~= 1 then
            if data.dashTapLast == 1 and data.dashTapTimer > 0 then
              data.dashTapLast = 0
              data.dashTapTimer = 0
              return "dashRight"
            else
              data.dashTapLast = 1
              data.dashTapTimer = maximumDoubleTapTime
            end
          end
          data.dashLastInput = 1
        elseif args.moves["left"] then
          if data.dashLastInput ~= -1 then
            if data.dashTapLast == -1 and data.dashTapTimer > 0 then
              data.dashTapLast = 0
              data.dashTapTimer = 0
              return "dashLeft"
            else
              data.dashTapLast = -1
              data.dashTapTimer = maximumDoubleTapTime
            end
          end
          data.dashLastInput = -1
        else
          data.dashLastInput = 0
        end
          return nil
      end
    end
    
    function update(args)
      local multiJumpCount = tech.parameter("multiJumpCount")
      local energyUsage = tech.parameter("energyUsage")
      local blinkMode = tech.parameter("blinkMode")
      local blinkOutTime = tech.parameter("blinkOutTime")
      local blinkInTime = tech.parameter("blinkInTime")
    
      local dashControlForce = tech.parameter("dashControlForce")
      local dashSpeed = tech.parameter("dashSpeed")
      local dashDuration = tech.parameter("dashDuration")
      --local energyUsage = tech.parameter("energyUsage")
    
      local boostControlForce = tech.parameter("boostControlForce")
      local boostSpeed = tech.parameter("boostSpeed")
      local energyUsagePerSecond = tech.parameter("energyUsagePerSecond")
      local energyUsageBoost = energyUsagePerSecond * args.dt
    
      local usedEnergy = 0
    
      if args.availableEnergy < energyUsageBoost then
        data.ranOut = true
      elseif tech.onGround() or tech.inLiquid() then
        data.ranOut = false
      end
    
      local boosting = false
      local diag = 1 / math.sqrt(2)
    
      if args.actions["blink"] and data.mode == "none" and args.availableEnergy > energyUsage then
        local blinkPosition = nil
        if blinkMode == "random" then
          local randomBlinkAvoidCollision = tech.parameter("randomBlinkAvoidCollision")
          local randomBlinkAvoidMidair = tech.parameter("randomBlinkAvoidMidair")
          local randomBlinkAvoidLiquid = tech.parameter("randomBlinkAvoidLiquid")
    
          blinkPosition =
            findRandomBlinkLocation(randomBlinkAvoidCollision, randomBlinkAvoidMidair, randomBlinkAvoidLiquid) or
            findRandomBlinkLocation(randomBlinkAvoidCollision, randomBlinkAvoidMidair, false) or
            findRandomBlinkLocation(randomBlinkAvoidCollision, false, false)
        elseif blinkMode == "cursor" then
          blinkPosition = blinkAdjust(args.aimPosition, true, true, false, false)
        elseif blinkMode == "cursorPenetrate" then
          blinkPosition = blinkAdjust(args.aimPosition, false, true, false, false)
        end
    
        if blinkPosition then
          data.targetPosition = blinkPosition
          data.mode = "start"
        else
          -- Make some kind of error noise
        end
      end
    
      
      if data.mode == "start" then
        tech.setVelocity({0, 0})
        data.mode = "out"
        data.timer = 0
    
        return energyUsage
      elseif data.mode == "out" then
        tech.setParentAppearance("hidden")
        tech.setAnimationState("blinking", "out")
        tech.setVelocity({0, 0})
        data.timer = data.timer + args.dt
    
        if data.timer > blinkOutTime then
          tech.setPosition(data.targetPosition)
          data.mode = "in"
          data.timer = 0
        end
    
        return 0
      elseif data.mode == "in" then
        tech.setParentAppearance("normal")
        tech.setAnimationState("blinking", "in")
        tech.setVelocity({0, 0})
        data.timer = data.timer + args.dt
    
        if data.timer > blinkInTime then
          data.mode = "none"
        end
    
        return 0
      end
    
      if args.actions["multiJump"] and data.multiJumps < multiJumpCount and args.availableEnergy > energyUsage then
        tech.jump(true)
        data.multiJumps = data.multiJumps + 1
        tech.burstParticleEmitter("multiJumpParticles")
        tech.playImmediateSound(tech.parameter("jumpsound"))
        return energyUsage
      else
        if tech.onGround() or tech.inLiquid() then
          data.multiJumps = 0
        end
        --return 0.0
      end
    
      local dashed = 0 --need a flag to tell if we've dashed
      if args.actions["dashRight"] and data.dashTimer <= 0 and args.availableEnergy > energyUsage then
        data.dashTimer = dashDuration
        data.dashDirection = 1
        dashed = 1
        usedEnergy = energyUsage
        data.airDashing = not tech.onGround()
      elseif args.actions["dashLeft"] and data.dashTimer <= 0 and args.availableEnergy > energyUsage then
        data.dashTimer = dashDuration
        data.dashDirection = -1
        dashed = 1
        usedEnergy = energyUsage
        data.airDashing = not tech.onGround()
      end
    
      if data.dashTimer > 0 then
        tech.xControl(dashSpeed * data.dashDirection, dashControlForce, true)
    
        if data.airDashing then
          tech.applyMovementParameters({gravityEnabled = false})
          tech.yControl(0, dashControlForce, true)
        end
    
        if data.dashDirection == -1 then
          tech.moveLeft()
          tech.setFlipped(true)
        else
          tech.moveRight()
          tech.setFlipped(false)
        end
        tech.setAnimationState("dashing", "on")
        tech.setParticleEmitterActive("dashParticles", true)
        data.dashTimer = data.dashTimer - args.dt
      else
        tech.setAnimationState("dashing", "off")
        tech.setParticleEmitterActive("dashParticles", false)
      end
    
      if dashed == 1 then
        return usedEnergy
      else
        return 0.0
      end
    
      --elseif args.actions["blink"] and data.mode == "none" and args.availableEnergy > energyUsage then
    end
    
    EDIT: Did a quick diff on your script and mine, and here's the part I did differently. You had this:

    Code:
      elseif args.moves["jump"] and not tech.onGround() then
        --world.logInfo("here1")
          end
        end
        data.lastJump = currentJump
    I removed all of these lines in my version.
     
  4. WatcherCCG

    WatcherCCG Giant Laser Beams

    Hate to ask this given the new news, but have you made any progress on the Rocket Jump file?
     
  5. LimiterDrive

    LimiterDrive Space Spelunker

    Thanks a ton! Works like a charm now.
     
  6. Fullmoon

    Fullmoon Scruffy Nerf-Herder

    Hm. Installed this. Also added into Tabula Rasa for existing character. I can craft the tech blueprint, but I cannot add it to tech selector. I just can't use it.
     
  7. Doc Honcho

    Doc Honcho Big Damn Hero

    I dunno, dash and any jump tech would be nice to have at the same time. And the gravity bubble is not infinite until you get some late tier gear, I can only float for a short time with gold and it uses enough energy to make fighting difficult if you fund yourself attacked after using it
     
  8. LimiterDrive

    LimiterDrive Space Spelunker

    The way ultratech is currently set up, it gives you steep energy discounts on all the abilities in it. Normally, in tier 2 armor just as an example, I can only dash about 6 times. With ultratech equipped I can dash around 30 times. Same can be said about the other techs in ultratech.
     
  9. SuperMandrew

    SuperMandrew Cosmic Narwhal

    Yes, I have the old energy cost values in ultratech. You'd have to open up dash.tech and to see how to adjust energy costs.
     
  10. Jessen

    Jessen Scruffy Nerf-Herder

    I cannot, for the life of me, get this to work. I would appreciate it if it was looked at and updated for the new modding system
     
  11. Jessen

    Jessen Scruffy Nerf-Herder

    i cannot get this mod to work, regardless of if I put an entry into player.config or not
     
  12. SuperMandrew

    SuperMandrew Cosmic Narwhal

    You'll need an entry into player.config for this mod. Make sure you're putting it in tier1.

    Since this is an older mod (before the mods folder system was in place), I'm not sure what kind of conflicts appear in this. Regardless, I'd try creating a folder inside the mods folder, like "supermandrew_ultratech", then placing the tech folder of this mod in there, and adding the entry to player.config. This should also work for all the other threads (at least, mine) which you seem to be having a similar problem.

    When in doubt, be sure to check /Starbound/starbound.log after any problems.
     
  13. Jessen

    Jessen Scruffy Nerf-Herder

    I created named folders for them, since that's how it works. So far any method I've tried to correct the problem has failed. I broke down and eventually used starreader to try adding the items to myself. turned into generic items. When i open up the log and look for ultratech, it tells me "Error: Could not instantiate item '[ultraTech, 1, {}]'. ItemException: No such item 'ultraTech'" and "Error: Could not instantiate item '[ultraTech-chip, 1, {}]'. ItemException: No such item 'ultraTech-chip'".

    I also tried a method of creating a player.config file copy in the named mod folder so that i don't have to change the original file, in theory that really should work but i cant tell.

    Its the same thing for the fire morphball mod. Cant get that one working either. I think these two may need updates.
     
  14. N1sh

    N1sh Space Hobo

    is this mod discontinued? It is a must have in my list but can't get it to work
     
  15. Rhyr

    Rhyr Space Hobo

    I'm running into this same issue, and cannot figure out what is causing it. Do you happen to remember what was causing the game to crash when equipping the tech?
     
  16. Sea of infinity

    Sea of infinity Void-Bound Voyager

  17. Patchumz

    Patchumz Pangalactic Porcupine

    If anyone really wants to use this standalone, I've been using my own version of it ever since it broke (easy to fix). I simply fixed the icon (I made my own icon via combining all the 4 tech icons in a clever way) and the incompatibility. It also automatically gets added to your tech station due to the wonders of __merge.

    Simply unzip it into the mods folder.
     

    Attached Files:

    Sea of infinity likes this.
  18. DandyWizard

    DandyWizard Space Penguin Leader

    well firstly 4 techs and your right and thats why the non-random blink doesn't go past walls
     
  19. DandyWizard

    DandyWizard Space Penguin Leader

    there is only mobility techs
     
  20. Khazhor

    Khazhor Void-Bound Voyager

    Man i have [v. Furious Koala] and i can't use your mod, i don't know what I'm doing wrong, the mod just don't work...
    Maybe I installed it in a wrong way, can you tell me what to do?
    What I did was placing the ultratech folder in the Starbound/mods folder, but it doesn't work, I've even tried with new chars but nothing...

    PS: I downloaded the regular version, without the hover thing...
     

Share This Page