- Joined
- Aug 14, 2006
- Messages
- 7,602
Hero only make an animation, but this doesn't work. It works in a test map which I have attached. This should be just like a basic attack.
JASS:
//TESH.scrollpos=25
//TESH.alwaysfold=0
//===========================================================================
//===================================SETUP===================================
//===========================================================================
function BookAttack_AID_ATTACK takes nothing returns integer
return 'A61L' //Change to your attack ability Id
endfunction
function BookAttack_GROUP takes nothing returns group
//Make a UnitGroup variable
return udg_TempGroup //Edit. Should be "udg_" plus whatever name you used.
endfunction
//===========================================================================
//================================END OF SETUP===============================
//===========================================================================
function BookAttack_SET_GROUP takes group g returns nothing
set g = CreateGroup()
endfunction
function BookAttack_DoTrue takes nothing returns boolean
return true
endfunction
function BookAttack_Select takes nothing returns nothing
if IsUnitInGroup(GetTriggerUnit(), BookAttack_GROUP()) then //Checks if unit is already in the group, preventing double select.
else
call GroupAddUnit(BookAttack_GROUP(), GetTriggerUnit())
endif
endfunction
function BookAttack_Deselect takes nothing returns nothing
call GroupRemoveUnit(BookAttack_GROUP(), GetTriggerUnit())
endfunction
function BookAttack_Attack takes nothing returns nothing
if GetSpellTargetUnit() != null then
call GroupTargetOrderById(BookAttack_GROUP(), 851983, GetSpellTargetUnit())
else
call GroupPointOrderByIdLoc(BookAttack_GROUP(), 851983, GetSpellTargetLoc())
endif
endfunction
function BookAttack_Conditions takes nothing returns boolean
return GetSpellAbilityId() == BookAttack_AID_ATTACK()
endfunction
function InitTrig_BookAttack takes nothing returns nothing
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
local trigger t3 = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(t1, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, Condition(function BookAttack_DoTrue))
call TriggerRegisterPlayerUnitEvent(t2, Player(i), EVENT_PLAYER_UNIT_SELECTED, Condition(function BookAttack_DoTrue))
call TriggerRegisterPlayerUnitEvent(t3, Player(i), EVENT_PLAYER_UNIT_DESELECTED, Condition(function BookAttack_DoTrue))
set i = i + 1
exitwhen i == 12
endloop
call TriggerAddCondition(t1, Condition(function BookAttack_Conditions))
call TriggerAddAction(t1, function BookAttack_Attack)
call TriggerAddAction(t2, function BookAttack_Select)
call TriggerAddAction(t3, function BookAttack_Deselect)
call BookAttack_SET_GROUP(BookAttack_GROUP())
//Cleanup
set t1 = null
set t2 = null
set t3 = null
set i = 0
endfunction