Modding Help not effected by grav weapons?

Discussion in 'Starbound Modding' started by spookysalmon, Apr 30, 2019.

Tags:
  1. spookysalmon

    spookysalmon Void-Bound Voyager

    is it possible to make my ingame character not movable by other players gravity manipulating weapons and if so would anyone know or supply me with answer Please and thank you
     
  2. SpazDiesFirst360.0

    SpazDiesFirst360.0 Phantasmal Quasar

    A simple solution would be to set your gravity to zero, as anything multiplied by zero is still zero. This is incredibly impractical, however, as who wants to be continuously affected by zero gravity?
    Another option would be to make a tech (or status effect) that checks if the player's current gravity is not equal to the world's gravity, then changes it accordingly.
    • Let's say that the current world gravity is 80 (the default), and a player uses a weapon that multiplies your gravity by, say, 10. The status effect (or tech) would notice this change and apply a status effect that negates the other player's effect.
    I hope this makes sense.
     
  3. spookysalmon

    spookysalmon Void-Bound Voyager

    it does make sense but there is one factor i never mentioned is that i dont know how to recreate a tech or change tech functions such as gravity correction
     
  4. SpazDiesFirst360.0

    SpazDiesFirst360.0 Phantasmal Quasar

    I created a simple jump-based tech that adds and removes an effect that reduces your gravity to zero. It does this by calling
    Code:
    status.addEphemeralEffect(effectName)
    and later calling
    Code:
    status.removeEphemeralEffect(effectName)
    Now, there are properties that can be used, such as
    Code:
    world.gravity(Vec2 position)
    but you'll have to do some digging into how to get a player's gravity.
    Gravity correction would work in the following manner...
    Code:
    function correctGravity()
        if <player gravity> > world.gravity(mcontroller.position()) then
            status.addEphemeralEffect(<name of gravity correcting effect>)
    end
    With the following inside a status effect lua file...
    Code:
    local x = <player gravity>
    local multiplier = world.gravity(mcontroller.position()) / x
    And then apply the modifier to the player's gravity.
     

Share This Page