afisakov
You can change this now in User CP.
- Reaction score
- 37
I am working on adding an AOE hex to a tower-defense map. I based it off a triggered-hex another unit has in-game. So far I got the hex to work but cannot force the unit to resume moving again afterwards.
main ability:
I tried to use the displaytexttoplayersall function to troubleshoot, but now got stuck. I cannot figure out why it displays "0" repeatedly (multiple units in area), but not the "1".
the ability it was based on, in which the move again function does work:
ps. udg_siege is a boolean, game does not give me a syntax error when saving in world editor, and once again the hex itself works, something goes wrong after the display "0" command and the display "1" command does not run.
Thanks in advance for the help
main ability:
JASS:
function Trig_hex_aoe_Conditions takes nothing returns boolean
return (GetUnitTypeId(GetAttacker())=='o022') and GetUnitState(GetAttacker(),UNIT_STATE_MANA)>100.
endfunction
function hithexc takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetAttacker())) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0.405 and (GetUnitAbilityLevel(GetFilterUnit(), 'ACmi') < 1) and (GetUnitAbilityLevel(GetFilterUnit(), 'Bams') < 1)
endfunction
function forcemove2 takes unit u1 returns nothing
call TriggerSleepAction(0.2)
call DisplayTextToForce( GetPlayersAll(), "1" )
set udg_TempPoint = GetRectCenter(udg_Regions[GetUnitUserData(u1)])
call IssuePointOrderLoc( u1, "move", udg_TempPoint )
call RemoveLocation(udg_TempPoint)
endfunction
function forcemove2s takes unit u1, integer i returns nothing
local integer tr
call DisplayTextToForce( GetPlayersAll(), "1" )
if IsUnitInGroup(u1, udg_Red) then
set tr=1
elseif IsUnitInGroup(u1, udg_Blue) then
set tr=2
elseif IsUnitInGroup(u1, udg_Teal) then
set tr=3
elseif IsUnitInGroup(u1, udg_Purple) then
set tr=4
endif
call PolledWait(i+0.1)
set udg_TempPoint = GetRectCenter(udg_SiegeRegions[tr])
call IssuePointOrderLoc( u1, "attack", udg_TempPoint )
call RemoveLocation(udg_TempPoint)
endfunction
function hexem takes nothing returns nothing
local unit u=GetEnumUnit()
local unit u2
if IsUnitType(u, UNIT_TYPE_SUMMONED) then
call UnitDamageTargetBJ(GetAttacker(),u, ( 4000.* udg_abp[GetConvertedPlayerId(GetOwningPlayer(GetAttacker()))] ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
else
set u2=CreateUnit(GetOwningPlayer(GetAttacker()), 'n00C', GetUnitX(u),GetUnitY(u), 270.0)
call UnitAddAbilityBJ( 'A02C', u2 )
call SetUnitAbilityLevel(u2, 'A02C', udg_inthex)
call IssueTargetOrderBJ( u2, "hex", u )
call UnitApplyTimedLife(u2, 'BTLF', .5)
<b> call DisplayTextToForce( GetPlayersAll(), "0" )
if udg_Siege then
call forcemove2s(u,udg_inthex)
else
call forcemove2(u)
endif</b>
endif
set u=null
set u2=null
endfunction
function Trig_hex_aoe_Actions takes nothing returns nothing
local location tp1
local real hexl
local group tg
local integer pn=GetConvertedPlayerId(GetOwningPlayer(GetAttacker()))
local real cx
if (GetUnitAbilityLevel(GetTriggerUnit(), 'ACmi') < 1) and (GetUnitAbilityLevel(GetTriggerUnit(), 'Bams') < 1) then
set hexl=6.*Pow(.95,udg_hlev)*udg_abp[pn]
set udg_inthex=R2I(hexl+.5)
set cx=200*udg_mypc[pn]
set tp1=GetUnitLoc(GetTriggerUnit())
set tg=GetUnitsInRangeOfLocMatching(cx,tp1,Condition(function hithexc))
call ForGroup(tg,function hexem)
call DestroyGroup(tg)
call RemoveLocation (tp1)
call SetUnitState(GetAttacker(), UNIT_STATE_MANA, GetUnitState(GetAttacker(),UNIT_STATE_MANA)-100*(2.-udg_mypc[pn]) )
endif
set tg=null
set tp1=null
endfunction
//===========================================================================
function InitTrig_hex_aoe takes nothing returns nothing
set gg_trg_hex_aoe = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_hex_aoe, Player(11), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_hex_aoe, Condition( function Trig_hex_aoe_Conditions ) )
call TriggerAddAction( gg_trg_hex_aoe, function Trig_hex_aoe_Actions )
endfunction
I tried to use the displaytexttoplayersall function to troubleshoot, but now got stuck. I cannot figure out why it displays "0" repeatedly (multiple units in area), but not the "1".
the ability it was based on, in which the move again function does work:
JASS:
function Trig_Hexing_Tower_2_Conditions takes nothing returns boolean
if not( (GetUnitTypeId(GetAttacker())=='o011') or(GetUnitTypeId(GetAttacker())=='o012') or(GetUnitTypeId(GetAttacker())=='o015') ) then
return false
endif
if GetUnitStateSwap(UNIT_STATE_MANA, GetAttacker())<100. then
return false
endif
return true
endfunction
function forcemove takes unit u1 returns nothing
call TriggerSleepAction(0.2)
set udg_TempPoint = GetRectCenter(udg_Regions[GetUnitUserData(u1)])
call IssuePointOrderLoc( u1, "move", udg_TempPoint )
call RemoveLocation(udg_TempPoint)
endfunction
function forcemoves takes unit u1, integer i returns nothing
local integer tr
if IsUnitInGroup(u1, udg_Red) then
set tr=1
elseif IsUnitInGroup(u1, udg_Blue) then
set tr=2
elseif IsUnitInGroup(u1, udg_Teal) then
set tr=3
elseif IsUnitInGroup(u1, udg_Purple) then
set tr=4
endif
call PolledWait(i+0.1)
set udg_TempPoint = GetRectCenter(udg_SiegeRegions[tr])
call IssuePointOrderLoc( u1, "attack", udg_TempPoint )
call RemoveLocation(udg_TempPoint)
endfunction
function Trig_Hexing_Tower_2_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local unit u2
local real hexl
if (GetUnitAbilityLevel(u, 'BOhx') < 1) and GetUnitUserData(GetAttacker())==0 then
if (GetUnitAbilityLevel(u, 'ACmi') < 1) and (GetUnitAbilityLevel(u, 'Bams') < 1) then
if IsUnitType(u, UNIT_TYPE_SUMMONED) then
call UnitDamageTargetBJ(GetAttacker(),u, ( 900.* udg_abp[GetConvertedPlayerId(GetOwningPlayer(GetAttacker()))] ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
else
set u2=CreateUnit(GetOwningPlayer(GetAttacker()), 'n00C', GetUnitX(u),GetUnitY(u), 270.0)
call UnitAddAbilityBJ( 'A02C', u2 )
set hexl=10.*Pow(.95,udg_hlev)*udg_abp[GetConvertedPlayerId(GetOwningPlayer(GetAttacker()))]
call SetUnitAbilityLevel(u2, 'A02C', R2I(hexl+.5))
call IssueTargetOrderBJ( u2, "hex", u )
call UnitApplyTimedLife(u2, 'BTLF', .5)
if udg_Siege then
call forcemoves(u,R2I(hexl+.5))
else
call forcemove(u)
endif
endif
call SetUnitState(GetAttacker(), UNIT_STATE_MANA, GetUnitState(GetAttacker(),UNIT_STATE_MANA)-100*(2.-udg_mypc[GetConvertedPlayerId(GetOwningPlayer(GetAttacker()))]) )
endif
endif
set u=null
set u2=null
endfunction
//===========================================================================
function InitTrig_Hexing_Tower_2 takes nothing returns nothing
set gg_trg_Hexing_Tower_2 = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hexing_Tower_2, Player(11), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Hexing_Tower_2, Condition( function Trig_Hexing_Tower_2_Conditions ) )
call TriggerAddAction( gg_trg_Hexing_Tower_2, function Trig_Hexing_Tower_2_Actions )
endfunction
Thanks in advance for the help
Last edited: