Resurrection halos widget

Resurrection halos widget

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Resurrection halos widget

Post by Floris »

Displays a halo above every resurrected movable unit.

- the halo animates a little with size variation.

Image
Attachments
resurrection_halos.zip
18 february 2015
(11.05 KiB) Downloaded 5 times
screen00098.jpg
(302.28 KiB) Downloaded 1 time
Last edited by Floris on 18 Feb 2015, 22:44, edited 7 times in total.
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: Resurrection halos widget

Post by jamerlan »

Cool widget! Works!
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Resurrection halos widget

Post by CarRepairer »

This assumes all robots are good. Approximately 50% of them are evil. Give some of them horns.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Resurrection halos widget

Post 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!
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: Resurrection halos widget

Post 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
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Resurrection halos widget

Post by smoth »

could always do an inverted halo.. you know, red edge black center
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: Resurrection halos widget

Post by jamerlan »

Sometimes halos are too high. (take a look at zeus in attached screenshot)
halo_too_high.png
(1.25 MiB) Downloaded 2 times
And probably they could be bigger :-)
Last edited by jamerlan on 23 Jan 2015, 22:45, edited 1 time in total.
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: Resurrection halos widget

Post 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...
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Resurrection halos widget

Post 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.
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: Resurrection halos widget

Post 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
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Resurrection halos widget

Post 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.
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: Resurrection halos widget

Post by Floris »

That uses gadget callins, unavailable at widget level

And widget:UnitDestroyed is only called with your own units...
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Resurrection halos widget

Post by PicassoCT »

Could you do health halos? Instead of bars..?
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: Resurrection halos widget

Post 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/
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: Resurrection halos widget

Post by jamerlan »

local haloImg = ':n:'..LUAUI_DIRNAME..'Images/halo21.png'

fail :-) widget contains only halo.png
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: Resurrection halos widget

Post by Floris »

thanks!, already was aware of the halo img name bug.
i'll update the file on the forum later.
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: Resurrection halos widget

Post 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.
User avatar
Floris
Posts: 611
Joined: 04 Jan 2011, 20:00

Re: Resurrection halos widget

Post 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...
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: Resurrection halos widget

Post 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
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Resurrection halos widget

Post 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.
Post Reply

Return to “Lua Scripts”