Modding Help creating alternative energy

Discussion in 'Starbound Modding' started by NaViGaToR532, Jan 23, 2020.

Tags:
  1. NaViGaToR532

    NaViGaToR532 Orbital Explorer

    I want to create magic, and for this I need to add mana. I tried to copy the player’s energy


    player.config.patch
    Code:
    [
        { "op":"add", "path":"/statusControllerSettings/stats/maxMana", "value":{ "baseValue" : 100.0} },
        { "op":"add", "path":"/statusControllerSettings/stats/manaRegenPercentageRate", "value":{ "baseValue" : 0.00166} },
        { "op":"add", "path":"/statusControllerSettings/stats/manaRegenBlockTime", "value":{ "baseValue" : 10.0} },
    
        { "op":"add", "path":"/statusControllerSettings/resources/mana", "value":{ "maxStat": "maxMana", "initialPercentage": 1.0} },
        { "op":"add", "path":"/statusControllerSettings/resources/manaRegenBlock", "value":{ "maxStat" : "manaRegenBlockTime", "deltaValue" : -1.0, "initialPercentage" : 0.0} }
    ]


    interface\windowconfig\teambar.config.patch
    Code:
    [
       { "op":"add", "path":"/paneLayout/manaBar",
            "value":{
                "zlevel" : 8,
                "type" : "progress",
                "position" : [30, -35],
                "background" : "/interface/emptybar.png",
                "size" : [60, 8],
                "progressSet" : {
                    "inner" : "/interface/energybar.png",
                    "type" : "repeat"
                },
                "direction" : "horizontal"
            }
        }
    ]

    but I still don't understand how to interact with mana in lua, how to change the size of progress bar and, for example, spend mana instead of energy

    I already tried to resize using widget.setProgress ("manaBar", status.resourcePercentage ("mana")), but I got the error "attempt to index a nil value (global 'widget')"
     
  2. Isaac MacPherson

    Isaac MacPherson Scruffy Nerf-Herder

    I've recently also considered adding magic to one of my Starbound mods. I'm not sure how to approach the task myself, but I'll certainly "share my notes" when I come up with something (this could pave the way for other magic mods (unless one has already been created, in which case... my new nickname shall be Captain Oblivious)). LUA has been a tricky mistress for me ever since I got an interest in modding Starbound.
     

Share This Page