Gtam
Lerning how to write and read!! Yeah.
- Reaction score
- 164
OffsetUnitReals
By Gtam aka SharkBait87
By Gtam aka SharkBait87
I dont know if anyone will find this usefull but in any way i hope someone does.
This Requires NewGen
This snippet can Offset a Units Reals with a easy function call and get the offseted Real x with a function call and y aswell.
There are some other function calls that can be usefull.
To Import Just create a new trigger name RealsOffset and replace all the text with this.
Here is the code
JASS:
library RealsOffset
//=======================================================================================\\
//=======================================================================================\\
//= This is created by Gtam =\\
//= This library makes offsetting reals alot easier =\\
//= It can offset reals, move units to the offseted reals, =\\
//= damage the moved unit, create a effect at the moved unit and =\\
//= damage and created effects to the moved unit =\\
//= =\\
//= GetOffsetUnitRealX() takes unit, real1, real2 returns real =\\
//= This is used to get the offseted reals X =\\
//= =\\
//= GetOffsetUnitRealY() takes unit, real1, real2 returns real =\\
//= This is ised to get the offseted reals y =\\
//= =\\
//= OffsetUnitRealsMove() takes unit, real1, real2 returns nothing =\\
//= This will offset unit reals by real and move him there =\\
//= =\\
//= OffsetUnitRealsMoveDamage() takes unit1, unit2, real1, real2, attacktype, =\\
//= damagetype, weapontype returns nothing =\\
//== This will offset unit1 reals by real 1 and move him there then cause unit2 =\\
//= to damage unit1 by real2 =\\
//= =\\
//= OffsetUnitRealsMoveEffect() takes unit, real, string returns nothing =\\
//= This will offset unit reals by real and move him there and create a effect at =\\
//= unit1 current position and his offseted position =\\
//= =\\
//= OffsetUnitRealsMoveDamageEffect() takes unit1, unit2, real1, real2, string, =\\
//= attacktype, damagetype, weapontype returns nothing =\\
//= This will offset unit1 reals by real 1 and move him there then cause unit2 =\\
//= to damage unit1 by real2 and create a effect at unit1 current position and his =\\
//= offseted position =\\
//= =\\
//=======================================================================================\\
//=======================================================================================\\
globals
private real urx
private real ury
endglobals
function GetOffsetUnitRealX takes unit u, real r, real f returns real
set urx = GetUnitX(u) + r * Cos (f * .0175)
return urx
endfunction
function GetOffsetUnitRealY takes unit u, real r, real f returns real
set ury = GetUnitY(u) + r * Sin (f * .0175)
return ury
endfunction
function OffsetUnitRealsMove takes unit u, real r, real f returns nothing
call SetUnitPosition( u, GetOffsetUnitRealX(u,r,f), GetOffsetUnitRealY(u,r,f))
endfunction
function OffsetUnitRealsMoveDamage takes unit u, unit t, real r, real f, real d, attacktype a, damagetype b, weapontype c returns nothing
call OffsetUnitRealsMove(u, r, f)
call UnitDamageTarget( t, u, d, false, false, a, b, c )
endfunction
function OffsetUnitRealsMoveEffect takes unit u, real r, real f, string s returns nothing
call DestroyEffect( AddSpecialEffect( s, GetUnitX(u), GetUnitY(u)))
call OffsetUnitRealsMove( u, r, f)
call DestroyEffect( AddSpecialEffect( s, urx, ury))
endfunction
function OffsetUnitRealsMoveDamageEffect takes unit u, unit t, real r, real f, real d, string s, attacktype a, damagetype b, weapontype c returns nothing
call DestroyEffect( AddSpecialEffect( s, GetUnitX(u), GetUnitY(u)))
call OffsetUnitRealsMove( u, r, f)
call DestroyEffect( AddSpecialEffect( s, urx, ury))
call UnitDamageTarget( t, u, d, false, false, a, b, c )
endfunction
endlibrary
Btw. This is my first jass resource. Hope its usefull
Code:
ChangeLog
v1.00 Released
v1.01 Updated to Komations suggestions
v1.02 Bugs fix and should work properly now