I started a thread concerning this spell before
http://www.hiveworkshop.com/forums/world-editor-help-zone-98/basic-attack-spell-207889/
I was given a source by
Maker:
and
mckill2009:
And I dont know which is better, but I stop using jass since a lot of error occured in my map. can someone make a GUI MUI version of any of this spell? also kindly change the target type to unit target. Thanks
http://www.hiveworkshop.com/forums/world-editor-help-zone-98/basic-attack-spell-207889/
I was given a source by
Maker:
JASS:
function Attack_Filter takes nothing returns boolean
return not IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)
endfunction
function Attack_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'Acrs'
endfunction
function Attack_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real f = GetUnitFacing(u) * bj_DEGTORAD
local player p = GetOwningPlayer(u)
local unit t
local real x2
local real y2
call GroupEnumUnitsInRange(bj_lastCreatedGroup, x ,y, 172+150, function Attack_Filter)
loop
set t = FirstOfGroup(bj_lastCreatedGroup)
exitwhen t == null
set x2 = GetUnitX(t)
set y2 = GetUnitY(t)
if IsUnitEnemy(t, p) and IsUnitInRangeXY(t, x, y, 150) and Cos(f-Atan2(y2-y, x2-x)) > 0 then
call UnitDamageTarget(u, t, 50, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_CLAW_HEAVY_SLICE)
call GroupClear(bj_lastCreatedGroup)
else
call GroupRemoveUnit(bj_lastCreatedGroup, t)
endif
endloop
set u = null
set p = null
endfunction
//===========================================================================
function InitTrig_Attack takes nothing returns nothing
set gg_trg_Attack = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Attack, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Attack, Condition( function Attack_Conditions ) )
call TriggerAddAction( gg_trg_Attack, function Attack_Actions )
endfunction
and
mckill2009:
JASS:
//TESH.scrollpos=24
//TESH.alwaysfold=0
//Spell Name: Combat Knife
//Created by: Mckill2009
scope CombatKnife initializer init
globals
private constant integer SPELL_ID = 'A006'
private constant attacktype ATK = ATTACK_TYPE_PIERCE
private constant damagetype DMG = DAMAGE_TYPE_NORMAL
private constant string SFX = "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl"
private constant string ATTACHMENT = "chest"
private constant real AOE = 90
private unit TEMP_UNIT
endglobals
private function GetDamageMin takes integer i returns real
return 1 + i * 2.
endfunction
private function GetDamageMax takes integer i returns real
return 3 + i * 9.
endfunction
private function OrganicUnit takes unit u returns boolean
return not IsUnitType(u, UNIT_TYPE_MECHANICAL) and not IsUnitType(u, UNIT_TYPE_ANCIENT) and /*
*/not IsUnitType(u, UNIT_TYPE_TOWNHALL)
endfunction
private function FilterUnit takes nothing returns boolean
local unit u = GetFilterUnit()
local boolean b = GetWidgetLife(u) > 0.405 and IsUnitEnemy(TEMP_UNIT, GetOwningPlayer(u)) and not IsUnitType(u, UNIT_TYPE_FLYING)
set u = null
return b
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit first
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real x1
local real y1
local real facing = GetUnitFacing(u)*bj_DEGTORAD
local integer level = GetUnitAbilityLevel(u, SPELL_ID)
local real damage = GetRandomReal(GetDamageMin(level), GetDamageMax(level))
local texttag tag
set x1 = x+90*Cos(facing)
set y1 = y+90*Sin(facing)
set TEMP_UNIT = u
call GroupEnumUnitsInRange(bj_lastCreatedGroup, x1, y1, AOE, function FilterUnit)
set first = FirstOfGroup(bj_lastCreatedGroup)
if first !=null then
set tag = CreateTextTag()
call UnitDamageTarget(u, first, damage, false, false, ATK, DMG, null)
if OrganicUnit(first) then
call DestroyEffect(AddSpecialEffectTarget(SFX, first, ATTACHMENT))
endif
call SetTextTagPosUnit(tag, first, 0.)
call SetTextTagText(tag, I2S(R2I(damage)), 0.02)
call SetTextTagPermanent(tag, false)
call SetTextTagVelocity(tag, 0.03, 0.03)
call SetTextTagLifespan(tag, 3)
call SetTextTagFadepoint(tag, 0.01)
endif
call IssueImmediateOrder(u, "stop")
set u = null
set first = null
set tag = null
endfunction
private function Cond takes nothing returns boolean
return GetSpellAbilityId()==SPELL_ID
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(t, Condition(function Cond))
call TriggerAddAction(t, function Actions)
set t = null
endfunction
endscope
And I dont know which is better, but I stop using jass since a lot of error occured in my map. can someone make a GUI MUI version of any of this spell? also kindly change the target type to unit target. Thanks