- Joined
- Aug 14, 2006
- Messages
- 7,602
Hey.
I have a JASS script that worked before but doesn't work anymore. Someone might know what's wrong? Here's the JASS script. By the way, the campaign I'm making doesn't work with vJASS.
This JASS fuction suppose to be like a basic attack in the game. However, when I try to attack with this spell, it just swings the unit's hammer but actually doesn't do anything.
The one who can help will have some REP.
I have a JASS script that worked before but doesn't work anymore. Someone might know what's wrong? Here's the JASS script. By the way, the campaign I'm making doesn't work with vJASS.
This JASS fuction suppose to be like a basic attack in the game. However, when I try to attack with this spell, it just swings the unit's hammer but actually doesn't do anything.
The one who can help will have some REP.
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