- Joined
- Oct 15, 2008
- Messages
- 17
Hi,
i'm trying to make this Hoof Stomp spell vJASS MUI but it's not working.
i've already made a GUI working version but converting it is tricky.
i've uploaded the test map which contains both GUI and my vJASS versions so you can test them and see how the spell is meant to work etc.
If it helps, i can post the GUI version here too.
below is the vJASS code for the spell:
Thanks very much!
i'm trying to make this Hoof Stomp spell vJASS MUI but it's not working.
i've already made a GUI working version but converting it is tricky.
i've uploaded the test map which contains both GUI and my vJASS versions so you can test them and see how the spell is meant to work etc.
If it helps, i can post the GUI version here too.
below is the vJASS code for the spell:
JASS:
scope HoofStomp initializer Init
//===========================================================================
//=============================SETUP START===================================
//===========================================================================
globals
private constant integer SPELL_ID = 'A000' //rw of teh ability
private constant integer DUMMY_ID = 'h019' //rw of the dummy unit
private constant real INTERVAL = 0.03 //cicles of the timer
private constant string STOMP_EFFECT = "Abilities\\Spells\\Orc\\EarthQuake\\EarthQuakeTarget.mdl"
private constant string SPELL_EFFECT = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
private constant attacktype A_TYPE = ATTACK_TYPE_MAGIC //the attack type of the spell
private constant damagetype D_TYPE = DAMAGE_TYPE_UNIVERSAL //the damage type of the spell
endglobals
private function Duration takes integer level returns real
return 3.
endfunction
private function Range takes integer level returns real
return 350.
endfunction
private function Targets takes unit target returns boolean
//the units the spell will affect
return not IsUnitType(target, UNIT_TYPE_STRUCTURE) and not IsUnitType(target, UNIT_TYPE_MAGIC_IMMUNE)
endfunction
//===========================================================================
//=============================SETUP END=====================================
//===========================================================================
globals
private group all
private group copy
private boolexpr b
endglobals
//===========================================================================
//Function made by Blade.dk; Search for [url=http://www.wc3campaigns.com]wc3campaigns.com[/url] for more info
private function CopyGroup takes group g returns group
set bj_groupAddGroupDest = CreateGroup()
call ForGroup(g, function GroupAddGroupEnum)
return bj_groupAddGroupDest
endfunction
//===========================================================================
private function Pick takes nothing returns boolean
return Targets(GetFilterUnit())
endfunction
//===========================================================================
private struct Data
unit caster
unit target
real spellX
real spellY
real duration
real range
integer level
location p
static method Loop takes nothing returns nothing
local timer t = GetExpiredTimer()
local thistype data = GetTimerData(t)
local real x
local real y
local location tp
local unit dum
call GroupEnumUnitsInRange(all, data.spellX, data.spellY, data.range, b)
set copy = CopyGroup(all)
set data.target = FirstOfGroup(copy)
loop
exitwhen(data.target == null)
set data.target = FirstOfGroup(copy)
call GroupRemoveUnit(copy, data.target)
if IsUnitEnemy(data.target, GetOwningPlayer(data.caster)) then
set tp = GetUnitLoc(data.target)
call SetUnitFacingToFaceLocTimed(data.target, data.p, 0.01)
call SetUnitPositionLoc(data.target, PolarProjectionBJ(tp, 10.00, (GetUnitFacing(data.target) + 180.00)))
endif
endloop
set data.duration = data.duration - INTERVAL
if data.duration <= 0. then
call ReleaseTimer(t)
call data.destroy()
call TriggerSleepAction(0.50)
loop
exitwhen(data.target == null)
set data.target = FirstOfGroup(copy)
call GroupRemoveUnit(copy, data.target)
if IsUnitEnemy(data.target, GetOwningPlayer(data.caster)) then
call SetUnitFlyHeightBJ(data.target, 0.00, 740.00 )
endif
endloop
call TriggerSleepAction(0.69)
loop
exitwhen(data.target == null)
set data.target = FirstOfGroup(copy)
call GroupRemoveUnit(copy, data.target)
if IsUnitEnemy(data.target, GetOwningPlayer(data.caster)) then
call SetUnitPathing(data.target, true)
set dum = CreateUnitAtLoc(GetOwningPlayer(data.caster), 'e008', data.p, bj_UNIT_FACING )
call IssueTargetOrder(dum, "firebolt", data.target)
call UnitApplyTimedLifeBJ(1.00, 'BTLF', dum)
endif
endloop
endif
endmethod
//===========================================================================
static method Actions takes unit caster, real spellX, real spellY, integer level returns thistype
local thistype data = thistype.create()
local timer t = NewTimer()
local unit = target
local effect = e
local effect = e2
local location = p
set p = GetUnitLoc(caster)
call TerrainDeformationCraterBJ(2.00, false, p, 250.00, 95.00)
set e = AddSpecialEffectLocBJ(p, STOMP_EFFECT)
set e2 = AddSpecialEffectLocBJ(p, SPELL_EFFECT)
call DestroyEffect(e)
call DestroyEffect(e2)
set spellX = GetLocationX(p)
set spellY = GetLocationY(p)
call GroupEnumUnitsInRange(all, spellX, spellY, Range(level), b)
set copy = CopyGroup(all)
set target = FirstOfGroup(copy)
loop
exitwhen(target == null)
set target = FirstOfGroup(copy)
call GroupRemoveUnit(copy, target)
if IsUnitEnemy(target, GetOwningPlayer(caster)) then
call SetUnitFacingToFaceLocTimed(target, p, 0.19)
call UnitAddAbilityBJ('Amrf', target)
call SetUnitFlyHeightBJ(target, 500.00, 910.00)
call UnitRemoveAbilityBJ('Amrf', target)
call SetUnitPathing(target, false)
endif
endloop
set data.caster = caster
set data.target = target
set data.spellX = spellX
set data.spellY = spellY
set data.p = p
set data.range = Range(level)
set data.duration = Duration(level)
set data.level = level
call SetTimerData(t, data)
call TimerStart(t, INTERVAL, true, function thistype.Loop)
return data
endmethod
endstruct
private function Conditions takes nothing returns boolean
local unit caster
local real x
local real y
local integer level
if GetSpellAbilityId() == SPELL_ID then
set caster = GetTriggerUnit()
set x = GetSpellTargetX()
set y = GetSpellTargetY()
set level = GetUnitAbilityLevel(caster, SPELL_ID)
call Data.Actions(caster, x, y, level)
endif
set caster = null
return false
endfunction
private function Init takes nothing returns nothing
local trigger HoofStompTrg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(HoofStompTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(HoofStompTrg, Condition( function Conditions ) )
//setting globals
set all = CreateGroup()
set copy = CreateGroup()
set b = Condition(function Pick)
//preloading effects
call Preload(STOMP_EFFECT)
call Preload(SPELL_EFFECT)
//preloading the ability
set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID, 0, 0, 0)
call UnitAddAbility(bj_lastCreatedUnit, SPELL_ID)
call KillUnit(bj_lastCreatedUnit)
endfunction
endscope
Thanks very much!