D.V.D
Make a wish
- Reaction score
- 73
Working on the tauren area. I made a outpost. Here's a screenshot:
scope CDispellHoT
struct SG
unit targ
real amount
boolean end
real dur
string effectstring
effect sfx
real counter
integer buffid
endstruct
globals
private integer Total = 0
private SG array D
private timer T=CreateTimer()
endglobals
private function LoopActions takes nothing returns nothing
local integer i = 0
local location array loc2
local texttag array txt
local effect array sfx
loop
exitwhen i>=Total
if D<i>.end then
call DestroyEffect(D<i>.sfx)
set D<i>.sfx = null
call D<i>.destroy()
set Total=Total-1
if Total > 0 then
set D<i>=D[Total]
set i=i-1
else
call PauseTimer(T)
endif
else
set txt<i> = CreateTextTag()
set loc2<i> = GetUnitLoc(D<i>.targ)
call SetUnitState(D<i>.targ,UNIT_STATE_LIFE,(GetUnitState(D<i>.targ,UNIT_STATE_LIFE)+D<i>.amount))
call SetTextTagText(txt<i>,I2S(R2I(D<i>.amount)),TextTagSize2Height(8.00))
call SetTextTagPos(txt<i>,GetLocationX(loc2<i>),GetLocationY(loc2<i>),150)
call SetTextTagColor(txt<i>,51,255,0,255)
call SetTextTagPermanent(txt<i>,false)
call SetTextTagLifespan(txt<i>, .67)
call SetTextTagFadepoint(txt<i>, 0.47)
call SetTextTagVelocityBJ( txt<i>, 250.00, 90 )
call RemoveLocation(loc2<i>)
set loc2<i> = null
set D<i>.counter = D<i>.counter + 1
if D<i>.dur <= D<i>.counter then
set D<i>.end = true
endif
endif
set i = i+1
endloop
endfunction
private function CancelHeal takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer i = 0
local boolean found = false
loop
exitwhen found == true
if u == D<i>.targ then
set found = true
set D<i>.end = true
call UnitRemoveAbility(D<i>.targ,D<i>.buffid)
endif
set i = i+1
endloop
call TriggerClearActions(GetTriggeringTrigger())
call DestroyTrigger(GetTriggeringTrigger())
endfunction
private function CancelGuidance takes unit u returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_DAMAGED)
call TriggerAddAction(t,function CancelHeal)
endfunction
function CDispellHot takes unit t,real am, real d,string effstring, integer bid returns nothing
local SG LSG = SG.create()
set LSG.targ = t
set LSG.amount = am
set LSG.end = false
set LSG.dur = d
set LSG.counter = 0
set LSG.effectstring = effstring
set LSG.sfx = AddSpecialEffectTarget(LSG.effectstring,LSG.targ,"origin")
set LSG.buffid = bid
call CancelGuidance(t)
if Total == 0 then
call TimerStart(T,1,true,function LoopActions)
endif
set D[Total] = LSG
set Total = Total+1
endfunction
endscope
</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>
EDIT: oh and what about systems? there are some very good knockbacksystems, with sweet physics, so i would suggest that you compile a list of systems to be used, so we all use the same ones.
scope BattleCharge initializer Init
private keyword Data
// -------------
// | START SETUP |
// -------------
globals
private integer Total = 0
private Data array D
private unit TempU
private group TempG = CreateGroup()
private timer t = CreateTimer()
private filterfunc fltr
// Constants
private constant integer ABILITY_CODE = 039;A002039;
private constant integer STAND_ANIM_INDEX = 1 // Unit's 'stand' animation index
private constant integer RUNNING_ANIM_INDEX = 6 // Unit's 'run' animation index
private constant string DAMAGE_EFFECT = "Objects\\Spawnmodels\\Critters\\Albatross\\CritterBloodAlbatross.mdl"
private constant real IMPACT_AOE = 150. // The area where units take damage
private constant real INITIAL_SPEED = 1. // The distance the unit moves every time
private constant real ACCELERATION = 2.5
private constant real MAX_RANGE = 800.
private constant real SENSITIVITY = 80. // Enemy units within this range stops the charge and deals damage
private constant real FREQUENCY = 0.04 // Frequency of the timer
// Damage Constants
private constant real STAMINA_FACTOR = 1.
private constant real DISTANCE_FACTOR = 1.
endglobals
private function UnitFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempU)) and GetWidgetLife(GetFilterUnit()) > 0.405 and not IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
endfunction
private function GetDamage takes unit source, integer level, real distance returns real
return I2R(level) * (GetStaminaMelee(source) * STAMINA_FACTOR + distance * DISTANCE_FACTOR * 0.05)
endfunction
// -----------
// | END SETUP |
// -----------
private struct Data
unit source
real velocity = INITIAL_SPEED
real d = 0.0
real x
real y
real cos
real sin
boolean done = false
static method create takes unit source, real angle returns Data
local Data d = Data.allocate()
set d.source = source
call SetUnitPathing(source, false)
set d.x = GetUnitX(source)
set d.y = GetUnitY(source)
set d.cos = Cos(angle)
set d.sin = Sin(angle)
return d
endmethod
method move takes nothing returns nothing
local unit f
set TempU = .source
set .x = .x + .velocity * .cos
set .y = .y + .velocity * .sin
call GroupEnumUnitsInRange(TempG, .x, .y, SENSITIVITY, Filter(function UnitFilter))
if (.d <= MAX_RANGE and CheckPathability(.x, .y) and FirstOfGroup(TempG) == null) then
//call SetUnitAnimation(.source, "walk")
call SetUnitAnimationByIndex(.source, RUNNING_ANIM_INDEX)
call SetUnitX(.source, .x)
call SetUnitY(.source, .y)
else
set .done = true
endif
call GroupClear(TempG)
set .d = .d + .velocity
set .velocity = .velocity + ACCELERATION
set f = null
endmethod
method onDestroy takes nothing returns nothing
local unit f
local real angle
local real damage = GetDamage(.source, GetUnitAbilityLevel(.source, ABILITY_CODE), .d)
local real tx
local real ty
set TempU = .source
call SetUnitAnimationByIndex(.source, STAND_ANIM_INDEX)
call GroupEnumUnitsInRange(TempG, .x, .y, IMPACT_AOE, Filter(function UnitFilter))
loop
set f = FirstOfGroup(TempG)
exitwhen f == null
set tx = GetUnitX(f)
set ty = GetUnitY(f)
set angle = Atan2(ty - GetUnitY(.source), tx - GetUnitX(.source))
call UnitDamageTarget(.source, f, damage, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call CreateFloatingDamagePos(damage, tx, ty, "|cffff0000")
call DoKnockBack(.source, f, 60.0, 6.0, angle, 0.0, false, false)
call DestroyEffect(AddSpecialEffectTarget(DAMAGE_EFFECT, f, "chest"))
call GroupRemoveUnit(TempG, f)
endloop
call GroupClear(TempG)
call SetUnitPathing(.source, true)
set .source = null
set f = null
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILITY_CODE
endfunction
private function Loop takes nothing returns nothing
local integer i = Total - 1
loop
exitwhen i < 0
if D<i>.done == true then
call D<i>.destroy()
set D<i> = D[Total - 1]
set Total = Total - 1
else
call D<i>.move()
endif
set i = i - 1
endloop
if Total == 0 then
call PauseTimer(t)
endif
endfunction
private function Actions takes nothing returns nothing
local unit source = GetTriggerUnit()
local location sloc = GetSpellTargetLoc()
local real angle = Atan2(GetLocationY(sloc) - GetUnitY(source), GetLocationX(sloc) - GetUnitX(source))
local Data d = Data.create(source, angle)
call d.move()
if Total == 0 then
call TimerStart(t, FREQUENCY, true, function Loop)
endif
set D[Total] = d
set Total = Total + 1
call RemoveLocation(sloc)
set source = null
endfunction
// Main function
private function Init takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(trig, Condition(function Conditions))
call TriggerAddAction(trig, function Actions)
set fltr = Filter(function UnitFilter)
set trig = null
endfunction
endscope
</i></i></i></i>
Well for the dust animation, just add an ImpaleDust special effect at the loc whenever you move the unit^^
scope CDispellHoT
struct SG
unit targ
real amount
boolean end
real dur
string effectstring
effect sfx
real counter
integer buffid
endstruct
globals
private integer Total = 0
private SG array D
private timer T=CreateTimer()
endglobals
private function LoopActions takes nothing returns nothing
local integer i = 0
local location array loc2
local texttag array txt
local effect array sfx
loop
exitwhen i>=Total
if D<i>.end then
call DestroyEffect(D<i>.sfx)
set D<i>.sfx = null
call D<i>.destroy()
set Total=Total-1
if Total > 0 then
set D<i>=D[Total]
set i=i-1
else
call PauseTimer(T)
endif
else
set txt<i> = CreateTextTag()
set loc2<i> = GetUnitLoc(D<i>.targ)
call SetUnitState(D<i>.targ,UNIT_STATE_LIFE,(GetUnitState(D<i>.targ,UNIT_STATE_LIFE)+D<i>.amount))
call SetTextTagText(txt<i>,I2S(R2I(D<i>.amount)),TextTagSize2Height(8.00))
call SetTextTagPos(txt<i>,GetLocationX(loc2<i>),GetLocationY(loc2<i>),150)
call SetTextTagColor(txt<i>,51,255,0,255)
call SetTextTagPermanent(txt<i>,false)
call SetTextTagLifespan(txt<i>, .67)
call SetTextTagFadepoint(txt<i>, 0.47)
call SetTextTagVelocityBJ( txt<i>, 250.00, 90 )
call RemoveLocation(loc2<i>)
set loc2<i> = null
set D<i>.counter = D<i>.counter + 1
if D<i>.dur <= D<i>.counter or GetUnitAbilityLevel(D<i>.targ,D<i>.buffid) < 1 then
set D<i>.end = true
endif
endif
set i = i+1
endloop
endfunction
private function CancelHeal takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer i = 0
local boolean found = false
loop
exitwhen found == true
if u == D<i>.targ then
set found = true
set D<i>.amount = (D<i>.amount)*0.25
endif
set i = i+1
endloop
call TriggerClearActions(GetTriggeringTrigger())
call DestroyTrigger(GetTriggeringTrigger())
endfunction
private function CancelGuidance takes unit u returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_DAMAGED)
call TriggerAddAction(t,function CancelHeal)
endfunction
function SpiritGuidance takes unit t,real am, real d,string effstring, integer bid returns nothing
local SG LSG = SG.create()
set LSG.targ = t
set LSG.amount = am
set LSG.end = false
set LSG.dur = d
set LSG.counter = 0
set LSG.effectstring = effstring
set LSG.sfx = AddSpecialEffectTarget(LSG.effectstring,LSG.targ,"origin")
set LSG.buffid = bid
call CancelGuidance(t)
if Total == 0 then
call TimerStart(T,1,true,function LoopActions)
endif
set D[Total] = LSG
set Total = Total+1
endfunction
endscope
</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>
The tauren area is shaping out nicely too.
ill take the dips on that one
- The Tauren Warrior now properly displays animation
- The Tauren Warrior initiates 'attack 2' animation before hitting the units for
better timing and effect.
- The War Stomp effect appears on units that are hit.