Page 1 of 2
Resurrection halos widget
Posted: 22 Jan 2015, 01:02
by Floris
Displays a halo above every resurrected movable unit.
- the halo animates a little with size variation.

Re: Resurrection halos widget
Posted: 22 Jan 2015, 19:49
by jamerlan
Cool widget! Works!
Re: Resurrection halos widget
Posted: 22 Jan 2015, 20:10
by CarRepairer
This assumes all robots are good. Approximately 50% of them are evil. Give some of them horns.
Re: Resurrection halos widget
Posted: 22 Jan 2015, 20:15
by smoth
corpses know what teams they are from, so you know that they were not yours before you resurrect, does the new unit know it wasn't? if so that would be a prime candidate for horns instead of halo.
I dunno, I didn't think this halo marker sort of thing was possible, pretty cool!
Re: Resurrection halos widget
Posted: 22 Jan 2015, 20:40
by Floris
I'm not sure if its possible at all to determine if the resurrected unit belonged to the enemy. But thinking about that its possible to get back the stockpile value, it probably is possible someway. Doesn't get a resurrected unit a new id?
But aestaticly horns are very hard to do right. A halo is a lot easier, it floats and doesn't need to stick very precise on top of the 'head' of the unit.
Like the idea though :D
Re: Resurrection halos widget
Posted: 22 Jan 2015, 20:45
by smoth
could always do an inverted halo.. you know, red edge black center
Re: Resurrection halos widget
Posted: 23 Jan 2015, 20:13
by jamerlan
Sometimes halos are too high. (take a look at zeus in attached screenshot)
And probably they could be bigger

Re: Resurrection halos widget
Posted: 23 Jan 2015, 21:12
by Floris
The widget uses unitheight as defined in unitdefs.
Could add an option to define unitheight per unit type separately, maybe also even a off center value so it always hovers above a unit head.
But... maybe later...
Re: Resurrection halos widget
Posted: 23 Jan 2015, 23:35
by smoth
pretty much best you can do is petition the content dev to set the height. Sadly that is a 3do not an s3o. I am not sure if the height can be manually set on that zeus model.
Re: Resurrection halos widget
Posted: 01 Feb 2015, 07:50
by Floris
new version!
- slightly thicker/larger halo + applied bevel 3d effect on the texture
- remembers halo units on /luaui reload
- bugfix for when speccing and changing los
- size animation is based on clock instead of gametime
Re: Resurrection halos widget
Posted: 01 Feb 2015, 09:44
by Silentwings
I'm not sure if its possible at all to determine if the resurrected unit belonged to the enemy. But thinking about that its possible to get back the stockpile value, it probably is possible someway. Doesn't get a resurrected unit a new id?
The unitID after resurrection will typically be different to the one before death. But, you can save info when it dies because you know when the wreck spawns and that it spawns in (almost) exactly the same place as its unit died, which is (almost) always unique for the current simframe. And then you can do the same trick backwards when it's resurrected. It's a bit of a hack, and it relies on knowing the order in which callins happen within a simframe, but I don't know of a better way to do it.
Code (by BrainDamage) for doing it with exp is here
http://imolarpg.dyndns.org/trac/balates ... ez_exp.lua. See the GameFrame callin for explanation of the callin order.
Re: Resurrection halos widget
Posted: 02 Feb 2015, 13:28
by Floris
That uses gadget callins, unavailable at widget level
And widget:UnitDestroyed is only called with your own units...
Re: Resurrection halos widget
Posted: 02 Feb 2015, 13:47
by PicassoCT
Could you do health halos? Instead of bars..?
Re: Resurrection halos widget
Posted: 06 Feb 2015, 19:53
by jamerlan
[f=0010324] Error: LuaUI::RunCallIn: error = 2, Initialize, [Internal Lua error: Call failure] error = 2, LuaUI/bawidgets.lua, [string "LuaUI/Widgets/gui_resurrection_halos.lua"]:249: attempt to compare number with nil
stack traceback:
[C]: in function 'Include'
[string "-------------------------------------------..."]:25: in function 'chunk'
[string "luaui.lua"]:50: in main chunk
if I add "data and data.haloUnitsCount ~= nil" - then error is gone
like that:
if data and data.haloUnitsCount ~= nil and data.haloUnitsCount > 0 and data.haloUnits ~= nil and os.clock() - data.lastOsClock < 2 then
P.S. bug was found during watching repay:
http://replays.springrts.com/replay/4c1 ... 7c4c9fd36/
Re: Resurrection halos widget
Posted: 06 Feb 2015, 21:25
by jamerlan
local haloImg = ':n:'..LUAUI_DIRNAME..'Images/halo21.png'
fail

widget contains only halo.png
Re: Resurrection halos widget
Posted: 06 Feb 2015, 21:35
by Floris
thanks!, already was aware of the halo img name bug.
i'll update the file on the forum later.
Re: Resurrection halos widget
Posted: 06 Feb 2015, 22:56
by jamerlan
I think this widget could use more unit type checks.
For example I built t2 lab in place of dead unit - t2 lab had halo :-D It was not dead before
How to deal with "new nano built in place of dead nano - have halo" - I have no idea.
Re: Resurrection halos widget
Posted: 07 Feb 2015, 00:45
by Floris
Ugh.. I don't understand why this can happen at all. (or did you just suggest what should/could happen?)
First it checks every unit that is created if its builder can resurrect.
Secondly it excludes if the unit unitdefs: isBuilding, isFactory or it's speed == 0..
...updated file...
Re: Resurrection halos widget
Posted: 07 Feb 2015, 09:59
by jamerlan
I had this bug on DSD

my new t2 lab had halo
Maybe you can check wreckage being resurrected? like com counter widget
Re: Resurrection halos widget
Posted: 07 Feb 2015, 13:48
by Silentwings
That uses gadget callins, unavailable at widget level... And widget:UnitDestroyed is only called with your own units...
All callins used in that gadget are available too widgets. Check the widget handler or
https://springrts.com/wiki/Lua:Callins if you are ever confused about such things. Of course, you would have to handle the difficulty that LuaUI only has access to information that is available to the player running your widget; as such you cannot determine in every case whether a wreck was last owned by a friendly or enemy player, but in most cases you have enough information to make a reasonable guess.