native UnitAlive takes unit whichUnit returns boolean
Name | Type | is_array | initial_value |
Altar_of_Power | location | No | |
Arcane_Construct_Hero | unit | No | |
Armageddon_Center | location | No | |
Armageddon_Heal_Timer | timer | No | |
Armageddon_Players_Group | group | No | |
Armageddon_Temp_Group | group | No | |
Armageddon_Temp_Position | location | No | |
Army_Sheep_Group | group | No | |
ASCT_Compensative_Team | force | No | |
ASCT_Compensative_Team_Name | string | No | |
ASCT_Culprit | player | No | |
ASCT_Deductive_Team | force | No | |
ASCT_Deductive_Team_Name | string | No | |
ASCT_Gold_Compensation | integer | No | 5000 |
ASCT_Gold_Deduction | integer | No | -10000 |
ASCT_Gold_Deduction_Cutprit | integer | No | -15000 |
ASCT_Level_Of_Offense | integer | No | |
ASCT_Temp_Hero | unit | No | |
ASCT_Temp_Position | location | No | |
Base_to_BOT | location | No | |
Base_to_TOP | location | No | |
Boss_1 | unit | Yes | |
Boss_10 | unit | Yes | |
Boss_11 | unit | Yes | |
Boss_12 | unit | Yes | |
Boss_2 | unit | Yes | |
Boss_3 | unit | Yes | |
Boss_4 | unit | Yes | |
Boss_5 | unit | Yes | |
Boss_6 | unit | Yes | |
Boss_7 | unit | Yes | |
Boss_8 | unit | Yes | |
Boss_9 | unit | Yes | |
Boss_Armageddon_Region | rect | No | |
Boss_Malthael_Region | rect | No | |
Boss_Minions | unit | Yes | |
Bosses_Angel_Respawn | location | No | |
Bosses_AoaC_Respawn_Point | location | No | |
Bosses_CNM_Respawn_Point | location | No | |
Bosses_Czin_Respawn | location | No | |
Bosses_DC_Respawn_Point | location | No | |
Bosses_Death_DummyUnits | unit | Yes | |
Bosses_Death_SFX_Pos | location | Yes | |
Bosses_Deathwing | unit | No | |
Bosses_DW_AOE_Damage | real | No | |
Bosses_DW_AOE_Point | location | No | |
Bosses_DW_AOE_Radius | real | No | |
Bosses_DW_AOE_SFX_Path | string | No | |
Bosses_DW_AOE_Wait | real | No | |
Bosses_DW_Center | location | No | |
Bosses_DW_Circle_1 | location | No | |
Bosses_DW_Circle_10 | location | No | |
Bosses_DW_Circle_11 | location | No | |
Bosses_DW_Circle_12 | location | No | |
Bosses_DW_Circle_13 | location | No | |
Bosses_DW_Circle_14 | location | No | |
Bosses_DW_Circle_15 | location | No | |
Bosses_DW_Circle_16 | location | No | |
Bosses_DW_Circle_17 | location | No | |
Bosses_DW_Circle_18 | location | No | |
Bosses_DW_Circle_2 | location | No | |
Bosses_DW_Circle_3 | location | No | |
Bosses_DW_Circle_4 | location | No | |
Bosses_DW_Circle_5 | location | No | |
Bosses_DW_Circle_6 | location | No | |
Bosses_DW_Circle_7 | location | No | |
Bosses_DW_Circle_8 | location | No | |
Bosses_DW_Circle_9 | location | No | |
Bosses_DW_Diag_1 | location | No | |
Bosses_DW_Diag_10 | location | No | |
Bosses_DW_Diag_11 | location | No | |
Bosses_DW_Diag_12 | location | No | |
Bosses_DW_Diag_13 | location | No | |
Bosses_DW_Diag_14 | location | No | |
Bosses_DW_Diag_15 | location | No | |
Bosses_DW_Diag_16 | location | No | |
Bosses_DW_Diag_17 | location | No | |
Bosses_DW_Diag_18 | location | No | |
Bosses_DW_Diag_19 | location | No | |
Bosses_DW_Diag_2 | location | No | |
Bosses_DW_Diag_20 | location | No | |
Bosses_DW_Diag_21 | location | No | |
Bosses_DW_Diag_22 | location | No | |
Bosses_DW_Diag_23 | location | No | |
Bosses_DW_Diag_24 | location | No | |
Bosses_DW_Diag_25 | location | No | |
Bosses_DW_Diag_26 | location | No | |
Bosses_DW_Diag_27 | location | No | |
Bosses_DW_Diag_28 | location | No | |
Bosses_DW_Diag_29 | location | No | |
Bosses_DW_Diag_3 | location | No | |
Bosses_DW_Diag_30 | location | No | |
Bosses_DW_Diag_31 | location | No | |
Bosses_DW_Diag_32 | location | No | |
Bosses_DW_Diag_33 | location | No | |
Bosses_DW_Diag_34 | location | No | |
Bosses_DW_Diag_35 | location | No | |
Bosses_DW_Diag_36 | location | No | |
Bosses_DW_Diag_37 | location | No | |
Bosses_DW_Diag_38 | location | No | |
Bosses_DW_Diag_39 | location | No | |
Bosses_DW_Diag_4 | location | No | |
Bosses_DW_Diag_40 | location | No | |
Bosses_DW_Diag_41 | location | No | |
Bosses_DW_Diag_5 | location | No | |
Bosses_DW_Diag_6 | location | No | |
Bosses_DW_Diag_7 | location | No | |
Bosses_DW_Diag_8 | location | No | |
Bosses_DW_Diag_9 | location | No | |
Bosses_DW_Fight_Int | integer | No | |
Bosses_DW_Fire_1 | location | No | |
Bosses_DW_Fire_10 | location | No | |
Bosses_DW_Fire_11 | location | No | |
Bosses_DW_Fire_12 | location | No | |
Bosses_DW_Fire_13 | location | No | |
Bosses_DW_Fire_14 | location | No | |
Bosses_DW_Fire_15 | location | No | |
Bosses_DW_Fire_16 | location | No | |
Bosses_DW_Fire_17 | location | No | |
Bosses_DW_Fire_18 | location | No | |
Bosses_DW_Fire_19 | location | No | |
Bosses_DW_Fire_2 | location | No | |
Bosses_DW_Fire_20 | location | No | |
Bosses_DW_Fire_21 | location | No | |
Bosses_DW_Fire_22 | location | No | |
Bosses_DW_Fire_23 | location | No | |
Bosses_DW_Fire_24 | location | No | |
Bosses_DW_Fire_25 | location | No | |
Bosses_DW_Fire_3 | location | No | |
Bosses_DW_Fire_4 | location | No | |
Bosses_DW_Fire_5 | location | No | |
Bosses_DW_Fire_6 | location | No | |
Bosses_DW_Fire_7 | location | No | |
Bosses_DW_Fire_8 | location | No | |
Bosses_DW_Fire_9 | location | No | |
Bosses_DW_Fly_1 | location | No | |
Bosses_DW_Fly_2 | location | No | |
Bosses_DW_Fly_3 | location | No | |
Bosses_DW_Fly_4 | location | No | |
Bosses_DW_Fly_5 | location | No | |
Bosses_DW_Fly_6 | location | No | |
Bosses_DW_Line_1 | location | No | |
Bosses_DW_Line_10 | location | No | |
Bosses_DW_Line_11 | location | No | |
Bosses_DW_Line_12 | location | No | |
Bosses_DW_Line_13 | location | No | |
Bosses_DW_Line_14 | location | No | |
Bosses_DW_Line_15 | location | No | |
Bosses_DW_Line_16 | location | No | |
Bosses_DW_Line_17 | location | No | |
Bosses_DW_Line_18 | location | No | |
Bosses_DW_Line_19 | location | No | |
Bosses_DW_Line_2 | location | No | |
Bosses_DW_Line_20 | location | No | |
Bosses_DW_Line_21 | location | No | |
Bosses_DW_Line_22 | location | No | |
Bosses_DW_Line_3 | location | No | |
Bosses_DW_Line_4 | location | No | |
Bosses_DW_Line_5 | location | No | |
Bosses_DW_Line_6 | location | No | |
Bosses_DW_Line_7 | location | No | |
Bosses_DW_Line_8 | location | No | |
Bosses_DW_Line_9 | location | No | |
Bosses_DW_Shadow_Minion_Point | location | Yes | |
Bosses_DW_Smite_1 | location | No | |
Bosses_DW_Smite_10 | location | No | |
Bosses_DW_Smite_2 | location | No | |
Bosses_DW_Smite_3 | location | No | |
Bosses_DW_Smite_4 | location | No | |
Bosses_DW_Smite_5 | location | No | |
Bosses_DW_Smite_6 | location | No | |
Bosses_DW_Smite_7 | location | No | |
Bosses_DW_Smite_8 | location | No | |
Bosses_DW_Smite_9 | location | No | |
Bosses_DW_Whirlwind_Minions | group | No | |
Bosses_DW_Whirlwind_Minions_2 | group | No | |
Bosses_ET_Respawn_Point | location | No | |
Bosses_GS_Respawn_Point | location | No | |
Bosses_Holy_king_Respawn | location | No | |
Bosses_Idlow_Respawn_Point | location | No | |
Bosses_Mystic_Respawn | location | No | |
Bosses_Nightsorrow_Respawn | location | No | |
Bosses_NW65_Respawn_Point | location | No | |
Bosses_OD_Respawn_Point | location | No | |
Bosses_PoE_Respawn_Point | location | No | |
Bosses_Renji_Respawn_Point | location | No | |
Bosses_RoN_Respawn_Point | location | No | |
Bosses_RotE_Respawn_Point | location | No | |
Bosses_SG_Respawn_Point | location | No | |
Bosses_SotS_Respawn_Point | location | No | |
Bosses_TD_Respawn_Point | location | No | |
Bosses_Temp_Integer | integer | No | |
Bosses_Temp_Location | location | No | |
Bosses_Temp_Location2 | location | No | |
Bosses_Temp_SFX | effect | No | |
Bosses_TGoT_Respawn_Point | location | No | |
Bosses_Titan316_Respawn_Point | location | No | |
Bosses_TTahK_Respawn_Point | location | No | |
Bosses_Ulq_Respawn_Point | location | No | |
Bosses_Yara_Respawn_Point | location | No | |
BOT_to_TOP | location | No | |
BurstFireLord_SFX | effect | No | |
CA_Castle_Regions | rect | Yes | |
CA_Castle_Respawn_Points | location | Yes | |
CA_Fire_Entrance_Point | location | No | |
CA_Fire_Respawn_Point | location | No | |
CA_Igloo_Entrance_Point | location | No | |
CA_Igloo_Respawn_Point | location | No | |
CA_Temp_Group | group | No | |
CA_Temp_Integer | integer | No | |
CA_Temp_Position | location | No | |
ColorStrings | string | Yes | |
Commands_HasPlayerRepicked | boolean | Yes | |
Commands_Temp_Group | group | No | |
Craft_Group | group | No | |
Death_Respawn_Timer | timer | No | |
Death_SFX | effect | Yes | |
Demonic_Manifestation_Respawn | boolean | No | |
DW_Spawn | location | No | |
Earth_lord_Point | location | No | |
Elite_Marine_Respawn | boolean | No | |
Fire_Elemental_Respawn | boolean | No | |
Fire_Fragment_Unit | unit | No | |
Fire_lord_Point | location | No | |
Fire_Nova_1 | location | No | |
Fire_Nova_2 | location | No | |
Fire_Nova_3 | location | No | |
Fire_Nova_4 | location | No | |
Frost_Wyrm_Respawn | boolean | No | |
GameEvent_Armageddon_ExPortal | destructable | No | |
GameEvent_Armageddon_Point | location | No | |
GameEvent_Armageddon_Portal | destructable | No | |
GameEvent_Armageddon_Summoner | unit | No | |
GameEvent_Armageddon_Timer | timer | No | |
GameEvent_Armageddon_Window | timerdialog | No | |
GameEvent_Duel_Center | location | No | |
GameEvent_Duel_HeroSpots | rect | Yes | |
GameEvent_Duel_Killer | player | No | |
GameEvent_Duel_Running | boolean | No | |
GameEvent_Duel_SavedAngle | real | Yes | |
GameEvent_Duel_SavePos | location | Yes | |
GameEvent_Duel_Team1_Hero | unit | No | |
GameEvent_Duel_Team1Point | location | No | |
GameEvent_Duel_Team2_Hero | unit | No | |
GameEvent_Duel_Team2Point | location | No | |
GameEvent_Duel_Time_Timer | timer | No | |
GameEvent_Duel_Timer | timer | No | |
GameEvent_Duel_TimerWindows | timerdialog | No | |
GameEvent_FC_Fountain | unit | No | |
GameEvent_FC_Player | player | No | |
GameEvent_IC_Timer | timer | No | |
GameEvent_IC_TimerWindow | timerdialog | No | |
GameEvent_LosingTeamHelp_Timer | timer | No | |
GameEvent_SecretShop_Point1 | location | No | |
GameEvent_SecretShop_Point2 | location | No | |
GameEvent_TeamDuel_Team1 | group | No | |
GameEvent_TeamDuel_Team2 | group | No | |
GameEvent_TeamDuel_Timer | timer | No | |
GameEvent_TeamDuel_TimerWin | timerdialog | No | |
GameEvent_XPGain_Counter | integer | No | |
GameEvent_XPGain_Multiplier | real | No | 100.00 |
GameEvents_Temp_Boolean | boolean | No | |
GameEvents_Temp_Group | group | No | |
GameEvents_Temp_Integer | integer | No | |
GameEvents_Temp_Location | location | No | |
GameEvents_Temp_Unit | unit | No | |
GameMode | integer | No | 0 |
GameMode_AllPick | integer | No | |
GameMode_AllRandom | integer | No | 1 |
GameMode_Classic_Team1_Kills | integer | No | |
GameMode_Classic_Team2_Kills | integer | No | |
GameMode_CTF_Points2Win | integer | No | 5 |
GameMode_CTF_Team1_FlagPos | location | No | |
GameMode_CTF_Team1_Points | integer | No | |
GameMode_CTF_Team2_FlagPos | location | No | |
GameMode_CTF_Team2_Points | integer | No | |
GameMode_CTF_Timer | timer | No | |
GameMode_CTF_Timer_Window | timerdialog | No | |
GameMode_Gamble | boolean | No | |
GameMode_LosingTeam | force | No | |
GameMode_Normal_Kill2Win | integer | No | 100 |
GameMode_Risk | boolean | No | |
GameMode_TempLocation | location | No | |
GameMode_VictoryString | string | No | |
GameMode_WinningTeam | force | No | |
GameModeSetup_Dialog | dialog | No | |
GameModeSetup_DialogButton | button | Yes | |
GameModeSetup_IsChosen | boolean | No | |
GameModeSetup_PlayerGroup | force | No | |
GameModeSetup_PlayerGroup2 | force | No | |
GameModeSetup_TempLocation | location | No | |
GameModeSetup_TempLocation2 | location | No | |
Global_HasPlayerChosenHero | boolean | Yes | |
Global_IsGamePaused | boolean | No | |
Global_RandomChance | integer | No | |
Hashtable | hashtable | No | |
Hashtable_DeadHero | integer | No | 10000 |
Hero_Level | integer | Yes | 1 |
Hero_Revive_Handle | handle | No | |
Hero_Revive_Timer | timer | Yes | |
Ice_lord_Point | location | No | |
Icy_Illidan_Respawn | location | No | |
Initializer_Temp_Integer | integer | No | |
Initializer_Temp_Location | location | No | |
Initializer_Temp_PlayerGroup | force | No | |
Items_SOD_Loop_Integer | integer | No | |
Items_SOF_Loop_Integer | integer | No | |
Items_Temp_Integer | integer | No | |
Items_Temp_Position | location | No | |
Leaderboard | leaderboard | No | |
Leaderboard_Kills | integer | Yes | |
Lightning_Sword | effect | No | |
LordNightsorrow_SFX | effect | No | |
Magic_Control_Boolean | boolean | No | |
Malthael_Center | location | No | |
Malthael_IsSummoned | boolean | No | |
Malthael_Spells_Timer | timer | No | |
Malthael_Temp_Group | group | No | |
Malthael_Temp_Group_2 | group | No | |
Malthael_Temp_Group_3 | group | No | |
Malthael_Temp_Group_4 | group | No | |
Malthael_Temp_Group_5 | group | No | |
Malthael_Temp_Position | location | No | |
Malthael_Throne_1 | location | No | |
Malthael_Throne_2 | location | No | |
Malthael_Throne_3 | location | No | |
Malthael_Totem_1 | location | No | |
Malthael_Totem_2 | location | No | |
Malthael_Totem_3 | location | No | |
Malthael_Totem_4 | location | No | |
Malthael_ZombiesKilled | integer | No | |
Map_Center_StartPoint | location | No | |
Mid_to_TOP | location | No | |
Mob_Burning_Fighter_SFX | effect | No | |
Mob_Temp_Position | location | No | |
Mob_Temp_Unit | unit | No | |
Mobs_B2_New_Unit | unit | No | |
Mobs_B_New_Unit | unit | No | |
Mobs_Bandit_Respawn_P | location | No | |
Mobs_BL_New_Unit | unit | No | |
Mobs_Bottom2_Destination | location | No | |
Mobs_Bottom2_Origin | location | No | |
Mobs_Bottom_Destination | location | No | |
Mobs_Bottom_Left_Destination | location | No | |
Mobs_Bottom_Left_Origin | location | No | |
Mobs_Bottom_Origin | location | No | |
Mobs_Bottom_Right_Destination | location | No | |
Mobs_Bottom_Right_Origin | location | No | |
Mobs_BR_New_Unit | unit | No | |
Mobs_Burst_Flame_Respawn_P | location | No | |
Mobs_Darkness_Respawn_P | location | No | |
Mobs_Demon_Respawn_P | location | No | |
Mobs_Demonic_Respawn_P | location | No | |
Mobs_Elemental_Respawn_P | location | No | |
Mobs_EliteMar_Respawn_P | location | No | |
Mobs_Elves_Respawn_P | location | No | |
Mobs_Fel_Orc_Bros_Respawn_P | location | No | |
Mobs_Fel_Orc_Respawn_P | location | No | |
Mobs_FireElem_Respawn_P | location | No | |
Mobs_Forest_Respawn_P | location | No | |
Mobs_Guard_of_Evil_Respawn_P | location | No | |
Mobs_Naga_Respawn_P | location | No | |
Mobs_Normal_IsHardOn | boolean | No | |
Mobs_Normal_IsMiddleOn | boolean | No | |
Mobs_Normal_Number_Easy | integer | No | |
Mobs_Normal_Number_Hard | integer | No | |
Mobs_Normal_Number_Middle | integer | No | |
Mobs_Normal_Spawn_Easy_Trg | trigger | Yes | |
Mobs_Normal_Spawn_Hard_Trg | trigger | Yes | |
Mobs_Normal_Spawn_Medium_Trg | trigger | Yes | |
Mobs_Polar_Respawn_P | location | No | |
Mobs_T2_New_Unit | unit | No | |
Mobs_T_New_Unit | unit | No | |
Mobs_TL_New_Unit | unit | No | |
Mobs_Top2_Destination | location | No | |
Mobs_Top2_Origin | location | No | |
Mobs_Top_Destination | location | No | |
Mobs_Top_Left_Destination | location | No | |
Mobs_Top_Left_Origin | location | No | |
Mobs_Top_Origin | location | No | |
Mobs_Top_Right_Destination | location | No | |
Mobs_Top_Right_Origin | location | No | |
Mobs_TR_New_Unit | unit | No | |
Mobs_Undead_Orc_Respawn_P | location | No | |
Mobs_Wyrm_Respawn_P | location | No | |
Multiboard | multiboard | No | |
Neutrals | force | No | |
Player_Chooser | player | No | |
Player_Magic_Storage | unit | Yes | |
Player_MaxHeroes | integer | No | 82 |
Player_Stash_Position | location | Yes | |
Player_Temp | player | No | |
Player_Temp_Force | force | No | |
Player_Temp_Group | group | No | |
Player_Temp_Integer | integer | No | |
Player_Temp_Position | location | No | |
Player_Upgraded_Hero | unitcode | No | |
Player_Upgraded_Hero_Item | itemcode | No | |
PlayerHero | unit | Yes | |
PlayerHero_Start_Position | location | No | |
Poison_Nova_1 | location | No | |
Poison_Nova_2 | location | No | |
Poison_Nova_3 | location | No | |
Poison_Nova_4 | location | No | |
Portal_End_Game_Left | location | No | |
Portal_End_Game_Right | location | No | |
Present_1 | location | No | |
Present_2 | location | No | |
Present_3 | location | No | |
Present_4 | location | No | |
Pyramidhead_SFX | effect | No | |
Radiance_aura_Group | group | No | |
Random_Temp_Group | group | No | |
Risk_Number | integer | No | |
SeaCyclop_SFX | effect | No | |
Secret_Shop | location | No | |
SecretEnterance | location | No | |
SF_Caster | unit | Yes | |
SF_Counter | integer | Yes | |
SF_Damage | integer | Yes | |
SF_Index | integer | No | |
SF_Loop_Integer | integer | No | |
SFX_Armageddon | effect | No | |
SFX_Armageddon_2 | effect | No | |
SFX_Malthael_1 | effect | No | |
SFX_Malthael_2 | effect | No | |
SFX_Malthael_3 | effect | No | |
SFX_Malthael_4 | effect | No | |
Spell_EarthShattering_Damage | real | No | |
Spell_EarthShattering_DPP | real | No | |
Spell_EarthShattering_Duration | real | No | |
Spell_EarthShattering_Period | real | No | |
Spell_EarthShattering_Radius | real | No | |
Spell_EarthShattering_Range | real | No | |
Spell_FF_Damage | integer | Yes | |
Spell_Frost_Shiver_Timer | timer | No | |
Spell_HomingMagic_Damage | real | No | |
Spell_HomingMagic_DPLAJ | real | No | |
Spell_HomingMagic_JumpAmount | integer | No | |
Spell_HomingMagic_JumpDelay | real | No | |
Spell_HomingMagic_JumpRange | real | No | |
Spell_HomingMagic_Lightning | lightningtype | No | |
Spell_HomingMagic_Range | real | No | |
Spell_IceSlash_Angle | real | No | |
Spell_IceSlash_ConeWidth | real | No | |
Spell_IceSlash_Damage | real | No | |
Spell_IceSlash_Radius | real | No | |
Spell_MO_Caster | unit | No | |
Spell_MO_Timer | timer | No | |
Spells_A_Caster | unit | Yes | |
Spells_A_Counter | integer | Yes | |
Spells_A_Damage | integer | Yes | |
Spells_A_Index | integer | No | |
Spells_A_Loop_Integer | integer | No | |
Spells_A_SFX | effect | Yes | |
Spells_A_Target_Count | integer | No | |
Spells_AI_Caster | unit | No | |
Spells_AI_Damage | real | No | |
Spells_AI_Timer | timer | No | |
Spells_AP_SFX | effect | No | |
Spells_AR_Caster | unit | Yes | |
Spells_AR_Counter | integer | Yes | |
Spells_AR_Index | integer | No | |
Spells_AR_Loop_Integer | integer | No | |
Spells_BH_Caster | unit | Yes | |
Spells_BH_Counter | integer | Yes | |
Spells_BH_Dummy | unit | Yes | |
Spells_BH_Index | integer | No | |
Spells_BH_Loop_Integer | integer | No | |
Spells_Charge_Caster | unit | No | |
Spells_CP_Caster | unit | Yes | |
Spells_CP_Caster_SFX | effect | Yes | |
Spells_CP_Counter | integer | Yes | |
Spells_CP_Index | integer | No | |
Spells_CP_Loop_Integer | integer | No | |
Spells_CP_SFX | effect | Yes | |
Spells_CP_SFX_Amount | integer | No | |
Spells_CP_UnitGroup | group | Yes | |
Spells_CS_Caster | unit | Yes | |
Spells_CS_Counter | integer | Yes | |
Spells_CS_Damage | integer | Yes | |
Spells_CS_Index | integer | No | |
Spells_CS_Loop_Integer | integer | No | |
Spells_DH_Caster | unit | No | |
Spells_DH_Real | real | No | |
Spells_Discharge_Caster | unit | No | |
Spells_Discharge_Damage | real | No | |
Spells_Discharge_Target | unit | No | |
Spells_DO_Caster | unit | No | |
Spells_DO_Dummy | unit | No | |
Spells_Doom_Caster | unit | No | |
Spells_Doom_Counter | integer | No | |
Spells_Doom_Damage | real | No | |
Spells_Doom_Target | unit | No | |
Spells_DP_Caster | unit | Yes | |
Spells_DP_Counter | integer | Yes | |
Spells_DP_Dummy | unit | Yes | |
Spells_DP_Index | integer | No | |
Spells_DP_Loop_Integer | integer | No | |
Spells_DR_Caster | unit | Yes | |
Spells_DR_Counter | integer | Yes | |
Spells_DR_Index | integer | No | |
Spells_DR_Loop_Integer | integer | No | |
Spells_DR_Strength | integer | Yes | |
Spells_FF_Caster | unit | Yes | |
Spells_FF_Counter | integer | Yes | |
Spells_FF_Index | integer | No | |
Spells_FF_Location | location | Yes | |
Spells_FF_Loop_Integer | integer | No | |
Spells_Hero_Position | location | No | |
Spells_LD_Dummy | unit | No | |
Spells_LS_Damage | real | No | |
Spells_MC_Group | group | No | |
Spells_R_SFX | effect | No | |
Spells_RA_Caster | unit | No | |
Spells_SE_Caster | unit | No | |
Spells_SE_Damage | real | No | |
Spells_SE_Number_Units | integer | No | |
Spells_SE_Position | location | No | |
Spells_SG_Caster | unit | No | |
Spells_TCO_Caster | unit | Yes | |
Spells_TCO_Counter | integer | Yes | |
Spells_TCO_Damage | integer | Yes | |
Spells_TCO_Index | integer | No | |
Spells_TCO_Loop_Integer | integer | No | |
Spells_TCO_SFX | effect | Yes | |
Spells_Temp_FS_Caster | unit | No | |
Spells_Temp_Group | group | No | |
Spells_Temp_Integer | integer | No | |
Spells_Temp_Player | player | No | |
Spells_Temp_Position | location | No | |
Spells_Temp_Position2 | location | No | |
Spells_Temp_Real | real | No | |
Spells_Temp_Unit | unit | No | |
Spells_Temp_Unit2 | unit | No | |
Spells_WS2_Angle | real | Yes | |
Spells_WS2_Caster | unit | Yes | |
Spells_WS2_Counter | integer | Yes | |
Spells_WS2_Distance | real | Yes | |
Spells_WS2_Index | integer | No | |
Spells_WS2_Loop_Integer | integer | No | |
Spells_WS_Caster | unit | No | |
Spells_WS_SFX | effect | No | |
Stone_of_Elements_Group | group | No | |
Stone_of_Elements_Regen | integer | No | |
Stone_of_Elements_Timer | timer | No | |
Switch_Dialog | dialog | No | |
Switch_Dialog_Buttons | button | Yes | |
Switch_IsInCooldown | boolean | No | |
Switch_IsPlayerInCooldown | boolean | Yes | |
Switch_Player | player | No | |
Switch_PlayersNewForce | force | No | |
Switch_Score | integer | No | 100 |
Tavern_Heroes | unitcode | Yes | |
Team1 | force | No | |
Team1_Stash_Point | location | No | |
Team1AntiTowerCreate | unitcode | No | |
Team2 | force | No | |
Team2_Stash_Point | location | No | |
Team2AntiTowerCreate | unitcode | No | |
TheDeath_Temp_Group | group | No | |
Thunder_lord_Point | location | No | |
Totems | integer | No | |
Transports_T1_ArenaOut | location | No | |
Transports_T1_BaseOut | location | No | |
Transports_T2_ArenaOut | location | No | |
Transports_T2_BaseOut | location | No | |
Transports_Temp_Position | location | No | |
Void_Vortex_1 | location | No | |
Void_Vortex_2 | location | No | |
Void_Vortex_3 | location | No | |
Void_Vortex_4 | location | No | |
Void_Vortex_5 | location | No | |
Votekick_Dialog | dialog | No | |
Votekick_Dialog_Buttons | button | Yes | |
Votekick_IsInCooldown | boolean | No | |
Votekick_IsPlayerInCooldown | boolean | Yes | |
Votekick_Player | player | No | |
Votekick_Score | integer | No | 100 |
Zombie_Spawn_1 | location | No | |
Zombie_Spawn_2 | location | No | |
Zombie_Spawn_3 | location | No |
library Playercolors initializer onInit
private function onInit takes nothing returns nothing
set udg_ColorStrings[1] = "|cffff0303"
set udg_ColorStrings[2] = "|cff0042ff"
set udg_ColorStrings[3] = "|cff1ce6b9"
set udg_ColorStrings[4] = "|cff540081"
set udg_ColorStrings[5] = "|cfffffc01"
set udg_ColorStrings[6] = "|cfffe8a0e"
set udg_ColorStrings[7] = "|cff20c000"
set udg_ColorStrings[8] = "|cffe55bb0"
set udg_ColorStrings[9] = "|cff959697"
set udg_ColorStrings[10] = "|cff7ebff1"
set udg_ColorStrings[11] = "|cff106246"
set udg_ColorStrings[12] = "|cff4e2a04"
set udg_ColorStrings[13] = "|cff9B0000"
set udg_ColorStrings[14] = "|cff0000C3"
set udg_ColorStrings[15] = "|cff00EAFF"
set udg_ColorStrings[16] = "|cffBE00FE"
set udg_ColorStrings[17] = "|cffEBCD87"
set udg_ColorStrings[18] = "|cffF8A48B"
set udg_ColorStrings[19] = "|cffBFFF80"
set udg_ColorStrings[20] = "|cffDCB9EB"
set udg_ColorStrings[21] = "|cff282828"
set udg_ColorStrings[22] = "|cffEBF0FF"
set udg_ColorStrings[23] = "|cff00781E"
set udg_ColorStrings[24] = "|cffA46F33"
set udg_ColorStrings[PLAYER_NEUTRAL_PASSIVE + 1] = "|c00272727"
set udg_ColorStrings[PLAYER_NEUTRAL_AGGRESSIVE + 1] = "|c00272727"
set udg_ColorStrings[bj_PLAYER_NEUTRAL_VICTIM + 1] = "|c00272727"
set udg_ColorStrings[bj_PLAYER_NEUTRAL_EXTRA + 1] = "|c00272727"
endfunction
endlibrary
library Table /* made by Bribe, special thanks to Vexorian & Nestharus, version 4.1.0.1.
One map, one hashtable. Welcome to NewTable 4.1.0.1
This newest iteration of Table introduces the new HashTable struct.
You can now instantiate HashTables which enables the use of large
parent and large child keys, just like a standard hashtable. Previously,
the user would have to instantiate a Table to do this on their own which -
while doable - is something the user should not have to do if I can add it
to this resource myself (especially if they are inexperienced).
This library was originally called NewTable so it didn't conflict with
the API of Table by Vexorian. However, the damage is done and it's too
late to change the library name now. To help with damage control, I
have provided an extension library called TableBC, which bridges all
the functionality of Vexorian's Table except for 2-D string arrays &
the ".flush(integer)" method. I use ".flush()" to flush a child hash-
table, because I wanted the API in NewTable to reflect the API of real
hashtables (I thought this would be more intuitive).
API
------------
struct Table
| static method create takes nothing returns Table
| create a new Table
|
| method destroy takes nothing returns nothing
| destroy it
|
| method flush takes nothing returns nothing
| flush all stored values inside of it
|
| method remove takes integer key returns nothing
| remove the value at index "key"
|
| method operator []= takes integer key, $TYPE$ value returns nothing
| assign "value" to index "key"
|
| method operator [] takes integer key returns $TYPE$
| load the value at index "key"
|
| method has takes integer key returns boolean
| whether or not the key was assigned
|
----------------
struct TableArray
| static method operator [] takes integer array_size returns TableArray
| create a new array of Tables of size "array_size"
|
| method destroy takes nothing returns nothing
| destroy it
|
| method flush takes nothing returns nothing
| flush and destroy it
|
| method operator size takes nothing returns integer
| returns the size of the TableArray
|
| method operator [] takes integer key returns Table
| returns a Table accessible exclusively to index "key"
*/
globals
private integer less = 0 //Index generation for TableArrays (below 0).
private integer more = 8190 //Index generation for Tables.
//Configure it if you use more than 8190 "key" variables in your map (this will never happen though).
private hashtable ht = InitHashtable()
private key sizeK
private key listK
endglobals
private struct dex extends array
static method operator size takes nothing returns Table
return sizeK
endmethod
static method operator list takes nothing returns Table
return listK
endmethod
endstruct
private struct handles extends array
method has takes integer key returns boolean
return HaveSavedHandle(ht, this, key)
endmethod
method remove takes integer key returns nothing
call RemoveSavedHandle(ht, this, key)
endmethod
endstruct
private struct agents extends array
method operator []= takes integer key, agent value returns nothing
call SaveAgentHandle(ht, this, key, value)
endmethod
endstruct
//! textmacro NEW_ARRAY_BASIC takes SUPER, FUNC, TYPE
private struct $TYPE$s extends array
method operator [] takes integer key returns $TYPE$
return Load$FUNC$(ht, this, key)
endmethod
method operator []= takes integer key, $TYPE$ value returns nothing
call Save$FUNC$(ht, this, key, value)
endmethod
method has takes integer key returns boolean
return HaveSaved$SUPER$(ht, this, key)
endmethod
method remove takes integer key returns nothing
call RemoveSaved$SUPER$(ht, this, key)
endmethod
endstruct
private module $TYPE$m
method operator $TYPE$ takes nothing returns $TYPE$s
return this
endmethod
endmodule
//! endtextmacro
//! textmacro NEW_ARRAY takes FUNC, TYPE
private struct $TYPE$s extends array
method operator [] takes integer key returns $TYPE$
return Load$FUNC$Handle(ht, this, key)
endmethod
method operator []= takes integer key, $TYPE$ value returns nothing
call Save$FUNC$Handle(ht, this, key, value)
endmethod
method has takes integer key returns boolean
return HaveSavedHandle(ht, this, key)
endmethod
method remove takes integer key returns nothing
call RemoveSavedHandle(ht, this, key)
endmethod
endstruct
private module $TYPE$m
method operator $TYPE$ takes nothing returns $TYPE$s
return this
endmethod
endmodule
//! endtextmacro
//Run these textmacros to include the entire hashtable API as wrappers.
//Don't be intimidated by the number of macros - Vexorian's map optimizer is
//supposed to kill functions which inline (all of these functions inline).
//! runtextmacro NEW_ARRAY_BASIC("Real", "Real", "real")
//! runtextmacro NEW_ARRAY_BASIC("Boolean", "Boolean", "boolean")
//! runtextmacro NEW_ARRAY_BASIC("String", "Str", "string")
//New textmacro to allow table.integer[] syntax for compatibility with textmacros that might desire it.
//! runtextmacro NEW_ARRAY_BASIC("Integer", "Integer", "integer")
//! runtextmacro NEW_ARRAY("Player", "player")
//! runtextmacro NEW_ARRAY("Widget", "widget")
//! runtextmacro NEW_ARRAY("Destructable", "destructable")
//! runtextmacro NEW_ARRAY("Item", "item")
//! runtextmacro NEW_ARRAY("Unit", "unit")
//! runtextmacro NEW_ARRAY("Ability", "ability")
//! runtextmacro NEW_ARRAY("Timer", "timer")
//! runtextmacro NEW_ARRAY("Trigger", "trigger")
//! runtextmacro NEW_ARRAY("TriggerCondition", "triggercondition")
//! runtextmacro NEW_ARRAY("TriggerAction", "triggeraction")
//! runtextmacro NEW_ARRAY("TriggerEvent", "event")
//! runtextmacro NEW_ARRAY("Force", "force")
//! runtextmacro NEW_ARRAY("Group", "group")
//! runtextmacro NEW_ARRAY("Location", "location")
//! runtextmacro NEW_ARRAY("Rect", "rect")
//! runtextmacro NEW_ARRAY("BooleanExpr", "boolexpr")
//! runtextmacro NEW_ARRAY("Sound", "sound")
//! runtextmacro NEW_ARRAY("Effect", "effect")
//! runtextmacro NEW_ARRAY("UnitPool", "unitpool")
//! runtextmacro NEW_ARRAY("ItemPool", "itempool")
//! runtextmacro NEW_ARRAY("Quest", "quest")
//! runtextmacro NEW_ARRAY("QuestItem", "questitem")
//! runtextmacro NEW_ARRAY("DefeatCondition", "defeatcondition")
//! runtextmacro NEW_ARRAY("TimerDialog", "timerdialog")
//! runtextmacro NEW_ARRAY("Leaderboard", "leaderboard")
//! runtextmacro NEW_ARRAY("Multiboard", "multiboard")
//! runtextmacro NEW_ARRAY("MultiboardItem", "multiboarditem")
//! runtextmacro NEW_ARRAY("Trackable", "trackable")
//! runtextmacro NEW_ARRAY("Dialog", "dialog")
//! runtextmacro NEW_ARRAY("Button", "button")
//! runtextmacro NEW_ARRAY("TextTag", "texttag")
//! runtextmacro NEW_ARRAY("Lightning", "lightning")
//! runtextmacro NEW_ARRAY("Image", "image")
//! runtextmacro NEW_ARRAY("Ubersplat", "ubersplat")
//! runtextmacro NEW_ARRAY("Region", "region")
//! runtextmacro NEW_ARRAY("FogState", "fogstate")
//! runtextmacro NEW_ARRAY("FogModifier", "fogmodifier")
//! runtextmacro NEW_ARRAY("Hashtable", "hashtable")
struct Table extends array
// Implement modules for intuitive syntax (tb.handle; tb.unit; etc.)
implement realm
implement integerm
implement booleanm
implement stringm
implement playerm
implement widgetm
implement destructablem
implement itemm
implement unitm
implement abilitym
implement timerm
implement triggerm
implement triggerconditionm
implement triggeractionm
implement eventm
implement forcem
implement groupm
implement locationm
implement rectm
implement boolexprm
implement soundm
implement effectm
implement unitpoolm
implement itempoolm
implement questm
implement questitemm
implement defeatconditionm
implement timerdialogm
implement leaderboardm
implement multiboardm
implement multiboarditemm
implement trackablem
implement dialogm
implement buttonm
implement texttagm
implement lightningm
implement imagem
implement ubersplatm
implement regionm
implement fogstatem
implement fogmodifierm
implement hashtablem
method operator handle takes nothing returns handles
return this
endmethod
method operator agent takes nothing returns agents
return this
endmethod
//set this = tb[GetSpellAbilityId()]
method operator [] takes integer key returns Table
return LoadInteger(ht, this, key) //return this.integer[key]
endmethod
//set tb[389034] = 8192
method operator []= takes integer key, Table tb returns nothing
call SaveInteger(ht, this, key, tb) //set this.integer[key] = tb
endmethod
//set b = tb.has(2493223)
method has takes integer key returns boolean
return HaveSavedInteger(ht, this, key) //return this.integer.has(key)
endmethod
//call tb.remove(294080)
method remove takes integer key returns nothing
call RemoveSavedInteger(ht, this, key) //call this.integer.remove(key)
endmethod
//Remove all data from a Table instance
method flush takes nothing returns nothing
call FlushChildHashtable(ht, this)
endmethod
//local Table tb = Table.create()
static method create takes nothing returns Table
local Table this = dex.list[0]
if this == 0 then
set this = more + 1
set more = this
else
set dex.list[0] = dex.list[this]
call dex.list.remove(this) //Clear hashed memory
endif
debug set dex.list[this] = -1
return this
endmethod
// Removes all data from a Table instance and recycles its index.
//
// call tb.destroy()
//
method destroy takes nothing returns nothing
debug if dex.list[this] != -1 then
debug call BJDebugMsg("Table Error: Tried to double-free instance: " + I2S(this))
debug return
debug endif
call this.flush()
set dex.list[this] = dex.list[0]
set dex.list[0] = this
endmethod
//! runtextmacro optional TABLE_BC_METHODS()
endstruct
//! runtextmacro optional TABLE_BC_STRUCTS()
struct TableArray extends array
//Returns a new TableArray to do your bidding. Simply use:
//
// local TableArray ta = TableArray[array_size]
//
static method operator [] takes integer array_size returns TableArray
local Table tb = dex.size[array_size] //Get the unique recycle list for this array size
local TableArray this = tb[0] //The last-destroyed TableArray that had this array size
debug if array_size <= 0 then
debug call BJDebugMsg("TypeError: Invalid specified TableArray size: " + I2S(array_size))
debug return 0
debug endif
if this == 0 then
set this = less - array_size
set less = this
else
set tb[0] = tb[this] //Set the last destroyed to the last-last destroyed
call tb.remove(this) //Clear hashed memory
endif
set dex.size[this] = array_size //This remembers the array size
return this
endmethod
//Returns the size of the TableArray
method operator size takes nothing returns integer
return dex.size[this]
endmethod
//This magic method enables two-dimensional[array][syntax] for Tables,
//similar to the two-dimensional utility provided by hashtables them-
//selves.
//
//ta[integer a].unit[integer b] = unit u
//ta[integer a][integer c] = integer d
//
//Inline-friendly when not running in debug mode
//
method operator [] takes integer key returns Table
static if DEBUG_MODE then
local integer i = this.size
if i == 0 then
call BJDebugMsg("IndexError: Tried to get key from invalid TableArray instance: " + I2S(this))
return 0
elseif key < 0 or key >= i then
call BJDebugMsg("IndexError: Tried to get key [" + I2S(key) + "] from outside TableArray bounds: " + I2S(i))
return 0
endif
endif
return this + key
endmethod
//Destroys a TableArray without flushing it; I assume you call .flush()
//if you want it flushed too. This is a public method so that you don't
//have to loop through all TableArray indices to flush them if you don't
//need to (ie. if you were flushing all child-keys as you used them).
//
method destroy takes nothing returns nothing
local Table tb = dex.size[this.size]
debug if this.size == 0 then
debug call BJDebugMsg("TypeError: Tried to destroy an invalid TableArray: " + I2S(this))
debug return
debug endif
if tb == 0 then
//Create a Table to index recycled instances with their array size
set tb = Table.create()
set dex.size[this.size] = tb
endif
call dex.size.remove(this) //Clear the array size from hash memory
set tb[this] = tb[0]
set tb[0] = this
endmethod
private static Table tempTable
private static integer tempEnd
//Avoids hitting the op limit
private static method clean takes nothing returns nothing
local Table tb = .tempTable
local integer end = tb + 0x1000
if end < .tempEnd then
set .tempTable = end
call ForForce(bj_FORCE_PLAYER[0], function thistype.clean)
else
set end = .tempEnd
endif
loop
call tb.flush()
set tb = tb + 1
exitwhen tb == end
endloop
endmethod
//Flushes the TableArray and also destroys it. Doesn't get any more
//similar to the FlushParentHashtable native than this.
//
method flush takes nothing returns nothing
debug if this.size == 0 then
debug call BJDebugMsg("TypeError: Tried to flush an invalid TableArray instance: " + I2S(this))
debug return
debug endif
set .tempTable = this
set .tempEnd = this + this.size
call ForForce(bj_FORCE_PLAYER[0], function thistype.clean)
call this.destroy()
endmethod
endstruct
//NEW: Added in Table 4.0. A fairly simple struct but allows you to do more
//than that which was previously possible.
struct HashTable extends array
//Enables myHash[parentKey][childKey] syntax.
//Basically, it creates a Table in the place of the parent key if
//it didn't already get created earlier.
method operator [] takes integer index returns Table
local Table t = Table(this)[index]
if t == 0 then
set t = Table.create()
set Table(this)[index] = t //whoops! Forgot that line. I'm out of practice!
endif
return t
endmethod
//You need to call this on each parent key that you used if you
//intend to destroy the HashTable or simply no longer need that key.
method remove takes integer index returns nothing
local Table t = Table(this)[index]
if t != 0 then
call t.destroy()
call Table(this).remove(index)
endif
endmethod
//Added in version 4.1
method has takes integer index returns boolean
return Table(this).has(index)
endmethod
//HashTables are just fancy Table indices.
method destroy takes nothing returns nothing
call Table(this).destroy()
endmethod
//Like I said above...
static method create takes nothing returns thistype
return Table.create()
endmethod
endstruct
endlibrary
/***********************************************
*
* SoundTools
* v3.0.0.2
* By Magtheridon96
*
* (Special Thanks to Rising_Dusk)
*
* - Allows you to play sounds immediately after creating them.
* - Uses a sound recycler to increase efficiency and save RAM.
*
* Requirements:
* -------------
*
* - Table by Bribe
* - hiveworkshop.com/forums/jass-resources-412/snippet-new-table-188084/
* - TimerUtils by Vexorian
* - wc3c.net/showthread.php?t=101322
*
* API:
* ----
*
* constant boolean DEFAULT_SOUND_STOPS_ON_LEAVE_RANGE
* constant integer DEFAULT_SOUND_FADE_IN_RATE
* constant integer DEFAULT_SOUND_FADE_OUT_RATE
* constant string DEFAULT_SOUND_EAX_SETTINGS
* constant integer DEFAULT_SOUND_VOLUME
* constant integer DEFAULT_SOUND_PITCH
*
* struct Sound extends array
*
* readonly string file
* readonly integer duration
* readonly boolean looping
* readonly boolean is3D
* readonly boolean stopOnLeaveRange
* readonly integer fadeIn
* readonly integer fadeOut
* readonly string eaxSetting
*
* static method create takes string fileName, integer duration, boolean looping, boolean is3D returns thistype
* - Creates a sound struct given the filepath, the duration in milliseconds, whether it is looping or not, and whether it is 3D or not.
* static method createEx takes string fileName, integer duration, boolean looping, boolean is3D, boolean stopOnExitRange, integer fadeIn, integer fadeOut, string eaxSetting returns thistype
* - In addition to static method create, this allows you to specificy whether the sound stops when the player leaves range, the fadeIn/fadeOut rates and the EAX Setting.
* static method release takes sound s returns boolean
* - Releases a sound and throws it into the recycler. Also stops the sound.
*
* method run takes nothing returns sound
* - Plays the sound.
* method runUnit takes unit whichUnit returns sound
* - Plays the sound on a unit.
* method runPoint takes real x, real y, real z returns sound
* - Plays the sound at a point.
* method runPlayer takes player whichPlayer returns sound
* - Plays the sound for a player.
*
* method runEx takes integer volume, integer pitch returns sound
* - Plays the sound. This function allows you to pass in extra arguments.
* method runUnitEx takes unit whichUnit, integer volume, integer pitch returns sound
* - Plays the sound on a unit. This function allows you to pass in extra arguments.
* method runPointEx takes real x, real y, real z, integer volume, integer pitch returns sound
* - Plays the sound at a point. This function allows you to pass in extra arguments.
* method runPlayerEx takes player whichPlayer, integer volume, integer pitch returns sound
* - Plays the sound for a player. This function allows you to pass in extra arguments.
*
* function NewSound takes string fileName, integer duration, boolean looping, boolean is3D returns Sound
* - Creates a sound struct given the filepath, the duration in milliseconds, whether it is looping or not, and whether it is 3D or not.
* function NewSoundEx takes string fileName, integer duration, boolean looping, boolean is3D, boolean stop, integer fadeInRate, integer fadeOutRate, string eax returns Sound
* - In addition to static method create, this allows you to specificy whether the sound stops when the player leaves range, the fadeIn/fadeOut rates and the EAX Setting.
* function ReleaseSound takes sound s returns boolean
* - Releases a sound and throws it into the recycler. Also stops the sound.
* function RunSound takes Sound this returns sound
* - Plays the sound.
* function RunSoundEx takes Sound this, integer volume, integer pitch returns sound
* - Plays the sound. This function allows you to pass in extra arguments.
* function RunSoundOnUnit takes Sound this, unit whichUnit returns sound
* - Plays the sound on a unit.
* function RunSoundAtPoint takes Sound this, real x, real y, real z returns sound
* - Plays the sound at a point.
* function RunSoundForPlayer takes Sound this, player p returns sound
* - Plays the sound for a player.
* function RunSoundOnUnitEx takes Sound this, unit whichUnit, integer volume, real pitch returns sound
* - Plays the sound on a unit. This function allows you to pass in extra arguments.
* function RunSoundAtPointEx takes Sound this, real x, real y, real z, integer volume, real pitch returns sound
* - Plays the sound at a point. This function allows you to pass in extra arguments.
* function RunSoundForPlayerEx takes Sound this, player p, integer volume, real pitch returns sound
* - Plays the sound for a player. This function allows you to pass in extra arguments.
*
* Credits:
* --------
*
* - Rising_Dusk (The original system)
* - Zwiebelchen (Research - He found a ton of Wc3 sound bugs and ways to fix them)
*
***********************************************/
library SoundTools requires Table, TimerUtils
/*
* Configuration
*/
globals
constant boolean DEFAULT_SOUND_STOPS_ON_LEAVE_RANGE = true
constant integer DEFAULT_SOUND_FADE_IN_RATE = 10
constant integer DEFAULT_SOUND_FADE_OUT_RATE = 10
constant string DEFAULT_SOUND_EAX_SETTINGS = "CombatSoundsEAX"
constant integer DEFAULT_SOUND_VOLUME = 127
constant integer DEFAULT_SOUND_PITCH = 1
endglobals
globals
private constant integer SOUND_CHANNEL = 5
private constant integer SOUND_MIN_DIST = 600
private constant integer SOUND_MAX_DIST = 10000
private constant integer SOUND_DIST_CUT = 3000
endglobals
/*
* End of Configuration
*/
struct Sound extends array
private static key tk
private static key pk
private static Table tb = tk
private static Table pt = pk
private static integer index = 1
private static Table array stack
private static integer array count
readonly string file
readonly integer duration
readonly boolean looping
readonly boolean is3D
readonly boolean stopOnLeaveRange
readonly integer fadeIn
readonly integer fadeOut
readonly string eaxSetting
private real pitch
static method createEx takes string fileName, integer dur, boolean loopng, boolean isTD, boolean stop, integer fadeInRate, integer fadeOutRate, string eax returns thistype
local thistype this = index
set index = index + 1
set this.file = fileName
set this.duration = dur
set this.looping = loopng
set this.is3D = isTD
set this.stopOnLeaveRange = stop
set this.fadeIn = fadeInRate
set this.fadeOut = fadeOutRate
set this.eaxSetting = eax
set this.pitch = 1
set stack[this] = Table.create()
return this
endmethod
static method create takes string fileName, integer dur, boolean loopng, boolean isTD returns thistype
return createEx(fileName, dur, loopng, isTD, DEFAULT_SOUND_STOPS_ON_LEAVE_RANGE, DEFAULT_SOUND_FADE_IN_RATE, DEFAULT_SOUND_FADE_OUT_RATE, DEFAULT_SOUND_EAX_SETTINGS)
endmethod
// Credits to Zwiebelchen for this function
// He discovered a bug with sound pitches and this function was written to fix that.
method setSoundPitch takes sound s, real newPitch returns nothing
if GetSoundIsPlaying(s) or GetSoundIsLoading(s) then
call SetSoundPitch(s, 1/this.pitch)
call SetSoundPitch(s, newPitch)
set this.pitch = newPitch
elseif newPitch == 1 then
call SetSoundPitch(s, 1.0001)
set this.pitch = 1.0001
else
call SetSoundPitch(s, newPitch)
set this.pitch = newPitch
endif
endmethod
private static sound snd
private method get takes nothing returns sound
if count[this] == 0 then
/*
* Create new sound and point it to
* Sound struct instance.
*/
set snd = CreateSound(this.file, this.looping, this.is3D, this.stopOnLeaveRange, this.fadeIn, this.fadeOut, this.eaxSetting)
set pt[GetHandleId(snd)] = this
/*
* Configure sound
*/
call SetSoundDuration(snd, this.duration)
call SetSoundChannel(snd, SOUND_CHANNEL)
call SetSoundVolume(snd, DEFAULT_SOUND_VOLUME)
call this.setSoundPitch(snd, DEFAULT_SOUND_PITCH)
/*
* Proper 3D sound configuration
*/
if this.is3D then
call SetSoundDistances(snd, SOUND_MIN_DIST, SOUND_MAX_DIST)
call SetSoundDistanceCutoff(snd, SOUND_DIST_CUT)
call SetSoundConeAngles(snd, 0, 0, DEFAULT_SOUND_VOLUME)
call SetSoundConeOrientation(snd, 0, 0, 0)
endif
return snd
endif
/*
* Pop out of sound stack.
*/
set count[this] = count[this] - 1
return stack[this].sound[count[this]]
endmethod
private method push takes sound s returns nothing
set stack[this].sound[count[this]] = s
set count[this] = count[this] + 1
endmethod
private static method recycle takes nothing returns nothing
local timer t = GetExpiredTimer()
local sound s = tb.sound[GetHandleId(t)]
/*
* Stop sound and push to the
* stack.
*/
call StopSound(s, false, true)
call thistype(GetTimerData(t)).push(s)
call ReleaseTimer(t)
set t = null
set s = null
endmethod
private static integer array next
private static sound array media
private static method runSounds takes nothing returns nothing
local thistype this = next[0]
local timer t
call ReleaseTimer(GetExpiredTimer())
loop
exitwhen this == 0
/*
* Play the sound.
*/
call StartSound(media[this])
/*
* If it is not looping,
* we can recycle it when
* it finishes playing.
*/
if not this.looping then
set t = NewTimerEx(this)
set tb.sound[GetHandleId(t)] = media[this]
call TimerStart(t, this.duration * 0.001, false, function thistype.recycle)
endif
set media[this] = null
set this = next[this]
endloop
set next[0] = 0
set t = null
endmethod
method run takes nothing returns sound
debug if this == 0 then
debug call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "[SoundTools]Error: Attempted to play null sound.")
debug return null
debug endif
if next[0] == 0 then
call TimerStart(NewTimer(), 0, false, function thistype.runSounds)
endif
if media[this] == null then
set next[this] = next[0]
set next[0] = this
set media[this] = this.get()
debug else
debug call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "[SoundTools]Warning: Attempted to run the same sound twice.")
endif
return media[this]
endmethod
method runEx takes integer volume, integer newPitch returns sound
set snd = this.run()
call SetSoundVolume(snd, volume)
call this.setSoundPitch(snd, newPitch)
return snd
endmethod
static method release takes sound s returns boolean
local integer id = GetHandleId(s)
if s == null then
debug call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "[SoundTools]Error: Attempted to release a null sound.")
return false
elseif pt[id] == 0 then
debug call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "[SoundTools]Error: Attempted to release a sound not allocated by RunSound.")
return false
endif
/*
* Stop the sound and push it
* to the stack.
*/
call StopSound(s, false, true)
call thistype(pt[id]).push(s)
return true
endmethod
method runUnit takes unit whichUnit returns sound
set snd = this.run()
call AttachSoundToUnit(snd, whichUnit)
return snd
endmethod
method runUnitEx takes unit whichUnit, integer volume, integer newPitch returns sound
set snd = this.runUnit(whichUnit)
call SetSoundVolume(snd, volume)
call this.setSoundPitch(snd, newPitch)
return snd
endmethod
method runPoint takes real x, real y, real z returns sound
set snd = this.run()
call SetSoundPosition(snd, x, y, z)
return snd
endmethod
method runPointEx takes real x, real y, real z, integer volume, integer newPitch returns sound
set snd = this.runPoint(x, y, z)
call SetSoundVolume(snd, volume)
call this.setSoundPitch(snd, newPitch)
return snd
endmethod
method runPlayer takes player p returns sound
set snd = this.run()
if GetLocalPlayer() != p then
call SetSoundVolume(snd, 0)
endif
return snd
endmethod
method runPlayerEx takes player p, integer volume, integer newPitch returns sound
set snd = this.runPlayer(p)
call SetSoundVolume(snd, volume)
call this.setSoundPitch(snd, newPitch)
return snd
endmethod
endstruct
function NewSoundEx takes string fileName, integer duration, boolean looping, boolean is3D, boolean stop, integer fadeInRate, integer fadeOutRate, string eax returns Sound
return Sound.createEx(fileName, duration, looping, is3D, stop, fadeInRate, fadeOutRate, eax)
endfunction
function NewSound takes string fileName, integer duration, boolean looping, boolean is3D returns Sound
return Sound.create(fileName, duration, looping, is3D)
endfunction
function RunSound takes Sound this returns sound
return this.run()
endfunction
function RunSoundEx takes Sound this, integer volume, integer pitch returns sound
return this.runEx(volume, pitch)
endfunction
function ReleaseSound takes sound s returns boolean
return Sound.release(s)
endfunction
function RunSoundOnUnit takes Sound this, unit whichUnit returns sound
return this.runUnit(whichUnit)
endfunction
function RunSoundOnUnitEx takes Sound this, unit whichUnit, integer volume, integer pitch returns sound
return this.runUnitEx(whichUnit, volume, pitch)
endfunction
function RunSoundAtPoint takes Sound this, real x, real y, real z returns sound
return this.runPoint(x, y, z)
endfunction
function RunSoundAtPointEx takes Sound this, real x, real y, real z, integer volume, integer pitch returns sound
return this.runPointEx(x, y, z, volume, pitch)
endfunction
function RunSoundForPlayer takes Sound this, player p returns sound
return this.runPlayer(p)
endfunction
function RunSoundForPlayerEx takes Sound this, player p, integer volume, integer pitch returns sound
return this.runPlayerEx(p, volume, pitch)
endfunction
endlibrary
library SimpleTriggerData initializer onInit
globals
private hashtable triggerDataBank = null
private constant integer TRIGGER_DATA_KEY= 10000
endglobals
function NewTriggerEx takes integer data returns trigger
local trigger newTrigger = CreateTrigger()
call SaveInteger(triggerDataBank,TRIGGER_DATA_KEY,GetHandleId(newTrigger),data)
return newTrigger
endfunction
function ReleaseTrigger takes trigger whichTrigger returns nothing
call RemoveSavedInteger(triggerDataBank,TRIGGER_DATA_KEY,GetHandleId(whichTrigger))
call DestroyTrigger(whichTrigger)
endfunction
function GetTriggerData takes trigger whichTrigger returns integer
return LoadInteger(triggerDataBank,TRIGGER_DATA_KEY,GetHandleId(whichTrigger))
endfunction
private function onInit takes nothing returns nothing
set triggerDataBank = InitHashtable()
endfunction
endlibrary
library TimerUtils initializer init
//*********************************************************************
//* TimerUtils (red+blue+orange flavors for 1.24b+) 2.0
//* ----------
//*
//* To implement it , create a custom text trigger called TimerUtils
//* and paste the contents of this script there.
//*
//* To copy from a map to another, copy the trigger holding this
//* library to your map.
//*
//* (requires vJass) More scripts: htt://www.wc3c.net
//*
//* For your timer needs:
//* * Attaching
//* * Recycling (with double-free protection)
//*
//* set t=NewTimer() : Get a timer (alternative to CreateTimer)
//* set t=NewTimerEx(x) : Get a timer (alternative to CreateTimer), call
//* Initialize timer data as x, instead of 0.
//*
//* ReleaseTimer(t) : Relese a timer (alt to DestroyTimer)
//* SetTimerData(t,2) : Attach value 2 to timer
//* GetTimerData(t) : Get the timer's value.
//* You can assume a timer's value is 0
//* after NewTimer.
//*
//* Multi-flavor:
//* Set USE_HASH_TABLE to true if you don't want to complicate your life.
//*
//* If you like speed and giberish try learning about the other flavors.
//*
//********************************************************************
//================================================================
globals
//How to tweak timer utils:
// USE_HASH_TABLE = true (new blue)
// * SAFEST
// * SLOWEST (though hash tables are kind of fast)
//
// USE_HASH_TABLE = false, USE_FLEXIBLE_OFFSET = true (orange)
// * kinda safe (except there is a limit in the number of timers)
// * ALMOST FAST
//
// USE_HASH_TABLE = false, USE_FLEXIBLE_OFFSET = false (red)
// * THE FASTEST (though is only faster than the previous method
// after using the optimizer on the map)
// * THE LEAST SAFE ( you may have to tweak OFSSET manually for it to
// work)
//
private constant boolean USE_HASH_TABLE = true
private constant boolean USE_FLEXIBLE_OFFSET = false
private constant integer OFFSET = 0x100000
private integer VOFFSET = OFFSET
//Timers to preload at map init:
private constant integer QUANTITY = 256
//Changing this to something big will allow you to keep recycling
// timers even when there are already AN INCREDIBLE AMOUNT of timers in
// the stack. But it will make things far slower so that's probably a bad idea...
private constant integer ARRAY_SIZE = 8190
endglobals
//==================================================================================================
globals
private integer array data[ARRAY_SIZE]
private hashtable ht
endglobals
//It is dependent on jasshelper's recent inlining optimization in order to perform correctly.
function SetTimerData takes timer t, integer value returns nothing
static if(USE_HASH_TABLE) then
// new blue
call SaveInteger(ht,0,GetHandleId(t), value)
elseif (USE_FLEXIBLE_OFFSET) then
// orange
static if (DEBUG_MODE) then
if(GetHandleId(t)-VOFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
set data[GetHandleId(t)-VOFFSET]=value
else
// new red
static if (DEBUG_MODE) then
if(GetHandleId(t)-OFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
set data[GetHandleId(t)-OFFSET]=value
endif
endfunction
function GetTimerData takes timer t returns integer
static if(USE_HASH_TABLE) then
// new blue
return LoadInteger(ht,0,GetHandleId(t) )
elseif (USE_FLEXIBLE_OFFSET) then
// orange
static if (DEBUG_MODE) then
if(GetHandleId(t)-VOFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
return data[GetHandleId(t)-VOFFSET]
else
// new red
static if (DEBUG_MODE) then
if(GetHandleId(t)-OFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
return data[GetHandleId(t)-OFFSET]
endif
endfunction
//==========================================================================================
globals
private timer array tT[ARRAY_SIZE]
private integer tN = 0
private constant integer HELD=0x28829022
//use a totally random number here, the more improbable someone uses it, the better.
private boolean didinit = false
endglobals
private keyword init
//==========================================================================================
// I needed to decide between duplicating code ignoring the "Once and only once" rule
// and using the ugly textmacros. I guess textmacros won.
//
//! textmacro TIMERUTIS_PRIVATE_NewTimerCommon takes VALUE
// On second thought, no.
//! endtextmacro
function NewTimerEx takes integer value returns timer
if (tN==0) then
if (not didinit) then
//This extra if shouldn't represent a major performance drawback
//because QUANTITY rule is not supposed to be broken every day.
call init.evaluate()
set tN = tN - 1
else
//If this happens then the QUANTITY rule has already been broken, try to fix the
// issue, else fail.
debug call BJDebugMsg("NewTimer: Warning, Exceeding TimerUtils_QUANTITY, make sure all timers are getting recycled correctly")
set tT[0]=CreateTimer()
static if( not USE_HASH_TABLE) then
debug call BJDebugMsg("In case of errors, please increase it accordingly, or set TimerUtils_USE_HASH_TABLE to true")
static if( USE_FLEXIBLE_OFFSET) then
if (GetHandleId(tT[0])-VOFFSET<0) or (GetHandleId(tT[0])-VOFFSET>=ARRAY_SIZE) then
//all right, couldn't fix it
call BJDebugMsg("NewTimer: Unable to allocate a timer, you should probably set TimerUtils_USE_HASH_TABLE to true or fix timer leaks.")
return null
endif
else
if (GetHandleId(tT[0])-OFFSET<0) or (GetHandleId(tT[0])-OFFSET>=ARRAY_SIZE) then
//all right, couldn't fix it
call BJDebugMsg("NewTimer: Unable to allocate a timer, you should probably set TimerUtils_USE_HASH_TABLE to true or fix timer leaks.")
return null
endif
endif
endif
endif
else
set tN=tN-1
endif
call SetTimerData(tT[tN],value)
return tT[tN]
endfunction
function NewTimer takes nothing returns timer
return NewTimerEx(0)
endfunction
//==========================================================================================
function ReleaseTimer takes timer t returns nothing
if(t==null) then
debug call BJDebugMsg("Warning: attempt to release a null timer")
return
endif
if (tN==ARRAY_SIZE) then
debug call BJDebugMsg("Warning: Timer stack is full, destroying timer!!")
//stack is full, the map already has much more troubles than the chance of bug
call DestroyTimer(t)
else
call PauseTimer(t)
if(GetTimerData(t)==HELD) then
debug call BJDebugMsg("Warning: ReleaseTimer: Double free!")
return
endif
call SetTimerData(t,HELD)
set tT[tN]=t
set tN=tN+1
endif
endfunction
private function init takes nothing returns nothing
local integer i=0
local integer o=-1
local boolean oops = false
if ( didinit ) then
return
else
set didinit = true
endif
static if( USE_HASH_TABLE ) then
set ht = InitHashtable()
loop
exitwhen(i==QUANTITY)
set tT[i]=CreateTimer()
call SetTimerData(tT[i], HELD)
set i=i+1
endloop
set tN = QUANTITY
else
loop
set i=0
loop
exitwhen (i==QUANTITY)
set tT[i] = CreateTimer()
if(i==0) then
set VOFFSET = GetHandleId(tT[i])
static if(USE_FLEXIBLE_OFFSET) then
set o=VOFFSET
else
set o=OFFSET
endif
endif
if (GetHandleId(tT[i])-o>=ARRAY_SIZE) then
exitwhen true
endif
if (GetHandleId(tT[i])-o>=0) then
set i=i+1
endif
endloop
set tN = i
exitwhen(tN == QUANTITY)
set oops = true
exitwhen not USE_FLEXIBLE_OFFSET
debug call BJDebugMsg("TimerUtils_init: Failed a initialization attempt, will try again")
endloop
if(oops) then
static if ( USE_FLEXIBLE_OFFSET) then
debug call BJDebugMsg("The problem has been fixed.")
//If this message doesn't appear then there is so much
//handle id fragmentation that it was impossible to preload
//so many timers and the thread crashed! Therefore this
//debug message is useful.
elseif(DEBUG_MODE) then
call BJDebugMsg("There were problems and the new timer limit is "+I2S(i))
call BJDebugMsg("This is a rare ocurrence, if the timer limit is too low:")
call BJDebugMsg("a) Change USE_FLEXIBLE_OFFSET to true (reduces performance a little)")
call BJDebugMsg("b) or try changing OFFSET to "+I2S(VOFFSET) )
endif
endif
endif
endfunction
endlibrary
library TimedHandles uses optional TimerUtils
/**************************************************************
*
* v1.0.5 by TriggerHappy
* ----------------------
*
* Use this to destroy a handle after X amount seconds.
*
* It's useful for things like effects where you may
* want it to be temporary, but not have to worry
* about the cleaning memory leak. By default it supports
* effects, lightning, weathereffect, items, ubersplats, and units.
*
* If you want to add your own handle types copy a textmacro line
* at the bottom and add whichever handle you want along with it's destructor.
*
* Example: //! runtextmacro TIMEDHANDLES("handle", "DestroyHandle")
*
* Installation
----------------------
* 1. Copy this script and over to your map inside a blank trigger.
* 2. If you want more efficiency copy TimerUtils over as well.
*
* API
* ----------------------
* call DestroyEffectTimed(AddSpecialEffect("effect.mdx", 0, 0), 5)
* call DestroyLightningTimed(AddLightning("CLPB", true, 0, 0, 100, 100), 5)
*
* Credits to Vexorian for TimerUtils and his help on the script.
*
**************************************************************/
globals
// If you don't want a timer to be ran each instance
// set this to true.
private constant boolean SINGLE_TIMER = true
// If you chose a single timer then this will be the speed
// at which the timer will update
private constant real UPDATE_PERIOD = 0.05
endglobals
// here you may add or remove handle types
//! runtextmacro TIMEDHANDLES("effect", "DestroyEffect")
//! runtextmacro TIMEDHANDLES("lightning", "DestroyLightning")
//! runtextmacro TIMEDHANDLES("weathereffect", "RemoveWeatherEffect")
//! runtextmacro TIMEDHANDLES("item", "RemoveItem")
//! runtextmacro TIMEDHANDLES("unit", "RemoveUnit")
//! runtextmacro TIMEDHANDLES("ubersplat", "DestroyUbersplat")
// Do not edit below this line
//! textmacro TIMEDHANDLES takes HANDLE,DESTROY
struct $HANDLE$Timed
$HANDLE$ $HANDLE$_var
static integer index = -1
static thistype array instance
static real REAL=UPDATE_PERIOD
static if SINGLE_TIMER then
static timer timer = CreateTimer()
real duration
real elapsed = 0
else static if not LIBRARY.TimerUtils then
static hashtable table = InitHashtable()
endif
method destroy takes nothing returns nothing
call $DESTROY$(this.$HANDLE$_var)
set this.$HANDLE$_var = null
static if SINGLE_TIMER then
set this.elapsed = 0
endif
call this.deallocate()
endmethod
private static method remove takes nothing returns nothing
static if SINGLE_TIMER then
local integer i = 0
local thistype this
loop
exitwhen i > thistype.index
set this = instance[i]
set this.elapsed = this.elapsed + UPDATE_PERIOD
if (this.elapsed >= this.duration) then
set instance[i] = instance[index]
set i = i - 1
set index = index - 1
call this.destroy()
if (index == -1) then
call PauseTimer(thistype.timer)
endif
endif
set i = i + 1
endloop
else
local timer t = GetExpiredTimer()
static if LIBRARY.TimerUtils then
local $HANDLE$Timed this = GetTimerData(t)
call ReleaseTimer(t)
call this.destroy()
else
local $HANDLE$Timed this = LoadInteger(table, 0, GetHandleId(t))
call DestroyTimer(t)
set t = null
call this.destroy()
endif
endif
endmethod
static method create takes $HANDLE$ h, real timeout returns $HANDLE$Timed
local $HANDLE$Timed this = $HANDLE$Timed.allocate()
static if SINGLE_TIMER then
set index = index + 1
set instance[index] = this
if (index == 0) then
call TimerStart(thistype.timer, UPDATE_PERIOD, true, function thistype.remove)
endif
set this.duration = timeout
else
static if LIBRARY.TimerUtils then
call TimerStart(NewTimerEx(this), timeout, false, function $HANDLE$timed.remove)
else
local timer t = CreateTimer()
call SaveInteger(thistype.table, 0, GetHandleId(t), this)
call TimerStart(t, timeout, false, function $HANDLE$Timed.remove)
set t = null
endif
endif
set this.$HANDLE$_var = h
return this
endmethod
endstruct
function $DESTROY$Timed takes $HANDLE$ h, real duration returns $HANDLE$Timed
return $HANDLE$Timed.create(h, duration)
endfunction
//! endtextmacro
endlibrary
globals
real bosses_DW_damage
endglobals
function Trig_Deathwing_Generic_AOE_Func005Func001C takes nothing returns boolean
if ( not ( IsUnitAliveBJ(GetEnumUnit()) == true ) ) then
return false
endif
if ( not ( IsUnitEnemy(GetEnumUnit(), Player(PLAYER_NEUTRAL_AGGRESSIVE)) == true ) ) then
return false
endif
return true
endfunction
function Trig_Deathwing_Generic_AOE_Func005A takes nothing returns nothing
if ( Trig_Deathwing_Generic_AOE_Func005Func001C() ) then
call SetUnitLifeBJ( GetEnumUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetEnumUnit()) - bosses_DW_damage) )
endif
endfunction
function Deathwing_Yeets_Damage_Bombs takes location targetPoint, string sfxPath, real radius, real damage, real waitAmount returns nothing
local group targetGroup = GetUnitsInRangeOfLocAll(radius, targetPoint)
call DestroyEffect(AddSpecialEffectLoc(sfxPath, targetPoint))
call TriggerSleepAction(waitAmount)
set bosses_DW_damage = damage
call ForGroupBJ(targetGroup, function Trig_Deathwing_Generic_AOE_Func005A )
call DestroyGroup(targetGroup)
endfunction
function Trig_Deathwing_Generic_AOE_Actions takes nothing returns nothing
call Deathwing_Yeets_Damage_Bombs( /*
*/ udg_Bosses_DW_AOE_Point, /*
*/ udg_Bosses_DW_AOE_SFX_Path, /*
*/ udg_Bosses_DW_AOE_Radius, /*
*/ udg_Bosses_DW_AOE_Damage, /*
*/ udg_Bosses_DW_AOE_Wait)
endfunction
//===========================================================================
function InitTrig_Deathwing_Generic_AOE takes nothing returns nothing
set gg_trg_Deathwing_Generic_AOE = CreateTrigger( )
call TriggerAddAction( gg_trg_Deathwing_Generic_AOE, function Trig_Deathwing_Generic_AOE_Actions )
endfunction
struct EarthShattering
public static constant integer DUMMY_ID = 'n000'
public static constant real MOVEMENT_PERIOD = 0.02
public static constant real MOVEMENT_TIMED_LIFE = 1.00
public static constant string EFFECT_PATH = "Doodads\\Felwood\\Rocks\\FelwoodFissure\\FelwoodFissure1.mdl"
public static constant string SOUND_EFFECT_PATH = "Sound\\Buildings\\Death\\HCancelBuilding.wav"
public static constant string SOUND_EFFECT2_PATH = "Sounds\\Interface\\GlueScreenMeteorHit1.wav"
public static constant string UBERSPLAT_NAME = "NVCR"
public static constant integer RARETY_OF_EFFECTS = 10
public real damage
public real duration
public real damagePerPeriod
public real period
public real angle
private real velocity
private real timedLife
private integer counter
private unit dummy
private unit caster
private group targetGroup
private region damageRegion
private rect dummyRect
private trigger collisionTrigger
private trigger enterRegion
private trigger leaveRegion
private timer spellTimer
private timer damageTimer
private static Sound soundEffect
private static Sound soundEffect2
private static method newTarget takes nothing returns nothing
local thistype this = GetTriggerData(GetTriggeringTrigger())
local unit triggerUnit = GetTriggerUnit()
if (not IsUnitAlly(triggerUnit,GetOwningPlayer(this.caster))) and UnitAlive(triggerUnit) then
call GroupAddUnit(this.targetGroup, triggerUnit)
call UnitDamageTarget(this.caster, triggerUnit, this.damage, false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
endif
set triggerUnit = null
endmethod
private static method enteredRegion takes nothing returns nothing
local thistype this = GetTriggerData(GetTriggeringTrigger())
local unit triggerUnit = GetTriggerUnit()
if (not IsUnitAlly(triggerUnit,GetOwningPlayer(this.caster))) and UnitAlive(triggerUnit) then
call GroupAddUnit(this.targetGroup, triggerUnit)
endif
endmethod
private static method leftRegion takes nothing returns nothing
local thistype this = GetTriggerData(GetTriggeringTrigger())
call GroupRemoveUnit(this.targetGroup, GetTriggerUnit())
endmethod
private static method damageTick takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer index = 0
local integer endIndex = BlzGroupGetSize(this.targetGroup)
set this.duration = this.duration - this.period
call thistype.soundEffect2.runPoint(GetRectCenterX(this.dummyRect),GetRectCenterY(this.dummyRect),0.00)
loop
exitwhen index >= endIndex
call UnitDamageTarget(this.caster, BlzGroupUnitAt(this.targetGroup,index), this.damagePerPeriod, false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
set index = index + 1
endloop
if (duration > 0.00 and period <= duration) then
call TimerStart(this.damageTimer,period,false, function thistype.damageTick)
else
call this.destroy()
endif
endmethod
private static method move takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local real dummyX = GetUnitX(this.dummy) + velocity*Cos(this.angle)
local real dummyY = GetUnitY(this.dummy) + velocity*Sin(this.angle)
local real calculatedTime
local effect dummyEffect = null
local ubersplat dummyUbersplat = null
call SetUnitX(this.dummy, dummyX)
call SetUnitY(this.dummy, dummyY)
set this.timedLife = this.timedLife - MOVEMENT_PERIOD
call MoveRectTo(this.dummyRect, dummyX,dummyY)
call RegionAddRect(this.damageRegion, this.dummyRect)
set this.counter = this.counter + 1
if this.timedLife > 0.00 then
if this.counter >= RARETY_OF_EFFECTS then
set this.counter = 0
set calculatedTime = this.timedLife + this.duration - MOVEMENT_TIMED_LIFE
set dummyEffect = AddSpecialEffect(EFFECT_PATH,dummyX,dummyY)
call BlzSetSpecialEffectYaw(dummyEffect, this.angle)
call DestroyEffectTimed(dummyEffect,calculatedTime)
set dummyUbersplat = CreateUbersplat(dummyX,dummyY,UBERSPLAT_NAME,255,255,255,255,false,true)
call SetUbersplatRender(dummyUbersplat,true)
call ShowUbersplat(dummyUbersplat,true)
call DestroyUbersplatTimed(dummyUbersplat, calculatedTime)
call thistype.soundEffect.runPoint(dummyX,dummyY,BlzGetLocalUnitZ(this.dummy))
set dummyEffect = null
endif
call TimerStart(this.spellTimer, MOVEMENT_PERIOD, false, function thistype.move)
else
call RemoveUnit(this.dummy)
endif
endmethod
public static method create takes unit caster, real damage, real damagePerPeriod, real period, real duration, real radius, real range, real angle returns thistype
local thistype this = thistype.allocate()
local real casterX = GetUnitX(caster)
local real casterY = GetUnitY(caster)
local real smallRadius = radius/ SquareRoot(2)
set this.damage = damage
set this.damagePerPeriod = damagePerPeriod
set this.period = period
set this.duration = duration
set this.angle = angle*bj_DEGTORAD
set this.velocity = range*thistype.MOVEMENT_PERIOD
set this.timedLife = MOVEMENT_TIMED_LIFE
set this.counter = 0
set this.caster = caster
set this.dummy = CreateUnit(GetOwningPlayer(caster),DUMMY_ID,casterX,casterY,angle)
set this.targetGroup = CreateGroup()
set this.dummyRect = Rect(smallRadius,smallRadius,smallRadius,smallRadius)
set this.damageRegion = CreateRegion()
call MoveRectTo(this.dummyRect,casterX,casterY)
set this.collisionTrigger = NewTriggerEx(this)
set this.enterRegion = NewTriggerEx(this)
set this.leaveRegion = NewTriggerEx(this)
set this.spellTimer = NewTimerEx(this)
set this.damageTimer = NewTimerEx(this)
call TriggerAddAction(this.collisionTrigger,function thistype.newTarget)
call TriggerAddAction(this.enterRegion, function thistype.enteredRegion)
call TriggerAddAction(this.leaveRegion, function thistype.leftRegion)
call TriggerRegisterEnterRegion(this.enterRegion, this.damageRegion, null)
call TriggerRegisterLeaveRegion(this.leaveRegion, this.damageRegion, null)
call TriggerRegisterUnitInRange(this.collisionTrigger,this.dummy,radius,null)
call TimerStart(this.spellTimer,MOVEMENT_PERIOD, false, function thistype.move)
call TimerStart(this.damageTimer,RMinBJ(duration,period),false, function thistype.damageTick)
return this
endmethod
public method destroy takes nothing returns nothing
call DestroyGroup(this.targetGroup)
call RemoveRegion(this.damageRegion)
call RemoveRect(this.dummyRect)
call RemoveUnit(this.dummy)
call PauseTimer(this.spellTimer)
call PauseTimer(this.damageTimer)
call DestroyTimer(this.spellTimer)
call DestroyTimer(this.damageTimer)
call DestroyTrigger(this.collisionTrigger)
call DestroyTrigger(this.enterRegion)
call DestroyTrigger(this.leaveRegion)
set this.dummy = null
set this.caster = null
set this.spellTimer = null
set this.damageTimer = null
set this.targetGroup = null
set this.collisionTrigger = null
set this.dummyRect = null
set this.damageRegion = null
set this.enterRegion = null
set this.leaveRegion = null
call this.deallocate()
endmethod
private static method onInit takes nothing returns nothing
set thistype.soundEffect = NewSound(SOUND_EFFECT_PATH,2818,false,true)
set thistype.soundEffect2 = NewSound(SOUND_EFFECT2_PATH,1500,false,true)
endmethod
endstruct
struct HomingMagic
public static constant real LIGHTNING_Z_OFFSET = 50.0
public static constant string SOUND_EFFECT_PATH = "Abilities\\Spells\\Orc\\LightningBolt\\LightningBolt.wav"
readonly real initialDamage
readonly real damagePercentLossAfterJump
readonly real range
readonly real delay
readonly string lightningCode
readonly integer jumps
readonly integer totalJumpAmount
private unit caster
private unit previousTarget
private unit target
private group targetGroup
private group tempTargetGroup
private timer strikeDelay
private static Sound soundEffect
private method chooseNextTarget takes nothing returns nothing
local unit currentUnit = null
local player casterOwner = GetOwningPlayer(this.caster)
local integer index = 0
local integer endIndex = 0
call GroupAddUnit(this.targetGroup,this.target)
call GroupEnumUnitsInRange(this.tempTargetGroup,GetUnitX(this.target),GetUnitY(this.target),this.range, null)
set endIndex = BlzGroupGetSize(this.tempTargetGroup)
loop
exitwhen index >= endIndex
set currentUnit = BlzGroupUnitAt(this.tempTargetGroup,index)
if IsUnitInGroup(currentUnit, this.targetGroup) or not UnitAlive(currentUnit) or IsUnitAlly(currentUnit,casterOwner) then
call GroupRemoveUnit(this.tempTargetGroup, currentUnit)
set index = index - 1
set endIndex = endIndex - 1
endif
set index = index + 1
endloop
set casterOwner = null
set bj_groupRandomConsidered = 0
set bj_groupRandomCurrentPick = null
call ForGroup(this.tempTargetGroup, function GroupPickRandomUnitEnum)
set this.previousTarget = this.target
set this.target = bj_groupRandomCurrentPick
endmethod
private static method spellStrike takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local real damage = this.initialDamage * (1.00 - this.damagePercentLossAfterJump * I2R(totalJumpAmount - jumps))
local real targetX = GetUnitX(this.target)
local real targetY = GetUnitY(this.target)
local real targetZ = BlzGetLocalUnitZ(this.target) + GetUnitFlyHeight(this.previousTarget) + LIGHTNING_Z_OFFSET
call UnitDamageTarget(this.caster, this.target, damage, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_LIGHTNING, WEAPON_TYPE_WHOKNOWS)
call DestroyLightningTimed(AddLightningEx(this.lightningCode, true, /*
*/ GetUnitX(this.previousTarget), GetUnitY(this.previousTarget),BlzGetLocalUnitZ(this.previousTarget) + GetUnitFlyHeight(this.previousTarget) + LIGHTNING_Z_OFFSET, /*
*/ targetX, targetY, targetZ /*
*/ ), 1.00)
call thistype.soundEffect.runPoint(targetX,targetY,targetZ)
set this.jumps = this.jumps - 1
if this.jumps > 0 then
call this.chooseNextTarget()
if this.target == null then
call this.destroy()
else
call TimerStart(this.strikeDelay,this.delay,false,function thistype.spellStrike)
endif
else
call this.destroy()
endif
endmethod
public static method create takes unit caster, unit target, real initialDamage, real damagePercentLossAfterJump, real range, integer jumps, real delay, string lightningCode returns thistype
local thistype this = thistype.allocate()
set this.damagePercentLossAfterJump = damagePercentLossAfterJump
set this.totalJumpAmount = jumps + 1
set this.jumps = totalJumpAmount
set this.range = range
set this.delay = delay
set this.initialDamage = initialDamage
set this.lightningCode = lightningCode
set this.caster = caster
set this.target = target
set this.previousTarget = caster
set this.targetGroup = CreateGroup()
set this.tempTargetGroup = CreateGroup()
set this.strikeDelay = NewTimerEx(this)
call TimerStart(this.strikeDelay,0.00,false,function thistype.spellStrike)
return this
endmethod
public method destroy takes nothing returns nothing
call PauseTimer(strikeDelay)
call DestroyGroup(targetGroup)
call DestroyGroup(tempTargetGroup)
call DestroyTimer(strikeDelay)
set caster = null
set target = null
set targetGroup = null
set tempTargetGroup = null
set strikeDelay = null
endmethod
private static method onInit takes nothing returns nothing
set thistype.soundEffect = NewSound(SOUND_EFFECT_PATH,2136,false,true)
endmethod
endstruct
struct IceSlash
private static group damageGroup
public static method execute takes unit caster, real radius, real angle, real angleOfEffect, real damage returns nothing
local integer unitAmount
local integer unitIndex = 0
local real casterX = GetUnitX(caster)
local real casterY = GetUnitY(caster)
local real targetX
local real targetY
local real angleDifference
local unit target
call GroupEnumUnitsInRange(thistype.damageGroup, casterX, casterY, radius,null)
set unitAmount = BlzGroupGetSize(thistype.damageGroup)
set angleOfEffect = angleOfEffect * bj_DEGTORAD / 2.00
set angle = angle * bj_DEGTORAD
loop
exitwhen unitIndex >= unitAmount
set target = BlzGroupUnitAt(thistype.damageGroup,unitIndex)
set targetX = GetUnitX(target)
set targetY = GetUnitY(target)
set angleDifference = angle - Atan2(targetY-casterY,targetX-casterX)
if (angleDifference <= angleOfEffect) and (angleDifference >= -angleOfEffect) then
call UnitDamageTarget(caster,target,damage,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_COLD,WEAPON_TYPE_WHOKNOWS)
endif
set unitIndex = unitIndex + 1
endloop
set target = null
endmethod
private static method onInit takes nothing returns nothing
set thistype.damageGroup = CreateGroup()
endmethod
endstruct
library UpgradedHero initializer onInit
private struct UpgradedHero
readonly integer itemID
readonly integer unitID
public static method create takes integer unitID, integer itemID returns thistype
local thistype this = thistype.allocate()
set this.itemID = itemID
set this.unitID = unitID
return this
endmethod
endstruct
globals
private trigger upgradeHero = null
private conditionfunc heroUpgradeCondition = null
private UpgradedHero array upgradedHero
private integer upgradedHeroCount = 0
private integer currentUpgradedHeroIndex = 0
endglobals
private function UpgradeHero takes nothing returns nothing
local UpgradedHero thisHero = upgradedHero[currentUpgradedHeroIndex]
local integer index = 0
local real angle = AngleBetweenPoints(udg_PlayerHero_Start_Position,udg_Map_Center_StartPoint)
local unit oldHero = GetTriggerUnit()
local player owner = GetOwningPlayer(oldHero)
local unit newHero = CreateUnitAtLoc(owner,thisHero.unitID,udg_PlayerHero_Start_Position,angle)
local item currentItem = null
loop
exitwhen index > 5
set currentItem = UnitItemInSlot(oldHero,index)
if GetItemTypeId(currentItem) == thisHero.itemID then
call RemoveItem(currentItem)
else
call UnitAddItem(newHero,currentItem)
endif
set index = index + 1
endloop
call RemoveUnit(oldHero)
set udg_PlayerHero[GetConvertedPlayerId(owner)] = newHero
call DisplayTextToForce( GetPlayersAll(), "Player " + GetPlayerName(owner) + " Has Selected the " + GetUnitName(newHero) + " And Entered The Arena")
call PanCameraToTimedLocForPlayer(owner, udg_Map_Center_StartPoint, 0)
call thisHero.destroy()
set upgradedHeroCount = upgradedHeroCount - 1
set upgradedHero[currentUpgradedHeroIndex] = upgradedHero[upgradedHeroCount]
endfunction
private function DoesUnitHaveItem takes nothing returns nothing
local integer inventoryIndex = 0
local integer index = 0
local boolean result = false
local unit whichUnit = GetTriggerUnit()
loop
exitwhen index >= upgradedHeroCount
set inventoryIndex = 0
loop
exitwhen inventoryIndex > 5
if GetItemTypeId(UnitItemInSlot(whichUnit,inventoryIndex)) == upgradedHero[index].itemID then
set result = true
set currentUpgradedHeroIndex = index
endif
set inventoryIndex = inventoryIndex + 1
endloop
set index = index + 1
endloop
if result then
set udg_Player_Temp_Integer = GetConvertedPlayerId(GetOwningPlayer(whichUnit))
call TriggerExecute(gg_trg_Reset_Hero_Previous_Level)
call UpgradeHero()
endif
endfunction
private function HeroUpgradeCondition takes nothing returns boolean
if not (udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] == GetTriggerUnit()) then
return false
else
return true
endif
endfunction
private function onInit takes nothing returns nothing
set upgradeHero = CreateTrigger()
set heroUpgradeCondition = Condition(function HeroUpgradeCondition)
call TriggerAddAction(upgradeHero, function DoesUnitHaveItem)
call TriggerAddCondition(upgradeHero,heroUpgradeCondition)
call TriggerRegisterEnterRectSimple(upgradeHero,gg_rct_Altar_of_Power)
endfunction
public function Register takes integer unitID, integer itemID returns nothing
set upgradedHero[upgradedHeroCount] = UpgradedHero.create(unitID,itemID)
set upgradedHeroCount = upgradedHeroCount + 1
endfunction
endlibrary