- Joined
- Nov 24, 2007
- Messages
- 55
Hi, I was wondering if there is a way to write a "global" function that I can call in other triggers?
For example, many of my spells end by doing some floating combat text to show the number of damage that ability did. This takes approximately 5 lines of code to do, and I hate copy/pasting these over and over, because then when i decide i need to change the way i do all floating text, i have to find and hunt down every single time i had done it.
For instance, I would love to have the following function accessible to all my triggers:
is this possible? Can i then in another trigger completely tell it via Jass just "call GlobalFloatingCombatText( target, R2S(damage), 100, 0, 0)" or something like that?
Thanks
For example, many of my spells end by doing some floating combat text to show the number of damage that ability did. This takes approximately 5 lines of code to do, and I hate copy/pasting these over and over, because then when i decide i need to change the way i do all floating text, i have to find and hunt down every single time i had done it.
For instance, I would love to have the following function accessible to all my triggers:
Code:
function GlobalFloatingCombatText takes unit targ, string msg, real red, real green, real blue returns nothing
call CreateTextTagLocBJ( msg, GetUnitLoc(targ), 0, 10.00, 0.00, red, green, blue )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 32.00, 90 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
is this possible? Can i then in another trigger completely tell it via Jass just "call GlobalFloatingCombatText( target, R2S(damage), 100, 0, 0)" or something like that?
Thanks