Hero
─║╣ero─
- Reaction score
- 250
System: Hero Selection System
Updated Version! Now in JASS and GUI
Description:
This is my Hero Selection System....I was inspired to create this when one day I was making an AOS map...and I wanted to implement Vexorian's Hero Selection System....well I wasn't too good at jass...and I still am a little shaky with the really advanced stuff...so I created my own...it is very similar to Vexorian's Hero Selection System BUT in the exception that it is made in GUI..and to me it is a lot more customizable...yes i know vexorian's hero selection system has lots of features for AI usage and other features normal hero selection systems dont have..well mine is similar...I don't know how to implement this in a AI tutorial...so i just left the AI part alone.(besides the crappy Blood Mage One lol)..now it has a JASS trigger for the whole system
Features:
Requirements and Implementation:
Credits:
For Those Interested Here is the Code In JASS: (yes I know it contains a couple bj's)
Download Below:
Updated Version! Now in JASS and GUI
Description:
This is my Hero Selection System....I was inspired to create this when one day I was making an AOS map...and I wanted to implement Vexorian's Hero Selection System....well I wasn't too good at jass...and I still am a little shaky with the really advanced stuff...so I created my own...it is very similar to Vexorian's Hero Selection System BUT in the exception that it is made in GUI..and to me it is a lot more customizable...yes i know vexorian's hero selection system has lots of features for AI usage and other features normal hero selection systems dont have..well mine is similar...I don't know how to implement this in a AI tutorial...so i just left the AI part alone.(besides the crappy Blood Mage One lol)..now it has a JASS trigger for the whole system
Features:
- Easily Editable Script
- Made in JASS and GUI
- JASS Trigger in 1 Trigger (it takes little space and is easy to work with instead of a huge folder containing many triggers)
Requirements and Implementation:
Code:
Put this in your map's custom header
function CS_Error takes player ForPlayer, string msg returns nothing
local sound error=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
if (GetLocalPlayer() == ForPlayer) then
if (msg!="") and (msg!=null) then
call ClearTextMessages()
call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
endif
call StartSound( error )
endif
call KillSoundWhenDone( error)
set error=null
endfunction
Copy the Selection System Trigger and find this code (it's the 3rd line)
constant function RegionX takes nothing returns rect
return gg_rct_All_Units_InVun
endfunction
change gg_rct_All_Units_InVun to the region name you created in WE
constant function PickAbility takes nothing returns integer
return 'A000'
endfunction
change 'A000' to the ability raw code in your map for choosing a hero
Variables:
-Create a visibility modifier variable called V
Credits:
- Vexorian for this Sim Error
- Hero12341234 for this system
For Those Interested Here is the Code In JASS: (yes I know it contains a couple bj's)
Code:
// HERO'S HERO SELECTION SYSTEM IN JASS
//CHANGE THIS TO YOUR REGIONS NAME
constant function RegionX takes nothing returns rect
return gg_rct_All_Units_InVun
endfunction
constant function PickAbility takes nothing returns integer
return 'A000'
endfunction
//=================================================================
function Trig_No_Morphing_Conditions takes nothing returns boolean
return RectContainsUnit(RegionX(), GetOrderedUnit()) == true
endfunction
function No_Morphy takes nothing returns boolean
return (GetIssuedOrderIdBJ() == String2OrderIdBJ("chemicalrage") ) or ( GetIssuedOrderIdBJ() == String2OrderIdBJ("robogoblin") ) or ( GetIssuedOrderIdBJ() == String2OrderIdBJ("metamorphosis") ) or ( GetIssuedOrderIdBJ() == String2OrderIdBJ("avatar") )
endfunction
function Trig_No_Morphing_Actions takes nothing returns nothing
if ( No_Morphy() ) then
// Makes sure the hero can't morph
call PauseUnit( GetOrderedUnit(),true )
call PauseUnit( GetOrderedUnit(),false )
call ResetUnitAnimation( GetOrderedUnit() )
else
endif
endfunction
//=================================================================
function Trig_Visibility_and_Pan_Camera takes nothing returns nothing
local location p
call CreateFogModifierRectBJ( true, GetEnumPlayer(), FOG_OF_WAR_VISIBLE, RegionX())
set udg_V=GetLastCreatedFogModifier()
set p=GetRectCenter(RegionX())
call PanCameraToTimedLocForPlayer( GetEnumPlayer(), p, 0 )
call RemoveLocation (p)
endfunction
function Trig_Visibility_and_Pan_Camera_Actions takes nothing returns nothing
call ForForce( GetPlayersAll(), function Trig_Visibility_and_Pan_Camera )
endfunction
//=================================================================
function Trig_Select_This_Hero_Conditions takes nothing returns boolean
return GetSpellAbilityId() == PickAbility()
endfunction
function Trig_Select_This_Hero_Actions takes nothing returns nothing
local unit cast
local location l
local fogmodifier a
set a=(udg_V)
set cast=GetTriggerUnit()
set l=GetPlayerStartLocationLoc(GetOwningPlayer(cast))
call CreateNUnitsAtLoc( 1, GetUnitTypeId(cast), GetOwningPlayer(cast),l, bj_UNIT_FACING )
call RemoveUnit( cast )
call DestroyFogModifier(a)
call PanCameraToTimedLocForPlayer( GetTriggerPlayer(), l, 0 )
call RemoveLocation (l)
set cast=null
set a=null
set l=null
endfunction
//=======================================================================
function Trig_No_Cast_Abilities_Conditions takes nothing returns boolean
return RectContainsUnit(RegionX(), GetSpellAbilityUnit()) == true
endfunction
function Trig_No_Cast_Abilities_Actions takes nothing returns nothing
// Makes sure you can't cast any abilites while the hero is in the selection region.
call PauseUnit(GetSpellAbilityUnit(),true )
call PauseUnit(GetSpellAbilityUnit(),false )
call ResetUnitAnimation( GetOrderedUnit() )
endfunction
//========================================================================
function Trig_De_Select_Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true and RectContainsUnit(RegionX(), GetTriggerUnit()) == true
endfunction
function Trig_De_Select_Actions takes nothing returns nothing
// Sets the Locals so We Don't Mess Up And It IS MUI
local player p
set p=GetTriggerPlayer()
if ( GetOwningPlayer(GetTriggerUnit()) != Player(PLAYER_NEUTRAL_PASSIVE) ) and GetOwningPlayer(GetTriggerUnit()) == (p) then
call SetUnitOwner( GetTriggerUnit(), Player(PLAYER_NEUTRAL_PASSIVE), true )
endif
set p=null
endfunction
//==========================================================================
function Trig_Select_Unit_Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true and RectContainsUnit(RegionX(), GetTriggerUnit()) == true
endfunction
function Select_Unit_Actions takes nothing returns nothing
local player p
set p=GetTriggerPlayer()
if (GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_PASSIVE) ) then
call SetUnitOwner( GetTriggerUnit(), GetTriggerPlayer(), true )
else
// Change this to change the Error Message
call CS_Error (p,"Someone is already looking at this hero")
endif
set p=null
endfunction
//==========================================================================
function Trig_Set_Up_Selection_System_Func00 takes nothing returns nothing
call UnitRemoveAbility(GetEnumUnit(),'Aatk' )
call UnitRemoveAbility(GetEnumUnit(),'Amov' )
call UnitAddAbility(GetEnumUnit(),PickAbility() )
call SetUnitInvulnerable( GetEnumUnit(), true )
endfunction
function Trig_Set_Up_Selection_System_Actions takes nothing returns nothing
local group g=CreateGroup()
call GroupEnumUnitsInRect(g,RegionX(),null)
call ForGroup(g,function Trig_Set_Up_Selection_System_Func00 )
call DestroyGroup(g)
set g=null
endfunction
//===========================================================================
function InitTrig_Selection_System takes nothing returns nothing
local integer i=0
local integer j=0
local trigger a=CreateTrigger()
local trigger b=CreateTrigger()
local trigger c=CreateTrigger()
local trigger d=CreateTrigger()
local trigger e=CreateTrigger()
local trigger f=CreateTrigger()
local trigger g=CreateTrigger()
call TriggerRegisterTimerEventSingle(a , 0.01 )
call TriggerAddAction( a, function Trig_Set_Up_Selection_System_Actions )
loop
exitwhen i==12
call TriggerRegisterPlayerUnitEvent(b, Player( i ),EVENT_PLAYER_UNIT_SELECTED,null)
set i=i+1
endloop
call TriggerAddCondition( b, Condition( function Trig_Select_Unit_Conditions ) )
call TriggerAddAction( b, function Select_Unit_Actions )
loop
exitwhen j==12
call TriggerRegisterPlayerUnitEvent(c, Player( j ),EVENT_PLAYER_UNIT_DESELECTED,null)
set j=j+1
endloop
call TriggerAddCondition( c, Condition( function Trig_De_Select_Conditions ) )
call TriggerAddAction( c, function Trig_De_Select_Actions )
call TriggerRegisterAnyUnitEventBJ(d, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerRegisterAnyUnitEventBJ( d, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerRegisterAnyUnitEventBJ( d, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterAnyUnitEventBJ( d, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( d, Condition( function Trig_No_Cast_Abilities_Conditions ) )
call TriggerAddAction( d, function Trig_No_Cast_Abilities_Actions )
call TriggerRegisterAnyUnitEventBJ( e, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( e, Condition( function Trig_Select_This_Hero_Conditions ) )
call TriggerAddAction( e, function Trig_Select_This_Hero_Actions )
call TriggerRegisterTimerEventSingle( f, 0.01 )
call TriggerAddAction( f, function Trig_Visibility_and_Pan_Camera_Actions )
call TriggerRegisterAnyUnitEventBJ( g, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerRegisterAnyUnitEventBJ( g, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterAnyUnitEventBJ( g, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( g, Condition( function Trig_No_Morphing_Conditions ) )
call TriggerAddAction( g, function Trig_No_Morphing_Actions )
endfunction
Download Below: