--- FIXED ---
(Now Ive one more Hero Selection System yeey)
It doesnt give the hero to someone
(ifselected is false for everyone, Heroes owned by Neutral Passive, Im in team[1] and Heroes in Heroes1 rect)
It gives the hero if I disable 1-2 things (they arent "if"s)
So whats wrong ?
(Now Ive one more Hero Selection System yeey)
JASS:
globals
rect gg_rct_Heroes1 // Position Team 1 Heroes
rect gg_rct_Heroes2 // Position Team 2 Heroes
rect gg_rct_SpawnPoint1
rect gg_rct_SpawnPoint2
boolean array udg_ifselected
force array udg_team
endglobals
constant function hss_pickability takes nothing returns integer
return 'A000' //Change this with your Pick This Hero ability Rawcode
endfunction
constant function hss_randomability takes nothing returns integer
return 'A001' //Change this with your Pick Random Hero ability Rawcode
endfunction
function GetPlayerColorString takes player p returns string
if p == Player(0) then
return "|c00FF0303"
endif
if p == Player(1) then
return "|c000042FF"
endif
if p == Player(2) then
return "|c001CE6B9"
endif
if p == Player(3) then
return "|c00800080"
endif
if p == Player(4) then
return "|c00FFFC01"
endif
if p == Player(5) then
return "|c00FF8000"
endif
if p == Player(6) then
return "|c0000FF00"
endif
if p == Player(7) then
return "|c00FF80FF"
endif
if p == Player(8) then
return "|c00C0C0C0"
endif
if p == Player(9) then
return "|c007EBFF1"
endif
if p == Player(10) then
return "|c00004000"
endif
if p == Player(11) then
return "|c004E2A04"
endif
return null
endfunction
function hss_abac takes nothing returns nothing
local unit u = GetTriggerUnit()
if udg_ifselected[GetConvertedPlayerId(GetOwningPlayer(u))] == false and GetSpellAbilityId() != hss_pickability() and GetSpellAbilityId() != hss_randomability() then
call PolledWait(0.1)
call UnitAddAbility(u,'Amov')
call IssueImmediateOrder(u,"stop")
call SetUnitAnimation(u,"stand")
call UnitRemoveAbility(u,'Amov')
endif
if GetSpellAbilityId() == hss_pickability() then
call SetUnitOwner(GetTriggerUnit(),Player(15),false)
call UnitAddAbility(GetTriggerUnit(),'Aloc')
call AddSpecialEffectTargetUnitBJ("chest",u,"Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl")
call DestroyEffect(GetLastCreatedEffectBJ())
call SetUnitVertexColor(GetTriggerUnit(),255,255,255,175)
endif
endfunction
function hss_initac takes nothing returns nothing
local group g
local unit u
local integer p = 0
set g = CreateGroup()
loop
exitwhen p == 12
if IsPlayerInForce(Player(p),udg_team[1]) then
call CreateFogModifierRectBJ(true,Player(p),ConvertFogState(4),gg_rct_Heroes1)
else
call CreateFogModifierRectBJ(true,Player(p),ConvertFogState(4),gg_rct_Heroes2)
endif
call GroupEnumUnitsInRect(g,gg_rct_Heroes1,Filter(null))
set p = p+1
endloop
loop
set u = FirstOfGroup(g)
exitwhen u == null
if GetOwningPlayer(u) == Player(PLAYER_NEUTRAL_PASSIVE) then
call UnitRemoveAbility(u,'Amov')
call UnitRemoveAbility(u,'Aatk')
call UnitAddAbility(u,hss_pickability())
call UnitAddAbility(u,hss_randomability())
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g = CreateGroup()
call GroupEnumUnitsInRect(g,gg_rct_Heroes2,Filter(null))
loop
set u = FirstOfGroup(g)
exitwhen u == null
if GetOwningPlayer(u) == Player(PLAYER_NEUTRAL_PASSIVE) then
call UnitRemoveAbility(u,'Amov')
call UnitRemoveAbility(u,'Aatk')
call UnitAddAbility(u,hss_pickability())
call UnitAddAbility(u,hss_randomability())
endif
call GroupRemoveUnit(g,u)
endloop
endfunction
function hss_selac takes nothing returns nothing
local effect e
local group g
local unit enum
local unit u = GetTriggerUnit()
local player p = GetTriggerPlayer()
if p != Player(15) then
if udg_ifselected[GetConvertedPlayerId(p)] == false then
call GroupEnumUnitsOfPlayer(g,p,Filter(null))
loop
set enum = FirstOfGroup(g)
exitwhen enum == null
if enum != u then
call SetUnitOwner(u,Player(15),true)
endif
call GroupRemoveUnit(g,enum)
endloop
if GetOwningPlayer(u) == Player(15) and (RectContainsUnit(gg_rct_Heroes1,u) and IsPlayerInForce(p,udg_team[1] )) or (RectContainsUnit(gg_rct_Heroes2,u) and IsPlayerInForce(p,udg_team[2] )) then
call SetUnitOwner(u,p,true)
set e = AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Aneu\\AneuTarget.mdl", u, "overhead")
loop
if GetTriggerPlayer() != GetOwningPlayer(u) then
call DestroyEffect(e)
endif
call TriggerSleepAction(0.5)
exitwhen Player(15) == GetOwningPlayer(u)
endloop
endif
endif
endif
endfunction
//===========================================================================
function InitTrig_Hero_Select_System takes nothing returns nothing
local trigger hss_init
local trigger hss_ab
local trigger hss_sel
set hss_init = CreateTrigger( )
call TriggerRegisterTimerEventSingle(hss_init,0)
call TriggerAddAction( hss_init, function hss_initac )
set hss_ab = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(hss_ab,EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddAction(hss_ab,function hss_abac)
set hss_sel = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(hss_sel,EVENT_PLAYER_UNIT_SELECTED)
call TriggerAddAction(hss_sel,function hss_selac)
endfunction
It doesnt give the hero to someone
(ifselected is false for everyone, Heroes owned by Neutral Passive, Im in team[1] and Heroes in Heroes1 rect)
It gives the hero if I disable 1-2 things (they arent "if"s)
So whats wrong ?
Last edited: