Floating text and FX question

Recommended Posts

Technical question (excuse my inexperience with Lua and InvisibleInc modding):


I'm working on a mod which requires functionality similar to that of Internationale's wireless scanner. I've managed to create an ability which does the same thing, except that there is no visual indication of it happening.


It should be possible, with boardrig.lua, to make pretty things happen on screen (floating text, anims, etc) but I do not have access to this within the context of an ability definition. In the case of the wireless scanner, the graphics and sounds are created in response to a EV_UNIT_REFRESH event within unitrig.lua (line 605). I want to do the same thing as this, but use my own text and fx (so that when a unit is in range, it makes a noise and does a flashy animation with some floating text around the scanned unit).


My question is: If I want my ability to create an arbitrary flashy animation or some custom floating text at a particular location, what's the best (non hacky, mod_api friendly) way to do this? Otherwise, how can I get a reference to the boardrig within the context of an ability definition?


Bonus question: How would you declare your own 'rig' files (for handling events) with the mod API?

Link to comment
Share on other sites

Figured it out.


For prosperity, the audiovisual components of Internationale's wireless scanner can be replicated with the following event triggers:


sim:dispatchEvent( simdefs.EV_PLAY_SOUND, "SpySociety/Actions/Engineer/wireless_emitter_reveal" )

sim:dispatchEvent( simdefs.EV_UNIT_FLOAT_TXT, {txt="<font1_18_r>"..STRINGS.UI.FLY_TXT.REVEALED.."</>", x=x1, y=y1, color={r=1,g=1,b=41/255,a=1}, alwaysShow=true} )

sim:dispatchEvent( simdefs.EV_UNIT_ADD_FX, {unit=unit, kanim="gui/hud_fx", symbol="aquire_console", anim="front", params={}} )


'alwaysShow' is needed for locations that the player doesn't have vision of.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.