[REL] Health and Mana 1.01

UI mod for DG.

http://forums.gaspowered.com/viewtopic.php?p=470761

hehe, i'm at it again. more UI mods for DG. 

this one a lot more people shall find useful; it makes the health, mana, and experience meters stay visible even when the mouse isn't over them. 

i also added regen to it as well, but as i can't find proper functions to call i've made a bit of a work-around that looks rather ugly. 

i'm going to use gaspowered forums for the mod as i can *cough* edit and update my thread there, please feel free to reply and make simple suggestions for future releases. 

[EDIT:] made a small addition.


Changelog: (last updated 21SEP08)

1.01: health and mana text is now toggleable (click on the bars to show/hide), thanks goes to Sorian for sharing that.

hopefully there'll be no more irrelevant code-spam in the thread either.


grab it from here, and enjoy.

 

4,414 views 5 replies
Reply #1 Top

Nice. Of my short beta testing of the game I found that mouse cursor will block the health numbers so you can't see them clearly. That definitely need fixing.

Reply #2 Top

If you are looking for the formula search around the base code, open it with a text program, IT WILL NOT DIRECTLY GIVE YOU THE FORMULA, but It is there.

Plus for demigods you have to add the variable of them upgrading them selves.

But the first part of this post should help with all the creeps.

EXAMPLE OF BASE CODE:

(Taken from Supreme Commander Forged Alliances  "Paragon Structure")

[code]ResourceOn = State {
        Main = function(self)
            local aiBrain = self:GetAIBrain()
            local massAdd = 0
            local energyAdd = 0
            local maxMass = self:GetBlueprint().Economy.MaxMass
            local maxEnergy = self:GetBlueprint().Economy.MaxEnergy
           
            while true do
                local massNeed = aiBrain:GetEconomyRequested('MASS') * 10
                local energyNeed = aiBrain:GetEconomyRequested('ENERGY') * 10

                local massIncome = (aiBrain:GetEconomyIncome( 'MASS' ) * 10) - massAdd
                local energyIncome = (aiBrain:GetEconomyIncome( 'ENERGY' ) * 10) - energyAdd
               
                massAdd = 20
                if massNeed - massIncome > 0 then
                    massAdd = massAdd + massNeed - massIncome
                end
               
                if maxMass and massAdd > maxMass then
                   massAdd = maxMass
                end
                self:SetProductionPerSecondMass(massAdd)

                energyAdd = 1000
                if energyNeed - energyIncome > 0 then
                    energyAdd = energyAdd + energyNeed - energyIncome
                end
                if maxEnergy and energyAdd > maxEnergy then
                    energyAdd = maxEnergy
                end
                self:SetProductionPerSecondEnergy(energyAdd)

                WaitSeconds(.5)
            end
        end,
    },
[code]

Reply #3 Top

Damn impulse bugs.

WTB WORKING edit button. >:(

local massNeed = aiBrain:GetEconomyRequested('MASS') * 10
local energyNeed = aiBrain:GetEconomyRequested('ENERGY') * 10

Translation: Need = ('Matrerial') * 10

local massIncome = (aiBrain:GetEconomyIncome( 'MASS' ) * 10) - massAdd
local energyIncome = (aiBrain:GetEconomyIncome( 'ENERGY' ) * 10) - energyAdd

Translation: Increase Produce = (('Material') * 10) - Current production

if massNeed - massIncome > 0 then
massAdd = massAdd + massNeed - massIncome

This is a rare case where they actually give a formula.

Simply put: It makes whatever is needed.

 

Reply #4 Top

bump for new version.

Reply #5 Top

Neat.  I hope they make it so clicking on them makes them stay put in the actual game itself :P