- Joined
- Oct 16, 2008
- Messages
- 10,454
you should do Maggy's suggestion to make the system more efficient...
i wonder why my indentions keep getting ruined. :\
loop
set p=FirstOfGroup(g)
exitwhen p==null
if CastOnAreaLvl_CHECK(u) then
if((IsUnitAlly(p,pl) and v)...
//blahhh...
//=======================================================================
private function FuuuILTER takes nothing returns boolean
call GroupAddUnit(g,GetFilterUnit())
return false
endfunction
//=======================================================================
private function CreateTargetGroup takes real x, real y, real r returns nothing
call GroupEnumUnitsInRange(g,x,y,r,f)
endfunction
//=======================================================================
private module zapdos
private static method onInit takes nothing returns nothing
set f=Filter(function FuuuILTER)
endmethod
endmodule
Consider this situation. You make a dummy cast a spell after the user runs a spell (why not put the channeling on the user? Who the hell knows >.>). Now you want to cast a spell, but oh no, your channeling is running for 30 seconds. Boom, your entire dummy is now disabled for the next 30 seconds, gg.
also in most good/advanced map, long-term spells [like ur example, rain of fire] are almost always coded because they need damage to be controllable... so they don't use a dummy to channel spells like RoF when they want it to be instant cast for the user... and for those reasons, I made custom systems like Meteor and Nova...
//=======================================================================
private module moltress
private static method onInit takes nothing returns nothing
call TriggerAddCondition(DEALLOCATOR,Condition(function DeallocationProcess))
endmethod
endmodule
...
//===========================================================================
private struct s extends array
implement moltres//you lack an s here
endstruct
//===========================================================================
hehehe if the user decides not to use the channeling spell support. i'll code in static if's for that situation.![]()
function CastOnTargetLvl takes unit u1, unit u2, integer id, integer oid, integer lvl returns nothing
//! runtextmacro DummyCasterUtils__AddSpellLeveled("u1","id","lvl")
//! runtextmacro DummyCasterUtils__SetUnitXY("u1","GetUnitX(u2)","GetUnitY(u2)")
call IssueTargetOrderById(u1,oid,u2)
call UnitRemoveAbility(u1,id) //<- this thing is slower... compared to the deallocation method i use... (which relies on a trigger executes via the EVENT_UNIT_SPELL_ENDCAST event)
endfunction
//=======================================================================
private function DeallocationProcess takes nothing returns boolean
// the lines here below execute before the "UnitRemoveAbility" above the first example
// NOTE: they are event driven.
set cs=GetTriggerUnit()
set rcs[w]=cs
set w=w+1
call UnitRemoveAbility(cs,GetSpellAbilityId())
call SetUnitOwner(cs,DEFAULT_OWNER,false)
return false
endfunction
//=======================================================================
private module moltres
private static method onInit takes nothing returns nothing
call TriggerAddCondition(DEALLOCATOR,Condition(function DeallocationProcess))
endmethod
endmodule
Alain.Mark said:my looping code is only for multicasting instant spells. (it works)
btw what i meant earlier was my code only uses one dummy caster when casting MULTIPLE times (for instant spells) and recycles dummy casters when casting MULTIPLE times (for channeled/timed spells). try it. it is faster and more efficient since it doesn't use timers and attaching. i meant my post earlier specifically for my libs "CastOnAreaLvl" function.
if(w==0)then
//put debug messages and see what I mean...
set cs=CreateUnit(pl,DUMMY_CASTER_ID,0,0,0)
.......
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
local unit d=AllocateCaster(Player(0))
call CastOnArea(d,0,0,1000.00,'Aenr',OrderId("entanglingroots"),false)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call Cheat("iseedeadpeople")
call TriggerRegisterPlayerEventEndCinematic( gg_trg_Untitled_Trigger_001, Player(0) )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
This event doesn't fire for a lot of abilities: EVENT_UNIT_SPELL_ENDCAST.