so i tried make unitdamagepoint function of my own, having heard that the function doesn't work well for whatever reason, i didn't understand at the time.
anyhow. the problem as i had noticed it was i was not able to use the filter correctly.
i'm probably missing something, but don't know what.
so i noticed spell was hurting ALL unitss including caster and allies even though filter supposed to check for if unit was an enemy. so i tried adding a small if then section in the primary udp function in order to temporarily deal with the problem. but i don't want to make a big long list of ifs in my udp function so please help me out here and get this working.
here it is in a library:
i know the spell may be much more complicated than it needs to be...
i made the spell quite a while ago... anyway i'm still pretty newb at spells and yet this one looks pretty darned good i would say as for what the final effect should look like...
but i'm open to suggestions but overall i'm trying to figure out what's theh deal with the filter and why it isn't working. btw i'm using cjass, so the code probably looks a little strange...and no i didn't cjass it ALL up...that might have been something of a waste of time...especially if it got too much cjass then you guys might not be able to read it...
i'm thinking maybe i shold just say, screw groups and use some unit arrays instead. they seem to be easier to deal with. opinions?
anyhow. the problem as i had noticed it was i was not able to use the filter correctly.
i'm probably missing something, but don't know what.
so i noticed spell was hurting ALL unitss including caster and allies even though filter supposed to check for if unit was an enemy. so i tried adding a small if then section in the primary udp function in order to temporarily deal with the problem. but i don't want to make a big long list of ifs in my udp function so please help me out here and get this working.
here it is in a library:
JASS:
public function UDP takes unit damager, group uir, real px, real py, real rr, boolexpr fltr, attacktype at, damagetype dt, weapontype wt, real damage, boolean spareally returns integer
local unit first = null
local integer c =0
call GroupEnumUnitsInRange(uir,px,py,rr,fltr)
loop
set first = FirstOfGroup(uir)
exitwhen first == null
call GroupRemoveUnit(uir,first)
set c=c+1
if spareally then
if IsUnitAlly(first,GetOwningPlayer(damager)) then
else
call UnitDamageTarget(damager,first,damage,false,false,at,dt,wt)
endif
else
call UnitDamageTarget(damager,first,damage,false,false,at,dt,wt)
endif
endloop
set first = null
return c
endfunction
///
///
///
// Inspira6tion taken from playing the playstation game Saga Frontier.
// A random GUI coder ( you know who you are ) helped me figure out
// how to abrutly stop the display of a dummy model by changing the unit
// scale as you will see below.
scope oscillatingscream initializer I
globals
private constant integer OSI = 039;A071039;,/*SpellID*/ODSI = 039;A079039;/*StunSpellID*/,ODI = 039;e00Y039;/*DummyID*/
private constant real rad = 600.00//radius of spell
private constant attacktype A_TYPE = FullAttack//attack type of damage dealt by oscillation
private constant damagetype D_TYPE = DAMAGE_TYPE_SONIC // Damage type of damage dealt by oscillation.
private constant weapontype W_TYPE = WEAPON_TYPE_WHOKNOWS // Weapon type of damage dealt by oscillation.
private constant boolean spareally=true
endglobals
private real Damage (integer lvl){return 15.00 + (10.00 * lvl)} // Damage dealt by oscillation times 7.
private boolean OS_Filter (){return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) \
and GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false}
//! textmacro oscdum
set d.dum = CreateUnit(GetOwningPlayer(d.cast), ODI, GetUnitX(d.cast), GetUnitY(d.cast) - 125.00, \
GetRandomReal(0.00,359.99))
call SetUnitScale(d.dum,5.0,5.0,5.0)
call SetUnitAbilityLevel(d.dummy,ODSI,d.lvl)
call IssueImmediateOrder(d.dummy,"stomp")
set d.ux=GetUnitX(d.cast)
set d.uy=GetUnitY(d.cast)
call TAF_UDP(d.cast,d.grp,d.ux,d.uy,rad,d.be,A_TYPE,D_TYPE,W_TYPE, Damage(d.lvl),spareally)
call UnitApplyTimedLife(d.dum, 039;BTLF039;, 2.0)
//! endtextmacro
//! textmacro oscdumm
set d.dumm = CreateUnit(GetOwningPlayer(d.cast), ODI, GetUnitX(d.cast), GetUnitY(d.cast) - 125.00, \
GetRandomReal(0.00,359.99))
call SetUnitScale(d.dumm,5.0,5.0,5.0)
call SetUnitAbilityLevel(d.dummy,ODSI,d.lvl)
call IssueImmediateOrder(d.dummy,"stomp")
set d.ux=GetUnitX(d.cast)
set d.uy=GetUnitY(d.cast)
call TAF_UDP(d.cast,d.grp,d.ux,d.uy,rad,d.be,A_TYPE,D_TYPE,W_TYPE, Damage(d.lvl),spareally)
call UnitApplyTimedLife(d.dumm, 039;BTLF039;, 2.0)
//! endtextmacro
private struct Data
unit cast
unit dum
unit dumm
unit dummy
group grp
integer lvl
integer orb
timer tim
real ux
real uy
boolexpr be
static method create takes unit cast returns Data
local Data d = Data.allocate()
local unit first = null
set d.cast = cast
set d.lvl = GetUnitAbilityLevel(d.cast, OSI)
set d.orb = 0
set d.tim = NewTimer()
set d.grp = CreateGroup()
set d.dum = CreateUnit(GetOwningPlayer(d.cast), ODI, GetUnitX(d.cast), GetUnitY(d.cast) - 125.00, \
GetRandomReal(0.00,359.99))
call SetUnitScale(d.dum,5.0,5.0,5.0)
set d.dummy = CreateUnit(GetOwningPlayer(d.cast), ODI, GetUnitX(d.cast), GetUnitY(d.cast) - 125.00, \
GetRandomReal(0.00,359.99))
call SetUnitScale(d.dummy,0.0,0.0,0.0)
call SetUnitAbilityLevel(d.dummy,ODSI,d.lvl)
call IssueImmediateOrder(d.dummy,"stomp")
set d.ux=GetUnitX(d.cast)
set d.uy=GetUnitY(d.cast)
set d.be = Filter(function OS_Filter)
call TAF_UDP(d.cast,d.grp,d.ux,d.uy,rad,d.be,A_TYPE,D_TYPE,W_TYPE, Damage(d.lvl),spareally)
call UnitApplyTimedLife(d.dum, 039;BTLF039;, 2.0)
call UnitApplyTimedLife(d.dumm, 039;BTLF039;, 2.0)
call SetTimerData(d.tim, d)
set first =null
return d
endmethod
method onDestroy takes nothing returns nothing
call RemoveUnit(.dummy)
call ReleaseTimer(.tim)
endmethod
endstruct
private function Callback takes nothing returns boolean
local timer tim = GetExpiredTimer()
local Data d = GetTimerData(tim)
set d.orb = d.orb + 1
if d.orb ==2 then
//! runtextmacro oscdumm()
elseif d.orb ==3 then
call SetUnitScale(d.dum,0.0,0.0,0.0)
elseif d.orb ==4 then
//! runtextmacro oscdum()
elseif d.orb ==5 then
call SetUnitScale(d.dumm,0.0,0.0,0.0)
elseif d.orb ==6 then
//! runtextmacro oscdumm()
elseif d.orb ==7 then
call SetUnitScale(d.dum,0.0,0.0,0.0)
elseif d.orb ==8 then
//! runtextmacro oscdum()
elseif d.orb ==9 then
call SetUnitScale(d.dumm,0.0,0.0,0.0)
elseif d.orb ==10 then
//! runtextmacro oscdumm()
elseif d.orb ==11 then
call SetUnitScale(d.dum,0.0,0.0,0.0)
elseif d.orb ==12 then
//! runtextmacro oscdum()
elseif d.orb ==13 then
call SetUnitScale(d.dumm,0.0,0.0,0.0)
elseif d.orb ==15 then
call SetUnitScale(d.dum,0.0,0.0,0.0)
elseif d.orb >= 16 then
call d.destroy()
endif
set tim = null
return false
endfunction
private function Actions takes nothing returns boolean
local Data d = Data.create(GetTriggerUnit())
call TimerStart(d.tim, 0.25, true, function Callback)
return false
endfunction
public function I takes nothing returns nothing
call GT_AddStartsEffectAction(function Actions, OSI)
endfunction
endscope
i know the spell may be much more complicated than it needs to be...
i made the spell quite a while ago... anyway i'm still pretty newb at spells and yet this one looks pretty darned good i would say as for what the final effect should look like...
but i'm open to suggestions but overall i'm trying to figure out what's theh deal with the filter and why it isn't working. btw i'm using cjass, so the code probably looks a little strange...and no i didn't cjass it ALL up...that might have been something of a waste of time...especially if it got too much cjass then you guys might not be able to read it...
i'm thinking maybe i shold just say, screw groups and use some unit arrays instead. they seem to be easier to deal with. opinions?