- Joined
- Mar 10, 2009
- Messages
- 5,016
Hi guys, Im experimenting a spell made from vJASS without using locals...
I know that this is not perfect but it's working, all I need is a VERY SIMPLE improvement of this spell without using locals...
Description:
Drops a huge rock on top of the target enemy unit while being snared.
Level 1 - Snares for 5 seconds, 50 Rock damage.
Level 2 - Snares for 10 seconds, 100 Rock damage.
Level 3 - Snares for 15 seconds, 150 Rock damage.
Level 4 - Snares for 20 seconds, 200 Rock damage.
Level 5 - Snares for 25 seconds, 250 Rock damage.
EDIT: Thanks to Berb
Now, please tell me if there are leaks like I never flush the hashtable, well I've done it before but didnt work...
Also, is there a way to reffer to a dying/triggering unit instead of timer?...
I know that this is not perfect but it's working, all I need is a VERY SIMPLE improvement of this spell without using locals...
Description:
Drops a huge rock on top of the target enemy unit while being snared.
Level 1 - Snares for 5 seconds, 50 Rock damage.
Level 2 - Snares for 10 seconds, 100 Rock damage.
Level 3 - Snares for 15 seconds, 150 Rock damage.
Level 4 - Snares for 20 seconds, 200 Rock damage.
Level 5 - Snares for 25 seconds, 250 Rock damage.
EDIT: Thanks to Berb
JASS:
scope SnareBoom
globals
private hashtable HASH = InitHashtable()
private timer TIMERDIES
private unit Caster
private unit Target
private unit Dummy
private integer SPELL_ID = 'A000'
private integer ID
private integer LEVEL
private real DAMAGE
private integer CASTERU = StringHash("Caster")
private integer TARGETU = StringHash("Target")
private integer DAMAGER = StringHash("Damage")
//=================CONFIGURATIONS==================//
private attacktype ATTYPE = ATTACK_TYPE_SIEGE
private damagetype DAMTYPE = DAMAGE_TYPE_NORMAL
private real DAMAGEBASE = 50
private real TIME = 1.0
private string SFX = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
endglobals
private function SnareBCondition takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function RockDies takes nothing returns nothing
set TIMERDIES = GetExpiredTimer()
set ID = GetHandleId(TIMERDIES)
set Caster = LoadUnitHandle(HASH, CASTERU, ID)
set Target = LoadUnitHandle(HASH, TARGETU, ID)
set DAMAGE = LoadReal(HASH, DAMAGER, ID)
call DestroyEffect(AddSpecialEffect(SFX, GetUnitX(Target), GetUnitY(Target)))
call UnitDamageTarget(Caster, Target, DAMAGE, false, false, ATTYPE, DAMTYPE, null)
endfunction
private function SnareBAction takes nothing returns nothing
set Caster = GetTriggerUnit()
set Target = GetSpellTargetUnit()
set Dummy = CreateUnit(GetOwningPlayer(Caster), 'h000', GetUnitX(Target), GetUnitY(Target), 0)
set TIMERDIES = CreateTimer()
set ID = GetHandleId(TIMERDIES)
call SetUnitFlyHeight(Dummy, 10.00, 1000.00 )
call UnitApplyTimedLife(Dummy , 'BTLF', TIME )
set LEVEL = GetUnitAbilityLevel(Caster, SPELL_ID)
set DAMAGE = DAMAGEBASE * I2R(LEVEL)
//Save Hash here
call SaveUnitHandle(HASH, CASTERU, ID, Caster)
call SaveUnitHandle(HASH, TARGETU, ID, Target)
call SaveReal(HASH, DAMAGER, ID, DAMAGE)
call TimerStart(TIMERDIES, TIME, false, function RockDies)
endfunction
//===========================================================================
function InitTrig_Snare_Boom takes nothing returns nothing
local trigger SnareB = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( SnareB, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( SnareB, Condition( function SnareBCondition ) )
call TriggerAddAction( SnareB, function SnareBAction )
set SnareB = null
endfunction
endscope
Now, please tell me if there are leaks like I never flush the hashtable, well I've done it before but didnt work...
Also, is there a way to reffer to a dying/triggering unit instead of timer?...
Last edited: