- Joined
- Mar 21, 2008
- Messages
- 84
Hi, im moving GUI MUI to vJASS and this is my 2nd spell, some functions are complety different and im a little confused doing that spell, i need other eyes for see the problem of this trigger.
* Point of spell : The hero cast spell on spell point (base spell : silence) in 400y AoE then all enemies inside on it gets entangling roots.
Can't make it works...
And for finish anyone can say to me if this trigger its well codded? (Thats my first spell , mythic Blink Strike. It works good)
Thanks :9
* Point of spell : The hero cast spell on spell point (base spell : silence) in 400y AoE then all enemies inside on it gets entangling roots.
Can't make it works...
JASS:
scope EternalGrasp initializer Init
//CONFIG
globals
private constant integer SPELL_ID = 'A004'
private constant integer DUMMY_SPELL_ID = 'A005'
private constant integer DUMMY_ID = 'h001'
private boolexpr b
endglobals
private function Range takes integer level returns real
return 400.
endfunction
//=====================================================
private function Targets takes unit target returns boolean
return (GetWidgetLife(target) > 0.405) and (IsUnitType(target, UNIT_TYPE_STRUCTURE) == false) and (IsUnitType(target, UNIT_TYPE_MAGIC_IMMUNE) == false) and (IsUnitType(target, UNIT_TYPE_MECHANICAL) == false)
endfunction
//=====================================================
private function Pick takes nothing returns boolean
return Targets(GetFilterUnit())
endfunction
//=====================================================
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
//=====================================================
private function Trig_EternalGrasp_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local location spellLoc = GetSpellTargetLoc()
local real spellX = GetLocationX(spellLoc)
local real spellY = GetLocationY(spellLoc)
local group gg = CreateGroup()
local unit f
//Unidad
set bj_lastCreatedUnit = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID, spellLoc, 0)
//Grupo
call GroupEnumUnitsInRange(gg, spellX, spellY, Range, b)
loop
set f = FirstOfGroup(gg)
exitwhen (f == null)
if IsUnitEnemy(f, GetOwningPlayer(caster)) then
call IssueTargetOrder(bj_lastCreatedUnit, "entanglingroots", f)
endif
endloop
//Remove Leaks
call RemoveLocation(spellLoc)
set caster = null
set spellLoc = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger EternalGraspTrg = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(EternalGraspTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(EternalGraspTrg, Condition( function Conditions ) )
call TriggerAddAction( EternalGraspTrg, function Trig_EternalGrasp_Actions )
//Setting global
set b = Condition(function Pick)
endfunction
endscope
And for finish anyone can say to me if this trigger its well codded? (Thats my first spell , mythic Blink Strike. It works good)
JASS:
scope BlinkSlash initializer Init
//CONFIG
globals
private constant integer SPELL_ID = 'A001'
private constant real DAMAGE_FORMULA = 50.
private constant string DAMAGE_EFFECT = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
private constant string CASTER_EFFECT = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
endglobals
//=====================================================
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
//=====================================================
private function Trig_BlinkSlash_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local location blinkLoc = GetSpellTargetLoc()
local location casterLoc = GetUnitLoc(caster)
local real DAMAGE = (GetUnitLevel(caster) * 2) + DAMAGE_FORMULA
call DestroyEffect(AddSpecialEffectLoc(CASTER_EFFECT, casterLoc))
call SetUnitPositionLoc(caster, blinkLoc)
call SetUnitAnimation(caster, "attack" )
call DestroyEffect(AddSpecialEffectTarget(DAMAGE_EFFECT, target, "origin"))
call UnitDamageTarget(caster, target, DAMAGE, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, null)
//Remove Leaks
call RemoveLocation(casterLoc)
call RemoveLocation(blinkLoc)
set blinkLoc = null
set casterLoc = null
set caster = null
set target = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger BlinkSlashTrg = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(BlinkSlashTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(BlinkSlashTrg, Condition( function Conditions ) )
call TriggerAddAction( BlinkSlashTrg, function Trig_BlinkSlash_Actions )
endfunction
endscope
Thanks :9