- Joined
- Jun 18, 2007
- Messages
- 214
So, I'm making my first timer spell, and so far I did good (I hope). Map doesn't give me errors, everything is working except pull. I don't understand where I go wrong, and any help would be grateful.
The spell should summon one dummy unit (bolt) and grow it over time, and that is working. Summon other dummy unit (dummy caster) that is transparent and channeling the spell, that's working as well. The only problem is the timer function, that should pull the enemy units to the bolt, it doesn't give me errors, but it's not working.
Oh, yea, please notice that GetHandleHandle has been changed to GetHandleAgent, and FlushHandleLocals to FlushHandle..
JASS:
constant function Blast_Orb_SFX_Explosion takes nothing returns string
return "Objects\\Spawnmodels\\NightElf\\NEDeathMedium\\NEDeath.mdl"
endfunction
constant function Blast_Orb_Rawcode takes nothing returns integer
return 'A001'
endfunction
constant function Blast_DummyID takes nothing returns integer
return 'h001'
endfunction
constant function Blast_Dummy_BuffID takes nothing returns integer
return 'BTLF'
endfunction
constant function Blast_DummyCasterID takes nothing returns integer
return 'h002'
endfunction
constant function Blast_Dummy_Damage_AbilityID takes nothing returns integer
return 'A004'
endfunction
constant function Blast_Increment_Size takes nothing returns real
return 1.00
endfunction
constant function Blast_CasterAnimation takes nothing returns string
return "channel"
endfunction
constant function Blast_Orb_Pull_Loop takes nothing returns real
return 0.03
endfunction
constant function Blast_Orb_Time takes integer i returns real
return 2.00+i
endfunction
constant function Blast_Orb_Radius takes integer i returns real
return 150.00*i
endfunction
constant function Blast_Orb_Pull_Speed takes nothing returns real
return 3.00
endfunction
constant function DummyCaster_Red takes nothing returns integer
return 0.5
endfunction
constant function DummyCaster_Green takes nothing returns integer
return 0.5
endfunction
constant function DummyCaster_Blue takes nothing returns integer
return 0.5
endfunction
constant function DummyCaster_Transparent takes nothing returns integer
return 60
endfunction
function Blast_Orb_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Blast_Orb_Rawcode()
endfunction
function Blast_Orb_Filter takes nothing returns boolean // Filter function for picking units in group
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) == true and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false and (GetWidgetLife(GetFilterUnit())>0.405)
endfunction
function Blast_Orb_Pull_Group takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit dummy = GetHandleUnit(t, "dummy")
local unit w
local real r = Blast_Orb_Radius(GetUnitAbilityLevel(dummy,Blast_Dummy_Damage_AbilityID()))
local location p = GetUnitLoc(dummy)
local location p1
local group g = GetUnitsInRangeOfLocMatching(r, p, Condition (function Blast_Orb_Filter))
loop
set w = FirstOfGroup(g)
exitwhen w == null
call GroupRemoveUnit(g,w)
set p1 = GetUnitLoc(w)
call SetUnitPositionLoc( w, PolarProjectionBJ(p, (DistanceBetweenPoints(p,p1) - Blast_Orb_Pull_Speed()), AngleBetweenPoints(p,p1)) )
call RemoveLocation(p1)
endloop
set dummy = null
set w = null
call RemoveLocation(p)
call DestroyGroup(g)
set r = 0.00
endfunction
function Blast_Orb_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit c = GetTriggerUnit()
local unit dummy
local unit dummy1
local integer i = 0
local integer i1 = R2I(Blast_Orb_Time(GetUnitAbilityLevel(c, Blast_Orb_Rawcode())))
local real size = Blast_Increment_Size()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local real x1 = GetUnitX(c)
local real y1 = GetUnitY(c)
set dummy = CreateUnit(GetOwningPlayer(c), Blast_DummyID(), x, y, 0)
call UnitApplyTimedLife(dummy, Blast_Dummy_BuffID(), Blast_Orb_Time(GetUnitAbilityLevel(c, Blast_Orb_Rawcode())))
set dummy1 = CreateUnit(GetOwningPlayer(c), Blast_DummyCasterID(), x1, y1, GetUnitFacing(c))
call SetUnitAnimation(dummy1, Blast_CasterAnimation())
call SetUnitVertexColor(dummy1, DummyCaster_Red(), DummyCaster_Green(), DummyCaster_Blue(), DummyCaster_Transparent())
call SetHandleAgent(t, "dummy", dummy)
call TimerStart(t, Blast_Orb_Pull_Loop(), true, function Blast_Orb_Pull_Group)
loop
set i = i+1
exitwhen i > i1
call SetUnitScale(dummy, size, size, size)
set size = size + Blast_Increment_Size()
call TriggerSleepAction(1)
endloop
call FlushHandle(t)
call DestroyTimer(t)
call PauseUnit(dummy1, true)
call ShowUnit(dummy1, false)
call DestroyEffect(AddSpecialEffect(Blast_Orb_SFX_Explosion(), x, y))
set c = null
set dummy1 = null
set i = 0
set i1 = 0
set size = 0.00
set x = 0.00
set y = 0.00
set x1 = 0.00
set y1 = 0.00
endfunction
function InitTrig_Blast_Orb takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Blast_Orb_Conditions))
call TriggerAddAction(t, function Blast_Orb_Actions)
call Preload(Blast_Orb_SFX_Explosion())
set t = null
endfunction
JASS:
function HATable takes nothing returns hashtable
return udg_HATable
endfunction
function InitHA takes nothing returns nothing
local hashtable ha = HATable()
set ha = InitHashtable()
set ha = null
endfunction
function SetHandleAgent takes handle subject, string name, agent value returns nothing
call SaveAgentHandle(HATable(), GetHandleId(subject), StringHash(name), value)
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
call SaveInteger(HATable(), GetHandleId(subject), StringHash(name), value)
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
call SaveBoolean(HATable(), GetHandleId(subject), StringHash(name), value)
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
call SaveReal(HATable(), GetHandleId(subject), StringHash(name), value)
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
call SaveStr(HATable(), GetHandleId(subject), StringHash(name), value)
endfunction
function GetHandleInt takes handle subject, string name returns integer
return LoadInteger(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return LoadBoolean(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleReal takes handle subject, string name returns real
return LoadReal(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleString takes handle subject, string name returns string
return LoadStr(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleUnit takes handle subject, string name returns unit
return LoadUnitHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleItem takes handle subject, string name returns item
return LoadItemHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return LoadTimerHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return LoadTriggerHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return LoadEffectHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleGroup takes handle subject, string name returns group
return LoadGroupHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return LoadLightningHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return LoadWidgetHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleLocation takes handle subject, string name returns location
return LoadLocationHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandlePlayer takes handle subject, string name returns player
return LoadPlayerHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleRegion takes handle subject, string name returns region
return LoadRegionHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleRect takes handle subject, string name returns rect
return LoadRectHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleForce takes handle subject, string name returns force
return LoadForceHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleFogmodifier takes handle subject, string name returns fogmodifier
return LoadFogModifierHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function GetHandleTimerDialog takes handle subject, string name returns timerdialog
return LoadTimerDialogHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function HaveHandleHandle takes handle subject, string name returns boolean
return HaveSavedHandle(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function HaveHandleInt takes handle subject, string name returns boolean
return HaveSavedInteger(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function HaveHandleReal takes handle subject, string name returns boolean
return HaveSavedReal(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function HaveHandleString takes handle subject, string name returns boolean
return HaveSavedString(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function HaveHandleBoolean takes handle subject, string name returns boolean
return HaveSavedBoolean(HATable(), GetHandleId(subject), StringHash(name))
endfunction
function RemoveHandle takes handle subject, string name returns nothing
call SaveAgentHandle(HATable(),GetHandleId(subject),StringHash(name), null)
call RemoveSavedHandle(HATable(),GetHandleId(subject),StringHash(name))
endfunction
function RemoveInt takes handle subject, string name returns nothing
call SaveInteger(HATable(),GetHandleId(subject),StringHash(name), 0)
call RemoveSavedInteger(HATable(),GetHandleId(subject),StringHash(name))
endfunction
function RemoveReal takes handle subject, string name returns nothing
call SaveReal(HATable(),GetHandleId(subject),StringHash(name), 0.0)
call RemoveSavedReal(HATable(),GetHandleId(subject),StringHash(name))
endfunction
function RemoveBoolean takes handle subject, string name returns nothing
call SaveBoolean(HATable(),GetHandleId(subject),StringHash(name), false)
call RemoveSavedBoolean(HATable(),GetHandleId(subject),StringHash(name))
endfunction
function RemoveStr takes handle subject, string name returns nothing
call SaveStr(HATable(),GetHandleId(subject),StringHash(name), null)
call RemoveSavedString(HATable(),GetHandleId(subject),StringHash(name))
endfunction
function FlushHandle takes handle subject returns nothing
call FlushChildHashtable(HATable(), GetHandleId(subject) )
endfunction
The spell should summon one dummy unit (bolt) and grow it over time, and that is working. Summon other dummy unit (dummy caster) that is transparent and channeling the spell, that's working as well. The only problem is the timer function, that should pull the enemy units to the bolt, it doesn't give me errors, but it's not working.
Oh, yea, please notice that GetHandleHandle has been changed to GetHandleAgent, and FlushHandleLocals to FlushHandle..
Last edited by a moderator: