- Joined
- May 27, 2009
- Messages
- 495
I recently made a spell and i like to ask if its mui
if not.. pls make it mui
its in jass.. and its my first spell made in jass so i would like to have some help
don't mind the variables, they are for debugging purposes only
variables with udg_ prefix
EDIT:
my spell uses timerutils
and if see any similarity around the threads here in hive, i just follow the tutorial that flame_phoenix made about making jass spell
if not.. pls make it mui

its in jass.. and its my first spell made in jass so i would like to have some help
JASS:
scope ParsleyEntanglement initializer Init
globals
private constant integer SPELL_ID = 'A00M'
private constant integer DAbility_ID = 'A00N'
private constant integer DUMMY_ID = 'h003'
private constant real PERange = 400.
private constant real PEDelay = 2.
private constant integer PEInstances = 2
private constant attacktype PE_ATTACKTYPE = ATTACK_TYPE_MAGIC
private constant damagetype PE_DAMAGETYPE = DAMAGE_TYPE_NORMAL
endglobals
private function PETargets takes unit target,unit c 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) and (IsUnitEnemy(target,GetOwningPlayer(c)))
endfunction
private function PEDamageReal takes integer i returns real
local real array r
set r[1] = 100.
set r[2] = 150.
set r[3] = 200.
return r[i]
endfunction
globals
group petarg
boolexpr b
unit caster
integer peindex = 0
integer pelvl
timer pet
real pedmg
endglobals
private function PECond takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function PEPick takes nothing returns boolean
return PETargets(GetFilterUnit(),GetTriggerUnit())
endfunction
private function PEDamage takes nothing returns nothing
call UnitDamageTarget(caster,GetEnumUnit(),pedmg,true,false,PE_ATTACKTYPE,PE_DAMAGETYPE,WEAPON_TYPE_CLAW_HEAVY_SLICE)
endfunction
private function PETimeLoop takes nothing returns nothing
if peindex < PEInstances then
set peindex = peindex + 1
call ForGroup(petarg,function PEDamage)
else
call ReleaseTimer(pet)
endif
endfunction
private function PEActions takes nothing returns nothing
local location spellLoc = GetSpellTargetLoc()
local real spellx = GetLocationX(spellLoc)
local real spelly = GetLocationY(spellLoc)
local unit pedummy
set caster = GetTriggerUnit()
set pelvl = GetUnitAbilityLevel(caster,SPELL_ID)
set pedmg = PEDamageReal(pelvl)
call GroupEnumUnitsInRange(petarg,spellx,spelly,PERange,b)
call CreateUnitAtLoc(GetOwningPlayer(caster),DUMMY_ID,spellLoc,0)
call UnitAddAbility(GetLastCreatedUnit(),DAbility_ID)
call SetUnitAbilityLevel(GetLastCreatedUnit(),DAbility_ID,pelvl)
call IssueImmediateOrder(GetLastCreatedUnit(),"stomp")
set pedummy = GetLastCreatedUnit()
set udg_PE_Level = GetUnitAbilityLevel(caster,SPELL_ID)
set udg_PE_Owner = GetOwningPlayer(caster)
set udg_PE_location = spellLoc
call TriggerExecute(gg_trg_Parsley_Entanglement_Dummy)
set pet = NewTimer()
call SetTimerData(pet,GetUnitTypeId(caster))
call TimerStart(pet,PEDelay,true,function PETimeLoop)
endfunction
//========================================================
private function Init takes nothing returns nothing
local trigger PEtrg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(PEtrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(PEtrg,Condition(function PECond))
call TriggerAddAction(PEtrg,function PEActions)
set b = Condition(function PEPick)
//====
set petarg = CreateGroup()
//Preload
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
don't mind the variables, they are for debugging purposes only

variables with udg_ prefix
EDIT:
my spell uses timerutils
and if see any similarity around the threads here in hive, i just follow the tutorial that flame_phoenix made about making jass spell