//TESH.scrollpos=0
//TESH.alwaysfold=0
Name | Type | is_array | initial_value |
Alliance_CandyMageA_Alive | boolean | No | true |
Alliance_CandyMageB_Alive | boolean | No | true |
Alliance_CandyMageC_Alive | boolean | No | true |
Alliance_Magic | unitcode | Yes | |
Alliance_Magic_Level | integer | No | 1 |
Alliance_Melee | unitcode | Yes | |
Alliance_Melee_Level | integer | No | 1 |
Alliance_Range | unitcode | Yes | |
Alliance_Range_Level | integer | No | 1 |
Alliance_TauntSound | sound | Yes | |
Alliance_uMelee_Spawn_Int | integer | Yes | 4 |
Alliance_Vanguard | unit | Yes | |
AllPlayers_Count | integer | No | |
AllPlayers_Online | force | No | |
AmbientSounds | sound | Yes | |
AnimationSpeedChange | real | No | |
Bo_AllianceAlarm | boolean | No | |
Boss_Revive_Time | real | No | |
CandyShield_Alliance | unit | No | |
CandyShield_Horde | unit | No | |
Caster_AOR | unit | No | |
Caster_PR | unit | No | |
CasterLoc_AOR | location | No | |
cc_endtag | string | No | |
cc_gold | string | No | |
Chosen | boolean | Yes | |
ConeMaximumDegrees | real | No | |
ConeMinimumDegrees | real | No | |
Creep_Positions | location | Yes | |
Creep_Revive_Time | real | No | |
Creep_Types | unitcode | Yes | |
Dam_Cyclone | real | Yes | |
Dam_PR | real | No | |
dam_thundagar | real | No | |
Effect_PR | effect | Yes | |
EffectsAttachmentPoints | string | Yes | |
EffectsAttachments | string | No | |
EndTag | string | No | |
FOH_Angle | real | No | |
FOH_Caster | unit | No | |
FOH_CasterLoc | location | No | |
FOH_TargetPoint | location | No | |
FOH_TempPoint | location | Yes | |
G_BeastialWrath | group | No | |
G_BOM | group | No | |
G_Conqueror | group | No | |
G_ConquerorTakeDam | group | No | |
G_Conversion | group | No | |
G_Cyclone | group | No | |
G_DeadlyBlade | group | No | |
G_DeadlyBladeTakeDamage | group | No | |
G_HERO | group | No | |
G_HM | group | No | |
G_HMTakeDam | group | No | |
G_HolySword | group | No | |
G_HolySwordTakeDam | group | No | |
G_lycan | group | No | |
G_MassDispell | group | No | |
G_MatchUp | group | No | |
G_movespeed | group | No | |
G_PreHero | group | No | |
G_QuilBeast | group | No | |
G_Rage | group | No | |
G_RageTakeDam | group | No | |
G_Raijin | group | No | |
G_RaijinTakeDam | group | No | |
G_SpiritBond | group | No | |
G_SpiritMoon | group | No | |
G_Starfall | group | No | |
G_StormStrike | group | No | |
G_StormStrikeTakeDam | group | No | |
G_Twisters | group | No | |
G_WhiteDragonArm | group | No | |
G_WhiteDragonArmTakeDam | group | No | |
Game_Minutes | integer | No | |
Game_Seconds | integer | No | |
Game_Time | timer | No | |
Game_Time_Minutes | integer | No | |
Game_Time_Seconds | integer | No | |
Game_Time_String | string | No | |
Game_Time_TenSeconds | integer | No | |
GameMode | integer | No | |
GameOn | boolean | No | |
GoldTag | string | No | |
GoldTag_end | string | No | |
GraveyardPointE | location | No | |
GraveyardPointW | location | No | |
GreenTag | string | No | |
Group_PR | group | No | |
Group_Steel | group | No | |
Heal_SpiritBond | real | Yes | |
HellfireDummyCaster | unit | Yes | |
HERO | unit | Yes | |
Hero_Array | unitcode | Yes | |
HERO_PLAYER | unit | Yes | |
Hero_Revive_Time | real | No | |
HeroIconPath | string | Yes | |
Hits | integer | No | |
Horde_Magic | unitcode | Yes | |
Horde_Magic_Level | integer | No | 1 |
Horde_Melee | unitcode | Yes | |
Horde_Melee_Level | integer | No | 1 |
Horde_Range | unitcode | Yes | |
Horde_Range_Level | integer | No | 1 |
Horde_TauntSound | sound | Yes | |
Horde_uMelee_Spawn_Int | integer | Yes | 4 |
Horde_Vanguard | unit | Yes | |
Int_Cyclone | integer | No | |
Int_QuilBeast | integer | No | |
Int_STR | integer | No | |
Int_Twister | integer | No | |
Item_NoobTier | itemcode | Yes | |
Item_UberTier | itemcode | Yes | |
Kills_BeyondGodlike | boolean | Yes | |
Kills_Dominating | boolean | Yes | |
Kills_Godlike | boolean | Yes | |
Kills_KillingSpree | boolean | Yes | |
Kills_MegaKill | boolean | Yes | |
Kills_MonsterKill | boolean | Yes | |
Kills_Unstoppable | boolean | Yes | |
Kills_WhickedSick | boolean | Yes | |
Life_SpiritBond | integer | Yes | |
Loc_Conqueror | location | No | |
Loc_Cyclone | location | No | |
Loc_Intercept | location | Yes | |
Loc_PR_A | location | No | |
Loc_PR_B | location | No | |
Loc_PR_C | location | No | |
Loc_Raijin | location | No | |
Loc_Shock | location | Yes | |
Loc_SS | location | No | |
Loc_Starfall | location | Yes | |
LoopCreep | integer | No | |
Lvl_BeastialWrath | integer | No | |
Lvl_KillCommand | integer | No | |
lvl_lycan | integer | No | |
Lvl_MassDispell | integer | No | |
Lvl_PaladinSpells | integer | No | |
Lvl_Rage | integer | No | |
Lvl_SpiritBond | integer | No | |
Lvl_Starfall | integer | No | |
Lvl_StormStrike | integer | No | |
Lvl_thundagar | integer | No | |
MyMultiboard | multiboard | No | |
NumberOfShockwaves | integer | No | |
Player_Colors | string | Yes | |
PlayerNames | StringExt | Yes | |
Players | force | No | |
Players_Alliance | force | No | |
Players_Alliance_Count | integer | No | |
Players_Alliance_Online | force | No | |
Players_Horde | force | No | |
Players_Horde_Count | integer | No | |
Players_Horde_Online | force | No | |
Players_Legion | force | No | |
PlayersSentinel | force | No | |
Playing_Alliance | boolean | Yes | |
Playing_Horde | boolean | Yes | |
Playing_Legion | boolean | Yes | |
Playing_Players | boolean | Yes | |
Re_HM | real | No | |
RedTag | string | No | |
Rex | unit | No | |
Score_Creeping | integer | Yes | |
Score_Deaths | integer | Yes | |
Score_Kills | integer | Yes | |
ShortMode_On | boolean | No | |
SingleMode | boolean | No | |
SiphonableCorpses | group | No | |
SiphonedCorpses | group | No | |
SM_HeroGroup | group | No | |
South_Monster_Special_FX | effect | No | |
Spawning_Barrack | unit | Yes | |
SpawningBool | boolean | No | |
SpecialEffect | effect | Yes | |
SpecialFX | effect | No | |
TargetPoint_AOR | location | No | |
TealTag | string | No | |
TempForce | force | No | |
TempGroup | group | No | |
TempGroupAI | group | No | |
TempInt | integer | No | |
TempInt_BonusGold | integer | No | |
TempMovementPoint | location | No | |
TempPoint | location | No | |
TempPoint_AOR | location | No | |
TempPointAI | location | No | |
TempPointCheck | location | No | |
TempReal | real | No | |
TempUnit | unit | No | |
TempUnitAI | unit | No | |
TextDisplayTime | real | No | |
This_Player_Is_Playing | boolean | Yes | |
Tom | unit | No | |
ToTheLimitAlliance | integer | No | |
ToTheLimitHorde | integer | No | |
ToTheLimitMagicRangeBoost | integer | No | |
ToTheLimitMeleeBoost | integer | No | |
U_BeastialWrath | unit | No | |
U_BeastKing | unit | No | |
U_Conqueror | unit | Yes | |
U_DeadlyBlade | unit | Yes | |
U_HM | unit | Yes | |
U_HolySword | unit | Yes | |
U_Intercept | unit | Yes | |
U_KillCommand | unit | No | |
U_MassDispell | unit | No | |
U_Monk | unit | No | |
U_Moon | unit | No | |
U_MOTD | unit | No | |
U_Nomad | unit | No | |
U_Paladin | unit | No | |
U_PetBear | unit | No | |
U_Rage | unit | Yes | |
U_Raijin | unit | Yes | |
U_SpiritMoon | unit | No | |
U_StormStrike | unit | Yes | |
U_WhiteDragon | unit | Yes | |
UberMobsAlliance | group | No | |
UberMobsHorde | group | No | |
UberMode_On | boolean | No | |
UltraShortMode_On | boolean | No | |
UT_Twister | unitcode | Yes | |
Wait_Shock | real | No | |
zMonster_Movement_Middle_Array | rect | Yes | |
zMonster_Movement_North_Array | rect | Yes | |
zMonster_Movement_South_Array | rect | Yes | |
zSpawnRegions | rect | Yes |
//TESH.scrollpos=1
//TESH.alwaysfold=0
library GetPlayerNameColored
function GetPlayerNameColored takes player id returns string
local playercolor col = GetPlayerColor(id)
local string r = GetPlayerName(id)
if col == PLAYER_COLOR_RED then
set r="|cffff0000"+r+"|r"
elseif col == PLAYER_COLOR_BLUE then
set r="|cff0000ff"+r+"|r"
elseif col == PLAYER_COLOR_CYAN then
set r="|cff93ffc9"+r+"|r"
elseif col == PLAYER_COLOR_PURPLE then
set r="|cff400080"+r+"|r"
elseif col == PLAYER_COLOR_YELLOW then
set r="|cffffff00"+r+"|r"
elseif col == PLAYER_COLOR_ORANGE then
set r="|cffff8000"+r+"|r"
elseif col == PLAYER_COLOR_GREEN then
set r="|cff00c400"+r+"|r"
elseif col == PLAYER_COLOR_PINK then
set r="|cffff80c0"+r+"|r"
elseif col == PLAYER_COLOR_LIGHT_GRAY then
set r="|cff808080"+r+"|r"
elseif col == PLAYER_COLOR_LIGHT_BLUE then
set r="|cffc1c1ff"+r+"|r"
elseif col == PLAYER_COLOR_AQUA then
set r="|cff5e5e2f"+r+"|r"
elseif col == PLAYER_COLOR_BROWN then
set r="|cff004000"+r+"|r"
else
set r="|cff000000"+r+"|r"
endif
return r
endfunction
// Added this so when heroes are created they can have their name in their players color, the S stands for string, since it returns the
// string, not the actual playercolor constant
function GetPlayerColorS takes player id returns string
local playercolor col = GetPlayerColor(id)
local string r = ""
if col == PLAYER_COLOR_RED then
set r="|cffff0000"
elseif col == PLAYER_COLOR_BLUE then
set r="|cff0000ff"
elseif col == PLAYER_COLOR_CYAN then
set r="|cff93ffc9"
elseif col == PLAYER_COLOR_PURPLE then
set r="|cff400080"
elseif col == PLAYER_COLOR_YELLOW then
set r="|cffffff00"
elseif col == PLAYER_COLOR_ORANGE then
set r="|cffff8000"
elseif col == PLAYER_COLOR_GREEN then
set r="|cff00c400"
elseif col == PLAYER_COLOR_PINK then
set r="|cffff80c0"
elseif col == PLAYER_COLOR_LIGHT_GRAY then
set r="|cff808080"
elseif col == PLAYER_COLOR_LIGHT_BLUE then
set r="|cffc1c1ff"
elseif col == PLAYER_COLOR_AQUA then
set r="|cff5e5e2f"
elseif col == PLAYER_COLOR_BROWN then
set r="|cff004000"
else
set r="|cff000000"
endif
return r
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library HSS initializer GetOrders needs GetPlayerNameColored
//=====HSS 1.30b=====\\
globals
// Config. Options:
private constant integer ChooseHeroUnitId = 'h001' // Rawcode of Choose Hero Unit
private constant integer ChooseHeroOrder = 1747988529 // Orderid when Choose Hero is selected
private constant integer RandomHeroUnitId = 'h002' // Rawcode of Random Hero Unit
// Use 0 if you don't want to let players choose a random hero
private constant integer RandomHeroOrder = 1747988530 // Orderid when Random Hero is selected
private constant real TimeLimit = 120. // Time limit for selecting heroes, after which players get a random hero
// Use 0. if you desire no time limit
private constant real MaxCompTime = 15. // Max time a computer will take to choose a random hero, this should be lower then TimeLimit
private constant boolean CleanUp = true // Whether you want the hero gallery removed after all players have a hero
private constant boolean DoubleHeroes = false // Whether you want to allow more then one of the same hero to be chosen
private constant boolean CompHeroes = false // Whether you want computer players to choose heroes.
private constant boolean RemoveChosen = true // Whether you want chosen heroes removed if DoubleHeroes is true
// If this is false, heroes will become opaque and non-selectable
private constant string DialogTitle = "Hero Selection Time" // The title of the timerdialog that shows the remaining selection time
//===========Don't touch past here unless you know what you are doing===========\\
// Needed Globals:
public unit array Heroes
public trigger CreatedHeroTrigger = null
public location array HeroCreation
public rect array HeroSelection
public group SelectableHeroes = CreateGroup()
public integer Players = 0
private unit Hero = null
private trigger Sell = CreateTrigger()
private trigger Orders = CreateTrigger()
private trigger Setup = CreateTrigger()
private string S = " has chosen the "
endglobals
//=====Get Selection Orders=====\\
private function GetSelectionOrders_Effects takes nothing returns nothing
local integer id = GetIssuedOrderId()
local unit u = GetOrderedUnit()
if GetTriggerEventId()==EVENT_UNIT_ISSUED_ORDER and id!=851972 then
call BJDebugMsg("The order for that selection is |cffff0000"+I2S(id)+"|r.")
endif
call DisableTrigger(Setup)
call PauseUnit( u, true)
call IssueImmediateOrder( u, "stop" )
call PauseUnit( u, false)
call EnableTrigger(Setup)
endfunction
private function GetSelectionOrders takes nothing returns boolean
local real x
local real y
local unit u
if not bj_isSinglePlayer then
return false
endif
set x = GetPlayerStartLocationX(Player(0))
set y = GetPlayerStartLocationY(Player(0))
set u = CreateUnit(Player(15),'Hpal',x,y,0)
set Setup = CreateTrigger()
call SetPlayerAlliance(Player(15),Player(0),ALLIANCE_SHARED_CONTROL,true)
call SetPlayerAlliance(Player(15),Player(0),ALLIANCE_SHARED_VISION,true)
if GetLocalPlayer()==Player(0) then
call SetCameraPosition(x,y)
call ClearSelection()
call SelectUnit(u,true)
endif
call UnitRemoveAbility(u, 'Amov')
call UnitAddAbility(u, 'Abun')
call UnitAddAbility(u,'Asud')
call AddUnitToStock(u, ChooseHeroUnitId,1,1)
call AddUnitToStock(u, RandomHeroUnitId,1,1)
call SetUnitInvulnerable(u,true)
call UnitModifySkillPoints(u, -1)
call TriggerRegisterUnitEvent(Setup, u, EVENT_UNIT_ISSUED_ORDER )
call TriggerAddAction(Setup,function GetSelectionOrders_Effects)
call DestroyTrigger(GetTriggeringTrigger())
return false
endfunction
private function GetOrders takes nothing returns nothing
call TriggerRegisterPlayerChatEvent( Setup, Player(0), "-HSSGetOrders", true )
call TriggerAddCondition(Setup,Condition(function GetSelectionOrders))
endfunction
//=====Main System=====\\
private function Cleaner takes nothing returns nothing
if CleanUp then
loop
set Hero = FirstOfGroup(SelectableHeroes)
exitwhen Hero==null
call GroupRemoveUnit(SelectableHeroes,Hero)
call RemoveUnit(Hero) // Lets hope for no bugs.... :)
endloop
endif
call DestroyGroup(SelectableHeroes)
set SelectableHeroes = null
call DestroyTrigger(Sell)
call DestroyTrigger(Orders)
call DestroyTrigger(Setup)
set Sell = null
set Orders = null
set Setup = null
endfunction
private function CreateHero takes unit u, player p returns nothing
local integer id = GetPlayerId(p)
local real x = GetLocationX(HeroCreation[id])
local real y = GetLocationY(HeroCreation[id])
set Hero = CreateUnit(p,GetUnitTypeId(u),x,y,GetRandomReal(0.,360.))
if GetLocalPlayer()==p then
call SelectUnit(Hero,true)
call SetCameraPosition(x,y)
endif
if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, GetPlayerNameColored(p)+S+GetPlayerColorS(p)+GetUnitName(Hero)+"|r.")
endif
call SetPlayerAlliance(Player(15),p,ALLIANCE_SHARED_CONTROL,false)
call SetPlayerAlliance(Player(15),p,ALLIANCE_SHARED_VISION,false)
set Heroes[id] = Hero
if CreatedHeroTrigger != null then
set bj_lastCreatedUnit = Hero
if TriggerEvaluate(CreatedHeroTrigger) then
call TriggerExecute(CreatedHeroTrigger)
endif
endif
if not DoubleHeroes then
if RemoveChosen then
call RemoveUnit(u) // please don't bug :)
else
call UnitAddAbility(u,'Aloc')
call SetUnitVertexColor( u, 255, 255, 255, 127 )
call GroupRemoveUnit(SelectableHeroes,u)
endif
endif
endfunction
private function GiveRandomHero takes player p, boolean forced returns nothing
if CountUnitsInGroup(SelectableHeroes)<=0 then
call BJDebugMsg("HSS Error: "+GetPlayerNameColored(p)+" |cffff0000will not recieve a hero because there are none left to give.")
return
endif
if forced then
set S = " has been forced into the "
else
set S = " has randomed the "
endif
set Hero = GroupPickRandomUnit(SelectableHeroes)
call CreateHero(Hero,p)
set S = " has chosen the "
endfunction
private function GiveComputerHero takes player p returns nothing
if MaxCompTime>TimeLimit then
call PolledWait(GetRandomReal(2.,TimeLimit-1.))
call BJDebugMsg("HSS Error: |cffff0000Your TimeLimit is lower then your MaxCompTime.")
else
call PolledWait(GetRandomReal(2.,MaxCompTime))
endif
call GiveRandomHero(p,false)
endfunction
private function GiveAllRandomHeroes takes nothing returns nothing
local integer i = 0
loop
exitwhen i>Players
if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and (CompHeroes or GetPlayerController(Player(i))!=MAP_CONTROL_COMPUTER) then
call GiveRandomHero(Player(i),false)
endif
call TriggerSleepAction(0.)
set i = i + 1
endloop
call Cleaner()
endfunction
private function Sold takes nothing returns nothing
set bj_ghoul[55] = GetSoldUnit()
if GetUnitTypeId(bj_ghoul[55])==ChooseHeroUnitId then
call CreateHero(GetSellingUnit(),GetOwningPlayer(bj_ghoul[55]))
else
call GiveRandomHero(GetOwningPlayer(bj_ghoul[55]),false)
endif
call RemoveUnit(bj_ghoul[55])
endfunction
private function StopOrders takes nothing returns nothing
local integer id = GetIssuedOrderId()
set Hero = GetTriggerUnit()
if id == 851972 or id == ChooseHeroOrder or id == RandomHeroOrder then
return
endif
call DisableTrigger(Orders)
call PauseUnit( Hero, true)
call IssueImmediateOrder( Hero, "stop" )
call PauseUnit( Hero, false)
call EnableTrigger(Orders)
endfunction
private function FilterHeroes takes nothing returns boolean
return IsUnitType(GetFilterUnit() , UNIT_TYPE_HERO)
endfunction
private function SetupHeroes takes nothing returns nothing
set Hero = GetEnumUnit()
call UnitRemoveAbility(Hero, 'Amov')
call UnitAddAbility(Hero, 'Abun')
call UnitAddAbility(Hero,'Asud')
call AddUnitToStock(Hero, ChooseHeroUnitId,1,1)
if RandomHeroUnitId > 0 then
call AddUnitToStock(Hero, RandomHeroUnitId,1,1)
endif
call SetUnitInvulnerable(Hero,true)
call TriggerRegisterUnitEvent(Sell,Hero,EVENT_UNIT_SELL)
call TriggerRegisterUnitEvent( Orders, Hero, EVENT_UNIT_ISSUED_TARGET_ORDER )
call TriggerRegisterUnitEvent( Orders, Hero, EVENT_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterUnitEvent( Orders, Hero, EVENT_UNIT_ISSUED_ORDER )
endfunction
public function Start takes nothing returns nothing
local integer i = 0
local integer j = 0
local real x
local real y
local timer t = null
local timerdialog td
set Players = GetPlayers() - 1
call GroupEnumUnitsOfPlayer(SelectableHeroes,Player(15) , Condition(function FilterHeroes))
if IsMapFlagSet(MAP_RANDOM_HERO) then
call GiveAllRandomHeroes()
return
endif
call TriggerAddAction(Sell,function Sold)
call TriggerAddAction(Orders,function StopOrders)
call ForGroup(SelectableHeroes,function SetupHeroes)
loop
exitwhen i > Players
set x = GetRectCenterX(HeroSelection[i])
set y = GetRectCenterY(HeroSelection[i])
call SetPlayerAlliance(Player(15),Player(i),ALLIANCE_SHARED_CONTROL,true)
call SetPlayerAlliance(Player(15),Player(i),ALLIANCE_SHARED_VISION,true)
if GetLocalPlayer()==Player(i) then
call SetCameraPosition(x,y)
endif
if CompHeroes and GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i))==MAP_CONTROL_COMPUTER then
call GiveComputerHero.execute(Player(i))
endif
set i = i + 1
endloop
if TimeLimit>0. then
set t = CreateTimer()
call TimerStart(t,TimeLimit,false,null)
set td = CreateTimerDialog(t)
call TimerDialogSetTitle(td,DialogTitle)
call TriggerSleepAction(0.)
call TimerDialogDisplay(td,true)
endif
loop
set i = 0
set j = 0
loop
exitwhen i > Players
if Heroes[i]==null and GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and (CompHeroes or GetPlayerController(Player(i))!=MAP_CONTROL_COMPUTER) then
if t!=null and TimerGetRemaining(t)<=.1 then
call GiveRandomHero(Player(i),true)
endif
set j = j + 1
elseif GetLocalPlayer()==Player(i) then
call TimerDialogDisplay(td,false)
endif
set i = i + 1
endloop
exitwhen j<=0
if CountUnitsInGroup(SelectableHeroes)<=0 then
call BJDebugMsg("HSS Error: |cffff0000There are no more heroes left to select.")
exitwhen true
endif
call TriggerSleepAction(0.)
endloop
if t!=null then
call DestroyTimer(t)
call DestroyTimerDialog(td)
set t = null
set td = null
endif
call Cleaner()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HSSSetup
//=====HSS 1.30b=====\\
globals
// This trigger can be referred to as HSSSetup_Trigger publically
// I have this as running after 0.0s, but you can execute it when you want, or change the time length to your liking (among other things)
public trigger Trigger = CreateTrigger()
endglobals
private function Actions takes nothing returns nothing
// Get total players in your map, but in JASS players start at 0, so subtract 1
local integer i = GetPlayers() - 1
// Loop through players in map, setting up their hero selection rects and hero creation locs
loop
exitwhen i < 0
// This is the rect where this player can choose heroes from
set HSS_HeroSelection[i] = gg_rct_Hero_Tavern
// This is the loc where this players heroes will be created once chosen
set HSS_HeroCreation[i] = GetStartLocationLoc(GetPlayerStartLocation(Player(i)))
set i = i - 1
endloop
// Store the trigger to be ran when a hero is created
set HSS_CreatedHeroTrigger = gg_trg_PostHeroCreation
// Start the selection system
call HSS_Start()
// Clean leak
call DestroyTrigger(Trigger)
set Trigger = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
call TriggerAddAction( Trigger, function Actions )
// Length in time after game starts that we want to start the HSS
call TriggerRegisterTimerEvent(Trigger,0.0,false)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function PostHeroCreation_Actions takes nothing returns nothing
local player p = GetOwningPlayer(bj_lastCreatedUnit)
// If its a computer hero, starts AI for it
if GetPlayerController(p)==MAP_CONTROL_COMPUTER then
//call StartMeleeAI(p, "war3mapImported\\Rex.ai" )
call SetPlayerHandicapXPBJ(p, 120.00 )
endif
// Create neat creation effect
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",bj_lastCreatedUnit,"origin"))
// Make arena visible to player
//set bj_lastCreatedFogModifier = CreateFogModifierRect(p,FOG_OF_WAR_VISIBLE,gg_rct_Arena,false,false)
//call FogModifierStart(bj_lastCreatedFogModifier)
endfunction
//===========================================================================
function InitTrig_PostHeroCreation takes nothing returns nothing
set gg_trg_PostHeroCreation = CreateTrigger( )
call TriggerAddAction( gg_trg_PostHeroCreation, function PostHeroCreation_Actions )
endfunction
//TESH.scrollpos=19
//TESH.alwaysfold=0
library xebasic
//**************************************************************************
//
// xebasic 0.2
// =======
// XE_DUMMY_UNITID : Rawcode of the dummy unit in your map. It should
// use the dummy.mdx model, so remember to import it as
// well, just use copy&paste to copy the dummy from the
// xe map to yours, then change the rawcode.
//
// XE_HEIGHT_ENABLER: Medivh's raven form ability, you may need to change
// this rawcode to another spell that morphs into a flier
// in case you modified medivh's spell in your map.
//
// XE_TREE_RECOGNITION: The ancients' Eat tree ability, same as with medivh
// raven form, you might have to change it.
//
// XE_ANIMATION_PERIOD: The global period of animation used by whatever
// timer that depends on it, if you put a low value
// the movement will look good but it may hurt your
// performance, if instead you use a high value it
// will not lag but will be fast.
//
//**************************************************************************
globals
constant integer XE_DUMMY_UNITID = 'e001'
constant integer XE_HEIGHT_ENABLER = 'Amrf'
constant integer XE_TREE_RECOGNITION = 'Aeat'
constant real XE_ANIMATION_PERIOD = 0.025
constant real XE_MAX_COLLISION_SIZE = 100.0
endglobals
endlibrary
//TESH.scrollpos=159
//TESH.alwaysfold=0
library xecast initializer init requires xebasic
//************************************************************************
// xecast 0.2
// ------
// Because dummy casters REALLY ARE this complicated!
//
//************************************************************************
//===========================================================================================================
globals
private constant integer MAXINSTANCES = 8190 //this is a lot, unless you leak xecast objects
private constant integer INITIAL_DUMMY_COUNT = 12
private constant integer DUMMY_STACK_LIMIT = 50 //don't allow to keep more than DUMMY_STACK_LIMIT innactive dummy units
endglobals
//=========================================================================
// Please notice all textmacros in this library are considered private.
// in other words: DON'T RUN THOSE TEXTMACROS!
//
private keyword structinit
globals
private real EPSILON=0.001 //noticed in war3 this is the sort of precision we want...
endglobals
struct xecast[MAXINSTANCES]
public integer abilityid = 0 //ID (rawcode) of the ability to cast
public integer level = 1 //Level of the ability to cast
public real recycledelay = 0.0 //Please notice, some spells need a recycle delay
// This is, a time period before they get recycle.
// For example, some spells are not instant, there is
// also the problem with damaging spells, this recycle
// delay must be large enough to contain all the time
// in which the spell can do damage.
public player owningplayer=Player(15) //which player to credit for the ability cast?
//notice this can also affect what units are targeteable
//==================================================================================================
// You need an order id for the ability so the dummy unit is able to cast it, two ways to assign it
// set instance.orderid = 288883 //would assign an integer orderid
// set instance.orderstring = "chainlightning" //would assign an orderstring
// (as those in the object editor)
//
method operator orderid= takes integer v returns nothing
set .oid=v
endmethod
method operator orderstring= takes string s returns nothing
set .oid=OrderId(s)
endmethod
//=================================================================================================
// Finally, you can determine from which point to cast the ability: z is the height coordinate.
//
public boolean customsource=false //Use a custom casting source?
public real sourcex // Determine the casting source for the dummy spell, require customsource =true
public real sourcey // You might prefer to use the setSourcePoint method
public real sourcez=0.0 //
method setSourcePoint takes real x, real y, real z returns nothing
set .sourcex=x
set .sourcey=y
set .sourcez=z
set .customsource=true
endmethod
method setSourceLoc takes location loc, real z returns nothing
set .sourcex=GetLocationX(loc)
set .sourcey=GetLocationY(loc)
set .sourcez=z
set .customsource=true
endmethod
private boolean autodestroy = false
//========================================================================================================
// you are always allowed to use .create() but you can also use createBasic which sets some things that
// are usually necessary up.
//
public static method createBasic takes integer abilityID, integer orderid, player owner returns xecast
local xecast r=xecast.allocate()
if(r==0) then
debug call BJDebugMsg("Warning: unbelievable but you actually used all xecast instances in your map! Please make sure you are not forgetting to destroy those what you create intensively, if that's not the case, then you'll have to increase xecast MAXINSTANCES")
endif
set r.oid=orderid
set r.abilityid=abilityID
set r.owningplayer=owner
return r
endmethod
//========================================================================================================
// Just like the above one, but the instance will self destruct after a call to any cast method
// (recommended)
//
public static method createBasicA takes integer abilityID, integer orderid, player owner returns xecast
local xecast r=xecast.allocate()
if(r==0) then
debug call BJDebugMsg("Warning: unbelievable but you actually used all xecast instances in your map! Please make sure you are not forgetting to destroy those what you create intensively, if that's not the case, then you'll have to increase xecast MAXINSTANCES")
endif
set r.oid=orderid
set r.abilityid=abilityID
set r.owningplayer=owner
set r.autodestroy=true
return r
endmethod
//==========================================================================================================
// Just like create, but the struct instance self destructs after a call to any cast method
// (Recommended)
//
public static method createA takes nothing returns xecast
local xecast r=xecast.allocate()
set r.autodestroy=true
return r
endmethod
//==========================================================================================================
// So, create the dummy, assign options and cast the skill!
// .castOnTarget(w) : If you want to hit a widget w with the ability
// .castOnPoint(x,y) : If you want to hit a point (x,y) with the ability
// .castInPoint(x,y) : For spells like warstomp which do not have a target.
// .castOnAOE(x,y,radius) : Classic area of effect cast. Considers collision size
// .castOnGroup(g) : Cast unit the unit group g, notice it will empty the group yet not destroy it.
//
//**********************************************************************************************************
// The implementation of such methods follows:
private static unit array dummystack
private static integer top=0
private static unit instantdummy
private integer oid=0
private static timer gametime
private static timer T
private static unit array recycle
private static real array expiretime
private static integer rn=0
//==========================================================================================================
// private dorecycle method, sorry but I need this up here.
//
private static method dorecycle takes nothing returns nothing
local unit u =.recycle[0]
local integer l
local integer r
local integer p
local real lt
call UnitRemoveAbility(u,GetUnitUserData(u))
call SetUnitFlyHeight(u,0,0)
if(.top==DUMMY_STACK_LIMIT) then
call RemoveUnit(u)
else
set .dummystack[.top]=u
set .top=.top+1
endif
set .rn=.rn-1
if(.rn==0) then
return
endif
set p=0
set lt=.expiretime[.rn]
loop
set l=p*2+1
exitwhen l>=.rn
set r=p*2+2
if(r>=.rn)then
if(.expiretime[l]<lt) then
set .expiretime[p]=.expiretime[l]
set .recycle[p]=.recycle[l]
set p=l
else
exitwhen true
endif
elseif (lt<=.expiretime[l]) and (lt<=.expiretime[r]) then
exitwhen true
elseif (.expiretime[l]<.expiretime[r]) then
set .expiretime[p]=.expiretime[l]
set .recycle[p]=.recycle[l]
set p=l
else
set .expiretime[p]=.expiretime[r]
set .recycle[p]=.recycle[r]
set p=r
endif
endloop
set .recycle[p]=.recycle[.rn]
set .expiretime[p]=lt
call TimerStart(.T, .expiretime[0]-TimerGetElapsed(.gametime), false, function xecast.dorecycle)
endmethod
private static trigger abilityRemove
// Repetitive process and no inline implemented for large functions, so for now it is a textmacro:
//! textmacro xecast_allocdummy
if(.recycledelay<EPSILON) then
set dummy=.instantdummy
call SetUnitOwner(dummy,.owningplayer,false)
elseif (.top>0) then
set .top=.top-1
set dummy=.dummystack[.top]
call SetUnitOwner(dummy,.owningplayer,false)
else
set dummy=CreateUnit(.owningplayer,XE_DUMMY_UNITID,0,0,0)
call TriggerRegisterUnitEvent(.abilityRemove,dummy,EVENT_UNIT_SPELL_ENDCAST)
call UnitAddAbility(dummy,'Aloc')
call UnitAddAbility(dummy,XE_HEIGHT_ENABLER)
call UnitRemoveAbility(dummy,XE_HEIGHT_ENABLER)
endif
call UnitAddAbility(dummy,.abilityid)
if(.level>1) then
call SetUnitAbilityLevel(dummy,.abilityid,.level)
endif
//! endtextmacro
private static integer cparent
private static integer current
private static real cexpire
//! textmacro xecast_deallocdummy
if(.recycledelay>=EPSILON) then
set .cexpire=TimerGetElapsed(.gametime)+.recycledelay
set .current=.rn
set .rn=.rn+1
loop
exitwhen (.current==0)
set .cparent=(.current-1)/2
exitwhen (.expiretime[.cparent]<=.cexpire)
set .recycle[.current]=.recycle[.cparent]
set .expiretime[.current]=.expiretime[.cparent]
set .current=.cparent
endloop
set .expiretime[.current]=.cexpire
set .recycle[.current]=dummy
call SetUnitUserData(dummy,.abilityid)
call TimerStart(.T, .expiretime[0]-TimerGetElapsed(.gametime), false, function xecast.dorecycle)
else
call SetUnitUserData(dummy,0)
call SetUnitFlyHeight(dummy,0,0)
call UnitRemoveAbility(dummy,.abilityid)
endif
//! endtextmacro
method castOnTarget takes widget target returns nothing
local unit dummy
//! runtextmacro xecast_allocdummy()
if (.customsource) then
call SetUnitX(dummy,.sourcex)
call SetUnitY(dummy,.sourcey)
call SetUnitFlyHeight(dummy,.sourcez,0.0)
else
call SetUnitX(dummy,GetWidgetX(target))
call SetUnitY(dummy,GetWidgetY(target))
endif
call IssueTargetOrderById(dummy,this.oid,target)
//! runtextmacro xecast_deallocdummy()
if(.autodestroy ) then
call this.destroy()
endif
endmethod
method castOnPoint takes real x, real y returns nothing
local unit dummy
//! runtextmacro xecast_allocdummy()
if (.customsource) then
call SetUnitX(dummy,.sourcex)
call SetUnitY(dummy,.sourcey)
call SetUnitFlyHeight(dummy,.sourcez,0.0)
else
call SetUnitX(dummy,x)
call SetUnitY(dummy,y)
endif
call IssuePointOrderById(dummy,this.oid,x,y)
//! runtextmacro xecast_deallocdummy()
if(.autodestroy ) then
call this.destroy()
endif
endmethod
method castOnLoc takes location loc returns nothing
//debug call BJDebugMsg("Warning: Locations are in use")
//nah but I should
call .castOnPoint(GetLocationX(loc),GetLocationY(loc))
endmethod
//ignores custom source x and y (for obvious reasons)
method castInPoint takes real x, real y returns nothing
local unit dummy
//! runtextmacro xecast_allocdummy()
if (.customsource) then
call SetUnitFlyHeight(dummy,.sourcez,0.0)
endif
call SetUnitX(dummy, x)
call SetUnitY(dummy, y)
call IssueImmediateOrderById(dummy,this.oid)
//! runtextmacro xecast_deallocdummy()
if(.autodestroy ) then
call this.destroy()
endif
endmethod
method castInLoc takes location loc returns nothing
//debug call BJDebugMsg("Warning: Locations are in use")
//nah but I should
call .castInPoint(GetLocationX(loc),GetLocationY(loc))
endmethod
//===================================================================================================
// For method castOnAOE:
//
private static group enumgroup
private static real aoex
private static real aoey
private static real aoeradius
private static xecast cinstance
private static boolexpr aoefunc
// Might look wrong, but this is the way to make it consider collision size, a spell that
// got a target circle and uses this method will let the user know which units it will
// hit with the mass cast.
static method filterAOE takes nothing returns boolean
local unit u=GetFilterUnit()
if IsUnitInRangeXY(u, .aoex, .aoey, .aoeradius) then
call .cinstance.castOnTarget(u)
endif
set u=null
return false
endmethod
//
method castOnAOE takes real x, real y, real radius returns nothing
set .aoex=x
set .aoey=y
set .aoeradius=radius
set .cinstance=this
call GroupEnumUnitsInRange(.enumgroup,x,y,radius + XE_MAX_COLLISION_SIZE , .aoefunc)
if(.autodestroy ) then
call this.destroy()
endif
endmethod
method castOnAOELoc takes location loc,real radius returns nothing
call .castOnAOE(GetLocationX(loc),GetLocationY(loc),radius)
endmethod
//==================================================================================================
// A quick and dirt castOnGroup method, perhaps it'll later have castOntarget inlined, but not now
//
method castOnGroup takes group g returns nothing
local unit t
loop
set t=FirstOfGroup(g)
exitwhen(t==null)
call GroupRemoveUnit(g,t)
call .castOnTarget(t)
endloop
if(.autodestroy ) then
call this.destroy()
endif
endmethod
private static method removeAbility takes nothing returns boolean
local unit u=GetTriggerUnit()
call UnitRemoveAbility(u, GetUnitUserData(u))
//This is necessary, picture a value for recycle delay that's higher than the casting time,
//for example if the spell does dps, if you leave the dummy caster with the ability and it
//is owned by an AI player it will start casting the ability on player units...
set u=null
return true
endmethod
//===================================================================================================
// structinit is a scope private keyword.
//
static method structinit takes nothing returns nothing
local integer i=INITIAL_DUMMY_COUNT+1
local unit u
set .aoefunc=Condition(function xecast.filterAOE)
set .enumgroup=CreateGroup()
set .abilityRemove = CreateTrigger()
loop
exitwhen (i==0)
set u=CreateUnit(Player(15),XE_DUMMY_UNITID,0,0,0)
call TriggerRegisterUnitEvent(.abilityRemove,u,EVENT_UNIT_SPELL_ENDCAST)
call UnitAddAbility(u,'Aloc')
call UnitAddAbility(u,XE_HEIGHT_ENABLER)
call UnitRemoveAbility(u,XE_HEIGHT_ENABLER)
set .dummystack[.top]=u
set .top=.top+1
set i=i-1
endloop
call TriggerAddCondition(.abilityRemove, Condition(function xecast.removeAbility ) )
set .top=.top-1
set .instantdummy=.dummystack[.top]
set .T=CreateTimer()
set .gametime=CreateTimer()
call TimerStart(.gametime,12*60*60,false,null)
endmethod
endstruct
private function init takes nothing returns nothing
call xecast.structinit()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library xepreload initializer init requires xebasic
//************************************************************************
// xepreload 0.3
// ---------
// Ah, the joy of preloading abilities, it is such a necessary evil...
// Notice you are not supposed to use this system in places outside map init
//
// This one does the preloading and tries to minimize the hit on loading time
// for example, it only needs one single native call per ability preloaded.
//
//************************************************************************
//===========================================================================================================
globals
private unit dum=null
endglobals
//inline friendly
function XE_PreloadAbility takes integer abilid returns nothing
call UnitAddAbility(dum, abilid)
endfunction
private function kill takes nothing returns nothing
call RemoveUnit(dum)
set dum=null
call DestroyTimer(GetExpiredTimer()) //I do hope this doesn't trigger the apocallypse. I didn't think
// it was a great idea to make this require a whole timer recycling
// system, so, just destroy. Anyone got a better idea on how to make
// this execute after all the other calls at init?
endfunction
private function init takes nothing returns nothing
set dum=CreateUnit(Player(15),XE_DUMMY_UNITID, 0,0,0)
call TimerStart(CreateTimer(),0.0,false,function kill)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HandleCounter
globals
//=====Config. Options=====\\
private constant string Title = "Handle Counter" // Title of your leaderboard
private constant string HandlesTitle = "Handles" // Text to display in handle count row
private constant string SecondsTitle = "Time (sec.)" // Text to display in time row
private constant integer Timeout = 1 // Interval to update at ( I recommend a whole number, or your time elapsed displayed could bug)
private constant player DisplayTo = Player(1) // What player to display the leaderboard to
private constant player Row1 = Player(1) // The time text will be displayed in this players color
private constant player Row2 = Player(0) // The handle count text will be displayed in this players color
private constant boolean Single_Only = true // Whether to display the Handle Counter leaderboard in single player only
//=====No Touching Past This Point!!!!=====\\
private trigger Trigger = CreateTrigger()
private leaderboard Lead = null
private integer Seconds = 0
private location L = null
endglobals
private function H2I takes handle h returns integer
return h
return 0
endfunction
private function HandleCounter_Conditions takes nothing returns boolean
return not Single_Only or bj_isSinglePlayer
endfunction
private function Update takes nothing returns nothing
set Seconds = Seconds + Timeout
call LeaderboardSetItemValue(Lead,0,Seconds)
set L = Location(5.,5.)
call LeaderboardSetItemValue(Lead,1,H2I(L)-0x100000)
call RemoveLocation(L)
endfunction
private function HandleCounter_Actions takes nothing returns nothing
call DestroyTrigger(Trigger)
set Trigger = CreateTrigger()
call TriggerRegisterTimerEvent(Trigger,Timeout,true)
call TriggerAddAction(Trigger,function Update)
set Lead = CreateLeaderboard()
call LeaderboardSetLabel(Lead, Title)
call PlayerSetLeaderboard(DisplayTo,Lead)
call LeaderboardDisplay(Lead,true)
call LeaderboardAddItem(Lead,SecondsTitle,Seconds,Row1)
call LeaderboardAddItem(Lead,HandlesTitle,0,Row2)
call LeaderboardSetSizeByItemCount(Lead,2)
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
call TriggerRegisterTimerEvent(Trigger,.001,false)
call TriggerAddCondition(Trigger,Condition(function HandleCounter_Conditions))
call TriggerAddAction( Trigger, function HandleCounter_Actions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library_once TimerUtils initializer redInit
//*********************************************************************
//* TimerUtils (Red flavor)
//* ----------
//*
//* 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.wc3campaigns.net
//*
//* For your timer needs:
//* * Attaching
//* * Recycling (with double-free protection)
//*
//* set t=NewTimer() : Get a timer (alternative to CreateTimer)
//* 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.
//*
//* Red flavor: Fastest, method in existence for timer attaching,
//* only takes an array lookup, H2I and subtraction.
//* However, all the code in your map requires extra care
//* not to forget to call ReleaseTimer. It also requires
//* to preload a lot of timers at map init, they use
//* memory and handle ids.
//*
//********************************************************************
//================================================================
globals
private constant integer QUANTITY = 256
private constant integer ARRAY_SIZE = 8191 //changing this to a higher value would effectively
//cripple the performance making this thing irrelevant
endglobals
//=================================================================================================
private function H2I takes handle h returns integer
return h
return 0
endfunction
//==================================================================================================
globals
private integer array data[ARRAY_SIZE]
private integer OFFSET
endglobals
//It is dependent on jasshelper's recent inlining optimization in order to perform correctly.
function SetTimerData takes timer t, integer value returns nothing
debug if(H2I(t)-OFFSET<0) then
debug call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
debug endif
set data[H2I(t)-OFFSET]=value
endfunction
function GetTimerData takes timer t returns integer
debug if(H2I(t)-OFFSET<0) then
debug call BJDebugMsg("GetTimerData: Wrong handle id, only use GetTimerData on timers created by NewTimer")
debug endif
return data[H2I(t)-OFFSET]
endfunction
//==========================================================================================
globals
private timer array tT
private integer tN = 0
private constant integer HELD=0x28829022
//use a totally random number here, the more improbable someone uses it, the better.
endglobals
//==========================================================================================
function NewTimer takes nothing returns timer
if (tN==0) then
//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, please increase it for your map, fix your map's timer leaks or switch to blue flavor when applicable")
set tT[0]=CreateTimer()
if (H2I(tT[0])-OFFSET<0) or (H2I(tT[0])-OFFSET>=ARRAY_SIZE) then
//all right, couldn't fix it
call BJDebugMsg("NewTimer: Unable to allocate a timer, you should probably switch to the blue flavor or fix timer leaks.")
return null
endif
else
set tN=tN-1
endif
call SetTimerData(tT[tN],0)
return tT[tN]
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==8191) 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 redInit takes nothing returns nothing
local integer i
local integer last
local boolean correct
loop
set tT[0] = CreateTimer()
set OFFSET=H2I(tT[0] )
set i=1
set correct=true
loop
exitwhen (i==QUANTITY)
set tT[i] = CreateTimer()
if(H2I(tT[i])-OFFSET<0) or (H2I(tT[i])-OFFSET>=ARRAY_SIZE) then
debug call BJDebugMsg("TimerUtils_redInit: Failed a initializing attempt")
set correct=false
exitwhen true
endif
set i=i+1
endloop
exitwhen correct
endloop
set tN=QUANTITY
endfunction
endlibrary
//TESH.scrollpos=49
//TESH.alwaysfold=0
library BoundSentinel initializer init
//*************************************************
//* BoundSentinel
//* -------------
//* Don't leave your units unsupervised, naughty
//* them may try to get out of the map bounds and
//* crash your game.
//*
//* To implement, just get a vJass compiler and
//* copy this library/trigger to your map.
//*
//*************************************************
//==================================================
globals
// High enough so the unit is no longer visible, low enough so the
// game doesn't crash...
//
// I think you need 0.0 or soemthing negative prior to patch 1.22
//
private constant real EXTRA = 500.0
endglobals
//=========================================================================================
globals
private real maxx
private real maxy
private real minx
private real miny
endglobals
//=======================================================================
// So, maybe it would be good to inline the above function or something
// but I like readable...
//
private function dis takes nothing returns nothing
local unit u=GetTriggerUnit()
local real x=GetUnitX(u)
local real y=GetUnitY(u)
if(x>maxx) then
set x=maxx
elseif(x<minx) then
set x=minx
endif
if(y>maxy) then
set y=maxy
elseif(y<miny) then
set y=miny
endif
call SetUnitX(u,x)
call SetUnitY(u,y)
set u=null
endfunction
private function init takes nothing returns nothing
local trigger t=CreateTrigger()
local region r=CreateRegion()
//return
set minx=GetCameraBoundMinX()-GetCameraMargin(CAMERA_MARGIN_LEFT) - EXTRA
set miny=GetCameraBoundMinY()-GetCameraMargin(CAMERA_MARGIN_BOTTOM) - EXTRA
set maxx=GetCameraBoundMaxX()+GetCameraMargin(CAMERA_MARGIN_RIGHT) + EXTRA
set maxy=GetCameraBoundMaxY()+GetCameraMargin(CAMERA_MARGIN_TOP) + EXTRA
call RegionAddRect(r, Rect(minx,miny,maxx,maxy))
call TriggerRegisterLeaveRegion(t,r, null)
call TriggerAddAction(t, function dis)
//this is not necessary but I'll do it anyway:
set t=null
set r=null
endfunction
endlibrary
//TESH.scrollpos=33
//TESH.alwaysfold=0
xecast
------
This one solves typical problems that require dummy casters. Things like the
AOE sleep, targetted warstomp, etc. It is object oriented, this just means that
you'll actually not just call functions but deal with xecast objects, change
their attributes and then order them to cast. It deals with the dirty things
like recycling and dealing with timing, etc.
implementation
--------------
Just copy the xecast trigger to your map.
xecast object
-------------
__________________________________________________________________________________________________
static method create takes nothing returns nothing
- ------
This is the create method, it will make a new xecast object for you to use:
set somevariable = xecast.create()
_________________________________________________________________________________________________
static method createBasic takes integer abilityID, integer orderid, player owner returns xecast
- - - - - - - - - - - -
An abbreviated constructor, allows you to quickly set the basic attributes
abilityID: the rawcode of the ability to cast.
Example: 'AHbz'
orderid : the orderid (integer) of the ability to cast.
Example: OrderId("blizzard")
owner : the owning player for this cast object (The one that gets credit for damage)
Example: ( GetOwningPlayer(GetTriggerUnit() ))
_________________________________________________________________________________________________
method destroy takes nothing returns nothing
-
Call destroy() on instances you are not going to use anymore, to prevent struct leaks that would
break your map. A simple use for xecast is to just keep one instance per dummy spell to prevent
having to care about destroying them. Another possibility is to use the A constructors.
Example: call somevariable.destroy()
__________________________________________________________________________________________________
static method createA takes nothing returns nothing
static method createBasicA takes integer abilityID, integer orderid, player owner returns xecast
-
These do the same as createA and createBasicA , the only difference is that the
object is destroyed automatically after every call to a cast method (See bellow).
_____________________________________________________________________________________________________
method castOnTarget takes widget target returns nothing
-
Tells the xecast object to cast its spell on the target. target may be unit, item or destructable.
_____________________________________________________________________________________________________
method castOnPoint takes real x, real y returns nothing
method castOnLoc takes location loc returns nothing
method castInPoint takes real x, real y returns nothing
method castInLoc takes location loc returns nothing
- -----------------------------------------------
Instead of casting on a target unit/item/destructable these ones cast on a target point. OnPoint is
used for point-targeteable spells, while InPoint is used for spells that have no target. The Loc
versions allow you to use locations. Locations are useless most of the times, but if you want to use
them you can use the Loc versions.
Example: call somevar.castOnPoint( spellx, spelly )
_____________________________________________________________________________________________________
method castOnAOE takes real x, real y, real radius returns nothing
method castOnAOELoc takes location loc,real radius returns nothing
method castOnGroup takes group g returns nothing
- ---------------------------------------------------
Methods to cast the spell on multiple units, AOE takes a circle's center and radius, while Group
takes a unit group, notice that the unit group will get cleaned after calling this function, which
means it will be an empty unit group, no, it does not destroy the group automatically, just empties it
* List of attributes *
________________________________________________________________________________
integer abilityid
----
This one holds the ability to cast's ability Id.
Example: set somevar.abilityid='AHbz'
________________________________________________________________________________
integer level
----
The level of the ability to cast.
Example: set somevar.level = GetUnitAbilityLevel(u, spellid)
________________________________________________________________________________
real recycledelay
----
The recycle delay is the time to wait before recycling the dummy caster, if
it is 0.0 the ability will be considered instant.
A proper recycle delay is important since when a dummy caster is recycled
its owner becomes player passive. Every damage done by the casted spell will
not credit the correct player.
Some other spells need some time in order to cast correctly. Not to mention
the channeling ones that require the caster to last during that situation.
Example: set somevar.recycledelay=10.0
________________________________________________________________________________
player owningplayer
----
The player that owns the spell (Who gets credited for it)
Example: set somevar.owningplayer = Player(2)
________________________________________________________________________________
integer orderid (write-only)
----
The ability to cast's order id. eg 858029 or OrderId("blizzard")
________________________________________________________________________________
string orderstring (write-only)
----
The ability to cast's order string (eg "blizzard")
________________________________________________________________________________
boolean customsource
----
false by default, determines if you want the dummy caster to be placed at
a specific point when casting, this allows you to exploit blizz spell's eye
candy. Once customsource is true, you need to set sourcex,sourcey and
sourcez.
________________________________________________________________________________
real sourcex, sourcey, sourcez
----
The coordinates where you want to place the dummy caster, z is height and
is 0.0 by default. These are ignored if customsource is set to false.
________________________________________________________________________________
method setSourcePoint takes real x, real y, real z returns nothing
method setSourceLoc takes location loc, real z returns nothing
----
In case setting all that stuff manually takes too much lines for your taste
you can use these methods to set those values, they will automatically set
customsource to true.
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Revive_Creeps_Actions takes nothing returns nothing
local integer CUSTOM
set CUSTOM = GetUnitUserData(GetDyingUnit())
call TriggerSleepAction( udg_Creep_Revive_Time )
call CreateNUnitsAtLoc( 1, udg_Creep_Types[CUSTOM], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Positions[CUSTOM], bj_UNIT_FACING )
call SetUnitUserData( GetLastCreatedUnit(), CUSTOM )
endfunction
//===========================================================================
function InitTrig_Revive_Creeps takes nothing returns nothing
set gg_trg_Revive_Creeps = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Revive_Creeps, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Revive_Creeps, function Trig_Revive_Creeps_Actions )
endfunction
//TESH.scrollpos=18
//TESH.alwaysfold=0
function Trig_Combine_Items_Conditions takes nothing returns boolean
if ( not ( GetItemCharges(GetManipulatedItem()) > 0 ) ) then
return false
endif
return true
endfunction
function Trig_Combine_Items_Actions takes nothing returns nothing
local integer ITEMCOUNT
local integer ITEMLOOP
local integer CHARGES
local integer MAXIMUM
local item NEWITEM
local unit OURUNIT
set MAXIMUM = 25
set ITEMCOUNT = 0
set ITEMLOOP = 0
set CHARGES = 0
set NEWITEM = GetManipulatedItem()
set OURUNIT = GetManipulatingUnit()
loop
exitwhen ITEMLOOP > 6
if ((GetItemTypeId(NEWITEM)) == (GetItemTypeId(UnitItemInSlotBJ(OURUNIT, ITEMLOOP)))) then
if ((GetItemCharges(UnitItemInSlotBJ(OURUNIT, ITEMLOOP)) + GetItemCharges(NEWITEM)) <= MAXIMUM) then
if not ( (UnitItemInSlotBJ(OURUNIT, ITEMLOOP)) == (NEWITEM)) then
set CHARGES = (GetItemCharges(UnitItemInSlotBJ(OURUNIT, ITEMLOOP))) + GetItemCharges(NEWITEM)
call SetItemCharges( UnitItemInSlotBJ(OURUNIT, ITEMLOOP), CHARGES )
call RemoveItem( NEWITEM )
set ITEMLOOP=7
endif
endif
endif
if ( ITEMLOOP < 7 ) then
set ITEMLOOP = ITEMLOOP + 1
endif
endloop
endfunction
//===========================================================================
function InitTrig_Combine_Items takes nothing returns nothing
set gg_trg_Combine_Items = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Combine_Items, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Combine_Items, Condition( function Trig_Combine_Items_Conditions ) )
call TriggerAddAction( gg_trg_Combine_Items, function Trig_Combine_Items_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope GlideCloak
//***************************************************
globals
private unit caster
private constant integer AbilityID = 'A070'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID and GetUnitTypeId(GetTriggerUnit()) != 'N00H'
endfunction
private function callback takes nothing returns nothing
local timer t=GetExpiredTimer()
call SetUnitPathing(caster, true)
call SetUnitVertexColorBJ(caster, 100, 100, 100, 0)
call ReleaseTimer(t)
endfunction
private function action takes nothing returns nothing
local timer t=NewTimer()
local integer il = GetUnitAbilityLevel(GetTriggerUnit(), AbilityID)
set caster = GetTriggerUnit()
call SetUnitPathing(caster, false)
call SetUnitVertexColorBJ(caster, 100, 100, 100, 80)
call TimerStart(t,6,false,function callback)
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope PiercingHowl
//***************************************************
globals
private constant integer AbilityID = 'A03H'
private constant integer DummyAbilityID = 'A033'
private constant string OrderID = "silence"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.createA()
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local real x = GetUnitX(c)
local real y = GetUnitY(c)
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call PolledWait(0.40)
call xc.castOnPoint(x,y)
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition) )
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope SealOfLight
//***************************************************
globals
private constant integer AbilityID = 'ANbr'
private constant integer BuffID = 'B01C'
private constant integer CasterID = 'Hpal'
private constant string EffectPath = "Abilities\\Spells\\Undead\\VampiricAura\\VampiricAuraTarget.mdl"
private constant string EffectLocal = "origin"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) ==CasterID and GetUnitAbilityLevel(GetAttacker(), BuffID) >0
endfunction
private function action takes nothing returns nothing
local unit c = GetAttacker()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local integer ic = 10
local integer ir = GetRandomInt(1,100)
local real heal = (30+(il*30))
if ir<=ic then
call SetWidgetLife(c, GetWidgetLife(c) + heal)
call DestroyEffect(AddSpecialEffectTarget(EffectPath, c, EffectLocal))
endif
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=19
//TESH.alwaysfold=0
scope BlessingOfMight
//***************************************************
globals
private constant integer AbilityID = 'A01I'
private boolexpr CheckGroup = null
private constant integer DummyAbilityID = 'A035'
private constant string OrderID = "innerfire"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function check takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) and IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit()))
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local group g = CreateGroup()
set g = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function check))
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnGroup(g)
call GroupClear(g)
call DestroyGroup(g)
call xc.destroy()
set g=null
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
set CheckGroup = Condition(function check)
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope Intercept
//***************************************************
globals
private constant integer AbilityID = 'ACfb'
private constant integer DummyAbilityID = 'A03U'
private constant string DummyOrder = "thunderbolt"
private constant string EffectPath = "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl"
private constant string EffectLocal = "overhead"
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
endglobals
//****************************************************
//=========================
//Intercept
//=========================
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local location loc1 = GetUnitLoc(c)
local location loc2 = GetUnitLoc(t)
local integer damage = 40 * GetUnitAbilityLevel(c, AbilityID)
local real ra = AngleBetweenPoints(loc1, loc2)
set ra = (ra+180.)
call SetUnitFacingToFaceUnitTimed(c, t, 0.00)
call DestroyEffect(AddSpecialEffectTarget(EffectPath, c, EffectLocal))
call PlaySoundOnUnitBJ(gg_snd_InvisibilityTarget, 100, c)
call CasterCastAbility(GetOwningPlayer(c), DummyAbilityID, DummyOrder, t, true)
call SetUnitPositionLocFacingLocBJ(c, PolarProjectionBJ(loc2, 100.00, ra), loc2)
call UnitDamageTarget(c, t, damage, false, false, AttackType, DamageType, null)
call IssueTargetOrder(c, "attack", t)
call PolledWait(0.50)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1 = null
set loc2 = null
set c = null
set t = null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=16
//TESH.alwaysfold=0
scope Vigor
//***************************************************
globals
private constant integer AbilityID = 'A000'
private unit caster
private real bonus
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function callback takes nothing returns nothing
local timer t=GetExpiredTimer()
call ModifyHeroStat( bj_HEROSTAT_STR, caster, bj_MODIFYMETHOD_SUB, R2I(bonus))
call ReleaseTimer(t)
endfunction
private function action takes nothing returns nothing
local timer t=NewTimer()
local integer il = GetUnitAbilityLevel(GetTriggerUnit(), AbilityID)
local integer str = GetHeroStr(GetTriggerUnit(), true)
set bonus = (str*(0.05+(il*0.05)))
set caster = GetTriggerUnit()
call ModifyHeroStat( bj_HEROSTAT_STR, caster, bj_MODIFYMETHOD_ADD, R2I(bonus))
call TimerStart(t,25.,false,function callback)
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=11
//TESH.alwaysfold=0
scope JusticeSword
//***************************************************
globals
private constant integer AbilityID = 'AHtb'
private constant string EffectPath = "Abilities\\Spells\\Other\\HealingSpray\\HealBottleMissile.mdl"
private constant string EffectLocal = "weapon"
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local integer str = GetHeroStr(c, true)
local real dam
if il ==1 then
set dam = (1.5*str)
elseif il==2 then
set dam = (2*str)
elseif il==3 then
set dam = (2.5*str)
elseif il==4 then
set dam = (3*str)
endif
call UnitDamageTarget(c, t, dam, false, false, AttackType, DamageType, null)
call CreateTextTagUnitBJ("+" + I2S(R2I(dam)), c, 0, 12, 100, 0.00, 0.00, 2 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
set c = null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope Mightiness
//***************************************************
globals
private constant integer AbilityID = 'A00C'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetLearnedSkill() ==AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
call ModifyHeroStat( bj_HEROSTAT_STR, c, bj_MODIFYMETHOD_ADD, 15)
set c = null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition( Trig, Condition( function condition ) )
call TriggerAddAction( Trig, function action )
set Trig = null
endfunction
endscope
//TESH.scrollpos=36
//TESH.alwaysfold=0
scope Starfall
//***************************************************
globals
private unit caster
private real damage
private group g = CreateGroup()
private boolexpr CheckGroup = null
private constant integer AbilityID = 'A04N'
private constant integer DummyAbilityID = 'A04O'
private constant string OrderID = "cripple"
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_MAGIC
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function check takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit()))
endfunction
private function fire takes nothing returns nothing
call UnitDamageTarget(caster, GetEnumUnit(), damage, false, false, AttackType, DamageType, null)
call GroupClear(g)
call DestroyGroup(g)
set g=null
endfunction
private function callback takes nothing returns nothing
local timer t=GetExpiredTimer()
call ForGroup(g, function fire)
call ReleaseTimer(t)
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local timer t=NewTimer()
set caster = GetTriggerUnit()
set damage = (200*(GetUnitAbilityLevel(caster, AbilityID)))
set g = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function check))
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(caster, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(caster)
call xc.castOnGroup(g)
call xc.destroy()
call TimerStart(t,1,false,function callback)
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
set CheckGroup = Condition(function check)
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=13
//TESH.alwaysfold=0
scope CheapShot
//***************************************************
globals
private constant integer AbilityID = 'A01L'
private constant integer DummyAbilityID = 'A01T'
private constant string OrderID = "thunderbolt"
private constant integer BuffID = 'B006'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
if GetUnitAbilityLevel(c, BuffID) > 0 then
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnTarget(t)
call UnitRemoveAbility(c, BuffID)
endif
call xc.destroy()
set c=null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( Trig, Condition( function condition ) )
call TriggerAddAction( Trig, function action )
set Trig = null
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope Stealth
//***************************************************
globals
private constant integer AbilityID = 'A01W'
private constant integer DummyAbilityID = 'A01M'
private constant string OrderID = "cripple"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnTarget(c)
call xc.destroy()
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( Trig, Condition( function condition ) )
call TriggerAddAction( Trig, function action )
set Trig = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CoupDeGrace
//***************************************************
globals
private constant integer AbilityID = 'A01X'
private constant integer CasterID = 'E000'
private constant string EffectPath = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
private constant string EffectLocal = "head"
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) ==CasterID and GetUnitAbilityLevel(GetAttacker(), AbilityID) >0
endfunction
private function action takes nothing returns nothing
local unit c = GetAttacker()
local unit t = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local integer ic = 15
local integer ir = GetRandomInt(1,100)
local real hp = GetUnitStateSwap(UNIT_STATE_LIFE, t)
if ir<=ic and il==1 and hp<=200 then
call SetUnitAnimationWithRarity(c, "attack", RARITY_RARE)
call PlaySoundOnUnitBJ( gg_snd_Hail, 100, c)
call DestroyEffect(AddSpecialEffectTarget(EffectPath, t, EffectLocal))
call UnitDamageTarget(c, t, 99999, false, false, AttackType, DamageType, null)
call CreateTextTagUnitBJ("Hail", c, 0, 12, 100.00, 100.00, 0.00, 2.00 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
elseif ir<=ic and il==2 and hp<=280 then
call SetUnitAnimationWithRarity(c, "attack", RARITY_RARE)
call PlaySoundOnUnitBJ( gg_snd_Hail, 100, c)
call DestroyEffect(AddSpecialEffectTarget(EffectPath, t, EffectLocal))
call UnitDamageTarget(c, t, 99999, false, false, AttackType, DamageType, null)
call CreateTextTagUnitBJ("Hail", c, 0, 12, 100.00, 100.00, 0.00, 2.00 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
elseif ir<=ic and il==3 and hp<=400 then
call SetUnitAnimationWithRarity(c, "attack", RARITY_RARE)
call PlaySoundOnUnitBJ( gg_snd_Hail, 100, c)
call DestroyEffect(AddSpecialEffectTarget(EffectPath, t, EffectLocal))
call UnitDamageTarget(c, t, 99999, false, false, AttackType, DamageType, null)
call CreateTextTagUnitBJ("Hail", c, 0, 12, 100.00, 100.00, 0.00, 2.00 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
endif
set c=null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope ConcussiveSting
//***************************************************
globals
private constant integer AbilityID = 'A00H'
private constant integer BuffID = 'B00F'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local unit u = GetSpellTargetUnit()
loop
exitwhen GetUnitAbilityLevel(u, BuffID) > 0
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
endloop
call SetUnitVertexColorBJ( u, 10.00, 100, 10.00, 10.00 )
loop
exitwhen GetUnitAbilityLevel(u, BuffID) == 0 or GetUnitStateSwap(UNIT_STATE_LIFE, u) == 0.00
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
endloop
call SetUnitVertexColorBJ( u, 100.00, 100, 100.00, 0.00 )
set u=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( Trig, Condition( function condition) )
call TriggerAddAction( Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope hunter
//***************************************************
globals
private constant integer AbilityID = 'A00K'
private constant integer DummyAbilityID = 'Ault'
private boolean elven = false
private integer level =0
private unit hunter
endglobals
//****************************************************
private function hide_act takes nothing returns nothing
if elven == true then
call SetUnitVertexColorBJ(hunter, 100, 100, 100, ( 28.00 * I2R(level) ) )
endif
endfunction
public function hide takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(Trig, 1.00 )
call TriggerAddAction( Trig, function hide_act )
set Trig=null
endfunction
private function camou_con takes nothing returns boolean
return GetLearnedSkill() ==AbilityID
endfunction
private function camou_act takes nothing returns nothing
set hunter = GetTriggerUnit()
set elven = true
set level = GetUnitAbilityLevel(hunter, AbilityID)
if GetUnitAbilityLevel(hunter, 'Ault') ==0 then
call UnitAddAbility(hunter, 'Ault')
endif
endfunction
public function camou takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( Trig, Condition( function camou_con ) )
call TriggerAddAction( Trig, function camou_act )
endfunction
endscope
function InitTrig_ElvenInstinct takes nothing returns nothing
call hunter_hide()
call hunter_camou()
endfunction
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope FlashHeal
//***************************************************
globals
private constant integer AbilityID = 'A02D'
private constant integer DummyAbilityID = 'A02E'
private constant string OrderID = "holybolt"
private unit tar_flashheal
private real x
private real y
private boolexpr flashheal_filter = null
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function check takes nothing returns boolean
return tar_flashheal !=GetFilterUnit()
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local group enemies = CreateGroup()
local unit t
local integer il = GetUnitAbilityLevel(c, AbilityID)
local integer ic = (2+il)
set tar_flashheal = GetSpellTargetUnit()
set x = GetUnitX(tar_flashheal)
set y = GetUnitY(tar_flashheal)
set xc.abilityid = DummyAbilityID
set xc.level = il
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call GroupEnumUnitsInRange(enemies, x, y, 600, flashheal_filter)
loop
set t = FirstOfGroup(enemies)
exitwhen t == null or ic == 0
call xc.castOnTarget(t)
set ic = ic - 1
call GroupRemoveUnit(enemies, t)
call PolledWait(0.20)
endloop
call DestroyGroup(enemies)
call xc.destroy()
set enemies=null
set tar_flashheal=null
set c =null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
set flashheal_filter = Condition(function check)
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition ) )
call TriggerAddAction(Trig, function action )
set Trig = null
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope DivineTouch
//***************************************************
globals
private constant integer AbilityID = 'A02H'
private unit cleric
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_DIVINE
private real heal
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function Checka takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and IsUnitAliveBJ(GetFilterUnit()) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)
endfunction
private function Checke takes nothing returns boolean
return not IsUnitAlly(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and IsUnitAliveBJ(GetFilterUnit()) and IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD)
endfunction
private function Heal takes nothing returns nothing
if GetUnitStateSwap(UNIT_STATE_LIFE, GetEnumUnit()) == GetUnitStateSwap(UNIT_STATE_MAX_LIFE, GetEnumUnit()) then
return
else
call SetWidgetLife(GetEnumUnit(), GetWidgetLife(GetEnumUnit()) + heal)
call UnitRemoveBuffs(GetEnumUnit(), false, true)
endif
endfunction
private function Dam takes nothing returns nothing
call UnitDamageTarget(cleric, GetEnumUnit(), heal, false, false, AttackType, DamageType, null)
call UnitRemoveBuffs(GetEnumUnit(), true, false)
endfunction
private function action takes nothing returns nothing
local real angle = 0.00
local location array loc_offset
local location loc = GetUnitLoc(GetTriggerUnit())
local group ga = CreateGroup()
local group ge = CreateGroup()
local integer il = GetUnitAbilityLevelSwapped(AbilityID, GetTriggerUnit())
set cleric = GetTriggerUnit()
set heal = (200*il)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 4
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set angle = ( angle + 50.00 )
set bj_forLoopBIndex = 1
set bj_forLoopBIndexEnd = 8
loop
exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
set loc_offset[GetForLoopIndexB()] = PolarProjectionBJ(loc, angle, ( 45.00 * I2R(GetForLoopIndexB()) ))
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", loc_offset[GetForLoopIndexB()]))
call RemoveLocation(loc_offset[bj_forLoopBIndex])
set loc_offset[bj_forLoopBIndex] =null
set bj_forLoopBIndex = bj_forLoopBIndex + 1
endloop
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation(loc)
set loc=null
set loc = GetUnitLoc(cleric)
set ga = GetUnitsInRangeOfLocMatching(500, loc, Condition(function Checka))
set ge = GetUnitsInRangeOfLocMatching(500, loc, Condition(function Checke))
call ForGroupBJ(ga, function Heal)
call ForGroupBJ(ge, function Dam)
call RemoveLocation(loc)
call DestroyGroup (ga)
call DestroyGroup (ge)
set loc=null
set ga=null
set ge=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( Trig, Condition( function condition) )
call TriggerAddAction( Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope NatureGift
//********************************************************
globals
private constant integer AbilityID = 'A03C'
private constant integer BuffID = 'B00Y'
endglobals
//********************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local integer bonus = (4*il)
loop
exitwhen GetUnitAbilityLevel(t, BuffID) >0
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
endloop
call ModifyHeroStat( bj_HEROSTAT_STR, t, bj_MODIFYMETHOD_ADD, bonus)
call ModifyHeroStat( bj_HEROSTAT_AGI, t, bj_MODIFYMETHOD_ADD, bonus)
call ModifyHeroStat( bj_HEROSTAT_INT, t, bj_MODIFYMETHOD_ADD, bonus)
loop
exitwhen GetUnitState(t, UNIT_STATE_LIFE) <= 0 or GetUnitAbilityLevel(t, BuffID) ==0
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
endloop
call ModifyHeroStat( bj_HEROSTAT_STR, t, bj_MODIFYMETHOD_SUB, bonus)
call ModifyHeroStat( bj_HEROSTAT_AGI, t, bj_MODIFYMETHOD_SUB, bonus)
call ModifyHeroStat( bj_HEROSTAT_INT, t, bj_MODIFYMETHOD_SUB, bonus)
set c=null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( Trig, Condition( function condition) )
call TriggerAddAction( Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope NatureGrasp
//********************************************************
globals
private constant integer CasterID = 'H009'
private constant integer AbilityID = 'A03E'
private constant integer BuffID = 'B00Z'
private constant integer DummyAbilityID = 'A03F'
private constant string OrderID = "entanglingroots"
endglobals
//********************************************************
private function condition takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) ==CasterID and GetUnitAbilityLevel(GetTriggerUnit(), BuffID) > 0
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetAttacker()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local integer ic = (2+(il*2))
local integer ir = GetRandomInt(1, 100)
if ir<=ic and il>=1 and IsUnitType(t, UNIT_TYPE_MELEE_ATTACKER) then
call IssueTargetOrderById(udg_Rex, OrderId(OrderID), t)
endif
set c=null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition( Trig, Condition( function condition ) )
call TriggerAddAction( Trig, function action )
set Trig = null
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope Overgrowth
//***************************************************
globals
private constant integer AbilityID = 'A005'
private constant integer DummyAbilityID = 'A00B'
private constant string OrderID ="entanglingroots"
private boolexpr CheckGroup = null
private group g = CreateGroup()
private integer lvl
private unit caster
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function check takes nothing returns boolean
return not IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) >0
endfunction
private function do takes nothing returns nothing
local xecast xc = xecast.createA()
set xc.abilityid = DummyAbilityID
set xc.level = lvl
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(caster)
call xc.castOnGroup(g)
call DestroyGroup(g)
set g=null
endfunction
private function action takes nothing returns nothing
local location loc = GetUnitLoc(GetTriggerUnit())
set caster = GetTriggerUnit()
set lvl = GetUnitAbilityLevel(caster, AbilityID)
set g = GetUnitsInRangeOfLocMatching(400, loc, Condition(function check))
call ForGroup(g, function do)
call RemoveLocation(loc)
set loc=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition) )
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
//**********************************************
//* Sheep staff.
//*
//* A quick sample for xecast.AOEloc
//*
//*
//----------------------------------------------
scope SheepStaff initializer init
private function spellIdMatch takes nothing returns boolean
return (GetSpellAbilityId()=='A006')
endfunction
private function onSpellCast takes nothing returns nothing
local xecast xc = xecast.create() //CreateA so we don't have to destroy the object after the cast.
local unit u = GetTriggerUnit()
local location loc = GetSpellTargetLoc() //The target point
call SetUnitAnimation(u, "attack") // Let's focus on the look of the item cast for a second...
//==============================================
// Here, we do assignments:
//
set xc.abilityid = 'A005' //* Cast ability A005
set xc.level = GetUnitAbilityLevel(u, 'A006' ) //* Same level as trigger ability
set xc.orderstring = "polymorph" //* The order is polymorph
set xc.owningplayer = GetOwningPlayer(u) //* The owning player, determines targets and bounty credits
call xc.castOnAOELoc( loc, 200.0 ) //* Our castOnAOE call, using the location version
//* A radius of 200.0
// Since createA was used, no need to destroy the xecast object
call xc.destroy()
call RemoveLocation(loc) //We need to clean the point.
set u=null
endfunction
private function init takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerAddCondition(t, Condition( function spellIdMatch) )
call TriggerAddAction(t, function onSpellCast)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
set t=null
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope werewolf
/////////
//Lycan
////////
private function lycan_con takes nothing returns boolean
return GetLearnedSkill()=='A03J'and IsUnitIllusion(GetTriggerUnit())==false
endfunction
private function lycan_act takes nothing returns nothing
local unit u=GetTriggerUnit()
call SetPlayerTechResearched(GetOwningPlayer(u),'R000',GetPlayerTechCount(GetOwningPlayer(u),'R000',true)+1)
set u=null
endfunction
public function lycan takes nothing returns nothing
local trigger Trig=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(Trig,Condition(function lycan_con))
call TriggerAddAction(Trig,function lycan_act)
set Trig=null
endfunction
//======
//Feral Rage
//======
private function feralrage_con takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) =='U006'
endfunction
private function feralrage_act takes nothing returns nothing
local unit c = GetAttacker()
local unit t = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, 'A03K')
local real leech
local real life = GetUnitState(t, UNIT_STATE_LIFE)
if il==1 then
set leech=(life*0.01)
elseif il==2 then
set leech=(life*0.015)
elseif il==3 then
set leech=(life*0.02)
elseif il==4 then
set leech=(life*0.025)
endif
if GetUnitAbilityLevel(c, 'B012') > 0 and IsUnitType(t, UNIT_TYPE_STRUCTURE) != true and IsUnitType(t, UNIT_TYPE_MECHANICAL) != true then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\VampiricAura\\VampiricAuraTarget.mdl",c, "origin"))
call SetUnitState(c, UNIT_STATE_LIFE, GetUnitState(c, UNIT_STATE_LIFE) + leech)
endif
set c=null
set t=null
endfunction
public function feralrage takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(Trig, Condition(function feralrage_con))
call TriggerAddAction(Trig, function feralrage_act)
set Trig=null
endfunction
endscope
function InitTrig_Werewolf takes nothing returns nothing
call werewolf_lycan()
call werewolf_feralrage()
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Shapeshift
//***************************************************
globals
private unit caster
private constant integer AbilityID = 'AEme'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function callback takes nothing returns nothing
local timer t=GetExpiredTimer()
call SetUnitTimeScalePercent(caster, 100.00 )
call ReleaseTimer(t)
endfunction
private function action takes nothing returns nothing
local timer t=NewTimer()
set caster = GetTriggerUnit()
call SetUnitTimeScalePercent(caster, 300.00 )
call TimerStart(t,1,false,function callback)
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope gale
//***************************************************
globals
private constant integer AbilityID = 'A02I'
private constant integer DummyAbilityID = 'A02J'
private constant string OrderID = "silence"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local location loc = GetUnitLoc(c)
call IssuePointOrderLoc(udg_Rex, OrderID, loc)
call RemoveLocation(loc)
set loc=null
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=48
//TESH.alwaysfold=0
scope gog
globals
private boolean ultidrow = false
private unit caster_drowmage
private integer in_drowmage
private integer ies
endglobals
//========
//Earthshield
//========
private function earthshield_con takes nothing returns boolean
return GetLearnedSkill()=='S000'and IsUnitIllusion(GetTriggerUnit())==false
endfunction
private function earthshield_act takes nothing returns nothing
set caster_drowmage = GetTriggerUnit()
set ultidrow = true
set ies = GetUnitAbilityLevelSwapped('S000', caster_drowmage)
endfunction
public function earthshield takes nothing returns nothing
local trigger Trig=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(Trig,Condition(function earthshield_con))
call TriggerAddAction(Trig,function earthshield_act)
endfunction
//==========
//HP Recovery
//==========
private function hpre_fil takes nothing returns boolean
return not IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0 and GetUnitState(caster_drowmage, UNIT_STATE_LIFE) > 0 and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(caster_drowmage)) and ultidrow ==true
endfunction
private function hpre_act takes nothing returns nothing
local location loc = GetUnitLoc(caster_drowmage)
local group g_hpre = CreateGroup()
local integer il = GetUnitLevel(caster_drowmage)
local real rhp
set in_drowmage = 0
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCasterOverhead.mdl", caster_drowmage, "overhead"))
call PlaySoundOnUnitBJ(gg_snd_DevourMagic, 100., caster_drowmage)
set g_hpre = GetUnitsInRangeOfLocMatching(400, loc, Condition(function hpre_fil))
set in_drowmage = CountUnitsInGroup(g_hpre)
if in_drowmage >=1 then
set rhp = (I2R(il) * I2R(in_drowmage))
call SetUnitLifeBJ(caster_drowmage, GetUnitState(caster_drowmage, UNIT_STATE_LIFE) + rhp)
call CreateTextTagUnitBJ("+"+ I2S(R2I(rhp)), caster_drowmage, 0, 12, 0.00, 100.00, 0.00, 0.00 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
endif
call RemoveLocation(loc)
set loc=null
call GroupClear(g_hpre)
call DestroyGroup(g_hpre)
set g_hpre = null
endfunction
public function hpre takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(Trig, 10)
call TriggerAddAction(Trig, function hpre_act )
set Trig=null
endfunction
endscope
function InitTrig_GOTG takes nothing returns nothing
call gog_earthshield()
call gog_hpre()
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope enrage
//********************************************************
globals
private constant integer CasterID = 'H00G'
private constant integer AbilityID = 'A024'
private constant integer DummyAbilityID = 'A023'
private constant string OrderID = "bloodlust"
endglobals
//********************************************************
private function condition takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) ==CasterID
endfunction
private function action takes nothing returns nothing
local unit u=GetTriggerUnit()
local integer il = GetUnitAbilityLevel(u, AbilityID)
local real r = 35 + (5 * il)
if il >0 and GetUnitLifePercent(u) <= r and GetUnitAbilityLevel(u, 'B00A') ==0 then
call IssueTargetOrderById(udg_Rex, OrderId(OrderID), u)
endif
set u=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( Trig, Condition( function condition ) )
call TriggerAddAction( Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope ursar
globals
private integer irage
private real damrage
endglobals
//================
//Lacerate
//================
private function lacerate_con takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(), 'B017') >0
endfunction
private function lacerate_act takes nothing returns nothing
local unit c = GetAttacker()
local unit t = GetTriggerUnit()
local real r_life = GetUnitStateSwap(UNIT_STATE_LIFE, c)
local real r_maxlife = GetUnitStateSwap(UNIT_STATE_MAX_LIFE, c)
local integer il = GetUnitAbilityLevel(c, 'A03Y')
local real dam
if il ==1 then
set dam = ((r_maxlife-r_life)*0.10)
elseif il ==2 then
set dam = ((r_maxlife-r_life)*0.15)
elseif il ==3 then
set dam = ((r_maxlife-r_life)*0.20)
endif
call UnitDamageTarget(c, t, dam, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_CLAW_HEAVY_SLICE)
set c=null
set t=null
endfunction
public function lacerate takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition( Trig, Condition( function lacerate_con ) )
call TriggerAddAction( Trig, function lacerate_act )
set Trig=null
endfunction
endscope
function InitTrig_Ursar takes nothing returns nothing
call ursar_lacerate()
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope Thunderfang
//********************************************************
globals
private constant integer CasterID = 'U007'
private constant integer AbilityID = 'A032'
private constant integer DummyAbilityID = 'S001'
private constant integer BuffID = 'B00U'
private constant string OrderID = "cripple"
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
endglobals
//********************************************************
private function condition takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) == 'U007' and GetUnitAbilityLevel(GetAttacker(), 'A032') >0
endfunction
private function action takes nothing returns nothing
local unit c = GetAttacker()
local unit t = GetTriggerUnit()
local integer i = GetRandomInt(1, 100)
local integer il = GetUnitAbilityLevel(c, AbilityID)
local real dam = (40 + (20 * il) )
if GetUnitAbilityLevel(c, BuffID)>0 then
call SetUnitAnimation(c, "attack slam")
call UnitDamageTarget(c, t, dam, false, false, AttackType, DamageType, null)
call IssueTargetOrderById(udg_Rex, OrderId(OrderID), t)
call UnitRemoveAbility(c, BuffID)
set udg_dam_thundagar = (udg_dam_thundagar + (10. * udg_Lvl_thundagar))
elseif i<=15 then
call SetUnitAnimation(c, "attack slam")
call UnitDamageTarget(c, t, dam, false, false, AttackType, DamageType, null)
call IssueTargetOrderById(udg_Rex, OrderId("cripple"), t)
set udg_dam_thundagar = (udg_dam_thundagar + (10. * udg_Lvl_thundagar))
endif
set c=null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition( Trig, Condition( function condition ) )
call TriggerAddAction( Trig, function action )
set Trig=null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Windwalk
//********************************************************
globals
private constant integer AbilityID = 'A037'
private constant integer DummyAbilityID = 'A03B'
private constant string OrderID = "invisibility"
endglobals
//********************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
call IssueTargetOrderById(udg_Rex, OrderId(OrderID), c)
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( Trig, Condition( function condition ) )
call TriggerAddAction( Trig, function action )
set Trig=null
endfunction
endscope
//TESH.scrollpos=28
//TESH.alwaysfold=0
scope Thundagar
//********************************************************
globals
private constant integer AbilityID = 'A039'
private constant integer DummyAbilityID = 'A03A'
private constant string OrderID = "firebolt"
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
private unit caster
private group g = CreateGroup()
endglobals
//********************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function check takes nothing returns boolean
return not IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) and GetFilterUnit() != GetTriggerUnit() and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) >0
endfunction
private function do takes nothing returns nothing
call UnitDamageTarget(caster, GetEnumUnit(), udg_dam_thundagar, false, false, AttackType, DamageType, null)
call GroupClear(g)
call DestroyGroup(g)
set g=null
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local location loc = GetUnitLoc(GetTriggerUnit())
set caster = GetTriggerUnit()
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(caster, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(caster)
set g = GetUnitsInRangeOfLocMatching(400, loc, Condition(function check))
call ForGroup(g, function do)
call xc.castOnAOE(x, y, 300)
call xc.destroy()
call RemoveLocation(loc)
set loc=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( Trig, Condition( function condition ) )
call TriggerAddAction( Trig, function action )
set Trig=null
endfunction
endscope
//TESH.scrollpos=59
//TESH.alwaysfold=0
scope gladiator
//********************************************************
globals
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
endglobals
//********************************************************
//=============
//Hamstring
//=============
private function hamsting_con takes nothing returns boolean
return GetSpellAbilityId() == 'A00L'
endfunction
private function hamsting_act takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local integer il = GetUnitAbilityLevelSwapped('A00L', c)
local integer is = GetHeroStatBJ(bj_HEROSTAT_STR, c, true)
local integer array dam
set dam[1] = (35+is) //damage level 1
set dam[2] = (70+is) //damage level 2
set dam[3] = (105+is) //damage level 3
set dam[4] = (140+is) //damage level 4
call UnitDamageTarget(c, t, I2R(dam[il]), false, false, AttackType, DamageType, null)
set c=null
set t=null
endfunction
public function hamsting takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function hamsting_con) )
call TriggerAddAction(Trig, function hamsting_act)
set Trig=null
endfunction
//========
//Toughness
//========
private function toughness_con takes nothing returns boolean
return GetLearnedSkill()=='A03R'and IsUnitIllusion(GetTriggerUnit())==false
endfunction
private function toughness_act takes nothing returns nothing
local unit u=GetTriggerUnit()
call SetPlayerTechResearched(GetOwningPlayer(u),'R001',GetPlayerTechCount(GetOwningPlayer(u),'R001',true)+1)
set u=null
endfunction
public function toughness takes nothing returns nothing
local trigger Trig=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(Trig,Condition(function toughness_con))
call TriggerAddAction(Trig,function toughness_act)
set Trig = null
endfunction
//===========
//War Fling
//===========
private function warfling_con takes nothing returns boolean
return GetSpellAbilityId() =='A00S'
endfunction
private function warfling_act takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local location loc1 = GetUnitLoc(c)
local location loc2 = GetUnitLoc(t)
local real towait
local integer il = GetUnitAbilityLevelSwapped('A00S', c)
local real dam = (DistanceBetweenPoints(loc1, loc2) * ( 0.10 * I2R(il)))
set towait=DistanceBetweenPoints(loc1, loc2) / 1200.00
call PolledWait( towait )
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",t, "head"))
call UnitDamageTarget(c, t, dam, false, false, AttackType, DamageType, null)
call CreateTextTagUnitBJ("+" + I2S(R2I(dam)), t, 0, 12, 100, 0.00, 0.00, 2 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
call RemoveLocation(loc2)
call RemoveLocation(loc1)
set loc2=null
set loc1=null
set c=null
set t=null
endfunction
public function warfling takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function warfling_con) )
call TriggerAddAction(Trig, function warfling_act)
set Trig=null
endfunction
//===========
//Execute
//===========
private function execute_con takes nothing returns boolean
return GetSpellAbilityId() == 'A00X'
endfunction
private function execute_act takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local integer il = GetUnitAbilityLevelSwapped('A00X', c)
local real maxlife = GetUnitStateSwap(UNIT_STATE_MAX_LIFE, t)
local real life = GetUnitStateSwap(UNIT_STATE_LIFE, t)
local real lostlife = (maxlife-life)
local real array dam
set dam[1] = (lostlife*0.60)
set dam[2] = (lostlife*0.80)
set dam[3] = lostlife
if GetUnitLifePercent(t) <=90. then
call UnitDamageTarget(c, t, dam[il], false, false, AttackType, DamageType, null)
call CreateTextTagUnitBJ("+" + I2S(R2I(dam[il])), t, 0, 12, 100, 0.00, 0.00, 2 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
else
call CreateTextTagUnitBJ("|cffffcc00Ineffective", t, 0, 12, 100, 0.00, 0.00, 2 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
endif
set c=null
set t=null
endfunction
public function execute takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function execute_con) )
call TriggerAddAction(Trig, function execute_act)
set Trig=null
endfunction
endscope
function InitTrig_Gladiator takes nothing returns nothing
call gladiator_hamsting()
call gladiator_warfling()
call gladiator_execute()
call gladiator_toughness()
endfunction
//TESH.scrollpos=10
//TESH.alwaysfold=0
scope ConcussionBlow
//***************************************************
globals
private unit caster
private constant integer AbilityID = 'A04Q'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function callback takes nothing returns nothing
local timer t=GetExpiredTimer()
call SetUnitTimeScalePercent(caster, 100.00 )
call ReleaseTimer(t)
endfunction
private function action takes nothing returns nothing
local timer t=NewTimer()
set caster = GetTriggerUnit()
call SetUnitTimeScalePercent(caster, 250.00 )
call TimerStart(t,1,false,function callback)
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=69
//TESH.alwaysfold=0
scope battlemaster
//*********************************
globals
private integer int_onslaught = 0
private boolexpr cyclone_bolex =null
private unit bmaster =null
private real cyclone_dam =0.
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
endglobals
//*********************************
//==============
//Onslaught
//==============
private function onslaught_con takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) == 'N00B' and GetUnitAbilityLevel(GetAttacker(), 'B013') > 0
endfunction
private function onslaught_act takes nothing returns nothing
local unit c = GetAttacker()
local integer il = GetUnitAbilityLevelSwapped('A03T', c)
set int_onslaught = ( int_onslaught + 1 )
call ModifyHeroStat( bj_HEROSTAT_STR, c, bj_MODIFYMETHOD_ADD, ( il * 1 ) )
if int_onslaught ==10 then
call ModifyHeroStat( bj_HEROSTAT_STR, c, bj_MODIFYMETHOD_SUB, ( int_onslaught * ( il * 1 ) ) )
set int_onslaught = 0
endif
loop
exitwhen GetUnitState(c, UNIT_STATE_LIFE) <= 0 or GetUnitAbilityLevel(c, 'B013') ==0
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
endloop
call ModifyHeroStat( bj_HEROSTAT_STR, c, bj_MODIFYMETHOD_SUB, ( int_onslaught * ( il * 1 ) ) )
set int_onslaught = 0
set c=null
endfunction
//===========================================================================
public function onslaught takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( Trig, Condition( function onslaught_con ) )
call TriggerAddAction(Trig, function onslaught_act)
set Trig=null
endfunction
//=====================
//Onslaught learn
//=====================
private function onslaughtlearn_con takes nothing returns boolean
return GetLearnedSkill() =='A03T'
endfunction
private function onslaughtlearn_act takes nothing returns nothing
local integer il = GetUnitAbilityLevelSwapped('A03T', GetTriggerUnit())
call ModifyHeroStat( bj_HEROSTAT_STR, GetTriggerUnit(), bj_MODIFYMETHOD_SUB, ( int_onslaught * ( ( il - 1 ) * 1 ) ) )
set int_onslaught = 0
endfunction
//===========================================================================
public function onslaught_learn takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( Trig, Condition( function onslaughtlearn_con) )
call TriggerAddAction( Trig, function onslaughtlearn_act )
set Trig=null
endfunction
//=========================
//Mortal Strike
//=========================
private function mortal_con takes nothing returns boolean
return GetSpellAbilityId() == 'AIfz'
endfunction
private function mortal_act takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local integer il = GetUnitAbilityLevel(c, 'A03V')
local integer str = GetHeroStr(c, true)
local real dam
if il ==1 then
set dam = (4*str)
elseif il ==2 then
set dam = (5*str)
elseif il ==3 then
set dam = (6*str)
endif
call SetUnitFacingToFaceUnitTimed(c, t, 0.00)
call AttachSoundToUnitBJ(gg_snd_ThunderBoltMissileDeath, c)
call UnitDamageTarget(c, t, dam, false, false, AttackType, DamageType, null)
call CreateTextTagUnitBJ("+" + I2S(R2I(dam)), c, 0, 12, 100, 0.00, 0.00, 2 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
if GetUnitLifePercent(t) ==0 and IsUnitType(t, UNIT_TYPE_HERO) then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIsm\\AIsmTarget.mdl",c, "origin"))
call SetHeroStat(c, bj_HEROSTAT_STR, GetHeroStatBJ(bj_HEROSTAT_STR, c, true) + 1)
endif
set c = null
set t = null
endfunction
public function mortal takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function mortal_con))
call TriggerAddAction(Trig, function mortal_act)
set Trig = null
endfunction
endscope
function InitTrig_BattleMaster takes nothing returns nothing
call battlemaster_onslaught()
call battlemaster_onslaught_learn()
call battlemaster_mortal()
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope BeastialWrath
//***************************************************
globals
private constant integer AbilityID = 'A04C'
private constant integer DummyAbilityID = 'A043'
private constant string OrderID = "bloodlust"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local group g = CreateGroup()
set g = GetUnitsOfPlayerAndTypeId(GetOwningPlayer(c), 'nqb1')
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnGroup(g)
call DestroyGroup(g)
call xc.destroy()
set g=null
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=53
//TESH.alwaysfold=0
scope nomad
globals
private integer int_wa =0
endglobals
//========
//Aspect of the Hawk learn
//========
private function hawk_con takes nothing returns boolean
return GetLearnedSkill()=='A00Z'and IsUnitIllusion(GetTriggerUnit())==false
endfunction
private function hawk_act takes nothing returns nothing
local unit u=GetTriggerUnit()
call SetPlayerTechResearched(GetOwningPlayer(u),'R002',GetPlayerTechCount(GetOwningPlayer(u),'R002',true)+1)
set u=null
endfunction
public function hawk takes nothing returns nothing
local trigger Trig=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(Trig,Condition(function hawk_con))
call TriggerAddAction(Trig,function hawk_act)
set Trig = null
endfunction
//==============
//Aspect of the Hawk
//==============
private function windarrow_con takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(), 'B002') > 0
endfunction
private function windarrow_act takes nothing returns nothing
local unit c = GetAttacker()
local unit t = GetTriggerUnit()
set int_wa = ( int_wa + 1 )
if int_wa ==10 then
call SetUnitAbilityLevelSwapped('A010',c, 2)
endif
if int_wa ==20 then
call SetUnitAbilityLevelSwapped('A010',c, 3)
endif
if int_wa ==30 then
call SetUnitAbilityLevelSwapped('A010',c, 4)
endif
if int_wa ==40 then
call SetUnitAbilityLevelSwapped('A010',c, 5)
endif
if int_wa ==50 then
call SetUnitAbilityLevelSwapped('A010',c, 1)
endif
loop
exitwhen GetUnitState(c, UNIT_STATE_LIFE) <= 0 or GetUnitAbilityLevel(c, 'B002') == 0
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
endloop
set int_wa = 0
call SetUnitAbilityLevelSwapped('A010',c, 1)
set c=null
set t=null
endfunction
public function windarrow takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition( Trig, Condition( function windarrow_con ) )
call TriggerAddAction(Trig, function windarrow_act)
set Trig=null
endfunction
endscope
function InitTrig_Nomad takes nothing returns nothing
call nomad_hawk()
call nomad_windarrow()
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope Command
//***************************************************
globals
private constant integer AbilityID = 'A04G'
private constant integer DummyAbilityID = 'A04E'
private constant string OrderID = "bloodlust"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID and GetWidgetLife(udg_U_PetBear) >0
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local real x = GetUnitX(c)
local real y = GetUnitY(c)
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnTarget(udg_U_PetBear)
call PlaySoundOnUnitBJ( gg_snd_HeroMoonPriestessYesAttack1, 100.00, udg_U_Nomad )
call xc.destroy()
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope BlindingHeal
//********************************************************
globals
private constant integer AbilityID = 'A04D'
endglobals
//********************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local integer ical = (40*il)
local integer imin = (ical+40)
local integer imax = (ical+100)
local integer heal = GetRandomInt(imin,imax)
call SetWidgetLife(t, GetWidgetLife(t) + heal)
call CreateTextTagUnitBJ("+"+I2S(heal), t, 0, 12, 0.00, 100.00, 0.00, 2.00 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
set c = null
set t = null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition ) )
call TriggerAddAction(Trig, function action )
set Trig = null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope MassDispel
//***************************************************
globals
private constant integer AbilityID = 'A04L'
private boolexpr CheckGroup = null
private constant integer DummyAbilityID = 'A04K'
private constant string OrderID = "autodispel"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function check takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local group g = CreateGroup()
set g = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function check))
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnGroup(g)
call GroupClear(g)
call DestroyGroup(g)
call xc.destroy()
set g=null
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
set CheckGroup = Condition(function check)
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=21
//TESH.alwaysfold=0
scope Tidal
//***************************************************
globals
private constant integer AbilityID = 'A00D'
private constant integer DummyAbilityID = 'A05U'
private constant string OrderID = "frostnova"
private unit target
private real x
private real y
private boolexpr CheckGroup = null
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function check takes nothing returns boolean
return target !=GetFilterUnit() and not IsUnitType(target, UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(target, UNIT_TYPE_MECHANICAL) and IsPlayerEnemy(GetOwningPlayer(target), GetOwningPlayer(GetTriggerUnit()))
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local group enemies = CreateGroup()
local unit t
local integer il = GetUnitAbilityLevel(c, AbilityID)
local integer ic = 6
set target = GetSpellTargetUnit()
set x = GetUnitX(target)
set y = GetUnitY(target)
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call GroupEnumUnitsInRange(enemies, x, y, 600, CheckGroup)
loop
set t = FirstOfGroup(enemies)
exitwhen t == null or ic == 0
call xc.castOnTarget(t)
set ic = ic - 1
call GroupRemoveUnit(enemies, t)
call PolledWait(0.20)
endloop
call DestroyGroup(enemies)
call xc.destroy()
set enemies=null
set target=null
set c =null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
set CheckGroup = Condition(function check)
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition ) )
call TriggerAddAction(Trig, function action )
set Trig = null
endfunction
endscope
//***************************************************************************************************************
//* *
//* S H R A P N A D E *
//* Actual Code *
//* v1.07 *
//* *
//* By: Rising_Dusk *
//* *
//***************************************************************************************************************
scope Shrapnade
globals
//*********************************************************
//* These are the configuration constants for the spell
//*
//* AbilityID: The ability ID that triggers the spell
//* DummyUnitID: The dummy unit's ID for who to attach effects to
//* DamageLocal: Where the DamageEffect gets played on a unit
//* DamageEffect: Which effect plays when you damage an enemy
//* ExplodeEffect: Which effect plays when a Shrapnade explodes
//* DummyUnitEffect: Which effect is attached to the dummy unit
//* AttackType: What attack type the damage dealt is of
//* DamageType: What damage type the damage dealt is of
//* BaseSpeed: Smaller numbers make it move faster (Normal: 25)
//* MinSpeed: Iteration speed minimum for fragmented shards
//* MaxSpeed: Iteration speed maximum for fragmented shards
//* BaseDamage: The damage the spell deals at level 1
//* DamagePerLevel: The damage each extra level makes the spell do
//* Fragments: Base number of fragments each spell cast breaks into
//* FragmentsPerLevel: How many extra fragments each level adds
//* MinFragRange: Minimum range fragments will target from initial blast
//* MaxFragRange: Maximum range fragments will target from initial blast
//* BlastAreaOfEffect: How big of an area the damage is dealt within
//* InitialBounceHeight: The max height of the spell-cast bomb
//* MinBounceHeight: The minimum max height of the fragmented shards
//* MaxBounceHeight: The maximum max height of the fragmented shards
//* MomentumAngle: The angle spread in radians that fragments can have
//*
private integer AbilityID = 'A046'
private integer DummyUnitID = 'h00D'
private string DamageLocal = "chest"
private string DamageEffect = "Abilities\\Weapons\\Rifle\\RifleImpact.mdl"
private string ExplodeEffect = "Abilities\\Weapons\\Mortar\\MortarMissile.mdl"
private string DummyUnitEffect = "Abilities\\Spells\\Other\\Transmute\\GoldBottleMissile.mdl"
private attacktype AttackType = ATTACK_TYPE_NORMAL
private damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
private real BaseSpeed = 20.
private real MinSpeed = 15.
private real MaxSpeed = 35.
private real BaseDamage = 200.
private real DamagePerLevel = 100.
private integer Fragments = 2
private integer FragmentsPerLevel = 2
private real MinFragRange = 100.
private real MaxFragRange = 400.
private real BlastAreaOfEffect = 200.
private real InitialBounceHeight = 250.
private real MinBounceHeight = 100.
private real MaxBounceHeight = 350.
private real MomentumAngle = 1.04719
//*********************************************************
//* These are static constants used by the spell and shouldn't be changed
//*
//* Timer: The timer that runs all of the effects for the spell
//* Counter: The counter for how many spell instances exist
//* Nades: The array of all struct instances that exist
//* TimerInterval: The interval for the timer that gets run.
//* Boolexpr: The boolean expression used for damage checking.
//*
private timer Timer = CreateTimer()
private integer Counter = 0
private integer array Nades
private real TimerInterval = 0.04
private boolexpr Boolexpr = null
//* This is the trigger for reference outside of the scope if desired
public trigger Trig = CreateTrigger()
endglobals
//*********************************************************
//* Some quick configuration functions
private function Check takes nothing returns boolean
//* This is the targeting BoolExpr for the spell (Who it hits)
//* bj_meleeNearestMine references the spell caster
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(bj_meleeNearestMine)) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING) and GetWidgetLife(GetFilterUnit()) > 0.405 and GetUnitAbilityLevel(GetFilterUnit(), 'Avul') <= 0
endfunction
private constant function FinalDamage takes integer lvl returns real
//* This just does the calculation for the spell's damage
return BaseDamage+(DamagePerLevel*(lvl-1))
endfunction
private constant function FragCount takes integer lvl returns integer
//* This just does the calculation for the spell's fragmentation
return Fragments+(FragmentsPerLevel*(lvl-1))
endfunction
//*********************************************************
//* Struct for the spell, I recommend leaving it alone
private struct nade
unit Dummy
unit Caster
effect DummyEffect
integer Level
boolean isPrimary
real Speed
real MaxHeight
real DistanceCheck
real DistanceTarget
real Angle
static method create takes unit u, real x, real y, integer level, real angle, real TotalDist, real max, real speed, boolean primary returns nade
local nade n = nade.allocate()
set n.Caster = u
set n.Dummy = CreateUnit(GetOwningPlayer(u), DummyUnitID, x, y, angle)
set n.DummyEffect = AddSpecialEffectTarget(DummyUnitEffect, n.Dummy, "origin")
set n.DistanceCheck = TotalDist
set n.DistanceTarget = TotalDist
set n.isPrimary = primary
set n.MaxHeight = max
set n.Speed = speed
set n.Angle = angle
set n.Level = level
call SetUnitFacing(n.Dummy, angle*57.29583)
if IsUnitType(n.Dummy, UNIT_TYPE_GROUND) then
call UnitAddAbility(n.Dummy, 'Amrf')
call UnitRemoveAbility(n.Dummy, 'Amrf')
endif
return n
endmethod
private method onDestroy takes nothing returns nothing
call DestroyEffect(AddSpecialEffect(ExplodeEffect, GetUnitX(this.Dummy), GetUnitY(this.Dummy)))
call DestroyEffect(this.DummyEffect)
call KillUnit(this.Dummy)
endmethod
endstruct
//******************************************************************************
//* The spell code itself.
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function Callback takes nothing returns nothing
local unit u
local unit d
local unit s
local nade n = 0
local nade m = 0
local integer i = Counter - 1
local integer j = 0
local integer lvl
local group g = CreateGroup()
local real xi
local real yi
local real xf
local real yf
local real z
local real di1
local real di2
loop
exitwhen i < 0
set n = Nades[i]
set u = n.Caster
set d = n.Dummy
set di1 = n.DistanceCheck
set di2 = n.DistanceTarget
set lvl = n.Level
set xi = GetUnitX(d)
set yi = GetUnitY(d)
if di1 <= 0 then
set bj_meleeNearestMine = u
call GroupEnumUnitsInRange(g, xi, yi, BlastAreaOfEffect, Boolexpr)
loop
set s = FirstOfGroup(g)
exitwhen s == null
call DestroyEffect(AddSpecialEffectTarget(DamageEffect, s, DamageLocal))
call UnitDamageTarget(u, s, FinalDamage(lvl), false, false, AttackType, DamageType, null)
call GroupRemoveUnit(g, s)
endloop
call GroupClear(g)
if n.isPrimary then
loop
exitwhen j >= FragCount(lvl)
set m = nade.create(u, xi, yi, lvl, GetRandomReal(n.Angle-MomentumAngle,n.Angle+MomentumAngle), GetRandomReal(MinFragRange,MaxFragRange), GetRandomReal(MinBounceHeight, MaxBounceHeight), GetRandomReal(MinSpeed, MaxSpeed), false)
set Nades[Counter] = m
set Counter = Counter + 1
set j = j + 1
endloop
endif
call n.destroy()
set Counter = Counter - 1
if Counter < 0 then
call PauseTimer(Timer)
set Counter = 0
else
set Nades[i] = Nades[Counter]
endif
else
set xf = xi + (di2/n.Speed) * Cos(n.Angle)
set yf = yi + (di2/n.Speed) * Sin(n.Angle)
set z = ((4*di1)/di2)*(1-(di1/di2))*n.MaxHeight
set n.DistanceCheck = di1 - (di2/n.Speed)
call SetUnitFacing(d, n.Angle*57.29583)
call SetUnitFlyHeight(d, z, 0)
call SetUnitX(d, xf)
call SetUnitY(d, yf)
endif
set i = i - 1
endloop
call GroupClear(g)
call DestroyGroup(g)
set g = null
set u = null
set d = null
set s = null
endfunction
private function Actions takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local location l = GetSpellTargetLoc()
local integer lvl = GetUnitAbilityLevel(u, AbilityID)
local real xi = GetUnitX(u)
local real yi = GetUnitY(u)
local real xf = GetLocationX(l)
local real yf = GetLocationY(l)
local real an = Atan2(yf - yi, xf - xi)
local real di = SquareRoot((xi-xf)*(xi-xf) + (yi-yf)*(yi-yf))
local nade n = 0
if di == 0 then
set di = 1
set an = GetUnitFacing(u)
endif
set n = nade.create(u, xi, yi, lvl, an, di, InitialBounceHeight, BaseSpeed, true)
if Counter == 0 then
call TimerStart(Timer, TimerInterval, true, function Callback)
endif
set Nades[Counter] = n
set Counter = Counter + 1
call RemoveLocation(l)
set l = null
set u = null
endfunction
//******************************************************************************
//* The InitTrig that breathes life into the husk that is my spell.
public function InitTrig takes nothing returns nothing
set Trig = CreateTrigger()
set Boolexpr = Condition(function Check)
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function Conditions))
call TriggerAddAction(Trig, function Actions)
endfunction
endscope
scope DazeSlash
//***************************************************
globals
private constant integer AbilityID = 'A04R'
private constant integer DummyAbilityID = 'A04S'
private constant string DummyOrder = "soulburn"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
call CasterCastAbility(GetOwningPlayer(c), DummyAbilityID, DummyOrder, t, false)
set c=null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope FrenziedBlade
//***************************************************
globals
private constant integer AbilityID = 'A04T'
private constant integer DummyAbilityID = 'A04V'
private constant integer BuffID = 'B014'
private constant string OrderID = "bloodlust"
private constant integer CasterID ='N00H'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) ==CasterID and GetUnitAbilityLevel(GetAttacker(), AbilityID)>0
endfunction
private function action takes nothing returns nothing
local unit u=GetAttacker()
local integer ic = 15
local integer ir = GetRandomInt(1, 100)
if ir<=ic and GetUnitAbilityLevel(u, BuffID) ==0 then
call IssueTargetOrderById(udg_Tom, OrderId(OrderID), u)
endif
set u=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( Trig, Condition( function condition) )
call TriggerAddAction( Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope Glide
//***************************************************
globals
private unit caster
private constant integer AbilityID = 'A04W'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function callback takes nothing returns nothing
local timer t=GetExpiredTimer()
call SetUnitPathing(caster, true)
call SetUnitVertexColorBJ(caster, 100, 100, 100, 0)
call ReleaseTimer(t)
endfunction
private function action takes nothing returns nothing
local timer t=NewTimer()
local integer il = GetUnitAbilityLevel(GetTriggerUnit(), AbilityID)
local real r = (2+il)
set caster = GetTriggerUnit()
call SetUnitPathing(caster, false)
call SetUnitVertexColorBJ(caster, 100, 100, 100, 80)
call TimerStart(t,r,false,function callback)
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope FlashStrike
//***************************************************
globals
private constant integer AbilityID = 'A04X'
private constant integer CasterID = 'N00H'
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
private constant string EffectPath = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
private constant string EffectLocal = "origin"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) ==CasterID and GetUnitAbilityLevel(GetAttacker(), AbilityID) >0 and not IsUnitType(GetTriggerUnit(), UNIT_TYPE_MECHANICAL)
endfunction
private function action takes nothing returns nothing
local unit c = GetAttacker()
local unit t = GetTriggerUnit()
local integer ic = 15
local integer ir = GetRandomInt(1,100)
local integer il = GetUnitAbilityLevel(c, AbilityID)
local real angle = bj_RADTODEG * Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c))
local real x = GetUnitX(t) + 50. * Cos(angle * bj_DEGTORAD)
local real y = GetUnitY(t) + 50. * Sin(angle * bj_DEGTORAD)
local real damage = (il*GetHeroAgi(c, true))
if ir<=ic then
call SetUnitX(c, x)
call SetUnitY(c, y)
call SetUnitFacing(c, RAbsBJ(angle-180.))
call SetUnitAnimation(c, "attack")
call UnitDamageTarget(c, t, damage, false, false, AttackType, DamageType, null)
call PlaySoundOnUnitBJ(gg_snd_MetalHeavySliceFlesh1, 100., c)
call IssueTargetOrder(c, "attack", t)
call DestroyEffect(AddSpecialEffectTarget(EffectPath, c, EffectLocal))
call CreateTextTagUnitBJ("+" + I2S(R2I(damage)), c, 0, 12, 100, 0.00, 0.00, 2 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
endif
set c=null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope SymbolOfHope
//***************************************************
globals
private constant integer AbilityID = 'A04Z'
private boolexpr CheckGroup = null
private constant integer DummyAbilityID = 'Arej'
private constant string OrderID = "rejuvination"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function check takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) and IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) and GetFilterUnit() != GetTriggerUnit()
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local group g = CreateGroup()
set g = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function check))
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnGroup(g)
call DestroyGroup(g)
call xc.destroy()
set g=null
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
set CheckGroup = Condition(function check)
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope DivineProtection
//***************************************************
globals
private constant integer AbilityID = 'A04I'
private boolexpr CheckGroup = null
private constant integer DummyAbilityID = 'A050'
private unit target
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function callback takes nothing returns nothing
local timer t=GetExpiredTimer()
call UnitRemoveAbility(target, DummyAbilityID)
call SetUnitInvulnerable(target, false )
call ReleaseTimer(t)
endfunction
private function action takes nothing returns nothing
local timer t=NewTimer()
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local real to =(1*il)
set target = GetSpellTargetUnit()
call UnitAddAbility(target, DummyAbilityID)
call SetUnitInvulnerable(target, true )
call TimerStart(t,to,false,function callback)
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=24
//TESH.alwaysfold=0
scope Umbra
//***************************************************
globals
private constant integer AbilityID = 'A053'
private constant integer DummyAbilityID = 'A057'
private constant string EffectPath = "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl"
private constant string EffectLocal = "origin"
private constant string OrderID = "852274"
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
private real damage
private unit caster
private unit target
private real x
private real y
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function callback takes nothing returns nothing
local timer t=GetExpiredTimer()
call SetUnitPosition(caster, x, y)
call SetUnitInvulnerable(caster, false)
call SetUnitVertexColorBJ(caster, 100, 100, 100, 0)
call SetUnitFacingToFaceUnitTimed(caster, target, 0.00)
call DestroyEffect(AddSpecialEffectTarget(EffectPath, caster, EffectLocal))
call SetUnitPathing(caster, true)
call UnitDamageTarget(caster, target, damage, false, false, AttackType, DamageType, null)
call ReleaseTimer(t)
endfunction
private function action takes nothing returns nothing
local timer t=NewTimer()
set caster = GetTriggerUnit()
set target = GetSpellTargetUnit()
set x = GetUnitX(target)
set y = GetUnitY(target)
set damage = 80 * GetUnitAbilityLevel(caster, AbilityID)
call DestroyEffect(AddSpecialEffectTarget(EffectPath, caster, EffectLocal))
call SetUnitVertexColorBJ(caster, 100, 100, 100, 80)
call SetUnitPathing(caster, false)
call SetUnitInvulnerable(caster, true)
call TimerStart(t,0.20,false,function callback)
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=7
//TESH.alwaysfold=0
scope Dyon
//***************************************************
globals
private constant integer AbilityID = 'A052'
private constant integer TechID1 = 'R003'
private constant integer TechID2 = 'R004'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetLearnedSkill()==AbilityID and IsUnitIllusion(GetTriggerUnit())==false
endfunction
private function action takes nothing returns nothing
local unit u=GetTriggerUnit()
call SetPlayerTechResearched(GetOwningPlayer(u),TechID1,GetPlayerTechCount(GetOwningPlayer(u),TechID1,true)+1)
call SetPlayerTechResearched(GetOwningPlayer(u),TechID2,GetPlayerTechCount(GetOwningPlayer(u),TechID2,true)+1)
set u=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=28
//TESH.alwaysfold=0
scope PathOfShadow
//***************************************************
globals
private constant integer AbilityID = 'A001'
private boolexpr CheckGroup = null
private constant integer DummyAbilityID = 'A05A'
private constant string OrderID = "invisibility"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() ==AbilityID
endfunction
private function check takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) and IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit()))
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local group g = CreateGroup()
set g = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function check))
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnGroup(g)
call DestroyGroup(g)
call xc.destroy()
set g=null
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
set CheckGroup = Condition(function check)
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//******************************************************************************
//* *
//* Cursed Soul Spell *
//* By Moyack *
//* Version 1.0 *
//* *
//******************************************************************************
//******************************************************************************
//* The constant functions where you can modify the ability properties
//*
constant function Cursed_Soul_SpellID takes nothing returns integer
// Returns the spell ID. Based on Raise Dead ability.
return 'A05F'
endfunction
constant function Cursed_Soul_LifeStolen takes integer level returns real
// Returns the percentge of life stolen to a random unit
return 0.15 + 0.1 * (level - 1)
endfunction
constant function Cursed_Soul_DamageRate takes nothing returns real
// Returns the percentge of life stolen to a random unit
return 5.0
endfunction
constant function Cursed_Soul_PossessDur takes integer level returns real
// Returns the possession duration for the target unit
return 20.0 + 10.0 * (level - 1)
endfunction
constant function Cursed_Soul_AOE takes nothing returns real
// Returns the AOE where the spell will try to find any enemy.
return 800.0
endfunction
constant function Cursed_Soul_Radius takes nothing returns real
// Returns the distace which the soul will have from the caster.
return 250.0
endfunction
constant function Cursed_Soul_StartEffect takes nothing returns string
// Returns the spirit effect for the spell.
return "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
endfunction
constant function Cursed_Soul_SpiritEffect takes nothing returns string
// Returns the spirit effect for the spell.
return "Abilities\\Spells\\Human\\Banish\\BanishTarget.mdl"
endfunction
constant function Cursed_Soul_SpiritEffectDead takes nothing returns string
// Returns the spirit effect when the soul dies before reaching the target.
return "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl"
endfunction
constant function Cursed_Soul_SpiritEffectTarget takes nothing returns string
// Returns the spirit effect when the soul dies before reaching the target.
return "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"
endfunction
constant function Cursed_Soul_SpiritEffectDamRate takes nothing returns string
// Returns the spirit effect when the soul dies before reaching the target.
return "Abilities\\Spells\\Undead\\Sleep\\SleepSpecialArt.mdl"
endfunction
constant function Cursed_Soul_SpiritEffectPossession takes nothing returns string
// Returns the spirit effect when the soul dies before reaching the target.
return "Abilities\\Spells\\Undead\\Possession\\PossessionMissile.mdl"
endfunction
//******************************************************************************
//* The custom functions used in the trigger
//*
function Cursed_Soul_GetAngleBetweenUnits takes unit a, unit b returns real
return Atan2(GetUnitY(b) - GetUnitY(a), GetUnitX(b) - GetUnitX(a))
endfunction
function Cursed_Soul_GetRandomEnemy takes unit c, group g, real range returns unit
local unit u
local boolean b1
local boolean b2
local boolean b3
local boolean b4
local boolean b5
loop
set u = FirstOfGroup(g)
set b1 = GetWidgetLife( u ) > 0.405
set b2 = IsUnitType(u, UNIT_TYPE_STRUCTURE) == false
set b3 = IsUnitType(u, UNIT_TYPE_FLYING) == false
set b4 = IsUnitEnemy(u, GetOwningPlayer(c))
set b5 = IsUnitInRangeXY(u, GetUnitX(c), GetUnitY(c), range)
exitwhen u == null or (b1 and b2 and b3 and b4 and b5)
call GroupRemoveUnit(g, u)
endloop
call DestroyGroup(g)
return u
endfunction
function Cursed_Soul_ControlSoul takes nothing returns nothing
local unit u = GetEnumUnit()
local real t = 0.0
local effect fx = AddSpecialEffectTarget(Cursed_Soul_SpiritEffect(), u, "origin")
call UnitAddAbility(u, 'Amrf')
call UnitRemoveAbility(u, 'Amrf')
loop
exitwhen GetWidgetLife(u) < 0.405 or u == null
call SetUnitVertexColor(u, 100, 100, 100, R2I(70.0 + 20.0 * Cos(t)))
call SetUnitFlyHeight(u, 40.0 + 40 * Cos(t), 100.0)
set t = t + 10.0
call TriggerSleepAction(0.0)
endloop
call DestroyEffect(fx)
set u = null
set fx = null
endfunction
function Cursed_Soul_StartControlSoul takes nothing returns nothing
call ExecuteFunc("Cursed_Soul_ControlSoul")
endfunction
function Cursed_Soul_CatchEnemy takes unit soul, unit caster, unit target returns nothing
local integer st = GetUnitTypeId(soul)
local player pt = GetOwningPlayer(target)
local player ps = GetOwningPlayer(soul)
local timer t = CreateTimer()
local real d = GetUnitState(soul, UNIT_STATE_MAX_LIFE) * Cursed_Soul_LifeStolen(GetUnitAbilityLevel(caster, Cursed_Soul_SpellID()))
loop
exitwhen IsUnitInRange(soul, target, 50.0) or GetWidgetLife(soul) < 0.405 or GetWidgetLife(target) < 0.405
call IssuePointOrder(soul, "move", GetUnitX(target), GetUnitY(target))
call TriggerSleepAction(0.0)
endloop
if GetWidgetLife(target) < 0.405 and GetWidgetLife(soul) >= 0.405 then
call DestroyEffect(AddSpecialEffect(Cursed_Soul_SpiritEffectDead(), GetUnitX(soul), GetUnitY(soul)))
call RemoveUnit(soul)
else//if GetWidgetLife(target) >= 0.405 and GetWidgetLife(soul) >= 0.405 then
call DestroyEffect(AddSpecialEffectTarget(Cursed_Soul_SpiritEffectTarget(), target, "origin"))
if GetUnitTypeId(target) == st then
call RemoveUnit(soul)
call DestroyEffect(AddSpecialEffectTarget(Cursed_Soul_SpiritEffectPossession(), target, "origin"))
call SetUnitOwner(target, ps, true)
call TimerStart(t, Cursed_Soul_PossessDur(GetUnitAbilityLevel(caster, Cursed_Soul_SpellID())), false, null)
loop
exitwhen TimerGetRemaining(t) <= 0 or GetWidgetLife(target) < 0.405
call DestroyEffect(AddSpecialEffectTarget(Cursed_Soul_SpiritEffectDamRate(), target, "origin"))
call UnitDamageTarget(caster, target, Cursed_Soul_DamageRate(), true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
call TriggerSleepAction(1.0)
endloop
call SetUnitOwner(target, pt, true)
else
call UnitDamageTarget(soul, target, d, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
call RemoveUnit(soul)
endif
endif
call DestroyTimer(t)
set pt = null
set ps = null
set t = null
endfunction
function Cursed_Soul_WaitNearbyEnemy takes unit soul, unit caster returns nothing
local real t = Cursed_Soul_GetAngleBetweenUnits(soul, caster)
local location lc
local group g
local unit u
local real x
local real y
loop
set lc = GetUnitLoc(caster)
set g = GetUnitsInRangeOfLocAll(0.6 * Cursed_Soul_AOE(), lc)
call RemoveLocation(lc)
set u = Cursed_Soul_GetRandomEnemy(caster, g, 0.6 * Cursed_Soul_AOE())
exitwhen u != null
call DestroyGroup(g)
set t = t + bj_PI / 15.0
set x = GetUnitX(caster) + Cursed_Soul_Radius() * Cos(t)
set y = GetUnitY(caster) + Cursed_Soul_Radius() * Sin(t)
call IssuePointOrder(soul, "move", x, y)
call TriggerSleepAction(0.0)
endloop
call Cursed_Soul_CatchEnemy(soul, caster, u)
set lc = null
set g = null
set u = null
endfunction
//******************************************************************************
//* The main functions used in the trigger
//*
function Cursed_Soul_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Cursed_Soul_SpellID()
endfunction
function Cursed_Soul_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local unit t = GetSpellTargetUnit()
local real x = GetUnitX(t)
local real y = GetUnitY(t)
local integer utt = GetUnitTypeId(t)
local real ft = GetUnitFacing(t)
local unit d = CreateUnit(GetOwningPlayer(c), utt, x, y, ft)
local group g = CreateGroup()
local location lc = GetUnitLoc(c)
call DestroyEffect(AddSpecialEffect(Cursed_Soul_StartEffect(), x, y))
call UnitAddAbility(d, 'Abun')
call UnitAddAbility(d, 'Aloc')
call GroupAddUnit(g, d)
call ForGroup(g, function Cursed_Soul_StartControlSoul)
call DestroyGroup(g)
set g = GetUnitsInRangeOfLocAll(Cursed_Soul_AOE(), lc)
call RemoveLocation(lc)
set t = Cursed_Soul_GetRandomEnemy(c, g, Cursed_Soul_AOE())
if t == null then
call Cursed_Soul_WaitNearbyEnemy(d, c)
else
call Cursed_Soul_CatchEnemy(d, c, t)
endif
set c = null
set t = null
set d = null
endfunction
//===========================================================================
function InitTrig_Cursed_Soul takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Cursed_Soul_Conditions ) )
call TriggerAddAction( t, function Cursed_Soul_Actions )
call Preload(Cursed_Soul_StartEffect())
call Preload(Cursed_Soul_SpiritEffect())
call Preload(Cursed_Soul_SpiritEffectDead())
call Preload(Cursed_Soul_SpiritEffectTarget())
call Preload(Cursed_Soul_SpiritEffectDamRate())
call Preload(Cursed_Soul_SpiritEffectPossession())
set t = null
endfunction
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope LifeBreak
//***************************************************
globals
private constant integer AbilityID = 'A05D'
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
private constant string EffectPath = "Effect\\LifeBreak.mdx"
private constant string EffectLocal = "origin"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local integer il = GetUnitAbilityLevelSwapped(AbilityID, c)
local real damage = GetUnitStateSwap(UNIT_STATE_MANA, c)
if GetUnitLifePercent(t) <=80. then
call PolledWait(0.30)
call DestroyEffect(AddSpecialEffectTarget(EffectPath,t, EffectLocal))
call SetUnitState(c, UNIT_STATE_MANA, GetUnitState(c, UNIT_STATE_MANA) - damage)
call UnitDamageTarget(c, t, damage, false, false, AttackType, DamageType, null)
call CreateTextTagUnitBJ("+" + I2S(R2I(damage)), c, 0, 12, 100, 0.00, 0.00, 2 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
else
call CreateTextTagUnitBJ("|cffffcc00Ineffective", t, 0, 12, 100, 0.00, 0.00, 2 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
endif
set c=null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition) )
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope MindFlay
//***************************************************
globals
private constant integer AbilityID = 'A05G'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local unit t = GetSpellTargetUnit()
local real heal = (50*il)
if IsUnitAlly(t, GetOwningPlayer(c))then
call PolledWait(0.40)
call SetUnitState(t, UNIT_STATE_MANA, GetUnitState(t, UNIT_STATE_MANA) + heal)
call CreateTextTagUnitBJ("+"+I2S(R2I(heal)), t, 0, 12, 100.00, 0.00, 100.00, 2.00 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
else
call PolledWait(0.40)
call SetUnitState(t, UNIT_STATE_MANA, GetUnitState(t, UNIT_STATE_MANA) - heal)
call CreateTextTagUnitBJ("-"+I2S(R2I(heal)), t, 0, 12, 100.00, 0.00, 100.00, 2.00 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
endif
set c = null
set t = null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition) )
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=11
//TESH.alwaysfold=0
scope VampiricTouch
//***************************************************
globals
private constant integer AbilityID = 'A04J'
private constant integer CasterID = 'O002'
private constant integer AbiA ='A05G'
private constant integer AbiB ='A05H'
private constant integer AbiC ='A05J'
private boolexpr CheckGroup = null
private real heal =0.
private group g = CreateGroup()
private constant string EffectPath = "Abilities\\Spells\\Undead\\VampiricAura\\VampiricAuraTarget.mdl"
private constant string EffectLocal = "origin"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == CasterID and GetUnitAbilityLevel(GetTriggerUnit(), AbilityID) >0
endfunction
private function check takes nothing returns boolean
return not IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) and IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) and GetFilterUnit() != GetTriggerUnit() and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) >0
endfunction
private function do takes nothing returns nothing
call SetWidgetLife(GetEnumUnit(), GetWidgetLife(GetEnumUnit()) + heal)
call DestroyEffect(AddSpecialEffectTarget(EffectPath, GetEnumUnit(), EffectLocal))
call DestroyGroup(g)
set g=null
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local location loc = GetUnitLoc(c)
if GetSpellAbilityId() ==AbiA or GetSpellAbilityId() ==AbiB or GetSpellAbilityId() ==AbiC then
set heal = (60*il)
set g = GetUnitsInRangeOfLocMatching(400, loc, Condition(function check))
call ForGroup(g, function do)
endif
call RemoveLocation(loc)
set loc=null
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition) )
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope HexOfWeakness
//***************************************************
globals
private constant integer AbilityID = 'A05H'
private constant integer DummyAbilityID = 'A05I'
private constant string OrderID = "cripple"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local real area = (100+(50*il))
local location loc = GetSpellTargetLoc()
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call PolledWait(0.40)
call xc.castOnAOELoc(loc, area)
call RemoveLocation(loc)
call xc.destroy()
set loc=null
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition) )
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MassSleep
//***************************************************
globals
private constant integer AbilityID = 'A05J'
private constant integer DummyAbilityID = 'A05K'
private constant string OrderID = "sleep"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local location loc = GetSpellTargetLoc()
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call PolledWait(0.40)
call xc.castOnAOELoc(loc, 400.)
call RemoveLocation(loc)
call xc.destroy()
set loc=null
set c=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition) )
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope ViperSting
//***************************************************
globals
private constant integer AbilityID = 'A05O'
private constant integer DummyAbilityID = 'A05Q'
private constant string OrderID = "invisibility"
private constant string EffectPath = "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBoltImpact.mdl"
private constant string EffectLocal = "head"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local unit t = GetSpellTargetUnit()
local real heal = (40*il)
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnTarget(c)
call DestroyEffect(AddSpecialEffectTarget(EffectPath, t, EffectLocal))
call SetUnitState(t, UNIT_STATE_MANA, GetUnitState(t, UNIT_STATE_MANA) - heal)
call CreateTextTagUnitBJ("-"+I2S(R2I(heal)), t, 0, 12, 100.00, 0.00, 100.00, 2.00 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 200.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
call xc.destroy()
set c = null
set t = null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition) )
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
scope PoisonDart
//***************************************************
globals
private constant integer AbilityID = 'Acdh'
private constant integer BuffID = 'BNdh'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local unit u = GetSpellTargetUnit()
loop
exitwhen GetUnitAbilityLevel(u, BuffID) > 0
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
endloop
call SetUnitVertexColorBJ( u, 10.00, 100, 10.00, 10.00 )
loop
exitwhen GetUnitAbilityLevel(u, BuffID) == 0 or GetUnitStateSwap(UNIT_STATE_LIFE, u) == 0.00
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
endloop
call SetUnitVertexColorBJ( u, 100.00, 100, 100.00, 0.00 )
set u=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( Trig, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( Trig, Condition( function condition) )
call TriggerAddAction( Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope DarkCut
//***************************************************
globals
private constant integer AbilityID = 'A05P'
private constant integer BuffID = 'BNdh'
private constant string EffectPath = "Effect\\EarthRender.mdl"
private constant string EffectLocal = "origin"
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local unit c = GetTriggerUnit()
local integer il = GetUnitAbilityLevel(c, AbilityID)
local unit t = GetSpellTargetUnit()
local real damage = (200*il)
if GetUnitAbilityLevel(t, BuffID) >0 then
call DestroyEffect(AddSpecialEffectTarget(EffectPath, t, EffectLocal))
call UnitDamageTarget(c, t, damage, false, false, AttackType, DamageType, null)
endif
set c = null
set t = null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition) )
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=21
//TESH.alwaysfold=0
scope InfernalNet
//***************************************************
globals
private constant integer AbilityID = 'A05N'
private constant integer DummyAbilityID = 'A05R'
private constant string OrderID = "unholyfrenzy"
private constant string EffectPath = "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBoltImpact.mdl"
private constant string EffectLocal = "head"
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function action takes nothing returns nothing
local xecast xc = xecast.create()
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local location loc1 = GetUnitLoc(c)
local location loc2 = GetUnitLoc(t)
local real towait
local integer il = GetUnitAbilityLevel(c, AbilityID)
set towait=DistanceBetweenPoints(loc1, loc2) / 1200.00
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call PolledWait(towait)
call xc.castOnTarget(t)
call RemoveLocation(loc2)
call RemoveLocation(loc1)
call xc.destroy()
set loc2=null
set loc1=null
set c=null
set t=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function condition) )
call TriggerAddAction(Trig, function action)
set Trig=null
endfunction
endscope
//TESH.scrollpos=5
//TESH.alwaysfold=0
scope SnakeBlood
//***************************************************
globals
private constant integer AbilityID = 'A05X'
private constant integer TechID1 = 'R005'
private constant integer TechID2 = 'R006'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetLearnedSkill()==AbilityID and IsUnitIllusion(GetTriggerUnit())==false
endfunction
private function action takes nothing returns nothing
local unit u=GetTriggerUnit()
call SetPlayerTechResearched(GetOwningPlayer(u),TechID1,GetPlayerTechCount(GetOwningPlayer(u),TechID1,true)+1)
call SetPlayerTechResearched(GetOwningPlayer(u),TechID2,GetPlayerTechCount(GetOwningPlayer(u),TechID2,true)+1)
set u=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope monk
globals
private constant integer AbilityID = 'A03N'
private constant attacktype AttackType = ATTACK_TYPE_NORMAL
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL
private constant integer DummyAbilityID = 'A03O'
private constant string OrderID = "firebolt"
private integer hit
private string e = "Abilities\\Spells\\Other\\HealingSpray\\HealBottleMissile.mdl"
private unit c
private unit t
private real damage
public trigger VSTrig
public trigger VSStop
public effect VSeffect
endglobals
private function FOB2_con takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function FOB2_act takes nothing returns nothing
set VSStop = GetTriggeringTrigger()
call DisableTrigger(VSTrig)
call SetUnitTimeScalePercent(c, 100 )
call ResetUnitAnimation(c)
call DestroyEffect(VSeffect)
set c=null
set t=null
call DisableTrigger(VSStop)
endfunction
public function FOB2 takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerAddCondition(Trig, Condition( function FOB2_con))
call TriggerAddAction(Trig, function FOB2_act)
set Trig=null
endfunction
public function FOB3_act takes nothing returns nothing
set VSTrig = GetTriggeringTrigger()
set hit = (hit + 1)
if hit == 10 or hit == 20 or hit == 30 or hit == 40 or hit == 50 or hit == 60 or hit == 70 or hit == 80 or hit == 90 or hit == 100 then
call ResetUnitAnimation(c)
call SetUnitAnimation(c, "attack")
call UnitDamageTarget(c, t, damage, false, false, AttackType, DamageType, null)
endif
if hit>=100 or GetWidgetLife(c) <=0 or GetWidgetLife(t) <=0 then
call SetUnitTimeScalePercent(c, 100 )
call ResetUnitAnimation(c)
call DestroyEffect(VSeffect)
set c=null
set t=null
call DisableTrigger(VSTrig)
endif
endfunction
public function FOB3 takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(Trig, 0.03 )
call TriggerAddAction(Trig, function FOB3_act)
set Trig=null
endfunction
private function FOB_con takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function FOB_act takes nothing returns nothing
local xecast xc = xecast.createA()
local real amspeed = 200.00
local string s = "hand"
set c = GetTriggerUnit()
set t = GetSpellTargetUnit()
set hit = 0
set damage = ( 20.00 * I2R(GetUnitAbilityLevel(c, AbilityID)) )
set xc.abilityid = DummyAbilityID
set xc.level = GetUnitAbilityLevel(c, AbilityID)
set xc.orderstring = OrderID
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnTarget(t)
call SetUnitTimeScalePercent(c, amspeed)
call AddSpecialEffectTargetUnitBJ(s, c, e)
set VSeffect = GetLastCreatedEffectBJ()
call EnableTrigger(VSTrig)
call EnableTrigger(VSStop)
endfunction
public function FOB takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trig, Condition( function FOB_con) )
call TriggerAddAction(Trig, function FOB_act)
set Trig=null
endfunction
endscope
function InitTrig_FurryOfBlows takes nothing returns nothing
call monk_FOB()
call monk_FOB2()
call monk_FOB3()
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope Mist
//***************************************************
globals
private constant integer AbilityID = 'AUcs'
private constant integer BuffID = 'B025'
private unit caster
private player p
private real x
private real y
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function callback takes nothing returns nothing
local timer t=GetExpiredTimer()
call SetUnitPosition(caster, x, y)
call PanCameraToForPlayer(p, x, y)
call SetUnitInvulnerable(caster, false)
call SetUnitPathing(caster, true)
call SelectUnitForPlayerSingle(caster, p)
if GetUnitAbilityLevel(caster, BuffID) >0 then
call SetUnitVertexColorBJ(caster, 0, 0, 0, 0)
else
call SetUnitVertexColorBJ(caster, 100, 100, 100, 0)
endif
call ReleaseTimer(t)
endfunction
private function action takes nothing returns nothing
local timer t=NewTimer()
local location loc1 = GetUnitLoc(GetTriggerUnit())
local location loc2 = GetSpellTargetLoc()
local real wait=DistanceBetweenPoints(loc1, loc2) / 1500.00
set caster = GetTriggerUnit()
set p = GetOwningPlayer(caster)
set x = GetLocationX(loc2)
set y = GetLocationY(loc2)
call ClearSelectionForPlayer(p)
call SetUnitVertexColorBJ(caster, 100, 100, 100, 100)
call SetUnitPathing(caster, false)
call SetUnitInvulnerable(caster, true)
call TimerStart(t,wait,false,function callback)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1=null
set loc2=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope DeathlessVigor
//***************************************************
globals
private constant integer AbilityID = 'A02Z'
private constant integer DummyAbilityID = 'A05Z'
private unit caster
private player p
private real x
private real y
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function callback takes nothing returns nothing
local timer t=GetExpiredTimer()
call SetUnitVertexColorBJ(caster, 100, 100, 100, 0)
call UnitRemoveAbility(caster, DummyAbilityID)
call ReleaseTimer(t)
endfunction
private function action takes nothing returns nothing
local timer t=NewTimer()
local integer il = GetUnitAbilityLevel(GetTriggerUnit(), AbilityID)
local real wait = (2*il)
set caster = GetTriggerUnit()
call SetUnitVertexColorBJ(caster, 0, 0, 0, 0)
call UnitAddAbility(caster, DummyAbilityID)
call TimerStart(t,wait,false,function callback)
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope
scope Mental
//***************************************************
globals
private constant integer AbilityID = 'A060'
private constant integer TechID = 'R007'
endglobals
//****************************************************
private function condition takes nothing returns boolean
return GetLearnedSkill()==AbilityID and IsUnitIllusion(GetTriggerUnit())==false
endfunction
private function action takes nothing returns nothing
local unit u=GetTriggerUnit()
call SetPlayerTechResearched(GetOwningPlayer(u),TechID,GetPlayerTechCount(GetOwningPlayer(u),TechID,true)+1)
set u=null
endfunction
public function InitTrig takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig, EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(Trig, Condition(function condition))
call TriggerAddAction(Trig, function action)
set Trig = null
endfunction
endscope