XeNiM666
I lurk for pizza
- Reaction score
- 138
Timed Effects
What does this do?
- This does exactly what the names states. It creates a special effect with a duration. This also creates special effects with height and scale.
Pros:
- Its easy to use
- Its very useful
- Leakless
- Lagless
- GUI friendly
Cons:
- Requires Vexorian's dummy.mdx ( attached at the bottom of post )
- Requires very little knowledge of JASS
Functions:
JASS:
// 1. AddTimedSpecialEffect //
// - takes string modelName, real duration, real x, real y, real z //
// - This function creates a timed effect for the duration of choice //
// 1. AddTimedSpecialEffectLoc //
// - takes string modelName, real duration, location whichLoc, real z //
// - This function creates a timed effect for the duration of choice //
// - This is used for GUI. Because GUI uses locations instead of reals //
// 1. AddTimedSpecialEffectEx //
// - takes string modelName, real duration, real scale, real x, real y, real z //
// - This function creates a timed effect for the duration of choice //
// - This one creates a special effect with a desired size //
The Code:
JASS:
//****************************************************************************************//
//****************************************************************************************//
// //
// TIMED EFFECTS SYSTEM //
// by XeNiM666 //
// //
//****************************************************************************************//
//****************************************************************************************//
// //
// REQUIRES: //
// 1. A vJASS preprocessor ( Jass NewGen Pack ) //
// 2. Vexorian's dummy.mdx model //
// //
//****************************************************************************************//
//****************************************************************************************//
// //
// THIS SYSTEM HAS 3 FUNCTIONS: //
// 1. AddTimedSpecialEffect //
// - takes string modelName, real duration, real x, real y, real z //
// - This function creates a timed effect for the duration of choice //
// 1. AddTimedSpecialEffectLoc //
// - takes string modelName, real duration, location whichLoc, real z //
// - This function creates a timed effect for the duration of choice //
// - This is used for GUI. Because GUI uses locations instead of reals //
// 1. AddTimedSpecialEffectEx //
// - takes string modelName, real duration, real scale, real x, real y, real z //
// - This function creates a timed effect for the duration of choice //
// - This one creates a special effect with a desired size //
// //
//****************************************************************************************//
//****************************************************************************************//
// //
// HOW TO IMPLEMENT: //
// 1. Create a trigger named TE //
// 2. Convert it to custom text //
// 3. Delete the text inside //
// 4. Copy all the text here and copy it to the trigger you created //
// 5. Copy the dummy unit in this map //
// //
//****************************************************************************************//
//****************************************************************************************//
library TE initializer onInit
globals
// THE RAW CODE OF THE DUMMY UNIT USED AS EFFECTS
// THE DUMMY MUST HAVE THE MODEL "dummy.mdx" BY "Vexorian"
private constant integer DUMMY_EFFECT = 039;u001039;
endglobals
//**************************************************************************************//
//**************************************************************************************//
// DO NOT TOUCH UNLESS YOU KNOW WHAT YOU'RE DOING //
//**************************************************************************************//
//**************************************************************************************//
private function Destroy takes effect e, real dur returns nothing
call TriggerSleepAction( dur )
call DestroyEffect( e )
set e = null
endfunction
function AddTimedSpecialEffectEx takes string modelName, real duration, real scale, real x, real y, real z returns nothing
local unit model = CreateUnit( Player( 15 ), DUMMY_EFFECT, x, y, 270.00 )
local effect e = AddSpecialEffectTarget( modelName, model, "origin" )
call SetUnitScale( model, scale * 0.01, scale * 0.01, scale * 0.01 )
call UnitApplyTimedLife( model, 039;BTLF039;, duration )
if z != 0.00 then
call UnitAddAbility( model, 039;Amrf039; )
call SetUnitFlyHeight( model, z, 0.00 )
call UnitRemoveAbility( model, 039;Amrf039; )
endif
set model = null
call Destroy( e, duration )
endfunction
function AddTimedSpecialEffect takes string modelName, real duration, real x, real y, real z returns nothing
local unit model = CreateUnit( Player( 15 ), DUMMY_EFFECT, x, y, 270.00 )
local effect e = AddSpecialEffectTarget( modelName, model, "origin" )
call UnitApplyTimedLife( model, 039;BTLF039;, duration )
if z != 0.00 then
call UnitAddAbility( model, 039;Amrf039; )
call SetUnitFlyHeight( model, z, 0.00 )
call UnitRemoveAbility( model, 039;Amrf039; )
endif
set model = null
call Destroy( e, duration )
endfunction
// FOR THOSE WHO LIKE USING LOCATIONS...
function AddTimedSpecialEffectLoc takes string modelName, real duration, location whichLoc, real z returns nothing
local unit model = CreateUnit( Player( 15 ), DUMMY_EFFECT, GetLocationX( whichLoc ), GetLocationY( whichLoc ), 270.00 )
local effect e = AddSpecialEffectTarget( modelName, model, "origin" )
call UnitApplyTimedLife( model, 039;BTLF039;, duration )
if z != 0.00 then
call UnitAddAbility( model, 039;Amrf039; )
call SetUnitFlyHeight( model, z, 0.00 )
call UnitRemoveAbility( model, 039;Amrf039; )
endif
set model = null
call Destroy( e, duration )
endfunction
private function onInit takes nothing returns nothing
call RemoveUnit( CreateUnit( Player( 15 ), DUMMY_EFFECT, 0.00, 0.00, 0.00 ) )
endfunction
endlibrary
There is a sample spell inside the map. Also please note that THE SPELL DOES NOTHING. Just shows a sample of the snippet.
Special Thanks:
- Vexorian for his dummy.mdx model
- Tinki3 for his Spell Map Template
Map: