//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
integer array DMTerrainType
integer array Distance
integer array Angle
integer array Rotation
integer array IsTrained
integer array SlaveID
integer array UnitArmor
integer array UnitDamage
integer array UnitLifeRegen
integer array UnitStrength
integer array UnitAgility
integer array UnitIntelligence
integer array UnitManaRegen
integer array UnitAttackSpeed
integer array UnitManaRegenPercent
integer array UnitMoveSpeed
real array UnitLife
real array UnitMana
integer array MacroNumber
real array AuraFXA
real array AuraFXB
real array AuraFXC
real array AuraFXD
real array AuraFXS
real array AuraFXRing
real array AuraFXTail
string array AuraFX
string array BonusSkill
boolean array PressedR
boolean array PressedL
boolean array HeroRestrictor
boolean array AuraFXShrink
location array DummyPoint
unit array RotationDummy
unit array Slave
unit array Master
unit array GraveMarker
player array SlavePlayer
timer array AuraFXTimer
trigger array Intercept
hashtable AuraFXHash
constant weapontype wtype = WEAPON_TYPE_WHOKNOWS
endglobals
Name | Type | is_array | initial_value |
Board | leaderboard | Yes | |
BOOT_Dialog | dialog | No | |
BOOT_DialogNo | button | No | |
BOOT_DialogYes | button | No | |
DebugBoard | multiboard | No | |
DebugBoardCreated | boolean | No | |
DM_Destination | location | Yes | |
DM_DoodPt | location | Yes | |
DM_MiscBool | boolean | Yes | |
DM_Player | player | Yes | |
DM_SubType | StringExt | Yes | |
DM_Unit | unit | Yes | |
DM_UnitType | unitcode | Yes | |
EnableMessages | boolean | No | |
Force | force | Yes | |
FreeHero | boolean | No | |
GUI_Doodads_Click | trigger | No | |
GUI_Items_Click | trigger | No | |
GUI_Misc_DoodadFillCount | integer | No | |
GUI_Misc_Escape | trigger | No | |
GUI_Misc_Select | trigger | No | |
GUI_Pointer | unit | Yes | |
GUI_Pointer_Point | trigger | No | |
GUI_Pointer_Unit | trigger | No | |
GUI_Tile | unit | Yes | |
GUI_Tile_Group | group | No | |
GUI_Units_Click | trigger | No | |
HERO_AllowDuplicates | boolean | No | |
HERO_ButtonText | texttag | Yes | |
HERO_FloatCam | boolean | Yes | |
HERO_IsDead | boolean | Yes | |
HERO_LastSel | unit | Yes | |
HERO_Ref2 | unit | Yes | |
HERO_Restrictor | trigger | No | |
HERO_Selection | trigger | No | |
KA_Group | group | No | |
KA_Text | texttag | Yes | |
KA_Unit | unit | Yes | |
MISC_Fountains | group | No | |
Names | string | Yes | |
Status | StringExt | Yes | |
TEMP_Destructible | destructable | No | |
TEMP_Integer | integer | No | |
TEMP_IntegerArray | integer | Yes | |
TEMP_Location | location | No | |
TEMP_Player | player | No | |
TEMP_Real | real | No | |
TEMP_RealArray | real | Yes | |
TEMP_String | string | No | |
TEMP_String2 | string | No | |
TEMP_Unit | unit | No | |
TRAIN_CountBad | integer | No | |
TRAIN_CountGood | integer | No | |
TRAIN_CountGoodTotal | integer | No | |
TRAIN_CurRoom | unit | No | |
TRAIN_Rooms | group | No | |
TRAIN_Type | unitcode | Yes | |
TranslateFrom | string | Yes | |
TranslateTo | string | Yes | |
TranslateTotal | integer | No | |
udg_HERO_ButtonText | texttag | Yes |
//TESH.scrollpos=567
//TESH.alwaysfold=0
globals
//MENU BOX items
unit GUI_Units
unit GUI_U_Create
unit GUI_U_Kill
unit GUI_U_Remove
unit GUI_U_Side
unit GUI_U_Move
unit GUI_U_Give
unit GUI_U_Size
unit GUI_U_Revive
unit GUI_U_Tint
unit GUI_U_Tint_Invis
unit GUI_U_Tint_White
unit GUI_U_Tint_Yellow
unit GUI_U_Tint_Green
unit GUI_U_Tint_Red
unit GUI_U_Tint_Blue
unit GUI_U_Invincible
//Items
unit GUI_Items
unit GUI_I_Create
unit GUI_I_Remove
unit GUI_I_Move
unit GUI_I_P_GoldPile
unit GUI_I_P_GoldCoin
unit GUI_I_P_PileOfRiches
//Doodads
unit GUI_Doodads
unit GUI_D_Create
unit GUI_D_Remove
unit GUI_D_Kill
unit GUI_D_Revive
unit GUI_D_Toggle
unit GUI_D_P_Grove
unit GUI_D_P_Junk
unit GUI_D_P_Crates
unit GUI_D_P_Rocks
unit GUI_D_P_Tree
unit GUI_D_P_Blight
unit GUI_D_P_Dispel
unit GUI_D_P_WoodenBridge
unit GUI_D_P_StoneBridge
unit GUI_D_P_ForceBridge
unit GUI_D_P_Gate
unit GUI_D_P_ElvenGate
unit GUI_D_P_DemonicGate
unit GUI_D_P_DungeonGate
unit GUI_D_P_IcerockGate
unit GUI_D_P_RollingStone
unit GUI_D_P_CastleGate
unit GUI_D_P_Door
unit GUI_D_P_DoubleDoor
unit GUI_D_P_Line1
unit GUI_D_P_Line2
unit GUI_D_P_StoneWall
unit GUI_D_P_NorthrendWall
unit GUI_D_P_RuinsWall
unit GUI_D_P_DungeonWall
unit GUI_D_P_FenceLine
unit GUI_D_P_EvilFence
unit GUI_D_P_CastleWall
unit GUI_D_P_InteriorWall
unit GUI_D_P_MineWall
//Single Doodads
unit GUI_D_P_Citadel
unit GUI_D_P_CTower
unit GUI_D_P_Flower
unit GUI_D_P_Mushroom1
unit GUI_D_P_Mushroom2
unit GUI_D_P_Mushroom3
unit GUI_D_P_Rocks1
unit GUI_D_P_Rocks2
unit GUI_D_P_Rocks3
unit GUI_D_P_Rocks4
unit GUI_D_P_Rocks5
unit GUI_D_P_Rocks6
unit GUI_D_P_Rocks7
unit GUI_D_P_Rocks8
unit GUI_D_P_Rocks9
unit GUI_D_P_Rocks10
unit GUI_D_P_IceyRock
unit GUI_D_P_IceyClaw
unit GUI_D_P_Mat
unit GUI_D_P_Grave
unit GUI_D_P_Light
unit GUI_D_P_Lamp
//Groves
unit GUI_D_P_NorthrendGrove
unit GUI_D_P_AshenvaleGrove
unit GUI_D_P_FallGrove
unit GUI_D_P_UndergroundGrove
unit GUI_D_P_DungeonGrove
unit GUI_D_P_OutlandGrove
unit GUI_D_P_RuinsGrove
unit GUI_D_P_BarrensGrove
unit GUI_D_P_FelwoodGrove
unit GUI_D_P_SnowyGrove
unit GUI_D_P_WinterGrove
unit GUI_D_P_SummerGrove
unit GUI_D_P_BrownGrove
unit GUI_D_P_CityGrove
//Single Facers
unit GUI_D_P_Log
unit GUI_D_P_Archway
unit GUI_D_P_Table
unit GUI_D_P_Chair
unit GUI_D_P_Bed
unit GUI_D_P_Trough
//Misc
unit GUI_Misc
unit GUI_M_Portal
unit GUI_M_Cinematic
unit GUI_M_Boot
//Toolbox
unit GUI_Toolbox
unit GUI_T_Tile_Red
unit GUI_T_Tile_Yellow
unit GUI_T_Tile_Blue
unit GUI_T_Tile_Teal
unit GUI_T_Tile_Purple
unit GUI_T_Tile_Orange
unit GUI_T_Tile_Green
unit GUI_T_Tile_Pink
unit GUI_T_Tile_Brown
unit GUI_T_Tile_Enemy
unit GUI_T_Tile_Ally
unit GUI_T_Tile_Gray
unit GUI_T_Tile_Cyan
unit GUI_T_Tile_DarkGreen
unit GUI_T_LoSBlocker
unit GUI_T_PathBlocker
//Hero Pallete
unit bHuman
unit bOrc
unit bUndead
unit bNightElf
unit bDone
//Hero Setups
integer array SpellID1
integer array SpellID2
integer array SpellID3
real array HeroPickX
real array HeroPickY
multiboard array DescrBoard
boolean Repick = true
//Non GUI Globals
boolean AllyAttack
boolean RezOff = false
boolean AltRez = true
boolean array BonusOnCreate
//DM Settings
rect array CreateRect
integer array DMTerrainVariation
integer array DMBrushShape
fogmodifier array DM_Fog
//Emitter Settings
hashtable EMITTER
group array EMITGROUP
//Global Chat
weathereffect array Weather
rect array WeatherRect
real array RealBrushSize
integer array IntegerBrushSize
integer array UnitBounty
string array OOC
string array SemiColonName
string array Info
item array udg_TEMP_ItemArray
//FX Table
hashtable QuestTable
endglobals
function SetGlobals takes nothing returns nothing
local integer i = 0
//DM Unit Pallete Setup
set CreateRect[0] = (gg_rct_Unit_DM1_Create)
set CreateRect[1] = (gg_rct_Unit_DM2_Create)
set CreateRect[2] = (gg_rct_Unit_DM3_Create)
set CreateRect[3] = (gg_rct_Unit_DM4_Create)
set CreateRect[4] = (gg_rct_Unit_DM5_Create)
set CreateRect[5] = (gg_rct_Unit_DM6_Create)
set CreateRect[6] = (gg_rct_Unit_DM7_Create)
set CreateRect[7] = (gg_rct_Unit_DM8_Create)
set CreateRect[8] = (gg_rct_Unit_DM9_Create)
set CreateRect[9] = (gg_rct_Unit_DM10_Create)
set CreateRect[10] = (gg_rct_Unit_DM11_Create)
set CreateRect[11] = (gg_rct_Unit_DM12_Create)
//DM Settings
set DMTerrainVariation[10] = 0
set DMTerrainVariation[9] = 0
set DMTerrainVariation[8] = 0
set DMBrushShape[10] = 0
set DMBrushShape[9] = 0
set DMBrushShape[8] = 0
//Conversions for MENU BOX items
set GUI_Units = gg_unit_n000_0001
set GUI_U_Create = gg_unit_n000_0002
set GUI_U_Kill = gg_unit_n000_0003
set GUI_U_Remove = gg_unit_n000_0004
set GUI_U_Side = gg_unit_n000_0005
set GUI_U_Move = gg_unit_n000_0006
set GUI_U_Give = gg_unit_n000_0007
set GUI_U_Size = gg_unit_n000_0009
set GUI_U_Revive = gg_unit_n000_0010
set GUI_U_Tint = gg_unit_n000_0011
set GUI_U_Tint_Invis = gg_unit_n000_0016
set GUI_U_Tint_White = gg_unit_n000_0017
set GUI_U_Tint_Yellow = gg_unit_n000_0018
set GUI_U_Tint_Green = gg_unit_n000_0021
set GUI_U_Tint_Red = gg_unit_n000_0020
set GUI_U_Tint_Blue = gg_unit_n000_0019
set GUI_U_Invincible = gg_unit_n000_0012
//Items
set GUI_Items = gg_unit_n000_0033
set GUI_I_Create = gg_unit_n000_0034
set GUI_I_Remove = gg_unit_n000_0035
set GUI_I_Move = gg_unit_n000_0036
set GUI_I_P_GoldPile = gg_unit_n000_0132
set GUI_I_P_GoldCoin = gg_unit_n000_0133
set GUI_I_P_PileOfRiches = gg_unit_n000_0079
//Doodads
set GUI_Doodads = gg_unit_n000_0037
set GUI_D_Create = gg_unit_n000_0038
set GUI_D_Remove = gg_unit_n000_0039
set GUI_D_Kill = gg_unit_n000_0040
set GUI_D_Revive = gg_unit_n000_0041
set GUI_D_Toggle = gg_unit_n000_0042
set GUI_D_P_Grove = gg_unit_n000_0123
set GUI_D_P_Junk = gg_unit_n000_0068
set GUI_D_P_Crates = gg_unit_n000_0096
set GUI_D_P_Rocks = gg_unit_n000_0154
set GUI_D_P_Tree = gg_unit_n000_0124
set GUI_D_P_Blight = gg_unit_n000_0125
set GUI_D_P_Dispel = gg_unit_n000_0131
set GUI_D_P_WoodenBridge = gg_unit_n008_0127
set GUI_D_P_StoneBridge = gg_unit_n009_0128
set GUI_D_P_ForceBridge = gg_unit_n00Q_0158
set GUI_D_P_Gate = gg_unit_n00G_0136
set GUI_D_P_ElvenGate = gg_unit_n00H_0137
set GUI_D_P_DemonicGate = gg_unit_n00F_0138
set GUI_D_P_DungeonGate = gg_unit_n03J_0306
set GUI_D_P_IcerockGate = gg_unit_n00R_0170
set GUI_D_P_RollingStone = gg_unit_n03I_0209
set GUI_D_P_CastleGate = gg_unit_n000_0255
set GUI_D_P_Door = gg_unit_n000_0256
set GUI_D_P_DoubleDoor = gg_unit_n000_0257
set GUI_D_P_Line1 = gg_unit_n00P_0183
set GUI_D_P_Line2 = gg_unit_n00P_0182
set GUI_D_P_StoneWall = gg_unit_n00O_0164
set GUI_D_P_NorthrendWall = gg_unit_n000_0215
set GUI_D_P_RuinsWall = gg_unit_n000_0216
set GUI_D_P_DungeonWall = gg_unit_n000_0236
set GUI_D_P_FenceLine = gg_unit_n000_0152
set GUI_D_P_EvilFence = gg_unit_n000_0210
set GUI_D_P_CastleWall = gg_unit_n000_0248
set GUI_D_P_InteriorWall = gg_unit_n000_0258
set GUI_D_P_MineWall = gg_unit_n000_0299
//Doodads Single
set GUI_D_P_Citadel = gg_unit_n000_0184
set GUI_D_P_CTower = gg_unit_n000_0254
set GUI_D_P_Flower = gg_unit_n000_0217
set GUI_D_P_Mushroom1 = gg_unit_n000_0192
set GUI_D_P_Mushroom2 = gg_unit_n000_0234
set GUI_D_P_Mushroom3 = gg_unit_n000_0235
set GUI_D_P_Rocks1 = gg_unit_n000_0220 //Ice
set GUI_D_P_Rocks2 = gg_unit_n000_0221 //Felwood
set GUI_D_P_Rocks3 = gg_unit_n000_0222 //Ashenvale
set GUI_D_P_Rocks4 = gg_unit_n000_0223 //Barrens
set GUI_D_P_Rocks5 = gg_unit_n000_0224 //Dungeon
set GUI_D_P_Rocks6 = gg_unit_n000_0225 //Lords
set GUI_D_P_Rocks7 = gg_unit_n000_0226 //North
set GUI_D_P_Rocks8 = gg_unit_n000_0227 //Outland
set GUI_D_P_Rocks9 = gg_unit_n000_0232 //Ruins
set GUI_D_P_Rocks10 = gg_unit_n000_0233 //Underground
set GUI_D_P_IceyRock = gg_unit_n000_0191
set GUI_D_P_IceyClaw = gg_unit_n000_0157
set GUI_D_P_Mat = gg_unit_n000_0260
set GUI_D_P_Grave = gg_unit_n000_0259
set GUI_D_P_Light = gg_unit_n000_0269
set GUI_D_P_Lamp = gg_unit_n000_0305
//Doodads Facers
set GUI_D_P_Archway = gg_unit_n000_0212
set GUI_D_P_Log = gg_unit_n000_0211
set GUI_D_P_Table = gg_unit_n000_0304
set GUI_D_P_Chair = gg_unit_n000_0301
set GUI_D_P_Bed = gg_unit_n000_0261
set GUI_D_P_Trough = gg_unit_n000_0143
//Groves
set GUI_D_P_NorthrendGrove = gg_unit_n000_0241
set GUI_D_P_AshenvaleGrove = gg_unit_n000_0238
set GUI_D_P_FallGrove = gg_unit_n000_0237
set GUI_D_P_UndergroundGrove = gg_unit_n000_0242
set GUI_D_P_DungeonGrove = gg_unit_n000_0243
set GUI_D_P_OutlandGrove = gg_unit_n000_0244
set GUI_D_P_RuinsGrove = gg_unit_n000_0245
set GUI_D_P_BarrensGrove = gg_unit_n000_0253
set GUI_D_P_FelwoodGrove = gg_unit_n000_0252
set GUI_D_P_SnowyGrove = gg_unit_n000_0251
set GUI_D_P_WinterGrove = gg_unit_n000_0250
set GUI_D_P_CityGrove = gg_unit_n000_0249
set GUI_D_P_SummerGrove = gg_unit_n000_0247
set GUI_D_P_BrownGrove = gg_unit_n000_0246
//Misc
set GUI_Misc = gg_unit_n000_0043
set GUI_M_Portal = gg_unit_n000_0044
set GUI_M_Cinematic = gg_unit_n000_0045
set GUI_M_Boot = gg_unit_n000_0047
//Toolbox
set GUI_Toolbox = gg_unit_n000_0048
set GUI_T_Tile_Red = gg_unit_n000_0056
set GUI_T_Tile_Blue = gg_unit_n000_0049
set GUI_T_Tile_Teal = gg_unit_n000_0050
set GUI_T_Tile_Yellow = gg_unit_n000_0057
set GUI_T_Tile_Purple = gg_unit_n000_0051
set GUI_T_Tile_Orange = gg_unit_n000_0052
set GUI_T_Tile_Green = gg_unit_n000_0053
set GUI_T_Tile_Pink = gg_unit_n000_0054
set GUI_T_Tile_Brown = gg_unit_n000_0055
set GUI_T_Tile_Enemy = gg_unit_n000_0313
set GUI_T_Tile_Ally = gg_unit_n000_0315
set GUI_T_Tile_Gray = gg_unit_n000_0104
set GUI_T_Tile_Cyan = gg_unit_n000_0179
set GUI_T_Tile_DarkGreen = gg_unit_n000_0207
set GUI_T_LoSBlocker = gg_unit_n000_0263
set GUI_T_PathBlocker = gg_unit_n000_0264
set bHuman = gg_unit_n000_0283
set bOrc = gg_unit_n000_0282
set bUndead = gg_unit_n000_0285
set bNightElf = gg_unit_n000_0284
set bDone = gg_unit_n000_0286
//Non GUI Globals Set-Up
set AllyAttack = false
set BonusOnCreate[8] = false
set BonusOnCreate[9] = false
set BonusOnCreate[10] = false
set SubLVL = 10
set ClassON = true
call UnitAddType(gg_unit_h006_0197, UNIT_TYPE_GIANT)
set RezOff = false
set AltRez = true
call GroupEnumUnitsInRect(ENUM_GROUP, gg_rct_DMarea, function GivePlayerThirteen)
//Init Tables
set EMITTER = InitHashtable()
set AuraFXHash = InitHashtable()
set QuestTable = InitHashtable()
//Custom Skill Set
set i = 0
loop
exitwhen i > 63
set CustomClass[i] = I2S(GetRandomInt(99999, 999999))
set CustomSkill[i] = I2S(GetRandomInt(99999, 999999))
set CustomGear[i] = EquipAll
set i = i + 1
endloop
//Human Descriptions
call SaveStr(AH, 'Strm', 1, "|cff99b4d1S|rtorm/ Creates storm clouds above your head that send bolts of lightning forth.//|cffffd700Each level increases number of clouds summoned.|r" )
call SaveStr(AH, 'Shoc', 1, "Shock/ Sends arcs of lightning at nearby enemies. Those filled with bolts of electricity may cause arcs of lightning to stream out of their body at nearby enemies. Chance is determined by stat. Doesn't show up in skills!//|cffffdc00Each level improves many things.|r" )
call SaveStr(AH, 'IcCo', 1, "Tidal Wave (|cff00ffffC|r)/ Sends a wave of water at enemies, pushing them back./|cff6d6d6dChanneled/|r/|cffffd700Level increases damage and mana cost per second, while lowering initial cost.|r" )
call SaveStr(AH, 'Elec', 1, "|cffffff00E|rlectrocute/ Send volts of electricity through the body of your enemey, leaving them paralyzed and immobile as you do.//|cffffd700Each level increases duration.|r" )
call SaveStr(AH, 'aitn', 1, "Assassinate (|cffff0000X|r)/ Disappear, only to reappear behind your enemies after slashing their throats. Damage is dependant on your main stat.//|cffffdc00Each level increases damage.|r" )
call SaveStr(AH, 'BacS', 1, "Backstab/ When behind an enemy you will cause backstab damage. There is a chance the unit will detect you and begin attacking you to stop the damage.//|cffffdc00Each level increases the damage done while decreasing the chance of detection.|r")
call SaveStr(AH, 'BlZo', 1, "|cff00ced1B|rlasting Zone/ Send down your weapon with such incredible fury that you sunder the earth before you, causing a wave of destruction.//|cffffdc00Each level increases the damage and range.|r" )
call SaveStr(AH, 'suhp', 1, "Call Holy Phoeni|cfffddb55x|r/ Influenced by the main stat of the caster, a bird wreathed in holy fire will be summoned forth. Upon birth it shall scorch your enemies, and death it shall heal your allies.//|cffffdc00Each level increases the base stats of the phoenix and the base heal and burn amount.|r" )
call SaveStr(AH, 'ClPo', 1, "|cffcd853fC|rloying Powder/ Spray cloying powder over a group of enemies, causing their reaction time to be slowed. The volatile powder will cause extra damage when sparked by missiles or bullets. Lasts 7 seconds.//|cffffdc00Each level increases cloying powder's slow rate and the bonus damage.|r" )
call SaveStr(AH, 'DMas', 1, "Ready, Aim, Fire!/ Study combat techniques passed on for generations. As you progress, you learn to pierce armor, stun opponents, cause critical damage, and evade enemy attacks." )
call SaveStr(AH, 'crub', 1, "Crushing Blow/ There's a 15% chance that your next hit will send your enemy flying backwards while dealing bonus damage.//|cffffdc00Each level increases the damage done by the spell. Base damage is determined by bonus damage and main stat.|r" )
call SaveStr(AH, 'DLig', 1, "|cffffcc00D|rivine Light/ A holy light that can heal a friendly living unit or damage an enemy Undead unit.//|cffffdc00Each level increases the total heal.|r" )
call SaveStr(AH, 'DblC', 1, "Double Cast/ Chance to cast a spell twice.//|cffffdc00Each level increases certain summon lifespans and increases chance to double cast.|r" )
call SaveStr(AH, 'EaBr', 1, "|cffd2691eE|rarthbreaker/ Send down your fist with such calaminous intent that you sunder the earth before you, causing a wave of destruction.//|cffffdc00Each level increases the damage and range.|r" )
call SaveStr(AH, 'ElVo', 1, "Elemental Quiver/ Within your quiver lies several arrows of varying properties. The arrow you grab is random.//|cffffdc00Each level increases the different arrows available.|r" )
call SaveStr(AH, 'ExBu', 1, "E|cffffa500x|rploding Bullet/ Send a bullet that strikes through any enemy it makes contact with. When it reaches it's target point, it will explode, dealing additional damage, with an extra bonus to those covered in Powder.//|cffffdc00Damage and range increase with level. Based on max stat.|r" )
call SaveStr(AH, 'ExSh', 1, "Exploding Shells/ These shells have a volatile powder that upon impact will explode, dealing damage to any enemies around the target.//|cffffdc00Each level increases damage and chance of explosion on fire.|r" )
call SaveStr(AH, 'FieS', 1, "|cffcd5c5cF|rierce Slash/ There's a 15% chance that your next hit will send your enemy flying backwards while dealing bonus damage.//|cffffdc00Each level increases the damage done by the spell. Base damage is determined by bonus damage and main stat.|r" )
call SaveStr(AH, 'FiBa', 1, "|cffff4500F|rireball/ Blast a Fireball from your fingertips. When it hits an enemy it will explode, scorching and shoving back all in it's wake.//|cffffdc00Damage influenced by level.|r" )
call SaveStr(AH, 'FrBl', 1, "Free|cff00ffffz|ring Blast/ Deal damage in an AoE, slowing enemies hit.//|cffffdc00Damage and radius increase with level. Damage is based on max stat.|r" )
call SaveStr(AH, 'InsS', 1, "Inspirin|cffffa500g|r Shout/ Inspirin|cffffa500g|r Shout/ Inspires friendly heroes, giving them a bonus to Max HP, Damage, and Armor.//|cffffdc00Each level increases the bonuses gained.|r" )
call SaveStr(AH, 'HCli', 1, "Li|cffffff00f|re/ Return a fallen comrade back to life or fully restore and cleanse a living ally./|cffffd700/Each level increases the amount of HP revived on, and reduces cooldown and cast time.|r")
call SaveStr(AH, 'life', 1, "Li|cffffff00f|re/ Return a fallen comrade back to life or fully restore and cleanse a living ally.//|cffffdc00Increases the power of life itself.|r")
call SaveStr(AH, 'mimi', 1, "Mimi|cffdb7093c|r/ Use to duplicate the skill an enemy has just used. //|cffffdc00Each level allows more and more uses before the spell reverts back to mimic.|r")
call SaveStr(AH, 'PsiA', 1, "Psionic Arrow/ Every attack made is charged with psionic energy. After landing a blow, that energy is dispersed, damaging all enemies behind the target equal to your main stat.//|cffffdc00Every level increases damage.|r")
call SaveStr(AH, 'RiHa', 1, "Ri|cffffff00g|rhteous Hammer/ Send forth a hammer that will scatter and damage those it makes impact with. If it hits an ally it will restore their hitpoints based on 60% of it's normal damage.//|cffffdc00Damage increases with level.|r")
call SaveStr(AH, 'A01H', 1, "S|cffffcct|omp/ Slams the ground, stunning and damaging nearby enemy land units. //|cffffcc00Each level increases damage, radius and stun duration." )
call SaveStr(AH, 'Sanc', 1, "Sanctua|cffffff00r|ry/ Creates a divine field of holy energy in an area. Periodically that area will be healed, and any enemy undead or summons will be harmed.//|cffffdc00Each level increases damage and heal.|r")
call SaveStr(AH, 'shod', 1, "|cffffff00D|rivine Shield/ Cast a shield which will periodically protect the target from damage.//|cffffdc00Each level increases the duration of the shield.|r")
call SaveStr(AH, 'SmBo', 1, "Smoke |cff716f64B|romb/ Tosses a small explosive onto the ground. It bursts open releasing shrapnel and smoke, which harms and disrupts the enemy. So long as the enemies remain in the smoke they will have reduced hit-rates.//|cffffdc00Each level increases duration and damage.|r")
call SaveStr(AH, 'SpSh', 1, "Sp|cffffa500r|read Shot/ Fires a spread of bullets at an enemy. Each bullet deals base damage and is increased if the target is covered in cloying powder.//|cffffdc00Each level increases damage.|r")
call SaveStr(AH, 'StBo', 1, "Storm|cffffff00b|rolt/ Send a bolt of conduitive lightning at a target unit or point. Should the lightning collide with an enemy, it will release a violent storm of eletrical energy on those around it.//|cffffdc00Each level increases the % of damage on secondary targets.|r")
call SaveStr(AH, 'SwMa', 1, "Sword Mastery/ Every attack increases your damage for a brief period of time.//|cffffdc00Leveling up increases damage gained and duration of bonus.|r")
call SaveStr(AH, 'Wall', 1, "|cffffd700W|rall/ Create a barrier of protection around a unit, absorbing all non-fatal damage that hits it.//|cffffdc00Level increases the amount of damage absorbed and duration of the shield.|r")
call SaveStr(AH, 'WarT', 1, "Wa|cffbdb76br|r-threat/ Taunt nearby enemies to attack you after hitting them with a powerful bellow.//|cffffdc00Increases damage and number of targets per level.|r" )
call SaveStr(AH, 'AHam', 1, "Anci|cff7fffd4e|rnt Hammer/ Call forth a hammer, inscribed with ancient runes, to thunder across the skull of one foe.//|cffffdc00Damage increased per level and cooldown reduced.|r")
call SaveStr(AH, 'Cove', 1, "|cffebd143C|rover/ Cover an ally, preventing all non-fatal damage from hurting them. The damage is redirected to you.//|cffffdc00Each level decreases the damage you recieve.|r")
call SaveStr(AH, 'InSt', 1, "Inne|cffff6347r|r Stregth/ Boost the armor, max life and damage of an ally.//|cffffdc00Each level increases the boost.|r")
call SaveStr(AH, 'A004', 1, "Lion's |cffd3941dG|rrace/ Increases a target friendly unit's damage and armor.//|cffffdc00Each level inceases bonuses.|r")
call SaveStr(AH, 'A05H', 1, "Ma|cff3d95ffg|ric Curtain/ Create a magic curtain around an ally, which absorbs the damaging effects of spells while dampening their power.//|cffffdc00Level increases many factors.|r")
call SaveStr(AH, 'SBlo', 1, "Shiel|cffaca899d|r Block/ Place the brunt of your shield before you, deflecting and returning a majority of damage from magic and arrows. However, the hero suffers a loss of damage.//|cffffdc00Level lowers penalty and raises benefits.|r")
call SaveStr(AH, 'Warm', 1, "Warmth/ Gives additional mana regeneration to nearby friendly units, and boosts health and mana permanently./Low Range.//|cffffdc00Level increases bonuses.|r" )
call SaveStr(AH, 'asas', 1, "Swift as Shadows (|cffffd700F|r)/ When this spell is active you will slowly become one with the shadows until you reach invisibility. As well you will move faster and faster, and become more and more evasive.//|cffffdc00Each level increases the cap on your transparency, movespeed, and evasion.|r")
call SaveStr(AH, 'MZen', 1, "Zen/ Gives a boost to health.//|cffffdc00Each level increases bonus health.|r" )
//Orc Descriptions
call SaveStr(AH, 'Bers', 1, "|cffff0000B|rerserk/ Causes the unit to attack and move much faster, but take more damage. During this time, you have no control.//|cffffdc00Levels improve berserk speed.|r")
call SaveStr(AH, 'BlSt', 1, "Blood Star (|cffff0000Q|r)/ Create a deep, blood red star with powerful qualities to heal allies and drain enemies. The more who stand within it's emanating rays the more damage it deals and the more it heals./|cff716f64Channeling.|r//|cffffd700Each level increases the radius and duration while lowering the cooldown.|r" )
call SaveStr(AH, 'SuWo', 1, "Summon Trained |cffd2691eW|rolf/ Summons a trained wolf to fight by your side. It gains it's power from your stats.//|cffffd700Each level increases wolf's power.|r" )
call SaveStr(AH, 'AnGh', 1, "Ancien|cff87ceebt|r Ghost/ Materialize the ghost of an ancestoral hero before you.//|cffffdc00Each level increases the duration of the ghost as well as his damage and damage reduction.|r")
call SaveStr(AH, 'AxeT', 1, "Axe |cffaca899T|ross/ Throw 3 Axes that return to the thrower, impaling all in it's way.//|cffffdc00Damage influenced by main stat.|r")
call SaveStr(AH, 'Bene', 1, "Bene|cff008000v|roodoo/ Brings to life powerful Voodoo Magics that restores the life of those around you.//|cffffdc00Each level decreases the cooldown and initial manacost while increasing the regeneration amount.|r")
call SaveStr(AH, 'BlWa', 1, "Blas|cffffcc00t|r Ward/ Create a unique ward tapped with unstable energy. After several seconds the ward will explode, damaging and sending back all enemies. Killing the ward prematurely will also set this off.//|cffffdc00Each level increases damage, cooldown, and speed of instability.|r")
call SaveStr(AH, 'BlSh', 1, "Bla|cffffa500z|re Shield/ Creates a shield that absorbs damage by using mana. Any enemy who attacks the unit will be burned by it's fiery core.//|cffffcc00Each level increases the damage of the shield and the amount of damage absorbed per point of mana.|r")
call SaveStr(AH, 'PoBL', 1, "Clarity |cff3d95ffA|rura/ Increases nearby unit's life regeneration rate. Those with the aura have a chance to restore a percentage of the casting cost on their spells.//|cffffdc00Each level increases chance and life regeneration rate.|r")
call SaveStr(AH, 'A063', 1, "D|cffffcc00r|raconic Lance/ Using ancient draconic magic, imbue a lance with the spirit of a dragon and hurl it forth at your enemies. /Should the enemy be under the effects of Dragon's Breath, it will suffer additional damage. //|cffffdc00Each level improves damage and cooldown.|r")
call SaveStr(AH, 'DrCa', 1, " cff00ff7fD|rrowsy Cask/ Toss a cask at an enemy full of sleepy shroom poultice which will knock an enemy out. The impact deals minor damage.//|cffffdc00Each level increases the damage, bounces and sleep duration.|r")
call SaveStr(AH, 'A011', 1, "|cffff4500F|rire Wall/ Conjures a wall of fire which damages units over time.//|cffffdc00Level increased damage and width.|r")
call SaveStr(AH, 'Flur', 1, "|cffcd853fF|rlurry/ Each successive attack on the same unit will cause you to attack faster and faster. Changing targets resets the attackspeed.//|cffffdc00Each level increases the attackspeed bonus and max attackspeed.|r")
call SaveStr(AH, 'A007', 1, "Hydra |cff3cb371W|rard/ Summons an immobile hydra ward to attack the hero's enemies. The ward has several special properties.//|cffffdc00Each level boosts the wards power.|r")
call SaveStr(AH, 'IcWa', 1, "I|cff40e0d0c|re Wall/ Conjures a wall of ice which slows units nearby it and impedes their movement. Lasts 4 seconds.//|cffffdc00Level increases slow and width.|r")
call SaveStr(AH, 'GaWa', 1, "|cff7fff00G|rale Wall/ Conjures a wall of wind which slows units who pass through it and has a chance to cyclone them.//|cffffd700Level increases cyclone length and wall duration.|r")
call SaveStr(AH, 'A00U', 1, "In|cffffcc00f|rerno/ Ignites the ground under all nearby enemy units and buildings causing large amounts of fire damage.//|cffffdc00Increases damage and duration.|r")
call SaveStr(AH, 'InSw', 1, "Insect S|cff9acd32w|rarm/ Create a swarm of insects that'll bite and tear at an enemies flesh. Each has a sting so annoying enemies may be forced to attack them.//|cffffdc00Each level increases the number of insects produced and their hitpoints.|r")
call SaveStr(AH, 'Insp', 1, "In|cffffd700s|rpire/ Has a chance to cast bloodlust on attacking allies in range.//|cffffdc00Each level increases the chance.|r")
call SaveStr(AH, 'Lace', 1, "La|cffa73610c|rerate/ Rend the flesh of an enemy with a mighty blow, causing them to take deeper and deeper damage with each strike following.//|cffffdc00Each level increases the duration of each laceration and base damage of each blow.|r")
call SaveStr(AH, 'RoDr', 1, "Lan|cff8b4513d|r Slide/ Calls forth rocks to fall, damaging units when they hit the ground. //|cffffdc00AOE and number of rocks increases per level.|r" )
call SaveStr(AH, 'MaDr', 1, "Mana |cff0054e3D|risplacement/ Temporarily remove the mystical energies of an enemy and add them to your own./When cast on an ally, you sacrifice your own mana to increase theirs.//|cffffdc00Each level decreases manacost and cooldown and raises effectiveness.|r")
call SaveStr(AH, 'Pier', 1, "Pier|cffaca899c|re/ Pierce the armor of an enemy while dealing medium damage. There is always a % chance that you will deal 2.5x damage on strike.//|cffffdc00Each level increases the duration of the armor debuff, damage dealt, and chance to critical.|r")
call SaveStr(AH, 'BlLi', 1, "Resolve/ Every time you're attacked, your will increases, raising your max lifepoints. The effect will last up to 2 minutes before the adrenaline disperses and leaves your body.//|cffffdc00Each level increases the amount of lifepoints raised.|r")
call SaveStr(AH, 'RiDa', 1, "|cff008000R|ritual Dance/ This dance is a beneficial ritual that restores the health of those near the one dancing. If there are gravestone markers nearby, heroes will be brought back to life with 1% of their life and mana.//|cffffdc00Each level increases the healing amount and increases the chance to revive a hero.|r")
call SaveStr(AH, 'A04E', 1, "Sword T|cffffcc00o|rss/ Tosses Swords into an area, dealing damage in it's wake.//|cffffdc00Level increases stun and damage.|r" )
call SaveStr(AH, 'A00V', 1, "T|cffffd700h|rird Eye/ Gives a percent chance to avoid attacks and a chance to deal additional damage. //|cffffdc00Each level increases your chance to dodge and your damage multiplier.|r" )
call SaveStr(AH, 'THav', 1, "|cff48d1ccT|ridal Haven/ Causes healing energy to seep up through the earth in the form of water, rapidly replenishing all nearby allies over time.//|cffffdc00Level increases heal.|r" )
call SaveStr(AH, 'blsp', 1, "|cff008080V|rodun Spin/ Gives a chance to strike with a furious whir of your blade, damaging enemies in an 250 AoE. There's a chance that those knicked by your blade will recieve a curse.//|cffffdc00Each level increases the power of your spin and chance of curse.|r" )
call SaveStr(AH, 'WhWi', 1, "|cffaca899W|rhirlwind/ Create a whirling wind that sucks up units that get to close. As you channel the units raise higher and higher, causing more damage on impact with the ground when the whirlwind is released.//|cffffdc00Level increases duration of the whirlwind.|r" )
call SaveStr(AH, 'blsa', 1, "|cff5f9ea0W|rhirring Blade/ For 3 seconds you will cause severe damage to all enemies in your vicinity. However you will not have control for that time.//|cffffdc00Each level increases the damage dealt during Whirring Blade|r" )
call SaveStr(AH, 'GBlo', 1, "|cffc10000G|rrand Blood/ The mighty combination of blood from a dragon and a troll creates a potent combination, raising armor and healing hitpoints. //|cffffdc00Levels allow allies to grow strong from it as well.|r" )
call SaveStr(AH, 'AnBl', 1, "Ancest|cffff8c00r|ral Blessing/ Boost armor by a large amount and increase life regeneration for an ally.//|cffffdc00Each level increases the duration, armor and regeneration bonus.|r" )
call SaveStr(AH, 'A001', 1, "|cffffcc00D|rragon's Breath/ Breath molten dragon's breath onto an enemy, which deals damage over time.//|cffffdc00Level increases damage and burn.|r" )
call SaveStr(AH, 'MaVo', 1, "Malvoo|cffda70d6d|roo/ Cause a target to become a Pin-Doll. Any damage it feels will be shared with those around it.//|cffffdc00Each level increases the duration, damage shared and reduces cooldown.|r" )
call SaveStr(AH, 'Pact', 1, "Pac|cff4169e1t|r/ Increase your next warlock spell's damage or effect by double at the cost of extra mana and life.//|cffffdc00Each level lowers the cooldown and cost.|r" )
//Undead Descriptions
call SaveStr(AH, 'SoTr', 1, "|cff20b2aaS|roul Trap/ Consume the mana from the life force of any enemy that dies within 600 range of you. The effect will last up to 5 minutes before the mana disperses and leaves your body.//|cffffdc00Each level increases the amount of " )
call SaveStr(AH, 'RaHe', 1, "Raise |cff778899H|rero/ Return a fallen comrade back to life as a spirit. Should it survive for 6 seconds it will materialize back into the plane of the living./|cffffd700/Each level improves the strength of the spirit, cooldown and cast time.|r" )
call SaveStr(AH, 'ReID', 1, "Revel in De|cff800080a|rd/ Gives additional mana regeneration to you and nearby allies per corpse on the ground.//|cffffdc00Each level increases the max corpses that boost this aura.|r")
call SaveStr(AH, 'AnAs', 1, "Animal Aspe|cff778899c|rt / Shift through the aspects of different animals, taking on their strengths.//|cffffd700Each level improves the number of animals available to shift through and manacost.|r")
call SaveStr(AH, 'AnBo', 1, "Animate |cff5f9ea0B|rones/ Using your own bones and energy, create and animate a skeletal servant for yourself.//|cffffdc00Each level increases the variety of summons.|r" )
call SaveStr(AH, 'Ausp', 1, "Auspi|cffffcc00c|re/ Activate auspice, the likes of which consume your energy as you gain attack speed.//|cffffdc00Each level increases the cap and speed growth gained from auspice.|r" )
call SaveStr(AH, 'BlPo', 1, "Blood Power/ Gain power by foes who have not yet been weakened, gaining your strength from theirs. The less life missing from an enemy the more damage you deal.//|cffffdc00Each level increases damage.|r" )
call SaveStr(AH, 'A00Y', 1, "Carrion Arro|cff6d6d6dw|r/ Adds extra damage to attacks. Units killed while under the effect of Carrion Arrow will intice carrion crows into the area.//|cffffdc00Each level increases crows summoned, but lowers their duration.|r" )
call SaveStr(AH, 'FrAA', 1, "Chilling Death Aura/ An aura that benefits allies, giving a chance that they will be given Frost Armor. The aura has a low range.//|cffffdc00Each level increases the chance.|r" )
call SaveStr(AH, 'CoLi', 1, "Consume Life/ Consume the lifepoints of any enemy that dies within 600 range of you. The effect will last up to 2 minutes before the life force disperses and leaves your body.//|cffffdc00Each level increases the amount of hitpoints absorbed.|r" )
call SaveStr(AH, 'Doom', 1, "|cff708090D|room/ Units cursed with Doom have a good chance to live if the one who cast it on them is significantly weaker. If they're undead, then Doom will fail at the end of it's timer.//|cffffdc00Each level increases the chance of Doom succeeding.|r" )
call SaveStr(AH, 'DoAt', 1, "|cffcd853fD|rouble Attack/ There's a chance that when you attack you will deal a second successive blow.//|cffffdc00Each level increases chance.|r" )
call SaveStr(AH, 'drai', 1, "|cff008000D|rrain/ Drain or transfer life. The more health you have, the more life is drained or transfered.//|cffffdc00Each level improves damage from your main stat.|r" )
call SaveStr(AH, 'Echo', 1, "|cff9370dbE|rchoes/ Send forth a mighty wave of sonic energy, which will distort depending on the targets affiliation with you. Heals allies and harms enemies.//|cffffdc00Each level increases the duration of the echo and the amount of damage and healing it does.|r" )
call SaveStr(AH, 'LiPo', 1, "|cff008000L|rife Potency/ Your power is measured in the strength of your body. At full health, you will have +<PotU,Dur4> damage, +<PotU,HeroDur4> armor, and +<PotU,Cost4>% attack speed. As you lose health, those bonuses will diminish depending on your hp to maxhp ratio." )
call SaveStr(AH, 'MaCl', 1, "Massive Cleave/ After several attacks you will send forth a massive wave of strength, cleaving all enemies before you.//|cffffdc00Each level increases damage and lowers attacks before cleave.|r" )
call SaveStr(AH, 'OvPr', 1, "Overwhelming Presence/ Your presence is so powerful that enemies near you feel crushed by it's very weight.//|cffffdc00Each level increases the number of targets damaged and how often the damage occurs.|r" )
call SaveStr(AH, 'Pest', 1, "P|cff9acd32e|rstilence/ Create a swarm of frogs festering and bloated with disease ridden swamp water. Upon contact with an enemy their stomaches will burst, damaging and diseasing those nearby.//|cffffdc00Each level increases the number of frogs produced.|r" )
call SaveStr(AH, 'PoDa', 1, "|cff7fff00P|roison Daggers/ Send forth daggers tipped with venom into your enemies.//|cffffdc00Each level increases the power of the venom, the number of daggers and the initial damage.|r" )
call SaveStr(AH, 'RCor', 1, "|cffffcc00R|raise Corpse/ Raises a dead units to fight for the hero. The hero chooses the corpse, and returns him from the grave for a limited amount of time.//|cffffdc00Each level increases the duration of the summon.|r" )
call SaveStr(AH, 'RePu', 1, "Through the |cffff0000R|reaper/ Damage those you hate and drag them closer to you. Frightened and confused, they'll begin to attack you.//|cffffdc00Each level increases damage done and max targets allowed.|r" )
call SaveStr(AH, 'ShSt', 1, "Sha|cff000000d|re Strike/ Medium strike with the added benefit of draining 45% of the damage done by it.//|cffffdc00Each level increases the damage. Damage is increased with max stat. Cooldown is lowered each level.|r" )
call SaveStr(AH, 'sang', 1, "Siphon (|cffffd700W|r)/ Deal damage to several targets in an AoE. Each target hit will heal you and restore your mana.//|cffffdc00Damage, max number of targets and AoE all increase with level.|r" )
call SaveStr(AH, 'DeSc', 1, "Sound Blast (|cff1e90ffC|r)/ Causes 5 seconds of silence in an area to all units, including the caster. Those hit by the silence will be damaged if they're enemies.//|cffffdc00Each level increases the damage dealt and radius.|r" )
call SaveStr(AH, 'BoBe', 1, "Summon Shado|cff8a2be2w|r Bane/ Shatter the bones of all your summoned units, and from their wreckage form a beast of shadow and death.//|cffffdc00Each level increases the power of the Shadow Bane summoned.|r" )
call SaveStr(AH, 'ToSo', 1, "|cffffd700T|rormented Sound/ Gives a chance that your attacks will deal double damage, and also increases the power of your spells. //|cffffdc00Each level increases your spell boost and your damage multiplier.|r" )
call SaveStr(AH, 'UnPu', 1, "Under|cff804000w|rorld Pull/ A coil of death that can damage an enemy living unit or heal a friendly Undead unit. If it's target dies after recieving the coil, it will be reborn as a skeletal minion.//|cffffcc00Each level increases the heal or harm amount and the power of the creature summoned.|r" )
call SaveStr(AH, 'oroc', 1, "Unholy Inter|cff9acd32v|rention/ Cast a shield which will periodically protect the target from damage.//|cffffdc00Each level increases the duration of the shield.|r" )
call SaveStr(AH, 'SoSh', 1, "|cffda70d6W|railing Essence/ Create orbs made of a powerful sound essence. These orbs rotate around you and release their sound waves on impact knocking back enemies with an overwhelming wail that deals damage.//|cffffdc00Each level increases the number of orbs summoned.|r" )
call SaveStr(AH, 'BLus', 1, "|cffb22222D|rrink/ Gain bonus damage and recieve a life stealing attack. If Auspice is active, you gain a 1.2x critical hit until your Blood Buff or Soul Presence wears off.//|cffffdc00Increases lifesteal and damage bonus.|r" )
call SaveStr(AH, 'BlSl', 1, "|cffffcc00B|rlink Slash/ Dissappear, only to reappear behind an enemy and slash them violently.//|cffffdc00Each level increases the damage caused.|r" )
call SaveStr(AH, 'BoSh', 1, "Bone Shiel|cffd2b48cd|r/ This barrier will prevent 3 hits of damage. Should all three hits be used, a spectre will emerge born from the strength of the one protected.//|cffffdc00Each level increases duration and lowers cooldown while influencing the power of the spectre.|r" )
call SaveStr(AH, 'Crip', 1, "|cff8fbc8bC|rrippling Blow/ Aim for an enemy's vital organs, sending them into a fit of such pain that they're weakened tremendously for a short period of time.//|cffffdc00Each level increases damage, attack power and duration.|r" )
call SaveStr(AH, 'CrAu', 1, "|cffff0000C|rritical Aura/ Gives nearby friendly units a chance to deal bonus damage on attack.//|cffffdc00Each level increases chance and multiplier.|r" )
call SaveStr(AH, 'CurS', 1, "|cffffcc00C|rursed Soul/ Takes the soul from a near corpse, forcing it to possess a random enemy. If that unit is different than the cursed soul, it will deal damage to the unit. Otherwise it will take control of that unit for a brief period.//|cffffdc00Increases damage and duration.|r" )
call SaveStr(AH, 'A008', 1, "Feasting Locus|cffffcc00t|r/ Summon several locusts out of a corpse to attack and swarm your enemies. //|cffffdc00At higher levels, the corpse bursts, creating a plague cloud.|r" )
call SaveStr(AH, 'GrGi', 1, "|cff7bca64G|rrim Gift/ Give the gift of death freely, or take it away. Units targeted by Grim Gift will recieve Undead status, or will have it removed. Allies will recieve a temporary full heal, but once the bonus ends or the buff is removed, the damage will come back. Enemies on the other hand will have their current lives cut by a quarter to a half.//|cffffdc00Level increases certain aspects of the benefits and the length of the buff.|r" )
call SaveStr(AH, 'SoEa', 1, "Soul Eate|cff854545r|r/ All damage you deal while under the power of Soul Eater will be amplified. However you sacrifice your hitpoints as you deal damage.//|cffffdc00Each level increases damage dealt back to you by +1% and bonus damage dealt by +10%.|r" )
call SaveStr(AH, 'WRem', 1, "Withering Rememberance/ Upon death, as your body withers into the after life, grant your killer the right of rememberance by leaving a parting gift.//|cffffdc00Each level increases summon duration and lowers cooldown.|r" )
//Nightelf Descriptions
call SaveStr(AH, 'MaGr', 1, "Maneater |cff32cd32G|rrove/ Conjure an army of immobile plants nearby you to attack enemies.//|cffffd700Each level increases the chance of a strong plant, the number of plants, their strength.|r" )
call SaveStr(AH, 'AEah', 1, "Thorns Aura/ An aura that gives friendly nearby units a damage shield, which returns a percentage of a melee attacker's damage back to it. //|cffffcc00Level increases return amount.|r" )
call SaveStr(AH, 'MuSh', 1, "Arrow |cff779d2fV|rolley/ Fires multiple arows at enemies in a cone. The arrows deal damage depending on attack bonus and main stat.//|cffffdc00Each level increases damage of arrows.|r" )
call SaveStr(AH, 'BlPa', 1, "Bla|cffff4500z|ring Palm/ Send your hand forward with such speed that the friction against the air ignites your palm, burning your enemies.//|cffffdc00Each level increases damage and duration of the fire.|r" )
call SaveStr(AH, 'Bolt', 1, "|cff778899B|rolt/ Fire a bolt of energy at a targeted enemy. The elemental shift of the caster determines the bolt's properties.//|cffffdc00Each level improves the amount of mana drained on use and some properties of the bolt.|r" )
call SaveStr(AH, 'GuFi', 1, "Cleaving |cff708090F|rist/ Send your opponent to the ground with a tremendous hit. If you have max health, you will deal a percent of that in damage to all around.//|cffffdc00Each level increases the damage.|r" )
call SaveStr(AH, 'CoMa', 1, "Combo Mastery/ After casting a spell there's a chance your cooldowns will be reset.//|cffffdc00Each level increases the chance.|r" )
call SaveStr(AH, 'DrSt', 1, "Dr|cff8fbc8by|rad Strike/ Imbued with the magic of the forests, this attack will strike down your enemies and root them for several seconds on top of medium damage./|cffffd700/Each level increases the damage dealt. Damage is increased by main stat.|r" )
call SaveStr(AH, 'EaHa', 1, "Earth Harness/ Gives an armor bonus to all units in range. The less units there are the greater the bonus.//|cffffdc00Each level increases the max armor the bonus can give.|r" )
call SaveStr(AH, 'EleS', 1, "Elemental Shif/ Shift the element of your weapon, changing the power behind it. Also effects the elemental Avatar created when you shift.//|cffffdc00Each level improves the number of elements available to shift through and manacost.|r" )
call SaveStr(AH, 'Geod', 1, "|cff779d2fG|reode/ Deals initial damage and creates an effect on an enemy depending on the ground below it.//|cffffdc00Each level increases the power of the effect and the damage.|r" )
call SaveStr(AH, 'GiQu', 1, "|cff8b4513G|riant Quake/ Slams the ground, causing a massive wave that damages enemies.//|cffffdc00Each level increases damage.|r" )
call SaveStr(AH, 'A04P', 1, "Grow |cff228b22T|rreants/ Quickly grows <A04P,DataB1> Treants to fight the master's enemies. /Lasts <A04P,Dur1> seconds." )
call SaveStr(AH, 'LMCo', 1, "Life and Mana |cff9acd32C|rombustion/ Switch between tearing the enemies life or mana energies from their body with each blow of your weapon.//|cffffdc00Each level increases the ratio.|r" )
call SaveStr(AH, 'LiEm', 1, "Li|cfffd8c42v|ring Embers/ Causes the ground to erupt into a massive Volcano. Every few seconds, a living ember is spawned from the Volcano.//|cffffdc00Each level increases the duration.|r" )
call SaveStr(AH, 'Rech', 1, "Mat|cff008000r|ra M./ Invert your mana with your life energy.//|cffffdc00Each level lowers the cooldown and manacost while giving a better ratio to life conversion.|r" )
call SaveStr(AH, 'MoFi', 1, "Moon Fi|cff648bcbr|re/ Creates a wreathe of blue fire that heals allies or damages enemies. Amount is random and based on main stat.//|cffffdc00Each level increases the strength of Moon Fire.|r" )
call SaveStr(AH, 'Aorb', 1, "Or|cff01e779b|r/ Create one of two orbs that will drain the life or mana of your enemies upon impact.//|cffffdc00Level increases drain amount.|r" )
call SaveStr(AH, 'PWrd', 1, "Petal |cffdda0ddW|rard/ Summons an immobile petal ward to assist the hero. //|cffffdc00Each level improves the petal ward.|r" )
call SaveStr(AH, 'Phas', 1, "Phase/ Phase out, creating an elemental Avatar in your place. If that Avatar should live it's entire duration it will replenish you upon phasing back based on it's current HP and MP.//|cffffdc00Level reduces cooldown and duration of Avatar.|r" )
call SaveStr(AH, 'A052', 1, "Sand Blast (|cfff4a460Q|r)/ Makes the ground tremble and break, causing damage to units and buildings and slowing enemies within the area of effect. Lasts <AOeq,Dur1> seconds.//|cffffdc00Each level increases the slow, AoE, cost and damage.|r" )
call SaveStr(AH, 'Scav', 1, "Scavang|cff8fbc8be|r/ Scavanage the ground for supplies.//|cffffdc00Each level increases the chance of finding an item.|r" )
call SaveStr(AH, 'SmDo', 1, "Smash Do|cff808080w|rn/ Smashes an enemy into the ground where it cannot move or fight back.//|cffffdc00Each level increases damage.|r" )
call SaveStr(AH, 'SnSh', 1, "Sna|cff779d2fr|re Shot/ Fires an arrow with a net attached. The net binds the enemy to the ground, keeping them from getting too close.//|cffffdc00Each level increases the duration of the net and damage done by the shot.|r" )
call SaveStr(AH, 'StFa', 1, "Star |cffdda0ddF|rall/ Shower an area with stars, each one causing damage upon impact.//|cffffdc00Each level increases the number of stars, the duration and the damage caused by their impact.|r" )
call SaveStr(AH, 'SuMe', 1, "Summon Moon |cff9db9ebE|rlemental/ Summons a moon elemental to attack the hero's enemies. /Lasts <SuME,Dur1> seconds. //|cffffcc00Each level increases the power of the summon.|r" )
call SaveStr(AH, 'A00O', 1, "Summon Moon |cff9db9ebE|rlemental/ Temporarily summons an Owl to aide the unit in combat. /Can see invisible units.//|cffffdc00Owl's strength is determined by user's stats and Summon Owl's level.|r" )
call SaveStr(AH, 'A00P', 1, "Taunt (Passive)/ Passively taunt an enemy within 200 range, forcing them to strike at you.//|cffffdc00Every level decreases how often your passive taunt goes off.|r" )
call SaveStr(AH, 'CVin', 1, "|cff228b22C|rall Plant/ Unleashes a immobile plant upon the enemy.//|cffffdc00Each level changes the plant summoned.|r" )
call SaveStr(AH, 'CoPi', 1, "Counter Pierce/ Reflect blows aimed at you by both magic and melee.//|cffffdc00Level increases chance and damage return, and damage reduction.|r" )
call SaveStr(AH, 'LuBl', 1, "Lunar |cff4169e1B|rlessing/ Reduce all damage done to an ally.//|cffffdc00Each level increases the amount of damage blocked.|r" )
call SaveStr(AH, 'A00T', 1, "Moss Armo|cff808000r|r/ Moss armor saturates your body in protective magical moss which absorbs magic damage on top of increasing regen and armor. However it roots you to the ground until turned off and prohibits MP regen.//|cffffdc00Each level increases all your bonuses gained while active.|r" )
call SaveStr(AH, 'Pulv', 1, "Pumm|cffbdb9ace|rl/ Pummel an enemy with ferocity, decimating them blow by blow. Enemies cannot move or attack while being pulverized.//|cffffdc00Each level increases duration.|r" )
//MISC/NUET Descriptions
call SaveStr(AH, 'BooS', 1, "Book of Son|cff6b8e23g|rs/ Learn a series of songs that enhances the allies around you as they become more complex.//|cffffd700Each level increases the number of auras produced by the book of songs.|r" )
call SaveStr(AH, 'BlBo', 1, "|cff6d6d6dB|rlade Bolero/ A sound likened to the sharp pointed blades of scimitars when piercing the ears of your enemies, nearly manifesting the imagery right into the area.//|cffffd700Each level increases the duration of the song and the strength of the blades.|r" )
call SaveStr(AH, 'Rapi', 1, "|cff5f9ea0R|rapido/ Refresh all your cooldowns, allowing you to player another tune after a short cast time.//|cffffd700Each level raises costs and lowers cast time.|r" )
call SaveStr(AH, 'HeRi', 1, "H|cffffcc00e|raling Rift/ Calls forth a relaxing sound that heals a target and bounces to nearby friendlies. Each bounce heals less damage. //|cffffcc00Level increases heal amount and targets affected.|r" )
call SaveStr(AH, 'Sacr', 1, "Sa|cffffa500c|rrement/ Drags in the life force of nearby units. Depending on the target it can use that energy to heal or harm.//cffffd700Each level increases the number of units affected and the radius.|r" )
call SaveStr(AH, 'mete', 1, "|cffffd700C|romet/ Slams an area with the impact of a giant comet.//|cffffdc00Level increases damage.|r" )
call SaveStr(AH, 'MeSt', 1, "Meteo|cffffd700r |rStorm/ Slams an area with the impact of multiple giant comets." )
call SaveStr(AH, 'DblA', 1, "|cffffd700D|rouble Cast/ Use to duplicate the skill an enemy has just used. Each level allows more and more uses before the spell reverts back to mimic." )
call SaveStr(AH, 'Sacr', 1, "Sa|cffffa500c|rremento/ Drags in the life force of nearby units. Depending on the target it can use that energy to heal or harm.//|cffffdc00Each level increases the number of units affected and the radius.|r" )
call SaveStr(AH, 'SLEl', 1, "Summon |cffffcc00T|rhunder Elemental/ Summons a thunder elemental to attack the hero's enemies.//|cffffdc00Level increases elemental power.|r" )
call SaveStr(AH, 'TriC', 1, "|cffffa500T|rricast/ Cause the last spell cast on the enemy to be cast again. Number of spells is dependant on level." )
call SaveStr(AH, 'Mega', 1, "M|cffffcc00e|rga Flare/ Creates an omnipotent blast of power, devastating the land and area in it's path. If you can, run from Megaflare before it hits you." )
call SaveStr(AH, 'ToCh', 1, "|cffda70d6T|rormenting Chains/ All targets cursed by Tormenting Chains will feel a portion of the damage inflicted on other cursed victims, while the source feels it amplified.//|cffffdc00Each level increases the number of targets caught and the amount amplified amongst them.|r" )
call SaveStr(AH, 'A05X', 1, "|cffffcc00N|rimble/ Increase your nimbility with your dagger, allowing you a faster attack rate permanently." )
call SaveStr(AH, 'AEpa', 1, "Poison A|cff7fff00r|rrows/ Increases the damage of the hero by imbuing their arrows with crippling poison.//|cffffdc00Each level increases bonus damage and speed reductions.|r" )
call SaveStr(AH, 'Wast', 1, "|cffd2691eW|rasted/ Become drunk, increasing your HP and damage/but making you prone to falling asleep.//|cffffdc00Each level increases HP, Duration and Damage boost.|r" )
call SaveStr(AH, 'Dice', 1, "Dic|cff708090e|r/ Take a roll of the dice. Every few/seconds the enemy is struck, recieving/random damage. The chance for the/roll to continue on is random,/but your chances improve the/higher the number.//|cffffdc00Each level increases the damage.|r" )
call SaveStr(AH, 'CoiT', 1, "|cffffd700C|roin Toss/ Throw 5 Coins that deal damage.//|cffffd700Damage influenced by main stat and skill level.|r" )
call SaveStr(AH, 'Beer', 1, "Spinning |cffb8860bB|reer Bottles/ Spin Beer Bottles around you that/will deal damage when they hit an/enemy, knocking them back and/causing intoxication.//|cffffd700Each level increases the number of/|cffffd700beers you swing.|r" )
call SaveStr(AH, 'ANcf', 1, "Breath of |cffffcc00F|rire/ Breathes a cone of fire at enemy/units which deals damage. Units that/have Drunken Haze on them will/ignite and take burn damage/over/time.//|cffffd700Each level increases initial damage and damage per second.|r" )
call SaveStr(AH, 'LstC', 1, "Last Call (|cffff8c00F|r)/ You announce that this is the/last call for alcohol. Everyone gets/absolutely hammered, and you/celebrate the spoils of war.//|cffffd700Each level lowers the cooldown.|r" )
call SaveStr(AH, 'ImpO', 1, "Improved Odds/ Gives a chance to avoid attacks and/deal additional damage.//|cffffd700Each level improves odds.|r/|cffffd700Each level adds one to the dice roll.|r/|cffffd700Each level adds a coin to coin toss.|r" )
endfunction
function InitTrig_Globals takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent( t, 0.3, false )
call TriggerAddAction(t, function SetGlobals)
set t = null
endfunction
//TESH.scrollpos=138
//TESH.alwaysfold=0
library IsTerrain
function IsTerrainCity1 takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Xdrt' then
return true
elseif GetTerrainType(x,y) == 'Xblm' then
return true
elseif GetTerrainType(x,y) == 'Xbtl' then
return true
elseif GetTerrainType(x,y) == 'Xsqd' then
return true
elseif GetTerrainType(x,y) == 'Xrtl' then
return true
elseif GetTerrainType(x,y) == 'Xgsb' then
return true
elseif GetTerrainType(x,y) == 'Xhdg' then
return true
elseif GetTerrainType(x,y) == 'Xwmb' then
return true
elseif GetTerrainType(x,y) == 'Xwmb' then
return true
elseif GetTerrainType(x,y) == 'Ldro' then
return true
elseif GetTerrainType(x,y) == 'Ldrg' then
return true
elseif GetTerrainType(x,y) == 'Lgrs' then
return true
elseif GetTerrainType(x,y) == 'Lgrd' then
return true
endif
return false
endfunction
function IsTerrainCity2 takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Vdrt' then
return true
elseif GetTerrainType(x,y) == 'Vdrr' then
return true
elseif GetTerrainType(x,y) == 'Vcrp' then
return true
elseif GetTerrainType(x,y) == 'Vcbp' then
return true
elseif GetTerrainType(x,y) == 'Vstp' then
return true
elseif GetTerrainType(x,y) == 'Vgrs' then
return true
elseif GetTerrainType(x,y) == 'Vrck' then
return true
elseif GetTerrainType(x,y) == 'Vgrt' then
return true
elseif GetTerrainType(x,y) == 'Ydrt' then
return true
elseif GetTerrainType(x,y) == 'Ydtr' then
return true
elseif GetTerrainType(x,y) == 'Yblm' then
return true
elseif GetTerrainType(x,y) == 'Ybtl' then
return true
elseif GetTerrainType(x,y) == 'Ysqd' then
return true
elseif GetTerrainType(x,y) == 'Yrtl' then
return true
elseif GetTerrainType(x,y) == 'Ygsd' then
return true
elseif GetTerrainType(x,y) == 'Yhdg' then
return true
elseif GetTerrainType(x,y) == 'Ywmb' then
return true
endif
return false
endfunction
function IsTerrainCity3 takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Jdrt' then
return true
elseif GetTerrainType(x,y) == 'Jdtr' then
return true
elseif GetTerrainType(x,y) == 'Jblm' then
return true
elseif GetTerrainType(x,y) == 'Jbtl' then
return true
elseif GetTerrainType(x,y) == 'Jsqd' then
return true
elseif GetTerrainType(x,y) == 'Jrtl' then
return true
elseif GetTerrainType(x,y) == 'Jgsb' then
return true
elseif GetTerrainType(x,y) == 'Jhdg' then
return true
elseif GetTerrainType(x,y) == 'Jwmb' then
return true
endif
return false
endfunction
function IsTerrainForest1 takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Ldrt' then
return true
elseif GetTerrainType(x,y) == 'Adrt' then
return true
elseif GetTerrainType(x,y) == 'Cdrt' then
return true
elseif GetTerrainType(x,y) == 'Cdrd' then
return true
elseif GetTerrainType(x,y) == 'Cpos' then
return true
elseif GetTerrainType(x,y) == 'Crck' then
return true
elseif GetTerrainType(x,y) == 'Cvin' then
return true
elseif GetTerrainType(x,y) == 'Cgrs' then
return true
elseif GetTerrainType(x,y) == 'Clvg' then
return true
endif
return false
endfunction
function IsTerrainForest2 takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Adrd' then
return true
elseif GetTerrainType(x,y) == 'Agrs' then
return true
elseif GetTerrainType(x,y) == 'Agrd' then
return true
elseif GetTerrainType(x,y) == 'Avin' then
return true
elseif GetTerrainType(x,y) == 'Adrg' then
return true
elseif GetTerrainType(x,y) == 'Alvd' then
return true
endif
return false
endfunction
function IsTerrainWinter takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Wdrt' then
return true
elseif GetTerrainType(x,y) == 'Wdro' then
return true
elseif GetTerrainType(x,y) == 'Wsng' then
return true
elseif GetTerrainType(x,y) == 'Wrok' then
return true
elseif GetTerrainType(x,y) == 'Wsnw' then
return true
elseif GetTerrainType(x,y) == 'Idrt' then
return true
elseif GetTerrainType(x,y) == 'Idtr' then
return true
elseif GetTerrainType(x,y) == 'Ibkb' then
return true
elseif GetTerrainType(x,y) == 'Irbk' then
return true
elseif GetTerrainType(x,y) == 'Itbk' then
return true
elseif GetTerrainType(x,y) == 'Iice' then
return true
elseif GetTerrainType(x,y) == 'Ibsg' then
return true
elseif GetTerrainType(x,y) == 'Isnw' then
return true
elseif GetTerrainType(x,y) == 'Ndrt' then
return true
elseif GetTerrainType(x,y) == 'Ndrd' then
return true
elseif GetTerrainType(x,y) == 'Nrck' then
return true
elseif GetTerrainType(x,y) == 'Ngrs' then
return true
elseif GetTerrainType(x,y) == 'Nice' then
return true
elseif GetTerrainType(x,y) == 'Nsnw' then
return true
elseif GetTerrainType(x,y) == 'Nsnr' then
return true
endif
return false
endfunction
function IsTerrainFall takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Fgrd' then
return true
elseif GetTerrainType(x,y) == 'Fdro' then
return true
elseif GetTerrainType(x,y) == 'Fdrg' then
return true
elseif GetTerrainType(x,y) == 'Fgrs' then
return true
elseif GetTerrainType(x,y) == 'Fgrd' then
return true
elseif GetTerrainType(x,y) == 'Qdrt' then
return true
elseif GetTerrainType(x,y) == 'Qdrr' then
return true
elseif GetTerrainType(x,y) == 'Qcbp' then
return true
elseif GetTerrainType(x,y) == 'Qcbp' then
return true
elseif GetTerrainType(x,y) == 'Qstp' then
return true
elseif GetTerrainType(x,y) == 'Qgrs' then
return true
elseif GetTerrainType(x,y) == 'Qrck' then
return true
elseif GetTerrainType(x,y) == 'Qgrt' then
return true
endif
return false
endfunction
function IsTerrainBarrens takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Bdrt' then
return true
elseif GetTerrainType(x,y) == 'Bdrh' then
return true
elseif GetTerrainType(x,y) == 'Bdrr' then
return true
elseif GetTerrainType(x,y) == 'Bdrg' then
return true
elseif GetTerrainType(x,y) == 'Bdsr' then
return true
elseif GetTerrainType(x,y) == 'Bdsd' then
return true
elseif GetTerrainType(x,y) == 'Bflr' then
return true
elseif GetTerrainType(x,y) == 'Bgrr' then
return true
endif
return false
endfunction
function IsTerrainSunkenRuins takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Zdrt' then
return true
elseif GetTerrainType(x,y) == 'Zdtr' then
return true
elseif GetTerrainType(x,y) == 'Zdrg' then
return true
elseif GetTerrainType(x,y) == 'Zbks' then
return true
elseif GetTerrainType(x,y) == 'Zsan' then
return true
elseif GetTerrainType(x,y) == 'Zbkl' then
return true
elseif GetTerrainType(x,y) == 'Ztil' then
return true
elseif GetTerrainType(x,y) == 'Zgrs' then
return true
elseif GetTerrainType(x,y) == 'Zvin' then
return true
endif
return false
endfunction
function IsTerrainOutland takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Odrt' then
return true
elseif GetTerrainType(x,y) == 'Odtr' then
return true
elseif GetTerrainType(x,y) == 'Osmb' then
return true
elseif GetTerrainType(x,y) == 'Ofst' then
return true
elseif GetTerrainType(x,y) == 'Olgb' then
return true
elseif GetTerrainType(x,y) == 'Orok' then
return true
elseif GetTerrainType(x,y) == 'Ofsl' then
return true
elseif GetTerrainType(x,y) == 'Oaby' then
return true
elseif GetTerrainType(x,y) == 'Kdrt' then
return true
elseif GetTerrainType(x,y) == 'Kfsl' then
return true
elseif GetTerrainType(x,y) == 'Kdtr' then
return true
elseif GetTerrainType(x,y) == 'Kfst' then
return true
elseif GetTerrainType(x,y) == 'Ksmb' then
return true
elseif GetTerrainType(x,y) == 'Klgb' then
return true
elseif GetTerrainType(x,y) == 'Ksqt' then
return true
elseif GetTerrainType(x,y) == 'Kdkt' then
return true
endif
return false
endfunction
function IsTerrainDungeon takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Ddrt' then
return true
elseif GetTerrainType(x,y) == 'Dbrk' then
return true
elseif GetTerrainType(x,y) == 'Drds' then
return true
elseif GetTerrainType(x,y) == 'Dlvc' then
return true
elseif GetTerrainType(x,y) == 'Dlav' then
return true
elseif GetTerrainType(x,y) == 'Ddkr' then
return true
elseif GetTerrainType(x,y) == 'Dgrs' then
return true
elseif GetTerrainType(x,y) == 'Dsqd' then
return true
endif
return false
endfunction
function IsTerrainUnderground takes real x, real y returns boolean
if GetTerrainType(x,y) == 'Gdrt' then
return true
elseif GetTerrainType(x,y) == 'Gbrk' then
return true
elseif GetTerrainType(x,y) == 'Grds' then
return true
elseif GetTerrainType(x,y) == 'Glvc' then
return true
elseif GetTerrainType(x,y) == 'Glav' then
return true
elseif GetTerrainType(x,y) == 'Gdkr' then
return true
elseif GetTerrainType(x,y) == 'Ggrs' then
return true
elseif GetTerrainType(x,y) == 'Gsqd' then
return true
endif
return false
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Geode initializer init
globals
private constant integer SPELLID = 'Geod'
endglobals
private function Actions takes unit c, unit t returns nothing
local xecast xe = xecast.createA()
local xedamage xd = xedamage.create()
local integer lvl = GetUnitAbilityLevel(c,'Geod')
local real dam = 15+40*lvl + SpellStat(c, false) * (0.65 + lvl*0.25)
local real tx = GetUnitX(c)
local real ty = GetUnitY(c)
local real x = GetUnitX(t)
local real y = GetUnitY(t)
set xe.recycledelay=10.0
set xd.dtype = DAMAGE_TYPE_MIND
set xd.atype = ATTACK_TYPE_MAGIC
call xd.useSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0), "origin")
call xd.damageTarget(c,t,dam)
if IsTerrainCity1(x,y) or IsTerrainCity2(x,y) or IsTerrainCity3(x,y) then
set xe.orderstring = "impale"
set xe.abilityid = 'AUim'
set xe.level = lvl
set xe.owningplayer = GetOwningPlayer(c)
call xe.setSourcePoint(tx,ty,0)
call xe.castOnPoint(x,y)
elseif IsTerrainForest1(x,y) or IsTerrainForest2(x,y) then
set xe.orderstring = "entanglingroots"
set xe.abilityid = 'root'
set xe.level = lvl
set xe.owningplayer = GetOwningPlayer(c)
call xe.castOnTarget(t)
elseif IsTerrainWinter(x,y) then
set xe.orderstring = "frostnova"
set xe.abilityid = 'AUfn'
set xe.level = lvl
set xe.owningplayer = GetOwningPlayer(c)
call xe.castOnTarget(t)
elseif IsTerrainFall(x,y) then
set xe.orderstring = "sleep"
set xe.abilityid = 'AUsl'
set xe.level = lvl
set xe.owningplayer = GetOwningPlayer(c)
call xe.castOnTarget(t)
elseif IsTerrainBarrens(x,y) then
set xe.orderstring = "stomp"
set xe.abilityid = 'AOw2'
set xe.level = lvl
set xe.owningplayer = GetOwningPlayer(c)
call xe.castInPoint(x,y)
elseif IsTerrainSunkenRuins(x,y) then
set xe.orderstring = "monsoon"
set xe.abilityid = 'ANmo'
set xe.level = lvl
set xe.owningplayer = GetOwningPlayer(c)
call xe.castOnPoint(x,y)
elseif IsTerrainOutland(x,y) then
set xe.orderstring = "rainoffire"
set xe.abilityid = 'ANrf'
set xe.level = lvl
set xe.owningplayer = GetOwningPlayer(c)
call xe.castOnPoint(x,y)
elseif IsTerrainDungeon(x,y) then
set xe.orderstring = "flamestrike"
set xe.abilityid = 'AHfs'
set xe.level = lvl
set xe.owningplayer = GetOwningPlayer(c)
call xe.castOnPoint(x,y)
elseif IsTerrainUnderground(x,y) then
set xe.orderstring = "shadowstrike"
set xe.abilityid = 'AEsh'
set xe.level = lvl
set xe.owningplayer = GetOwningPlayer(c)
call xe.setSourcePoint(tx,ty,0)
call xe.castOnTarget(t)
else
call xe.destroy()
endif
call xd.destroy()
endfunction
function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(),GetSpellTargetUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=390
//TESH.alwaysfold=0
library MapScript requires IsTerrain, TerrainPathability
//****************************************************
//****************************************************
//****************************************************
//Mapwide Global Utilites:
//****************************************************
//****************************************************
//****************************************************
function GetUnitBounty takes unit u returns integer
local integer i = UnitBounty[GetUnitId(u)]
local integer i2
if i == 0 then
set i = GetUnitPointValue(u)
if IsUnitType(u, UNIT_TYPE_HERO) then
set i = i * GetHeroLevel(u)
set i = i - i/3
elseif IsUnitType(u, UNIT_TYPE_SUMMONED) then
set i = i/2
endif
endif
set i2 = i/5
set i = GetRandomInt(i-i2, i+i2)
return i
endfunction
function SpellStat takes unit c, boolean bonus returns integer
if GetHeroInt(c, false) == 0 and GetHeroAgi(c, false) == 0 and GetHeroStr(c, false) == 0 then
return R2I(GetUnitBounty(c)*0.4)
elseif GetHeroInt(c, bonus) >= GetHeroStr(c, bonus) then
return GetHeroInt(c, bonus)
elseif GetHeroInt(c, bonus) >= GetHeroAgi(c, bonus) then
return GetHeroInt(c, bonus)
elseif GetHeroStr(c, bonus) >= GetHeroAgi(c, bonus) then
return GetHeroStr(c, bonus)
elseif GetHeroStr(c, bonus) > GetHeroInt(c, bonus) then
return GetHeroStr(c, bonus)
endif
return GetHeroAgi(c, bonus)
endfunction
function CustomAuraTail takes nothing returns nothing
local timer tail = GetExpiredTimer()
call DestroyEffect(LoadEffectHandle(AuraFXHash, 1, GetHandleId(tail)))
call ReleaseTimer(tail)
endfunction
function CustomAuraLoop takes nothing returns nothing
local timer tim = GetExpiredTimer()
local timer tail = NewTimer()
local unit u = LoadUnitHandle(AuraFXHash, 0, GetHandleId(tim))
local real A = AuraFXA[GetUnitId(u)]
local real B = AuraFXB[GetUnitId(u)]
local real C = AuraFXC[GetUnitId(u)]
local real D = AuraFXD[GetUnitId(u)]
local real S = AuraFXS[GetUnitId(u)]
local real T = AuraFXTail[GetUnitId(u)]
local real R = AuraFXRing[GetUnitId(u)]
local real X2 = GetUnitX(u) + 200*D * Cos(R*C * bj_DEGTORAD)
local real Y2 = GetUnitY(u) + 200*D * Sin(R*C * bj_DEGTORAD)
local real X = X2 + 66.67 * Cos(R*A * bj_DEGTORAD)
local real Y = Y2 + 66.67 * Sin(R*A * bj_DEGTORAD)
if IsUnitType(u, UNIT_TYPE_DEAD) then
elseif u != null then
call SaveEffectHandle(AuraFXHash, 1, GetHandleId(tail), AddSpecialEffect(AuraFX[GetUnitId(u)], X, Y))
call TimerStart(tail, T, false, function CustomAuraTail)
set AuraFXRing[GetUnitId(u)] = R + S
if AuraFXShrink[GetUnitId(u)] == true then
set AuraFXD[GetUnitId(u)] = D-B*S
else
set AuraFXD[GetUnitId(u)] = D+B*S
endif
if D >= 2 then
set AuraFXShrink[GetUnitId(u)] = true
elseif D <= 1 then
set AuraFXShrink[GetUnitId(u)] = false
endif
else
call ReleaseTimer(tim)
endif
set u = null
endfunction
function FXTimerLoop takes nothing returns nothing
local timer tim = GetExpiredTimer()
local timer tail = NewTimer()
local unit u = LoadUnitHandle(AuraFXHash, 0, GetHandleId(tim))
local real X = GetUnitX(u)
local real Y = GetUnitY(u)
local real T = AuraFXTail[GetUnitId(u)]
if IsUnitType(u, UNIT_TYPE_DEAD) then
elseif u != null then
call SaveEffectHandle(AuraFXHash, 1, GetHandleId(tail), AddSpecialEffect(AuraFX[GetUnitId(u)], X, Y))
call TimerStart(tail, T, false, function CustomAuraTail)
else
call ReleaseTimer(tim)
endif
endfunction
//custom data funcs (yeah, yeah, i'll use a gamecache someday)
function IsUnitTrain takes unit un returns boolean
if IsTrained[GetUnitId(un)] == 1 then
return true
endif
return false
endfunction
function SetUnitTrain takes unit un, boolean t returns nothing
if IsUnitTrain(un) != t then
if t then
set IsTrained[GetUnitId(un)] = 1
endif
endif
endfunction
function GetPlayerHeroEnum takes nothing returns nothing
if IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) then
set udg_TEMP_Unit = GetEnumUnit()
endif
endfunction
function GetPlayerHero takes integer id returns unit
//why isn't this just a static variable reference? because it
//used to be, and sometimes the ref would get lost and a player
//couldn't revive. i'm not taking any more chances.
//update: turns out that's not the bug. well fuck.
local group grp
if udg_FreeHero then
return udg_HERO_Ref2[id]
endif
set udg_TEMP_Unit = null
if IsPlayerInForce(ConvertedPlayer(id), udg_Force[1]) then
set grp = GetUnitsOfPlayerAll(ConvertedPlayer(id))
call ForGroupBJ(grp, function GetPlayerHeroEnum )
call DestroyGroup(grp)
endif
set udg_HERO_Ref2[id] = udg_TEMP_Unit
return udg_TEMP_Unit
endfunction
//keepalive
function KeepAliveUnit takes unit un returns nothing
local integer i
if IsUnitInGroup(un, udg_KA_Group) then
set i = 1
loop
exitwhen i > 1000
if udg_KA_Unit[i] == un then
call DestroyTextTagBJ( udg_KA_Text[i] )
call GroupRemoveUnitSimple( un, udg_KA_Group )
set udg_KA_Unit[i] = null
set udg_KA_Text[i] = null
set i = 1000
endif
set i = i + 1
endloop
else
if not IsUnitIdType(GetUnitTypeId(GetEnumUnit()), UNIT_TYPE_GIANT) then
if not IsUnitOwnedByPlayer(GetEnumUnit(), Player(15)) then
call GroupAddUnitSimple( un, udg_KA_Group )
call CreateTextTagUnitBJ( "KA", un, 0, 10, 100, 100, 100, 0 )
call ShowTextTagForceBJ( false, GetLastCreatedTextTag(), udg_Force[1] )
call ShowTextTagForceBJ( true, GetLastCreatedTextTag(), udg_Force[2] )
endif
endif
set i = 1
loop
exitwhen i > 1000
if udg_KA_Unit[i] == null then
set udg_KA_Unit[i] = un
set udg_KA_Text[i] = GetLastCreatedTextTag()
set i = 1000
endif
set i = i + 1
endloop
endif
endfunction
function RemoveKeepAliveUnit takes unit un returns nothing
if IsUnitInGroup(un, udg_KA_Group) then
call KeepAliveUnit(un)
endif
endfunction
//gamename translator
function AddTranslate takes string strfrom, string strto returns nothing
set udg_TranslateTotal = udg_TranslateTotal + 1
set udg_TranslateFrom[udg_TranslateTotal] = strfrom
set udg_TranslateTo[udg_TranslateTotal] = strto
endfunction
function InitTranslator takes nothing returns nothing
set udg_TranslateTotal = 0
call AddTranslate("custom_h00B", "trainingroom")
call AddTranslate("custom_h00B", "trainroom")
call AddTranslate("custom_n001", "fountain")
call AddTranslate("custom_e018", "dummy")
call AddTranslate("custom_h004", "barn")
call AddTranslate("custom_h003", "haycart")
call AddTranslate("custom_h002", "windmill")
call AddTranslate("custom_n00B", "questshop1")
call AddTranslate("custom_n00C", "questshop2")
call AddTranslate("custom_n00S", "questshop3")
call AddTranslate("custom_n02G", "questshop4")
call AddTranslate("custom_n02H", "questshop5")
call AddTranslate("custom_n02I", "questshop6")
call AddTranslate("custom_n02S", "itemshop")
call AddTranslate("custom_n00J", "blacksmith1")
call AddTranslate("custom_n00D", "blacksmith2")
call AddTranslate("custom_n00L", "blacksmith3")
call AddTranslate("custom_n00E", "haven1")
call AddTranslate("custom_n003", "haven2")
call AddTranslate("custom_n00K", "haven3")
call AddTranslate("custom_n00N", "tower1")
call AddTranslate("custom_n007", "tower2")
call AddTranslate("custom_n00M", "tower3")
call AddTranslate("custom_arm1", "armory1")
call AddTranslate("custom_arm2", "armory2")
call AddTranslate("custom_arm3", "armory3")
call AddTranslate("custom_tan1", "tannery1")
call AddTranslate("custom_tan2", "tannery2")
call AddTranslate("custom_tan3", "tannery3")
call AddTranslate("custom_sea1", "seamstress1")
call AddTranslate("custom_sea2", "seamstress2")
call AddTranslate("custom_sea3", "seamstress3")
call AddTranslate("custom_ugsp", "gargoylespire")
call AddTranslate("custom_frui", "marketstand")
//The following are heroes
call AddTranslate("custom_H007", "elvenarcher")
call AddTranslate("custom_MArc", "malearcher")
call AddTranslate("custom_ECle", "elvencleric")
call AddTranslate("custom_HSwo", "humanswordsman")
call AddTranslate("custom_H005", "humanmage")
call AddTranslate("custom_H005", "elvenmage")
call AddTranslate("custom_HSum", "humansummoner")
call AddTranslate("custom_HSum", "elvensummoner")
call AddTranslate("custom_H00S", "dwarvenwarrior")
call AddTranslate("custom_N03P", "dwarvencaster")
call AddTranslate("custom_N03P", "femaledwarf")
call AddTranslate("custom_N03Q", "dwarvenbard")
call AddTranslate("custom_N03Q", "dwarfbard")
call AddTranslate("custom_N030", "gnomecaster")
call AddTranslate("custom_H009", "dwarvenrifleman")
call AddTranslate("custom_H00G", "humancrusader")
call AddTranslate("custom_H00G", "elvencrusader")
call AddTranslate("custom_H00G", "crusader")
call AddTranslate("custom_HRo1", "humanassassin")
call AddTranslate("custom_HRo1", "elvenassassin")
call AddTranslate("custom_H00U", "elvenlasher")
call AddTranslate("custom_H00U", "lasher")
call AddTranslate("custom_HPir", "pirate")
call AddTranslate("custom_HPir", "humanpirate")
call AddTranslate("custom_HPir", "elvenpirate")
call AddTranslate("custom_E005", "brawler")
call AddTranslate("custom_E005", "pandarenbrawler")
call AddTranslate("custom_E004", "lizardgeomancer")
call AddTranslate("custom_E004", "lizardfolkgeomancer")
call AddTranslate("custom_E004", "geomancer")
call AddTranslate("custom_E006", "nightelfdruid")
call AddTranslate("custom_E006", "druid")
call AddTranslate("custom_PotM", "nightelfpriestess")
call AddTranslate("custom_PotM", "priestess")
call AddTranslate("custom_H00A", "nightelfgiant")
call AddTranslate("custom_E003", "nightelfarcher")
call AddTranslate("custom_E003", "nightelfranger")
call AddTranslate("custom_E003", "ranger")
call AddTranslate("custom_E001", "nightelfslayer")
call AddTranslate("custom_E001", "slayer")
call AddTranslate("custom_O007", "tigeranspellsword")
call AddTranslate("custom_O007", "tigeran")
call AddTranslate("custom_O007", "spellsword")
call AddTranslate("custom_NEde", "dryadenchantress")
call AddTranslate("custom_NEde", "enchantress")
call AddTranslate("custom_Avia", "avian")
call AddTranslate("custom_Avia", "wingedfolk")
call AddTranslate("custom_O001", "orcgruntie")
call AddTranslate("custom_O001", "gruntie")
call AddTranslate("custom_O004", "orcshaman")
call AddTranslate("custom_O004", "halfhumanshaman")
call AddTranslate("custom_O004", "moknathalshaman")
call AddTranslate("custom_O000", "orcsamurai")
call AddTranslate("custom_O006", "orcwarlock")
call AddTranslate("custom_O002", "trolldragoon")
call AddTranslate("custom_O002", "dragoon")
call AddTranslate("custom_O002", "humandragoon")
call AddTranslate("custom_TaLe", "taurentribesman")
call AddTranslate("custom_TaLe", "tribesman")
call AddTranslate("custom_TaLe", "taurentriballeader")
call AddTranslate("custom_TaLe", "triballeader")
call AddTranslate("custom_O003", "trollwitchdoctor")
call AddTranslate("custom_VooH", "trollvoodoohunter")
call AddTranslate("custom_VooH", "voodoohunter")
call AddTranslate("custom_U002", "undeadbanshee")
call AddTranslate("custom_U000", "skeletalsummoner")
call AddTranslate("custom_U000", "undeadsummoner")
call AddTranslate("custom_N004", "undeadranger")
call AddTranslate("custom_N005", "undeadknight")
call AddTranslate("custom_U001", "undeadvampire")
call AddTranslate("custom_U003", "undeadbaron")
call AddTranslate("custom_URog", "undeadrogue")
call AddTranslate("custom_N00T", "darkwaywalker")
call AddTranslate("custom_UWer", "werewolf")
call AddTranslate("custom_Wman", "wolfman")
call AddTranslate("custom_UWiz", "undeadcaster")
call AddTranslate("custom_UWiz", "ucaster")
call AddTranslate("custom_UGia", "ugiant")
call AddTranslate("custom_UGia", "undeadgiant")
call AddTranslate("custom_H00D", "heroarchangel")
call AddTranslate("custom_Ange", "heroangel")
call AddTranslate("custom_Wrai", "herowraith")
call AddTranslate("custom_Faer", "faerie")
call AddTranslate("custom_FQue", "faeriequeen")
call AddTranslate("custom_DKni", "darkknight")
call AddTranslate("custom_N01F", "earthpandaren")
call AddTranslate("custom_N01E", "firepandaren")
call AddTranslate("custom_N01G", "stormpandaren")
call AddTranslate("custom_DFrm", "direform")
call AddTranslate("custom_E01M", "vengeanceform")
call AddTranslate("custom_E00E", "stagform")
call AddTranslate("custom_DSal", "vizierform")
call AddTranslate("custom_E007", "bearform")
call AddTranslate("custom_DWil", "owlbearform")
call AddTranslate("custom_DWoF", "wolfform")
call AddTranslate("custom_H00E", "armoredknight")
call AddTranslate("custom_U005", "malecaster")
call AddTranslate("custom_EWiz", "malewizard")
call AddTranslate("custom_EWiz", "wizard")
//The following are Units
call AddTranslate("custom_u008", "voodoospirit")
call AddTranslate("custom_h00N", "airelemental")
call AddTranslate("custom_h00L", "earthelemental")
call AddTranslate("custom_h00M", "frostelemental")
call AddTranslate("custom_h00J", "fireelemental")
call AddTranslate("custom_h00P", "voidelemental")
call AddTranslate("custom_h00K", "waterelemental")
call AddTranslate("custom_h00O", "lightningelemental")
call AddTranslate("custom_mooE", "moonelemental")
call AddTranslate("custom_tome", "eviltome")
call AddTranslate("custom_tome", "evilbook")
call AddTranslate("custom_tome", "tome")
call AddTranslate("custom_tome", "book")
call AddTranslate("custom_btom", "floatingtome")
call AddTranslate("custom_btom", "floatingbook")
call AddTranslate("custom_dula", "dullahan")
call AddTranslate("custom_dAzu", "azuredragonlord")
call AddTranslate("custom_dBro", "bronzedragonlord")
call AddTranslate("custom_dRed", "reddragonlord")
call AddTranslate("custom_dGre", "greendragonlord")
call AddTranslate("custom_nar2", "archer2")
call AddTranslate("custom_nar3", "archer3")
call AddTranslate("custom_eleM", "tigeranelemental")
call AddTranslate("custom_crow", "carrioncrow")
call AddTranslate("custom_yfae", "youngfaerie")
call AddTranslate("custom_shbu", "mushroombuilder")
call AddTranslate("custom_shfo", "mushroomsoldier")
call AddTranslate("custom_h00H", "angel")
call AddTranslate("custom_h00F", "archangel")
call AddTranslate("custom_h00T", "wraith")
call AddTranslate("custom_boch", "marrowspectre")
call AddTranslate("custom_hoph", "holyphoenix")
call AddTranslate("custom_fley", "floatingeye")
call AddTranslate("custom_fidr", "lavadragon")
call AddTranslate("custom_shdr", "shadowdragon")
call AddTranslate("custom_now4", "owlscout4")
call AddTranslate("custom_now5", "owlscout5")
call AddTranslate("custom_hwa1", "hydraward1")
call AddTranslate("custom_hwa2", "hydraward2")
call AddTranslate("custom_hwa3", "hydraward3")
call AddTranslate("custom_hwa4", "hydraward4")
call AddTranslate("custom_hwa5", "hydraward5")
call AddTranslate("custom_pwrd", "petalward1")
call AddTranslate("custom_answ", "enchantedsword")
call AddTranslate("custom_u00G", "bonegolem")
call AddTranslate("custom_u00H", "bonebehemoth")
call AddTranslate("custom_u00I", "bonelord")
call AddTranslate("custom_u00J", "bonemenace")
call AddTranslate("custom_u00K", "boneminion")
call AddTranslate("custom_u00L", "bonegrater")
call AddTranslate("custom_u00M", "bonelesser")
call AddTranslate("custom_u00N", "boneweakling")
call AddTranslate("custom_u00O", "bonedust")
call AddTranslate("custom_u00P", "bonevengeance")
call AddTranslate("custom_floc", "locust")
call AddTranslate("custom_tcre", "whipvine")
call AddTranslate("custom_flow", "flower")
call AddTranslate("custom_vftr", "venusflytrap")
//The following are Doodads
call AddTranslate("custom_n019", "azsharastatue")
call AddTranslate("custom_n025", "barrel")
call AddTranslate("custom_n00Y", "bluefire")
call AddTranslate("custom_n012", "bookcase")
call AddTranslate("custom_n012", "bookshelf")
call AddTranslate("custom_n01S", "cage")
call AddTranslate("custom_n013", "campfire")
call AddTranslate("custom_n011", "column")
call AddTranslate("custom_n01Z", "cryptstone")
call AddTranslate("custom_n020", "grave1")
call AddTranslate("custom_n021", "grave2")
call AddTranslate("custom_n022", "grave3")
call AddTranslate("custom_n023", "grave4")
call AddTranslate("custom_n024", "grave5")
call AddTranslate("custom_n01B", "holyfountain")
call AddTranslate("custom_n01U", "sign")
call AddTranslate("custom_n017", "huntressstatuel")
call AddTranslate("custom_n01N", "ice")
call AddTranslate("custom_n018", "keeperstatue")
call AddTranslate("custom_n015", "snightstatue")
call AddTranslate("custom_n01T", "myhticalfountain")
call AddTranslate("custom_n01X", "oldruinfountain")
call AddTranslate("custom_n00X", "redfire")
call AddTranslate("custom_n01P", "ruincolumn")
call AddTranslate("custom_n01Y", "ruinfirecolumn")
call AddTranslate("custom_n01W", "ruinfountain")
call AddTranslate("custom_n01J", "ruinthrone")
call AddTranslate("custom_n01V", "ruinwhalestatue")
call AddTranslate("custom_n01R", "spiderstatue")
call AddTranslate("custom_n010", "table")
call AddTranslate("custom_n00Z", "throne")
call AddTranslate("custom_n014", "trashedcampfire")
call AddTranslate("custom_n028", "volcano")
call AddTranslate("custom_n01A", "whalestatue")
call AddTranslate("custom_n01M", "chair")
call AddTranslate("custom_n02A", "bed")
call AddTranslate("custom_n01M", "woodenchair")
call AddTranslate("custom_o008", "dmswards")
call AddTranslate("custom_flow", "carnivorousflower")
call AddTranslate("custom_o009", "serpenttrap1")
call AddTranslate("custom_o00A", "serpenttrap2")
call AddTranslate("custom_o00B", "serpenttrap3")
call AddTranslate("custom_str4", "serpenttrap4")
call AddTranslate("custom_str5", "serpenttrap5")
call AddTranslate("custom_h00l", "fieryegg")
call AddTranslate("custom_n02B", "resstone")
call AddTranslate("custom_n02C", "light")
call AddTranslate("custom_n02J", "web")
call AddTranslate("custom_n02D", "flyinglavadragon")
call AddTranslate("custom_n02D", "lavadragonflying")
call AddTranslate("custom_n02E", "mat")
call AddTranslate("custom_n02F", "wardrobe")
call AddTranslate("custom_n01L", "frozenthrone")
call AddTranslate("custom_n01O", "eyeofsargeras")
call AddTranslate("custom_n01C", "cityfountain")
call AddTranslate("custom_n029", "explosivebarrel")
call AddTranslate("custom_n01K", "evilthrone")
call AddTranslate("custom_n01Q", "archerytarget")
call AddTranslate("custom_n01Q", "target")
call AddTranslate("custom_n016", "evilstatue")
call AddTranslate("custom_n026", "eggsack1")
call AddTranslate("custom_n027", "eggsack2")
call AddTranslate("custom_n01O", "eyeofsargeras")
call AddTranslate("custom_n01C", "cityfountain")
call AddTranslate("custom_gem1", "gem")
call AddTranslate("custom_ccry", "crystalpedestal")
call AddTranslate("custom_ccry", "crystallamp")
call AddTranslate("custom_rock", "rock")
call AddTranslate("custom_n006", "cactus1")
call AddTranslate("custom_n00I", "cactus2")
call AddTranslate("custom_h000", "redhouse")
call AddTranslate("custom_h001", "greenhouse")
call AddTranslate("custom_h008", "bluehouse")
call AddTranslate("custom_h00C", "redlhouse")
call AddTranslate("custom_h00Q", "greenlhouse")
call AddTranslate("custom_h00R", "bluelhouse")
call AddTranslate("custom_n03H", "floatingrune")
call AddTranslate("custom_n02M", "glowingruin1")
call AddTranslate("custom_n02N", "glowingruin2")
call AddTranslate("custom_n02L", "glowingruin3")
call AddTranslate("custom_n02K", "glowingruin4")
call AddTranslate("custom_n02P", "glowingruin5")
call AddTranslate("custom_n02Q", "glowingruin6")
call AddTranslate("custom_n02O", "glowingruin7")
call AddTranslate("custom_n039", "flower1")
call AddTranslate("custom_n02R", "flower2")
call AddTranslate("custom_n03A", "flower3")
call AddTranslate("custom_n03B", "torch")
call AddTranslate("custom_n03K", "brazier")
call AddTranslate("custom_n03C", "minecart")
call AddTranslate("custom_n03D", "minecartempty")
call AddTranslate("custom_n03E", "magicallantern")
call AddTranslate("custom_n03F", "snowman")
call AddTranslate("custom_n03G", "hay")
call AddTranslate("custom_h00V", "mill")
call AddTranslate("custom_h00W", "nagaportal")
call AddTranslate("custom_e00E", "druidhut")
//The follow are the Item Shops & Gems
call AddTranslate("custom_n02T", "itemshop1")
call AddTranslate("custom_n002", "itemshop2")
call AddTranslate("custom_n02V", "itemshop3")
call AddTranslate("custom_n02U", "itemshop4")
call AddTranslate("custom_n02W", "itemshop5")
call AddTranslate("custom_n02Y", "itemshop6")
call AddTranslate("custom_n02X", "itemshop7")
call AddTranslate("custom_n02Z", "itemshop8")
call AddTranslate("custom_n031", "itemshop9")
call AddTranslate("custom_n030", "itemshop10")
call AddTranslate("custom_n032", "itemshop11")
call AddTranslate("custom_n033", "itemshop12")
call AddTranslate("custom_n035", "itemshop13")
call AddTranslate("custom_n036", "itemshop14")
call AddTranslate("custom_n034", "itemshop15")
call AddTranslate("custom_n038", "itemshop16")
call AddTranslate("custom_n037", "itemshop17")
call AddTranslate("custom_n03L", "specialweaponshop")
call AddTranslate("custom_n03M", "ultimateweaponshop")
call AddTranslate("custom_psh1", "potionshop")
call AddTranslate("custom_ssh1", "supplyshop")
call AddTranslate("custom_ssh2", "supplyshop2")
call AddTranslate("custom_n01D", "essenceshop")
call AddTranslate("custom_o009", "airgem")
call AddTranslate("custom_o00J", "arcanegem")
call AddTranslate("custom_o00K", "darkgem")
call AddTranslate("custom_o00E", "earthgem")
call AddTranslate("custom_o00A", "firegem")
call AddTranslate("custom_o00I", "frostgem")
call AddTranslate("custom_o00F", "lightninggem")
call AddTranslate("custom_o00H", "gemofmana")
call AddTranslate("custom_o00G", "naturegem")
call AddTranslate("custom_o00L", "poisongem")
call AddTranslate("custom_o00M", "spectralgem")
call AddTranslate("custom_o00N", "gemoflight")
call AddTranslate("custom_o00B", "watergem")
//Secondary Names
call AddTranslate("custom_ugrm", "gargoylestone")
call AddTranslate("custom_nogo", "bossogre")
call AddTranslate("custom_nogn", "bossogremagi")
call AddTranslate("custom_noga", "bossogrewarchief")
call AddTranslate("custom_hgyr", "gyrocopter")
//Hero Flag
call AddTranslate("custom_h006", "heroflag")
call AddTranslate("custom_", "")
endfunction
function TranslateTo takes string str returns string
local integer i
set i = 1
loop
exitwhen i > udg_TranslateTotal
if str == udg_TranslateFrom[i] then
return udg_TranslateTo[i]
endif
set i = i + 1
endloop
return str
endfunction
function TranslateFrom takes string str returns string
local integer i
set i = 1
loop
exitwhen i > udg_TranslateTotal
if str == udg_TranslateTo[i] then
return udg_TranslateFrom[i]
endif
set i = i + 1
endloop
return str
endfunction
function isShop takes integer i returns boolean
if i == 'n002' then //item shop
elseif i == 'psh1' then //potion shop
elseif i == 'ssh1' then //supply shops
elseif i == 'ssh2' then
elseif i == 'n01D' then //essences
elseif i == 'n00B' then //quest shops
elseif i == 'n00C' then
elseif i == 'n00S' then
elseif i == 'n02G' then
elseif i == 'n02H' then
elseif i == 'n02I' then
elseif i == 'n00J' then //blacksmiths
elseif i == 'n00D' then
elseif i == 'n00L' then
elseif i == 'arm1' then
elseif i == 'arm2' then
elseif i == 'arm3' then
elseif i == 'n00E' then //havens
elseif i == 'n003' then
elseif i == 'n00K' then
elseif i == 'tan1' then
elseif i == 'tan2' then
elseif i == 'tan3' then
elseif i == 'n00N' then //towers
elseif i == 'n007' then
elseif i == 'n00M' then
elseif i == 'sea1' then
elseif i == 'sea2' then
elseif i == 'sea3' then
else
return false
endif
return true
endfunction
//items
function DropCoin takes location pt, integer level returns nothing
if level <= 1 then
call CreateItemLoc( 'I002', pt )
elseif level == 2 then
call CreateItemLoc( 'I003', pt )
elseif level == 3 then
call CreateItemLoc( 'I004', pt )
elseif level == 4 then
call CreateItemLoc( 'I005', pt )
elseif level == 5 then
call CreateItemLoc( 'I006', pt )
elseif level == 6 then
call CreateItemLoc( 'I007', pt )
elseif level == 7 then
call CreateItemLoc( 'I008', pt )
elseif level == 8 then
call CreateItemLoc( 'I009', pt )
elseif level == 9 then
call CreateItemLoc( 'I00A', pt )
elseif level >= 10 then
call CreateItemLoc( 'I00B', pt )
endif
endfunction
function RandomItemDrop takes integer lvl returns integer
//currently ignore lvl
local integer junk
set junk = GetRandomInt(1,6)
if junk == 1 then
return 'manh'
elseif junk == 2 then
return 'tstr'
elseif junk == 3 then
return 'tdex'
elseif junk == 4 then
return 'tint'
elseif junk == 5 then
return 'tpow'
elseif junk == 6 then
return 'texp'
endif
return 0
endfunction
//doodads
// call CreateDestructableLoc( 'ATtr', GetRectCenter(GetPlayableMapRect()), GetRandomReal(0, 360), 1, 0 )
// call CreateDestructableLoc( 'BTtw', GetRectCenter(GetPlayableMapRect()), GetRandomReal(0, 360), 1, 0 )
// call CreateDestructableLoc( 'ITtw', GetRectCenter(GetPlayableMapRect()), GetRandomReal(0, 360), 1, 0 )
function IsBridge takes destructable d returns boolean
local integer dt
set dt = GetDestructableTypeId(d)
if dt == 'LT06' then
return true
elseif dt == 'LT04' then
return true
elseif dt == 'LT05' then
return true
elseif dt == 'LT07' then
return true
elseif dt == 'YT18' then
return true
elseif dt == 'YT16' then
return true
elseif dt == 'YT17' then
return true
elseif dt == 'YT43' then
return true
elseif dt == 'B005' then
return true
elseif dt == 'B007' then
return true
elseif dt == 'B001' then
return true
elseif dt == 'B003' then
return true
elseif dt == 'B004' then
return true
elseif dt == 'B006' then
return true
elseif dt == 'B000' then
return true
elseif dt == 'B002' then
return true
elseif dt == 'DTs1' then
return true
elseif dt == 'DTs2' then
return true
elseif dt == 'DTs3' then
return true
elseif dt == 'DTsb' then
return true
endif
return false
endfunction
function IsGate takes destructable d returns boolean
local integer dt
set dt = GetDestructableTypeId(d)
if dt == 'LTg1' then
return true
elseif dt == 'LTg3' then
return true
elseif dt == 'LTg2' then
return true
elseif dt == 'LTg4' then
return true
elseif dt == 'LTe1' then
return true
elseif dt == 'LTe3' then
return true
elseif dt == 'LTe2' then
return true
elseif dt == 'LTe4' then
return true
elseif dt == 'ATg1' then
return true
elseif dt == 'ATg3' then
return true
elseif dt == 'ATg2' then
return true
elseif dt == 'ATg4' then
return true
elseif dt == 'ITx1' then
return true
elseif dt == 'ITx2' then
return true
elseif dt == 'ITx3' then
return true
elseif dt == 'ITx4' then
return true
elseif dt == 'ZTd1' then
return true
elseif dt == 'ZTd2' then
return true
elseif dt == 'ZTd3' then
return true
elseif dt == 'ZTd4' then
return true
elseif dt == 'ZTd5' then
return true
elseif dt == 'ZTd6' then
return true
elseif dt == 'ZTd7' then
return true
elseif dt == 'ZTd8' then
return true
elseif dt == 'Ztg4' then
return true
elseif dt == 'Ztg2' then
return true
elseif dt == 'B01J' then
return true
elseif dt == 'B01M' then
return true
elseif dt == 'B01K' then
return true
elseif dt == 'B01Q' then
return true
elseif dt == 'B01P' then
return true
elseif dt == 'B01N' then
return true
elseif dt == 'B01L' then
return true
elseif dt == 'B01S' then
return true
elseif dt == 'B01R' then
return true
elseif dt == 'B01O' then
return true
elseif dt == 'DTg1' then
return true
elseif dt == 'DTg2' then
return true
elseif dt == 'DTg3' then
return true
elseif dt == 'DTg4' then
return true
endif
return false
endfunction
function MakeGate takes location pt, integer typ, integer dir returns nothing
local destructable dt
if typ == 1 then
//gate
if dir == 1 then
set dt = CreateDestructable( 'LTg1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'LTg2', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'LTg3', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'LTg4', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // \
endif
elseif typ == 2 then
//elvengate
if dir == 1 then
set dt = CreateDestructable( 'LTe1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 2 then
set dt = CreateDestructable( 'LTe2', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 3 then
set dt = CreateDestructable( 'LTe3', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 4 then
set dt = CreateDestructable( 'LTe4', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
endif
elseif typ == 3 then
//demonicgate
if dir == 1 then
set dt = CreateDestructable( 'ATg1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 2 then
set dt = CreateDestructable( 'ATg2', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 3 then
set dt = CreateDestructable( 'ATg3', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 4 then
set dt = CreateDestructable( 'ATg4', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
endif
elseif typ == 4 then
//frozen gate
if dir == 1 then
set dt = CreateDestructable( 'ITx1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 2 then
set dt = CreateDestructable( 'ITx2', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 3 then
set dt = CreateDestructable( 'ITx3', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 4 then
set dt = CreateDestructable( 'ITx4', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
endif
elseif typ == 5 then
//rolling stone
if dir == 1 then
set dt = CreateDestructable( 'ZTd1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 2 then
set dt = CreateDestructable( 'ZTd2', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 3 then
set dt = CreateDestructable( 'ZTd6', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif dir == 4 then
set dt = CreateDestructable( 'ZTd4', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
endif
elseif typ == 6 then
//castle gate
if dir == 1 then
set dt = CreateDestructable( 'B01J', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 0.3, 0 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'B01V', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 0.3, 0 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'B01M', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 0.3, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'B01U', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 0.3, 0 ) // \
endif
elseif typ == 7 then
//door
if dir == 1 then
set dt = CreateDestructable( 'B01K', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1.4, 0 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'B01Q', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1.4, 0 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'B01N', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1.4, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'B01P', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1.4, 0 ) // \
endif
elseif typ == 8 then
//double door
if dir == 1 then
set dt = CreateDestructable( 'B01L', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1.4, 0 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'B01S', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1.4, 0 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'B01O', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1.4, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'B01R', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1.4, 0 ) // \
endif
elseif typ == 9 then
//Dungeon Gate
if dir == 1 then
set dt = CreateDestructable( 'DTg1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'DTg2', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'DTg3', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'DTg4', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // \
endif
endif
call SetDestructableInvulnerable( dt, true )
set dt = null
endfunction
function MakeWall takes location pt, integer typ, integer dir returns nothing
local destructable dt
local real x = GetLocationX(pt)
local real y = GetLocationY(pt)
local string str
local integer i
set str = "stand"
if typ == 1 then
//stonewall
if dir == 1 then
set dt = CreateDestructable( 'LTw0', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 2 then
set dt = CreateDestructable( 'LTw3', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 3 then
set dt = CreateDestructable( 'LTw2', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 4 then
set dt = CreateDestructable( 'LTw1', x, y, GetRandomReal(0, 360), 1, 2 )
endif
elseif typ == 2 then
//fence
if dir == 1 then
set dt = CreateDestructable( 'B00I', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 2 then
set dt = CreateDestructable( 'B00K', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 3 then
set dt = CreateDestructable( 'B00J', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 4 then
set dt = CreateDestructable( 'B00L', x, y, GetRandomReal(0, 360), 1, 2 )
endif
elseif typ == 3 then
//evilfence
if dir == 1 then
set dt = CreateDestructable( 'B00M', x, y, GetRandomReal(0, 360), 1, 2 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'B00N', x, y, GetRandomReal(0, 360), 1, 2 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'B00P', x, y, GetRandomReal(0, 360), 1, 2 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'B00O', x, y, GetRandomReal(0, 360), 1, 2 ) // \
endif
elseif typ == 4 then
//northrendwall
if dir == 1 then
set dt = CreateDestructable( 'ITw0', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 2 then
set dt = CreateDestructable( 'ITw3', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 3 then
set dt = CreateDestructable( 'ITw2', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 4 then
set dt = CreateDestructable( 'ITw1', x, y, GetRandomReal(0, 360), 1, 2 )
endif
elseif typ == 5 then
//sunkenruinswall
if dir == 1 then
set dt = CreateDestructable( 'ZTw0', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 2 then
set dt = CreateDestructable( 'ZTw3', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 3 then
set dt = CreateDestructable( 'ZTw2', x, y, GetRandomReal(0, 360), 1, 2 )
elseif dir == 4 then
set dt = CreateDestructable( 'ZTw1', x, y, GetRandomReal(0, 360), 1, 2 )
endif
elseif typ == 6 then
set i = GetRandomInt(0,2)
//barred wall
if dir == 1 then
set dt = CreateDestructable( 'B018', x, y, GetRandomReal(0, 360), 1.5, i )
elseif dir == 2 then
set dt = CreateDestructable( 'B01A', x, y, GetRandomReal(0, 360), 1.7, i )
elseif dir == 3 then
set dt = CreateDestructable( 'B01B', x, y, GetRandomReal(0, 360), 1.5, i )
elseif dir == 4 then
set dt = CreateDestructable( 'B019', x, y, GetRandomReal(0, 360), 1.7, i )
endif
elseif typ == 7 then
//castle wall
if dir == 1 then
set dt = CreateDestructable( 'B01E', x, y, GetRandomReal(0, 360), 0.3, 2 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'B01G', x, y, GetRandomReal(0, 360), 0.3, 2 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'B01F', x, y, GetRandomReal(0, 360), 0.3, 2 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'B01H', x, y, GetRandomReal(0, 360), 0.3, 2 ) // \
endif
elseif typ == 8 then
//interior wall
if dir == 1 then
set dt = CreateDestructable( 'B01W', x, y, GetRandomReal(0, 360), 0.4, 2 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'B01Y', x, y, GetRandomReal(0, 360), 0.4, 2 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'B01T', x, y, GetRandomReal(0, 360), 0.4, 2 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'B01X', x, y, GetRandomReal(0, 360), 0.4, 2 ) // \
endif
elseif typ == 9 then
//mine wall
if dir == 1 then
set dt = CreateDestructable( 'B01Z', x, y, GetRandomReal(0, 360), 4.3, 0 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'B022', x, y, GetRandomReal(0, 360), 4.3, 0 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'B020', x, y, GetRandomReal(0, 360), 4.3, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'B021', x, y, GetRandomReal(0, 360), 4.3, 0 ) // \
endif
elseif typ == 10 then
//LoS Blocker
if IsPlayerInForce(GetLocalPlayer(), udg_Force[1]) then
set str = "death"
endif
set dt = CreateDestructable( 'YTlb', x, y, 0, 1, 0 )
call SetDestructableAnimation(dt, str)
elseif typ == 11 then
//Path Blocker
set dt = CreateDestructable( 'YTpb', x, y, 0, 1, 0 )
endif
call SetDestructableInvulnerable( dt, true )
endfunction
function MakeWallXY takes real x, real y, integer typ, integer dir returns nothing
local location loc = Location(x,y)
call MakeWall(loc, typ, dir)
call RemoveLocation(loc)
set loc = null
endfunction
//Make Single Doodad
function MakeSingle takes location pt, integer typ returns nothing
local destructable dt
local integer highbound
if typ == 0 then
//Citadel
set dt = CreateDestructable('XTvt', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
elseif typ == 1 then
//Flower
set highbound = GetRandomInt(0,4)
set dt = CreateDestructable('B00W', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 2 then
//Icey Rock
set highbound = 5
set dt = CreateDestructable('ITcr', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 3 then
//Icey Claw
set highbound = 10
set dt = CreateDestructable('B00H', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 4 then
//Mushroom
set highbound = 4
set dt = CreateDestructable('B00X', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 5 then
//Rock1 (Felwood)
set highbound = 4
set dt = CreateDestructable('B00Y', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 6 then
//Rock2 (Northrend)
set highbound = 4
set dt = CreateDestructable('B00Z', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 7 then
//Rock1 (Ashenvale)
set highbound = 4
set dt = CreateDestructable('B017', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 8 then
//Rock2 (Barrens)
set highbound = 4
set dt = CreateDestructable('B016', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 9 then
//Rock2 (Dungeon)
set highbound = 4
set dt = CreateDestructable('B011', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 10 then
//Rock2 (Lordaeron)
set highbound = 4
set dt = CreateDestructable('B015', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 11 then
//Rock2 (North)
set highbound = 4
set dt = CreateDestructable('B00Z', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 12 then
//Rock2 (Outland)
set highbound = 4
set dt = CreateDestructable('B012', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 13 then
//Rock2 (Ruins)
set highbound = 4
set dt = CreateDestructable('B014', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 14 then
//Rock2 (Underground)
set highbound = 4
set dt = CreateDestructable('B010', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 15 then
//Mushroom Felwood
set highbound = 4
set dt = CreateDestructable('B01D', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 16 then
//Mushroom Ruins
set highbound = 4
set dt = CreateDestructable('B01C', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, GetRandomInt(0,highbound) )
elseif typ == 17 then
//Castle Tower
set dt = CreateDestructable('B01I', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 0.35, 0 )
elseif typ == 18 then
//Bed
set dt = CreateDestructable('bed1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1.4, 0 )
elseif typ == 19 then
//Mat
set dt = CreateDestructable('mat1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1.4, 0 )
elseif typ == 20 then
//Grave
set dt = CreateDestructable('grv1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), GetRandomReal(0.9,1.1), GetRandomInt(0,3) )
elseif typ == 21 then
//Light
set dt = CreateDestructable('lig1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), GetRandomReal(8.5,9), 0 )
elseif typ == 22 then
//Lamp
set dt = CreateDestructable('lamp', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 )
endif
call SetDestructableInvulnerable( dt, true )
/*****To Play Birth Anim
call KillDestructable( dt )
call DestructableRestoreLife( dt, GetDestructableMaxLife(dt), true )
*/
endfunction
function MakeDoodadAngled takes location pt, integer typ, integer dir returns nothing
local destructable dt
if typ == 1 then
//Log
if dir == 1 then
set dt = CreateDestructable( 'B009', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) //---
elseif dir == 2 then
set dt = CreateDestructable( 'B00G', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'B00Q', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'B00R', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // \
endif
elseif typ == 2 then
//Archway
if dir == 1 then
set dt = CreateDestructable( 'B00T', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'B00V', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // \
elseif dir == 3 then
set dt = CreateDestructable( 'B00S', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'B00U', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // /
endif
elseif typ == 3 then
//table
if dir == 1 then
set dt = CreateDestructable( 'tab1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'tab3', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // \
elseif dir == 3 then
set dt = CreateDestructable( 'tab2', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'tab4', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // /
endif
elseif typ == 4 then
//chair
if dir == 1 then
set dt = CreateDestructable( 'cha1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // --- ^
elseif dir == 2 then
set dt = CreateDestructable( 'cha4', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // / >
elseif dir == 3 then
set dt = CreateDestructable( 'cha6', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // | >
elseif dir == 4 then
set dt = CreateDestructable( 'cha3', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // \ >
elseif dir == 5 then
set dt = CreateDestructable( 'cha5', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // v ---
elseif dir == 6 then
set dt = CreateDestructable( 'cha8', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // < /
elseif dir == 7 then
set dt = CreateDestructable( 'cha2', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // < |
elseif dir == 8 then
set dt = CreateDestructable( 'cha7', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // < \
endif
elseif typ == 5 then
//bed
if dir == 1 then
set dt = CreateDestructable( 'bed1', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'bed4', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // /
elseif dir == 3 then
set dt = CreateDestructable( 'bed2', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'bed3', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // \
endif
elseif typ == 6 then
//bed
if dir == 1 then
set dt = CreateDestructable( 'B026', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // ---
elseif dir == 2 then
set dt = CreateDestructable( 'B023', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // \
elseif dir == 3 then
set dt = CreateDestructable( 'B025', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // |
elseif dir == 4 then
set dt = CreateDestructable( 'B024', GetLocationX(pt), GetLocationY(pt), GetRandomReal(0, 360), 1, 0 ) // /
endif
endif
call SetDestructableInvulnerable( dt, true )
set dt = null
endfunction
function AngleToDirNum takes real theta returns integer
if -22.5 <= theta and theta < 22.5 then
return 3 //vert
elseif 22.5 <= theta and theta < 67.5 then
return 4 //diag2
elseif -67.5 <= theta and theta < 22.5 then
return 2 //diag1
elseif 67.5 <= theta and theta < 112.5 then
return 1 //horiz
elseif -112.5 <= theta and theta < -67.5 then
return 1
elseif 112.5 <= theta and theta < 157.5 then
return 2
elseif -157.5 <= theta and theta < -112.5 then
return 4
else
return 3
endif
return -1
endfunction
function AngleToDirNumEight takes real theta returns integer
if -22.5 <= theta and theta < 22.5 then
return 3 //vert
elseif 22.5 <= theta and theta < 67.5 then
return 4 //diag2
elseif -67.5 <= theta and theta < 22.5 then
return 2 //diag1
elseif 67.5 <= theta and theta < 112.5 then
return 1 //horiz
elseif -112.5 <= theta and theta < -67.5 then
return 5
elseif 112.5 <= theta and theta < 157.5 then
return 6
elseif -157.5 <= theta and theta < -112.5 then
return 8
else
return 7
endif
return -1
endfunction
function AngleToDirNumWrap takes real junk returns integer
local real theta
set theta = junk
if theta >= 180 then
set theta = theta - 360
endif
return AngleToDirNum(theta)
endfunction
function FindFacingDir takes location pt, location target returns integer
return AngleToDirNum(AngleBetweenPoints(pt, target))
endfunction
function FindFacingDirEight takes location pt, location target returns integer
return AngleToDirNumEight(AngleBetweenPoints(pt, target))
endfunction
function FindAlignmentDir takes location pt, location target returns integer
local real theta
set theta = AngleBetweenPoints(pt, target) + 90
if theta >= 180 then
set theta = theta - 360
endif
return AngleToDirNum(theta)
endfunction
// call CreateDestructableLoc( 'LTg1', GetRectCenter(GetPlayableMapRect()), GetRandomReal(0, 360), 1, 0 )
// call CreateDestructableLoc( 'LTg3', GetRectCenter(GetPlayableMapRect()), GetRandomReal(0, 360), 1, 0 )
// call CreateDestructableLoc( 'LTg2', GetRectCenter(GetPlayableMapRect()), GetRandomReal(0, 360), 1, 0 )
// call CreateDestructableLoc( 'LTg4', GetRectCenter(GetPlayableMapRect()), GetRandomReal(0, 360), 1, 0 )
function DrawWallLine takes location pt, integer typ, location target returns nothing
local real xmult
local real ymult
local real theta
local integer dir
local real curlen
local real totlen
local real lenmult
local real x = GetLocationX(pt)
local real y = GetLocationY(pt)
local real xt = GetLocationX(target)
local real yt = GetLocationY(target)
set theta = AngleBetweenPoints(pt, target)
set dir = AngleToDirNumWrap(theta + 90)
set totlen = DistanceBetweenPoints(pt,target)
if theta < -112.5 or theta > 112.5 then
set xmult = -1
elseif theta < 67.5 and theta > -67.5 then
set xmult = 1
else
set xmult = 0
endif
if theta < 157.5 and theta > 22.5 then
set ymult = 1
elseif theta < -22.5 and theta > -157.5 then
set ymult = -1
else
set ymult = 0
endif
set x = x + 160 * xmult
set y = y + 160 * ymult
set lenmult = SquareRoot(Pow(xmult*320, 2.00) + Pow(ymult*320, 2.00))
set curlen = lenmult/2
loop
if not(RectContainsCoords(gg_rct_DMarea, x, y)) then
call MakeWallXY(x,y,typ,dir)
endif
set x = x + 320 * xmult
set y = y + 320 * ymult
set curlen = curlen + lenmult
exitwhen curlen >= totlen
endloop
// call DisplayTextToForce( GetPlayersAll(), R2S(theta) )
// call DisplayTextToForce( GetPlayersAll(), R2S(xmult) + " " + R2S(ymult) )
endfunction
function DrawSmallWallLine takes location pt, integer typ, location target returns nothing
local real xmult
local real ymult
local real theta
local integer dir
local real curlen
local real totlen
local real lenmult
local real xadjust = 0
local real yadjust = 0
local real x = GetLocationX(pt)
local real y = GetLocationY(pt)
local real xt = GetLocationX(target)
local real yt = GetLocationY(target)
set theta = AngleBetweenPoints(pt, target)
set dir = AngleToDirNumWrap(theta + 90)
set totlen = DistanceBetweenPoints(pt,target)
if theta < -112.5 or theta > 112.5 then
set xmult = -1
elseif theta < 67.5 and theta > -67.5 then
set xmult = 1
else
set xmult = 0
endif
if theta < 157.5 and theta > 22.5 then
set ymult = 1
elseif theta < -22.5 and theta > -157.5 then
set ymult = -1
else
set ymult = 0
endif
if typ == 10 or typ == 11 then
if dir == 3 then
set yadjust = -64
elseif dir == 1 then
set xadjust = -64
else
set yadjust = -72
set xadjust = -72
endif
endif
set x = x + (64 + xadjust/2) * xmult
set y = y + (64 + yadjust/2) * ymult
set lenmult = SquareRoot(Pow(xmult*(128+xadjust), 2.00) + Pow(ymult*(128+yadjust), 2.00))
set curlen = lenmult/2
loop
if not(RectContainsCoords(gg_rct_DMarea, x, y)) then
call MakeWallXY(x,y,typ,dir)
endif
set x = x + (128 + xadjust) * xmult
set y = y + (128 + yadjust) * ymult
set curlen = curlen + lenmult
exitwhen curlen >= totlen
endloop
// call DisplayTextToForce( GetPlayersAll(), R2S(theta) )
// call DisplayTextToForce( GetPlayersAll(), R2S(xmult) + " " + R2S(ymult) )
endfunction
function DrawMixWallLine takes location pt, integer typ, location target returns nothing
local real xmult
local real ymult
local real theta
local integer dir
local real xadjust = 0
local real yadjust = 0
local real curlen
local real totlen
local real lenmult
local real x = GetLocationX(pt)
local real y = GetLocationY(pt)
local real xt = GetLocationX(target)
local real yt = GetLocationY(target)
set theta = AngleBetweenPoints(pt, target)
set dir = AngleToDirNumWrap(theta + 90)
set totlen = DistanceBetweenPoints(pt,target)
if theta < -112.5 or theta > 112.5 then
set xmult = -1
elseif theta < 67.5 and theta > -67.5 then
set xmult = 1
else
set xmult = 0
endif
if theta < 157.5 and theta > 22.5 then
set ymult = 1
elseif theta < -22.5 and theta > -157.5 then
set ymult = -1
else
set ymult = 0
endif
if typ == 8 then
if dir == 3 then
set yadjust = -80
elseif dir == 1 then
set xadjust = -80
endif
endif
if (xmult == 1 or xmult == -1) and (ymult == 1 or ymult == -1) then
set x = x + 64 * xmult
set y = y + 64 * ymult
set lenmult = SquareRoot(Pow(xmult*128, 2.00) + Pow(ymult*128, 2.00))
set curlen = lenmult/2
loop
if not(RectContainsCoords(gg_rct_DMarea, x, y)) then
call MakeWallXY(x,y,typ,dir)
endif
set x = x + 128 * xmult
set y = y + 128 * ymult
set curlen = curlen + lenmult
exitwhen curlen >= totlen
endloop
else
set x = x + (160 + xadjust/2) * xmult
set y = y + (160 + yadjust/2) * ymult
set lenmult = SquareRoot(Pow(xmult*(320+xadjust), 2.00) + Pow(ymult*(320+yadjust), 2.00))
set curlen = lenmult/2
loop
if not(RectContainsCoords(gg_rct_DMarea, x, y)) then
call MakeWallXY(x,y,typ,dir)
endif
set x = x + (320 + xadjust) * xmult
set y = y + (320 + yadjust) * ymult
set curlen = curlen + lenmult
exitwhen curlen >= totlen
endloop
endif
endfunction
function FindNearbyGateEnum takes nothing returns nothing
local location pt
set pt = GetDestructableLoc(GetEnumDestructable())
if IsGate(GetEnumDestructable()) then
if DistanceBetweenPoints(udg_TEMP_Location, pt) < udg_TEMP_Real then
set udg_TEMP_Destructible = GetEnumDestructable()
set udg_TEMP_Real = DistanceBetweenPoints(udg_TEMP_Location, pt)
endif
endif
call RemoveLocation(pt)
endfunction
function FindNearbyGate takes location pt returns destructable
set udg_TEMP_Real = 1000000
set udg_TEMP_Destructible = null
set udg_TEMP_Location = pt
call EnumDestructablesInCircleBJ( 1000.00, pt, function FindNearbyGateEnum )
return udg_TEMP_Destructible
endfunction
function BridgeDirection takes destructable d returns integer
local integer dt
set dt = GetDestructableTypeId(d)
if dt == 'LT06' then
return 3
elseif dt == 'LT04' then
return 4
elseif dt == 'LT05' then
return 1
elseif dt == 'LT07' then
return 2
elseif dt == 'DTs2' then
return 3 //Horizon
elseif dt == 'DTsb' then
return 4 //Vert
elseif dt == 'DTs1' then
return 1 //Diag 1
elseif dt == 'DTs3' then
return 2 //Diag 2
elseif dt == 'YT18' then
return 3
elseif dt == 'YT16' then
return 4
elseif dt == 'YT17' then
return 1
elseif dt == 'YT43' then
return 2
elseif dt == 'B005' then
return 3
elseif dt == 'B007' then
return 4
elseif dt == 'B001' then
return 1
elseif dt == 'B003' then
return 2
elseif dt == 'B004' then
return 3
elseif dt == 'B006' then
return 4
elseif dt == 'B000' then
return 1
elseif dt == 'B002' then
return 2
endif
return -1
endfunction
function GetBridgeTypeAtPt takes location pt returns integer
if RectContainsLoc(gg_rct_Forest, pt) then
return 0
elseif RectContainsLoc(gg_rct_Snow, pt) then
return 2
elseif RectContainsLoc(gg_rct_Desert, pt) then
return 1
endif
return 0
endfunction
function GetBridge takes integer typ, integer facing, location loc returns integer
local integer var
if typ == 0 then
//wooden bridge
if facing == 3 then
return 'LT06'
elseif facing == 4 then
return 'LT04'
elseif facing == 1 then
return 'LT05'
elseif facing == 2 then
return 'LT07'
endif
elseif typ == 1 then
//stone bridge
set var = GetBridgeTypeAtPt(loc)
if var == 0 then
//ashenvale
if facing == 3 then
return 'YT18'
elseif facing == 4 then
return 'YT16'
elseif facing == 1 then
return 'YT17'
elseif facing == 2 then
return 'YT43'
endif
elseif var == 1 then
//barrens
if facing == 3 then
return 'B005'
elseif facing == 4 then
return 'B007'
elseif facing == 1 then
return 'B001'
elseif facing == 2 then
return 'B003'
endif
elseif var == 2 then
//winter
if facing == 3 then
return 'B004'
elseif facing == 4 then
return 'B006'
elseif facing == 1 then
return 'B000'
elseif facing == 2 then
return 'B002'
endif
endif
elseif typ == 2 then
//force bridge
if facing == 3 then
return 'DTs2' //Horizon
elseif facing == 4 then
return 'DTsb' //Vertical
elseif facing == 1 then
return 'DTs1' //Diag 1
elseif facing == 2 then
return 'DTs3' //Diag 2
endif
endif
return 0
endfunction
function FindNearbyBridgeEnum takes nothing returns nothing
local location pt
set pt = GetDestructableLoc(GetEnumDestructable())
if IsBridge(GetEnumDestructable()) then
if DistanceBetweenPoints(udg_TEMP_Location, pt) < udg_TEMP_Real then
set udg_TEMP_Destructible = GetEnumDestructable()
set udg_TEMP_Real = DistanceBetweenPoints(udg_TEMP_Location, pt)
endif
endif
call RemoveLocation(pt)
endfunction
function FindNearbyBridge takes location pt returns destructable
set udg_TEMP_Real = 1000000
set udg_TEMP_Destructible = null
set udg_TEMP_Location = pt
call EnumDestructablesInCircleBJ( 1000.00, pt, function FindNearbyBridgeEnum )
return udg_TEMP_Destructible
endfunction
function MakeBridge takes integer typ, location pt returns integer
local destructable d
local location loc
local integer f
set d = FindNearbyBridge(pt)
if d == null then
return -1
else
set loc = GetDestructableLoc(d)
set f = BridgeDirection(d)
call RemoveDestructable(d)
call CreateDestructableLoc( GetBridge(typ,f,loc), loc, GetRandomReal(0, 360), 1, 0 )
call KillDestructable( GetLastCreatedDestructable() )
call DestructableRestoreLife( GetLastCreatedDestructable(), GetDestructableMaxLife(GetEnumDestructable()), true)
call RemoveLocation(loc)
endif
return 0
endfunction
function GetDoodadVariation takes integer dd returns integer
if dd == 'ATtr' then
return GetRandomInt(0, 4)
else
return GetRandomInt(0, 9)
endif
return 0
endfunction
function GetDoodadTypAtPt takes integer typ, location pt returns integer
local real dd
local real df
local real ds
local real dg
local real rnd
set udg_GUI_Misc_DoodadFillCount = udg_GUI_Misc_DoodadFillCount + 1
if IsTerrainWalkable(GetLocationX(pt), GetLocationY(pt)) then
if typ == 1 then
return 'NTtw'
elseif typ == 2 then
return 'ATtr'
elseif typ == 3 then
return 'FTtw'
elseif typ == 4 then
return 'GTsh'
elseif typ == 5 then
return 'DTsh'
elseif typ == 6 then
return 'OTtw'
elseif typ == 7 then
return 'ZTtw'
elseif typ == 8 then
return 'BTtw'
elseif typ == 9 then
return 'CTtr'
elseif typ == 10 then
return 'WTst'
elseif typ == 11 then
return 'WTtw'
elseif typ == 12 then
return 'YTct'
elseif typ == 13 then
return 'LTlt'
elseif typ == 14 then
return 'JTtw'
elseif RectContainsLoc(gg_rct_Forest, pt) then
return 'ATtr'
elseif RectContainsLoc(gg_rct_Snow, pt) then
return 'ITtw'
elseif RectContainsLoc(gg_rct_Desert, pt) then
return 'BTtw'
endif
return 'ATtr'
endif
return 0
endfunction
function DoodadFillAreaGrove takes rect area, boolean circle, integer typ returns nothing
local real inc = 150
local real x
local real y
local location pt
local integer dd
//normalize value to multiple of 150 of world coords to prevent tree seams
set x = I2R(R2I(GetRectMinX(area) / 150)) * 150
loop
exitwhen x > GetRectMaxX(area)
set y = I2R(R2I(GetRectMinY(area) / 150)) * 150
loop
exitwhen y > GetRectMaxY(area)
set pt = Location(x + GetRandomReal(-inc/5, inc/5),y + GetRandomReal(-inc/5, inc/5) + ModuloInteger(R2I(x / inc), 2) * inc / 2)
set dd = GetDoodadTypAtPt(typ,pt)
if not(circle) or DistanceBetweenPoints(pt, GetRectCenter(area)) <= (GetRectMaxX(area) - GetRectMinX(area))/2 then
call CreateDestructableLoc( dd, pt, GetRandomReal(0, 360), GetRandomReal(0.9,1.3), GetDoodadVariation(dd) )
call KillDestructable( GetLastCreatedDestructable() )
call DestructableRestoreLife( GetLastCreatedDestructable(), GetDestructableMaxLife(GetLastCreatedDestructable()), true )
if DistanceBetweenPoints(GetDestructableLoc(GetLastCreatedDestructable()), pt) > 100 then
call RemoveDestructable(GetLastCreatedDestructable())
endif
endif
// (prevent trigger from being stopped and prevent game desync(<-?))
set udg_GUI_Misc_DoodadFillCount = udg_GUI_Misc_DoodadFillCount + 1
if udg_GUI_Misc_DoodadFillCount > 500 then
set udg_GUI_Misc_DoodadFillCount = 0
call TriggerSleepAction(0)
endif
call RemoveLocation(pt)
set y = y + inc
endloop
set x = x + inc
endloop
endfunction
function DoodadFillAreaRock takes rect area, boolean circle returns nothing
local real inc = 128
local real x
local real y
local location pt
local integer dd
//normalize value to multiple of 150 of world coords to prevent tree seams
set x = I2R(R2I(GetRectMinX(area) / 128)) * 128
loop
exitwhen x > GetRectMaxX(area)
set y = I2R(R2I(GetRectMinY(area) / 128)) * 128
loop
exitwhen y > GetRectMaxY(area)
set pt = Location(x + GetRandomReal(-inc/5, inc/5),y + GetRandomReal(-inc/5, inc/5) + ModuloInteger(R2I(x / inc), 2) * inc / 2)
set dd = 'B008'
if not circle or DistanceBetweenPoints(pt, GetRectCenter(area)) <= (GetRectMaxX(area) - GetRectMinX(area))/2 then
call CreateDestructableLoc( dd, pt, GetRandomReal(0, 360), 1, GetDoodadVariation(dd) )
call KillDestructable( GetLastCreatedDestructable() )
call DestructableRestoreLife( GetLastCreatedDestructable(), GetDestructableMaxLife(GetLastCreatedDestructable()), true )
if DistanceBetweenPoints(GetDestructableLoc(GetLastCreatedDestructable()), pt) > 100 then
call RemoveDestructable(GetLastCreatedDestructable())
endif
endif
//(prevent trigger from being stopped and prevent game desync(<-?))
set udg_GUI_Misc_DoodadFillCount = udg_GUI_Misc_DoodadFillCount + 1
if udg_GUI_Misc_DoodadFillCount > 500 then
set udg_GUI_Misc_DoodadFillCount = 0
call TriggerSleepAction(0)
endif
call RemoveLocation(pt)
set y = y + inc
endloop
set x = x + inc
endloop
endfunction
function DoodadFillAreaCrates takes rect area, boolean circle returns nothing
local real inc = 75
local real x
local real y
local location pt
local integer dd
local integer junk
//normalize value to multiple of 150 of world coords to prevent tree seams
set x = I2R(R2I(GetRectMinX(area) / 75)) * 75
loop
exitwhen x > GetRectMaxX(area)
set y = I2R(R2I(GetRectMinY(area) / 75)) * 75
loop
exitwhen y > GetRectMaxY(area)
set pt = Location(x + GetRandomReal(-inc/5, inc/5),y + GetRandomReal(-inc/5, inc/5) + ModuloInteger(R2I(x / inc), 2) * inc / 2)
set junk = GetRandomInt(0,2)
if junk == 0 then
set dd = 'B00A'
elseif junk == 1 then
set dd = 'B00B'
elseif junk == 2 then
set dd = 'B00C'
endif
if GetBooleanOr(not(circle), DistanceBetweenPoints(pt, GetRectCenter(area)) <= (GetRectMaxX(area) - GetRectMinX(area))/2) then
call CreateDestructableLoc( dd, pt, GetRandomReal(0, 360), 1, GetDoodadVariation(dd) )
call KillDestructable( GetLastCreatedDestructable() )
call DestructableRestoreLife( GetLastCreatedDestructable(), GetDestructableMaxLife(GetLastCreatedDestructable()), true )
if DistanceBetweenPoints(GetDestructableLoc(GetLastCreatedDestructable()), pt) > 100 then
call RemoveDestructable(GetLastCreatedDestructable())
endif
endif
//(prevent trigger from being stopped and prevent game desync(<-?))
set udg_GUI_Misc_DoodadFillCount = udg_GUI_Misc_DoodadFillCount + 1
if udg_GUI_Misc_DoodadFillCount > 500 then
set udg_GUI_Misc_DoodadFillCount = 0
call TriggerSleepAction(0)
endif
call RemoveLocation(pt)
set y = y + inc
endloop
set x = x + inc
endloop
endfunction
function DoodadFillAreaJunk takes rect area, boolean circle returns nothing
local real inc = 150
local real x
local real y
local location pt
local integer dd
local integer junk
//normalize value to multiple of 150 of world coords to prevent tree seams
set x = I2R(R2I(GetRectMinX(area) / 150)) * 150
loop
exitwhen x > GetRectMaxX(area)
set y = I2R(R2I(GetRectMinY(area) / 150)) * 150
loop
exitwhen y > GetRectMaxY(area)
set pt = Location(x + GetRandomReal(-inc/5, inc/5),y + GetRandomReal(-inc/5, inc/5) + ModuloInteger(R2I(x / inc), 2) * inc / 2)
set junk = GetRandomInt(1,2)
if junk == 1 then
set dd = 'B00E'
else
set dd = 'B00F'
endif
if GetBooleanOr(not(circle), DistanceBetweenPoints(pt, GetRectCenter(area)) <= (GetRectMaxX(area) - GetRectMinX(area))/2) then
call CreateDestructableLoc( dd, pt, GetRandomReal(0, 360), 1, GetDoodadVariation(dd) )
//call KillDestructable( GetLastCreatedDestructable() )
//call DestructableRestoreLife( GetLastCreatedDestructable(), GetDestructableMaxLife(GetLastCreatedDestructable()), true )
if DistanceBetweenPoints(GetDestructableLoc(GetLastCreatedDestructable()), pt) > 100 then
call RemoveDestructable(GetLastCreatedDestructable())
endif
endif
//(prevent trigger from being stopped and prevent game desync(<-?))
set udg_GUI_Misc_DoodadFillCount = udg_GUI_Misc_DoodadFillCount + 1
if udg_GUI_Misc_DoodadFillCount > 500 then
set udg_GUI_Misc_DoodadFillCount = 0
call TriggerSleepAction(0)
endif
call RemoveLocation(pt)
set y = y + inc
endloop
set x = x + inc
endloop
endfunction
//cam
function GUIApplyCamForDM takes player pl returns nothing
//incomplete (zooming not yet done)
//call CameraSetupApplyForPlayer( true, gg_cam_ZoomOutCam, pl, 0.0 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_ROTATION, CameraSetupGetFieldSwap(CAMERA_FIELD_ANGLE_OF_ATTACK, gg_cam_ZoomOutCam), 1.00 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_ANGLE_OF_ATTACK, CameraSetupGetFieldSwap(CAMERA_FIELD_ANGLE_OF_ATTACK, gg_cam_ZoomOutCam), 0.00 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_TARGET_DISTANCE, CameraSetupGetFieldSwap(CAMERA_FIELD_TARGET_DISTANCE, gg_cam_ZoomOutCam), 0.00 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_FIELD_OF_VIEW, CameraSetupGetFieldSwap(CAMERA_FIELD_FIELD_OF_VIEW, gg_cam_ZoomOutCam), 0.00 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_FARZ, CameraSetupGetFieldSwap(CAMERA_FIELD_FARZ, gg_cam_ZoomOutCam), 0 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_ROLL, CameraSetupGetFieldSwap(CAMERA_FIELD_ROLL, gg_cam_ZoomOutCam), 0 )
call SetCameraFieldForPlayer( pl, CAMERA_FIELD_ROTATION, CameraSetupGetFieldSwap(CAMERA_FIELD_ROTATION, gg_cam_ZoomOutCam), 0 )
endfunction
function GUIApplyZoomForDM takes player pl returns nothing
//boobies
endfunction
//spell
//gen
function ClearScreen takes nothing returns nothing
local integer i
set i = 1
loop
exitwhen i > 20
call DisplayTextToForce(GetPlayersAll(), " ")
set i = i + 1
endloop
endfunction
function ClearScreenForce takes force fp returns nothing
local integer i
set i = 1
loop
exitwhen i > 20
call DisplayTextToForce(fp, " ")
set i = i + 1
endloop
endfunction
function GetPlayerTextColor takes player p returns string
if p == Player(0) then
return "|cffff0000"
elseif p == Player(1) then
return "|cff0000ff"
elseif p == Player(2) then
return "|cff40e0d0"
elseif p == Player(3) then
return "|cff9400d3"
elseif p == Player(4) then
return "|cffffff00"
elseif p == Player(5) then
return "|cffffa500"
elseif p == Player(6) then
return "|cff00ff00"
elseif p == Player(7) then
return "|cffdb7093"
elseif p == Player(8) then
return "|cffa0a0a0"
elseif p == Player(9) then
return "|cffadd8e6"
elseif p == Player(10) then
return "|cff006421"
elseif p == Player(11) then
return "|cff592e0d"
elseif p == Player(12) then
return "|cff8b0000"
elseif p == Player(14) then
return "|cffffebcd"
else
return "|c00000000"
endif
return ""
//-Vuen
endfunction
function ColorName takes string name, integer id returns string
return GetPlayerTextColor(Player(id)) + name + "|r"
endfunction
function ColorNamePl takes player pl returns string
return ColorName(GetPlayerName(pl), GetPlayerId(pl))
endfunction
function CountEnum takes nothing returns nothing
set udg_TEMP_Integer = udg_TEMP_Integer + 1
endfunction
function PauseEnumUnit takes nothing returns nothing
call PauseUnit( GetEnumUnit(), false )
endfunction
function KillEnumUnit takes nothing returns nothing
if not IsUnitIdType(GetUnitTypeId(GetEnumUnit()), UNIT_TYPE_GIANT) then
if not IsUnitOwnedByPlayer(GetEnumUnit(), Player(15)) then
call KillUnit( GetEnumUnit() )
endif
endif
endfunction
function RemoveEnumUnit takes nothing returns nothing
if not IsUnitIdType(GetUnitTypeId(GetEnumUnit()), UNIT_TYPE_GIANT) then
if not(IsUnitOwnedByPlayer(GetEnumUnit(), Player(15)))and not(udg_HERO_Ref2[GetPlayerId(GetOwningPlayer(GetEnumUnit())) + 1] == GetEnumUnit() )then
call RemoveUnit( GetEnumUnit() )
endif
endif
endfunction
function isWard takes unit un returns boolean
if GetUnitName(un) == "Healing Ward" then
return true
elseif GetUnitName(un) == "Serpent Ward" then
return true
elseif GetUnitName(un) == "Sentry Ward" then
return true
endif
return false
endfunction
function isDummy takes unit un returns boolean
if GetUnitTypeId(un) == 'e002' then
return true
endif
return false
endfunction
//train
//not a mirror, summoned, a dummy, a flag, a ward, a structure, or dead
function IsCountableTrainUnit takes unit un returns boolean
if IsUnitIllusionBJ(un) then
return false
elseif GetUnitTypeId(un) == 'h006' or GetUnitTypeId(un) == 'h00B' then
return false
elseif IsUnitType(un, UNIT_TYPE_SUMMONED) then
return false
elseif isDummy(un) then
return false
elseif isWard(un) then
return false
elseif IsUnitType(un,UNIT_TYPE_DEAD) then
return false
elseif IsUnitType(un, UNIT_TYPE_STRUCTURE) then
return false
endif
return true
endfunction
//is a training unit, and not a dummy, a flag, a ward, a structure, or dead
function IsKillableTrainUnit takes unit un returns boolean
if not(IsUnitTrain(un)) then
return false
elseif GetUnitTypeId(un) == 'h006' or GetUnitTypeId(un) == 'h00B' then
return false
elseif isWard(un) or isDummy(un) then
return false
elseif IsUnitType(un,UNIT_TYPE_DEAD) or IsUnitType(un, UNIT_TYPE_STRUCTURE) then
return false
endif
return true
endfunction
//math or numerical
function ICap takes integer val, integer low, integer high returns integer
return IMaxBJ(IMinBJ(val, high), low)
endfunction
function RCap takes real val, real low, real high returns real
return RMaxBJ(RMinBJ(val, high), low)
endfunction
function GetArrayMega takes integer i returns integer
return (i - ModuloInteger(i, 10)) / 10 //gets high on 2d base10 array
endfunction
function RShuffle takes real val returns real //random within 1/7 of val
return val + GetRandomReal(-val/7, val/7)
endfunction
function IShuffle takes integer val returns integer
return R2I(RShuffle(I2R(val)))
endfunction
function RBigShuffle takes real val returns real //random within 1/5 of val
return val + GetRandomReal(-val/5, val/5)
endfunction
function IBigShuffle takes integer val returns integer
return R2I(RBigShuffle(I2R(val)))
endfunction
function IsANumber takes string str returns boolean
//Couldn't really think of a simpler way to do this
if (str == "0") then
return true
elseif (str == "1") then
return true
elseif (str == "2") then
return true
elseif (str == "3") then
return true
elseif (str == "4") then
return true
elseif (str == "5") then
return true
elseif (str == "6") then
return true
elseif (str == "7") then
return true
elseif (str == "8") then
return true
elseif (str == "9") then
return true
endif
return false
endfunction
function GivePlayerThirteen takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetUnitOwner( GetFilterUnit(), Player(15), false )
endif
return false
endfunction
function GetPlayerNumFromStr takes string text, integer id returns integer
local integer i = 0
if text == "red" then
return 1
elseif text == "blue" then
return 2
elseif text == "teal" then
return 3
elseif text == "purple" then
return 4
elseif text == "yellow" then
return 5
elseif text == "orange" then
return 6
elseif text == "green" then
return 7
elseif text == "pink" then
return 8
elseif text == "grey" then
return 9
elseif text == "gray" then
return 9
elseif text == "cyan" then
return 10
elseif text == "lightblue" then
return 10
elseif text == "lb" then
return 10
elseif text == "darkgreen" then
return 11
elseif text == "dg" then
return 11
elseif text == "brown" then
return 12
elseif text == "enemy" then
return 13
elseif text == "black" then
return 13
elseif text == "hostile" then
return 13
elseif text == "ally" then
return 15
elseif text == "white" then
return 15
elseif text == "self" then
return id+1
else
loop
exitwhen i == bj_MAX_PLAYERS
if StringCase(GetPlayerName(Player(i)), false) == text then
return GetPlayerId(Player(i)) + 1
endif
set i = i + 1
endloop
set i = S2I(text)
if i < 1 or i > 16 then
return -1
endif
return i
endif
return -1
endfunction
function GetPlayerNumFromStrSafe takes string text, integer id returns integer
local integer i
set i = GetPlayerNumFromStr(text, id)
if i == -1 then
return 13
endif
return i
endfunction
function GetInventoryFromStr takes string text returns string
//STR classes
if text == "paladin" then
set text = Paladins
elseif text == "warrior" then
set text = Warriors
elseif text == "barbarian" then
set text = Barbarians
elseif text == "samurai" then
set text = Samurais
//AGI classes
elseif text == "rogue" then
set text = Rogues
elseif text == "ranger" then
set text = Rangers
elseif text == "spellsword" then
set text = Spellswords
elseif text == "monk" then
set text = Monks
//INT classes
elseif text == "mage" then
set text = Mages
elseif text == "shaman" then
set text = Shamans
//Equip All
elseif text == "equipall" or text == "" or text == "all" then
set text = EquipAll
endif
return text
endfunction
function CropText takes string bla returns string
return bla
endfunction
function CenterText takes string bla returns string
return bla
endfunction
function RaiseHero takes unit t, real hp, real mp returns nothing
local player pl = GetOwningPlayer(t)
local integer id = GetPlayerId(pl)
local unit un = GetPlayerHero(id+1)
call ReviveHero( un, GetUnitX(t), GetUnitY(t), true )
call RemoveUnit( t )
if GetLocalPlayer() == pl then
call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "You have been revived with a |cffffff00life spell!|r" )
call ResetToGameCamera( 0 )
call PanCameraToTimed( GetUnitX(un), GetUnitY(un), 0 )
endif
set udg_HERO_IsDead[id+1] = false
if GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER) > 0 then
call AddHeroXP( un,GetPlayerState(pl, PLAYER_STATE_RESOURCE_LUMBER), false )
call SetPlayerStateBJ( pl, PLAYER_STATE_RESOURCE_LUMBER, 0 )
endif
call SetWidgetLife( un, hp )
call SetUnitState( un, UNIT_STATE_MANA, mp )
set un = null
set pl = null
endfunction
//End of Vuen's Code
//===================================================================================================
//Get the N closest units
//***************************************************************************************************
//*
//* Finds the N closest units of a group to XY coordinates.
//* By Daminon.
//*
//* Important:
//* - You must remember the radius used for adding the units to Group1 so it can be used in
//* Radius. This is important for avoiding square root.
//* - Be sure to not set a greater vaule to N than the amount of units in Group1.
//* - Never use this function when there are 0 units in the given group.
//*
//* Thanks:
//* ¯¯¯¯¯¯¯
//* - Vexorian for advices that gave a great improvment. Like avoid square root.
//* - Nantuko Husk for telling that Pow is always slow. Remember: Pow always slow! Pow always slow!
//*
//***************************************************************************************************
function GetNClosestUnits takes group Group1, real X1, real Y1, real Radius, integer N returns group
local unit First
local unit Closest
local integer UnitAmount
local real Distance
local real TestDistance
local real X2
local real Y2
local real X3
local real Y3
local group Group2
local group Group3
set Distance = Radius * Radius
set Group2 = CreateGroup()
set Group3 = CreateGroup()
call GroupAddGroup(Group1, Group2)
loop
exitwhen (N == 0)
call GroupAddGroup(Group2, Group1)
set UnitAmount = CountUnitsInGroup(Group1)
loop
exitwhen (UnitAmount == 0)
set First = FirstOfGroup(Group1)
set X2 = GetUnitX(First)
set Y2 = GetUnitY(First)
set X3 = X1 - X2
set Y3 = Y1 - Y2
set TestDistance = X3 * X3 + Y3 * Y3
if (TestDistance < Distance) then
set Closest = First
set Distance = TestDistance
endif
set UnitAmount = UnitAmount - 1
call GroupRemoveUnit(Group1, First)
endloop
call GroupAddUnit(Group3, Closest)
call GroupRemoveUnit(Group2, Closest)
set Distance = Radius * Radius
set N = N - 1
endloop
call DestroyGroup(Group1)
call DestroyGroup(Group2)
set Group1 = null
set Group2 = null
set First = null
set Closest = null
return Group3
endfunction
//===================================================================================================
//Get units in angled rectangle
//***************************************************************************************************
//*
//* Returns a group containing all units in a rectangle with given attributes.
//*
//*
//* A
//* <-------------->
//* ______________
//* C1 | | ^
//* <------>| | |
//* +-------| | |B
//* | | |
//* | | v
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//*
//* Just guess if this was hard to make...
//*
//*
//* By Daminon.
//*
//***************************************************************************************************
function GroupEnumUnitsInAngledRectangleBeta takes real An1, real C1, real A, real B, real X0, real Y0, group G2, boolexpr Fi returns group
local unit F
local real An2
local real An3
local real C2
local real C3
local real X1 = C1 * CosBJ(An1) + X0
local real Y1 = C1 * SinBJ(An1) + Y0
local real X2 = B / 2 * CosBJ(An1 - 90) + X1
local real Y2 = B / 2 * SinBJ(An1 - 90) + Y1
local real X3 = B / 2 * CosBJ(An1 + 90) + X1
local real Y3 = B / 2 * SinBJ(An1 + 90) + Y1
local real X4 = A * CosBJ(An1) + X2
local real Y4 = A * SinBJ(An1) + Y2
local real X5 = A * CosBJ(An1) + X3
local real Y5 = A * SinBJ(An1) + Y3
local real X6
local real Y6
local real DX
local real DY
local group G1 = CreateGroup()
local rect R
if ((An1 >= 0 and An1 <= 90) or (An1 >= 180 and An1 <= 270)) then
set R = Rect(X3, Y2, X4, Y5)
//Colsest corner = X3, Y2. Distant corner = X4, Y5.
else
set R = Rect(X2, Y3, X5, Y4)
//Colsest corner = X2, Y3. Distant corner = X5, Y4.
endif
call GroupEnumUnitsInRect(G1, R, Fi)
if (ModuloReal(An1, 90) == 0) then
loop
set F = FirstOfGroup(G1)
exitwhen (F == null)
call GroupAddUnit(G2, F)
call GroupRemoveUnit(G1, F)
endloop
else
loop
set F = FirstOfGroup(G1)
exitwhen (F == null)
set X6 = GetUnitX(F)
set Y6 = GetUnitY(F)
set DX = X6 - X1//
set DY = Y6 - Y1//
set An2 = 90 - (Atan2BJ(Y6 - Y1, X6 - X1) - An1)
if (An2 >= 360) then
set An2 = An2 - 360
endif
if (An2 <= 180) then
if (An2 < 90) then
set DX = X5 - X1//
set DY = Y5 - Y1//
set An3 = 90 - (Atan2BJ(Y5 - Y1, X5 - X1) - An1)
if (An3 >= 360) then
set An3 = An3 - 360
endif
if (An2 > An3) then
set C2 = A / CosBJ(90 - An2)
set DX = X6 - X1
set DY = Y6 - Y1
set C3 = SquareRoot(DX * DX + DY * DY)
if (C3 <= C2) then
call GroupAddUnit(G2, F)
endif
elseif (An2 < An3) then
set C2 = (B / 2) / CosBJ(An2)
set DX = X6 - X1
set DY = Y6 - Y1
set C3 = SquareRoot(DX * DX + DY * DY)
if (C3 <= C2) then
call GroupAddUnit(G2, F)
endif
endif
elseif (An2 > 90) then
set DX = X4 - X1
set DY = Y4 - Y1
set An3 = 90 - (Atan2BJ(Y4 - Y1, X4 - X1) - An1)
if (An3 >= 360) then
set An3 = An3 - 360
endif
if (An2 > An3) then
set C2 = (B / 2) / CosBJ(180 - An2)
set DX = X6 - X1
set DY = Y6 - Y1
set C3 = SquareRoot(DX * DX + DY * DY)
if (C3 <= C2) then
call GroupAddUnit(G2, F)
endif
elseif (An2 < An3) then
set C2 = A / CosBJ(An2 - 90)
set DX = X6 - X1
set DY = Y6 - Y1
set C3 = SquareRoot(DX * DX + DY * DY)
if (C3 <= C2) then
call GroupAddUnit(G2, F)
endif
endif
elseif (An2 == 90) then
set DX = X6 - X1
set DY = Y6 - Y1
set C3 = SquareRoot(DX * DX - DY * DY)
if (C3 <= A) then
call GroupAddUnit(G2, F)
endif
endif
endif
call GroupRemoveUnit(G1, F)
endloop
endif
call DestroyGroup(G1)
call RemoveRect(R)
call DestroyBoolExpr(Fi)
set G1 = null
set R = null
set Fi = null
set F = null
return G2
endfunction
//===================================================================================================
//Is point in quad fast
//***************************************************************************************************
//*
//* Checks if a point is in a quad.
//* By Grater.
//*
//***************************************************************************************************
function DoesQuadContainOrigin takes real x1, real y1, real x2, real y2, real x3, real y3, real x4, real y4 returns boolean
local integer counter = 0
if (x1-x2)*y1 < x1 * (y1-y2) then
set counter = counter + 1
endif
if (x2-x3)*y2 < x2 * (y2-y3) then
set counter = counter + 1
endif
if (x3-x4)*y3 < x3 * (y3-y4) then
set counter = counter + 1
endif
if (x4-x1)*y4 < x4 * (y4-y1) then
set counter = counter + 1
endif
return ((counter == 4) or (counter == 0))
endfunction
function IsPointInQuadFast takes real x, real y, real x1, real y1, real x2, real y2, real x3, real y3, real x4, real y4 returns boolean
return DoesQuadContainOrigin(x1-x,y1-y,x2-x,y2-y,x3-x,y3-y,x4-x,y4-y)
endfunction
//===================================================================================================
//Group enum units in cone
//***************************************************************************************************
//*
//* Grouping function to get units within a cone. Like how Carrion Swarm works.
//* By Grater.
//*
//***************************************************************************************************
function GroupEnumUnitsInCone takes group g, location loc, real length, real angle, real width1, real width2, boolexpr filter returns nothing
local group tempGroup = CreateGroup()
local real array x
local real array y
local real minX
local real minY
local real maxX
local real maxY
local rect tempRect
local location tempLoc
local unit u
set x[1] = GetLocationX(loc) + CosBJ(angle-90.0) * width1
set y[1] = GetLocationY(loc) + SinBJ(angle-90.0) * width1
set x[2] = GetLocationX(loc) + CosBJ(angle+90.0) * width1
set y[2] = GetLocationY(loc) + SinBJ(angle+90.0) * width1
set tempLoc = PolarProjectionBJ(loc, length,angle)
set x[3] = GetLocationX(tempLoc) + CosBJ(angle+90.0) * width2
set y[3] = GetLocationY(tempLoc) + SinBJ(angle+90.0) * width2
set x[4] = GetLocationX(tempLoc) + CosBJ(angle-90.0) * width2
set y[4] = GetLocationY(tempLoc) + SinBJ(angle-90.0) * width2
// Now we have a quad, define the rect that encloses it.
set minX = RMinBJ(x[1],RMinBJ(x[2],RMinBJ(x[3],x[4])))
set minY = RMinBJ(y[1],RMinBJ(y[2],RMinBJ(y[3],y[4])))
set maxX = RMaxBJ(x[1],RMaxBJ(x[2],RMaxBJ(x[3],x[4])))
set maxY = RMaxBJ(y[1],RMaxBJ(y[2],RMaxBJ(y[3],y[4])))
set tempRect = Rect(minX,minY,maxX,maxY)
call GroupEnumUnitsInRect(tempGroup,tempRect,filter)
//Now we filter the ins and outs
loop
set u = FirstOfGroup(tempGroup)
exitwhen u == null
if IsPointInQuadFast(GetUnitX(u),GetUnitY(u),x[1],y[1],x[2],y[2],x[3],y[3],x[4],y[4]) then
call GroupAddUnit(g,u)
endif
call GroupRemoveUnit(tempGroup,u)
endloop
call RemoveLocation(tempLoc)
call DestroyGroup(tempGroup)
call RemoveRect(tempRect)
set tempGroup = null
set tempLoc = null
set tempRect = null
endfunction
function CreateMessage takes location makeme, string spellname, real duration returns texttag
local texttag temptag=CreateTextTag()
call SetTextTagText(temptag,spellname,(12*0.023/10))
call SetTextTagPermanent(temptag,false)
call SetTextTagLifespan(temptag,duration)
call SetTextTagFadepoint(temptag,duration*0.75)
call SetTextTagPos(temptag,GetLocationX(makeme),GetLocationY(makeme),8.00)
//call SetTextTagVelocity(temptag,0.02,0.1)
return temptag
endfunction
function CreateMessageXY takes real x, real y, string spellname, real duration returns texttag
local texttag temptag=CreateTextTag()
call SetTextTagText(temptag,spellname,(12*0.023/10))
call SetTextTagPermanent(temptag,false)
call SetTextTagLifespan(temptag,duration)
call SetTextTagFadepoint(temptag,duration*0.75)
call SetTextTagPos(temptag,x,y,8.00)
//call SetTextTagVelocity(temptag,0.02,0.1)
return temptag
endfunction
//===================================================================================================
function JumpParabola takes real dist, real maxdist,real curve returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*(maxdist/curve)
endfunction
function BackstabAngleDifference takes real a1, real a2 returns real // By Pyrogasm
local real x
// The Modulo will get the co-terminal angle if the angle is less than -360 or greater than 360.
set a1=ModuloReal(a1,360)
set a2=ModuloReal(a2,360)
// makes sure angle 1 is the smaller angle. If it isn't it switches them.
if a1>a2 then
set x=a1
set a1=a2
set a2=x
endif
// Subtracts 360, to get the first negative co-terminal angle, this is then used in a comparison to check if the angle is greater than 180
set x=a2-360
if a2-a1 > a1-x then
// If it is, use the negative angle instead
set a2=x
endif
// Now, get the difference between the 2 angles.
set x=a1-a2
// If the difference is negative, make it positive and return it. If its positive, return it.
if (x<0) then
return -x
endif
return x
endfunction
//===================================================================================================
function RangedSwap takes player pl, boolean switch returns nothing
call SetPlayerAbilityAvailable(pl, 'OFRa', switch)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
//************************************
//************************************
//********** COLOR FUNCTIONS *******
//************************************
//************************************
function GetPlayerTagColor takes player p, string field returns integer
if p == Player(0) then
if field == "red" then
return 255
elseif field == "green" then
return 0
elseif field == "blue" then
return 0
endif
elseif p == Player(1) then
if field == "red" then
return 0
elseif field == "green" then
return 0
elseif field == "blue" then
return 255
endif
elseif p == Player(2) then
if field == "red" then
return 0
elseif field == "green" then
return 255
elseif field == "blue" then
return 255
endif
elseif p == Player(3) then
if field == "red" then
return 255
elseif field == "green" then
return 0
elseif field == "blue" then
return 255
endif
elseif p == Player(4) then
if field == "red" then
return 255
elseif field == "green" then
return 255
elseif field == "blue" then
return 0
endif
elseif p == Player(5) then
if field == "red" then
return 254
elseif field == "green" then
return 137
elseif field == "blue" then
return 13
endif
elseif p == Player(6) then
if field == "red" then
return 0
elseif field == "green" then
return 255
elseif field == "blue" then
return 0
endif
elseif p == Player(7) then
if field == "red" then
return 228
elseif field == "green" then
return 90
elseif field == "blue" then
return 175
endif
elseif p == Player(8) then
if field == "red" then
return 150
elseif field == "green" then
return 150
elseif field == "blue" then
return 150
endif
elseif p == Player(9) then
if field == "red" then
return 125
elseif field == "green" then
return 190
elseif field == "blue" then
return 241
endif
elseif p == Player(10) then
if field == "red" then
return 15
elseif field == "green" then
return 97
elseif field == "blue" then
return 69
endif
elseif p == Player(11) then
if field == "red" then
return 77
elseif field == "green" then
return 41
elseif field == "blue" then
return 3
endif
elseif p == Player(12) then
if field == "red" then
return 40
endif
elseif p == Player(14) then
if field == "red" then
return 100
elseif field == "green" then
return 100
elseif field == "blue" then
return 80
endif
else
return 0
endif
return 0
endfunction
//************************************
//************************************
//********** CHAT FUNCTIONS ********
//************************************
//************************************
function CreateFog takes nothing returns nothing
call SetTerrainFogExBJ( 0, 0.00, 8000, udg_TEMP_RealArray[4], udg_TEMP_RealArray[1], udg_TEMP_RealArray[2], udg_TEMP_RealArray[3] )
endfunction
function doSharePlayerEnumControl takes nothing returns nothing
//careful with gettriggerplayer, its not actually in docommandentered, no guarantees
call SetPlayerAlliance( GetEnumPlayer(), GetTriggerPlayer(), ALLIANCE_SHARED_CONTROL, true )
call SetPlayerAlliance( Player(12), GetTriggerPlayer(), ALLIANCE_SHARED_CONTROL, true)
call SetPlayerAlliance( Player(14), GetTriggerPlayer(), ALLIANCE_SHARED_CONTROL, true)
endfunction
function doSharePlayerEnumUncontrol takes nothing returns nothing
//careful with gettriggerplayer, its not actually in docommandentered, no guarantees
call SetPlayerAlliance( GetEnumPlayer(), GetTriggerPlayer(), ALLIANCE_SHARED_CONTROL, false )
endfunction
function CustomAuraFX takes nothing returns boolean
if IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) != true then
set AuraFX[GetUnitId(GetFilterUnit())] = LoadStr(AH, 1, StringHash(udg_TEMP_String))
endif
return false
endfunction
function CustomAuraReal takes nothing returns boolean
if IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) != true then
if udg_TEMP_String == "a" then
set AuraFXA[GetUnitId(GetFilterUnit())] = udg_TEMP_Real
elseif udg_TEMP_String == "b" then
set AuraFXB[GetUnitId(GetFilterUnit())] = udg_TEMP_Real
elseif udg_TEMP_String == "c" then
set AuraFXC[GetUnitId(GetFilterUnit())] = udg_TEMP_Real
elseif udg_TEMP_String == "s" then
set AuraFXS[GetUnitId(GetFilterUnit())] = udg_TEMP_Real
elseif udg_TEMP_String == "t" then
set AuraFXTail[GetUnitId(GetFilterUnit())] = udg_TEMP_Real
endif
endif
return false
endfunction
function EmitterLoop takes nothing returns nothing
local timer tim = GetExpiredTimer()
local unit f = LoadUnitHandle(EMITTER, GetHandleId(tim), 0)
local integer utype = LoadInteger(EMITTER, GetHandleId(f), 1)
local integer max = LoadInteger(EMITTER, GetHandleId(f), 2)
local integer limit = LoadInteger(EMITTER, GetHandleId(f), 3)
local integer total = LoadInteger(EMITTER, GetHandleId(f), 4)
local integer bonus = LoadInteger(EMITTER, GetHandleId(f), 5)
local integer skill = LoadInteger(EMITTER, GetHandleId(f), 6)
local real dur = LoadReal(EMITTER, GetHandleId(f), 7)
local integer bounty = LoadInteger(EMITTER, GetHandleId(f), 8)
local integer id = LoadInteger(EMITTER, GetHandleId(f), 9)+1
local integer cur = CountUnitsInGroup(EMITGROUP[GetUnitId(f)])
if utype != null and max > cur and total < limit then
set bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(f), utype, GetUnitX(f), GetUnitY(f), GetUnitFacing(f))
call SetUnitAnimation(bj_lastCreatedUnit, "birth")
call SaveInteger(EMITTER, GetHandleId(f), 4, total+1)
call GroupAddUnit(EMITGROUP[GetUnitId(f)], bj_lastCreatedUnit)
if dur > 0 then
call UnitApplyTimedLife(bj_lastCreatedUnit, 'BFig', dur)
endif
if bounty > 0 then
set UnitBounty[GetUnitId(bj_lastCreatedUnit)] = bounty
endif
if bonus == 1 then
call SetUnitBonus(bj_lastCreatedUnit, BONUS_ARMOR, GetUnitBonus(udg_GUI_Pointer[id], BONUS_ARMOR))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_DAMAGE, GetUnitBonus(udg_GUI_Pointer[id], BONUS_DAMAGE))
call SetUnitMaxState(bj_lastCreatedUnit, UNIT_STATE_MAX_MANA, GetUnitState(udg_GUI_Pointer[id], UNIT_STATE_MAX_MANA))
call SetUnitMaxState(bj_lastCreatedUnit, UNIT_STATE_MAX_LIFE, GetUnitState(udg_GUI_Pointer[id+1], UNIT_STATE_MAX_LIFE))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_ATTACK_SPEED, GetUnitBonus(udg_GUI_Pointer[id], BONUS_ATTACK_SPEED))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_LIFE_REGEN, GetUnitBonus(udg_GUI_Pointer[id], BONUS_LIFE_REGEN))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_MANA_REGEN, GetUnitBonus(udg_GUI_Pointer[id], BONUS_MANA_REGEN))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_MOVEMENT_SPEED, GetUnitBonus(udg_GUI_Pointer[id], BONUS_MOVEMENT_SPEED))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_MANA_REGEN_PERCENT, GetUnitBonus(udg_GUI_Pointer[id], BONUS_MANA_REGEN_PERCENT))
endif
if skill != 0 then
call UnitAddAbility(bj_lastCreatedUnit, skill)
endif
endif
if IsUnitType(f, UNIT_TYPE_DEAD) or f == null then
call ReleaseTimer(tim)
call ReleaseGroup(EMITGROUP[GetUnitId(f)])
call FlushChildHashtable(EMITTER, GetHandleId(f))
endif
set f = null
endfunction
function EmitEnumUnitSelected takes nothing returns boolean
local timer tim
local unit f = GetFilterUnit()
local real TICK = 1
call SaveInteger(EMITTER, GetHandleId(f), 9, udg_TEMP_Integer)
call SaveInteger(EMITTER, GetHandleId(f), 4, 0) //total
if LoadReal(EMITTER, GetHandleId(f), 0) > 0 then //interval
set TICK = LoadReal(EMITTER, GetHandleId(f), 0)
endif
if LoadInteger(EMITTER, GetHandleId(f), 3) < 1 then //limit
call SaveInteger(EMITTER, GetHandleId(f), 3, 99999)
endif
if LoadInteger(EMITTER, GetHandleId(f), 2) < 1 then //max
call SaveInteger(EMITTER, GetHandleId(f), 2, 6)
endif
if not IsUnitIdType(GetUnitTypeId(f), UNIT_TYPE_GIANT) then
set EMITGROUP[GetUnitId(f)] = NewGroup()
set tim = NewTimer()
call SaveUnitHandle(EMITTER, GetHandleId(tim), 0, f)
call TimerStart(tim, TICK, true, function EmitterLoop )
call SaveTimerHandle(EMITTER, GetHandleId(f), 10, tim)
endif
set f = null
return false
endfunction
function DeEmitEnumUnitsSelected takes nothing returns boolean
local unit f = GetFilterUnit()
call ReleaseTimer(LoadTimerHandle(EMITTER, GetHandleId(f), 10))
call FlushChildHashtable(EMITTER, GetHandleId(f))
call ReleaseGroup(EMITGROUP[GetUnitId(f)])
set f = null
return false
endfunction
function IntervalEnumUnitsSelected takes nothing returns boolean
local timer tim
local unit f = GetFilterUnit()
call SaveReal(EMITTER, GetHandleId(f), 0, S2R(udg_TEMP_String))
if LoadTimerHandle(EMITTER, GetHandleId(f), 10) != null then
set tim = LoadTimerHandle(EMITTER, GetHandleId(f), 10)
call ReleaseTimer(tim)
set tim = NewTimer()
call TimerStart(tim, LoadReal(EMITTER, GetHandleId(f), 0), true, function EmitterLoop )
call SaveTimerHandle(EMITTER, GetHandleId(f), 10, tim)
endif
set f = null
return false
endfunction
function UTypeEnumUnitsSelected takes nothing returns boolean
call SaveInteger(EMITTER, GetHandleId(GetFilterUnit()), 1, UnitId(TranslateFrom(udg_TEMP_String)))
return false
endfunction
function MaxEnumUnitsSelected takes nothing returns boolean
call SaveInteger(EMITTER, GetHandleId(GetFilterUnit()), 2, S2I(udg_TEMP_String))
return false
endfunction
function LimitEnumUnitsSelected takes nothing returns boolean
call SaveInteger(EMITTER, GetHandleId(GetFilterUnit()), 3, S2I(udg_TEMP_String))
return false
endfunction
function BonusEnumUnitsSelected takes nothing returns boolean
call SaveInteger(EMITTER, GetHandleId(GetFilterUnit()), 5, S2I(udg_TEMP_String))
return false
endfunction
function SkillEnumUnitsSelected takes nothing returns boolean
call SaveInteger(EMITTER, GetHandleId(GetFilterUnit()), 6, skillhash[udg_TEMP_String])
return false
endfunction
function TimeEnumUnitsSelected takes nothing returns boolean
call SaveReal(EMITTER, GetHandleId(GetFilterUnit()), 7, S2R(udg_TEMP_String))
return false
endfunction
function BountyEnumUnitsSelected takes nothing returns boolean
call SaveInteger(EMITTER, GetHandleId(GetFilterUnit()), 8, S2I(udg_TEMP_String))
return false
endfunction
function AttachEnumUnitSelected takes nothing returns boolean
local string str = LoadStr(AH, 1, StringHash(udg_TEMP_String))
local effect fx
call DestroyEffect(LoadEffectHandle(QuestTable, udg_TEMP_Integer, GetHandleId(GetFilterUnit())))
set fx = AddSpecialEffectTarget(str, GetFilterUnit(), udg_TEMP_String2 )
call SaveEffectHandle(QuestTable, udg_TEMP_Integer, GetHandleId(GetFilterUnit()), fx)
set fx = null
set str = null
return false
endfunction
function AttachEnumPlayerSelected takes nothing returns boolean
local string str = LoadStr(AH, 1, StringHash(udg_TEMP_String))
local effect fx
if GetOwningPlayer(GetFilterUnit()) == udg_TEMP_Player then
call DestroyEffect(LoadEffectHandle(QuestTable, udg_TEMP_Integer, GetHandleId(GetFilterUnit())))
set fx = AddSpecialEffectTarget(str, GetFilterUnit(), udg_TEMP_String2 )
call SaveEffectHandle(QuestTable, udg_TEMP_Integer, GetHandleId(GetFilterUnit()), fx)
endif
set fx = null
set str = null
return false
endfunction
function VulnEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetUnitInvulnerable( GetFilterUnit(), false )
endif
return false
endfunction
function ResetCoolSelected takes nothing returns boolean
call UnitResetCooldown(GetFilterUnit())
return false
endfunction
function InvulnEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetUnitInvulnerable( GetFilterUnit(), true )
endif
return false
endfunction
function ColorEnumUnitSelected takes nothing returns boolean
call SetUnitColor( GetFilterUnit(), GetPlayerColor(Player(udg_TEMP_Integer-1)))
return false
endfunction
function QuestOnEnumUnitSelected takes nothing returns boolean
local effect c
set c = AddSpecialEffectTarget("Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl", GetFilterUnit(), "overhead")
call DestroyEffect(LoadEffectHandle(QuestTable, 0, GetHandleId(GetFilterUnit())))
call FlushChildHashtable(QuestTable, 0)
call SaveEffectHandle(QuestTable, 0, GetHandleId(GetFilterUnit()), c)
set c = null
return false
endfunction
function QuestOffEnumUnitSelected takes nothing returns boolean
call DestroyEffect(LoadEffectHandle(QuestTable, 0, GetHandleId(GetFilterUnit())))
call FlushChildHashtable(QuestTable, 0)
return false
endfunction
function PlayEnumUnitSelected takes nothing returns boolean
call SetUnitAnimation(GetFilterUnit(), udg_TEMP_String)
return false
endfunction
function PlayForPlayer takes nothing returns boolean
if GetOwningPlayer(GetFilterUnit()) == udg_TEMP_Player then
call SetUnitAnimation(GetFilterUnit(), udg_TEMP_String)
endif
return false
endfunction
function AnimEnumUnitSelected takes nothing returns boolean
call SetUnitTimeScale(GetFilterUnit(), udg_TEMP_Real * 0.01)
return false
endfunction
function PauseEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
if IsUnitPaused(GetFilterUnit()) then
call PauseUnit(GetFilterUnit(), false)
else
call PauseUnit(GetFilterUnit(), true)
endif
endif
return false
endfunction
function SetFlyEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call UnitAddAbility(GetFilterUnit(), 'Amrf')
call UnitRemoveAbility(GetFilterUnit(), 'Amrf')
call SetUnitFlyHeight(GetFilterUnit(), udg_TEMP_Real, udg_TEMP_Real)
endif
return false
endfunction
function NCEnumUnitSelected takes nothing returns boolean
call SetUnitPathing(GetFilterUnit(), false)
return false
endfunction
function NCOffEnumUnitSelected takes nothing returns boolean
call SetUnitPathing(GetFilterUnit(), true)
return false
endfunction
function TintEnumUnitSelected takes nothing returns boolean
call SetUnitVertexColorBJ( GetFilterUnit(), udg_TEMP_RealArray[1], udg_TEMP_RealArray[2], udg_TEMP_RealArray[3], udg_TEMP_RealArray[4] )
return false
endfunction
function TintWater takes nothing returns nothing
call SetWaterBaseColorBJ( udg_TEMP_RealArray[1], udg_TEMP_RealArray[2], udg_TEMP_RealArray[3], udg_TEMP_RealArray[4] )
endfunction
function DebuffEnum takes nothing returns boolean
call UnitRemoveBuffs( GetFilterUnit(), true, true)
return false
endfunction
function ImmuneEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call UnitAddAbility( GetFilterUnit(), 'ACmi')
endif
return false
endfunction
function UnImmuneEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call UnitRemoveAbility( GetFilterUnit(), 'ACmi')
endif
return false
endfunction
function SkillAddEnumUnitSelected takes nothing returns boolean
local integer i = 0
local unit f = GetFilterUnit()
if not IsUnitIdType(GetUnitTypeId(f), UNIT_TYPE_GIANT) and GetUnitAbilityLevel(f, skillhash[udg_TEMP_String]) < 1 then
call UnitAddAbility(f,skillhash[udg_TEMP_String])
call UnitMakeAbilityPermanent(f, true, skillhash[udg_TEMP_String])
set BonusSkill[GetUnitId(f)] = udg_TEMP_String
if SlavesMaster[GetUnitId(f)] != null then
set SpellID1[GetUnitId(SlavesMaster[GetUnitId(f)])] = skillhash[udg_TEMP_String]
endif
endif
set f = null
return false
endfunction
function SkillRemoveEnumUnitSelected takes nothing returns boolean
local integer i = 0
local unit f = GetFilterUnit()
if not IsUnitIdType(GetUnitTypeId(f), UNIT_TYPE_GIANT) and GetUnitAbilityLevel(f, skillhash[udg_TEMP_String]) > 0 then
call UnitMakeAbilityPermanent(f, false, skillhash[udg_TEMP_String])
call UnitRemoveAbility(f,skillhash[udg_TEMP_String])
endif
set f = null
return false
endfunction
function SkillSetEnumUnitSelected takes nothing returns boolean
local integer i = 0
local unit f = GetFilterUnit()
if not IsUnitIdType(GetUnitTypeId(f), UNIT_TYPE_GIANT) then
call UnitAddAbility(f,skillhash[udg_TEMP_String])
call SetUnitAbilityLevel(GetFilterUnit(),skillhash[udg_TEMP_String], udg_TEMP_Integer)
call UnitMakeAbilityPermanent(f, true, skillhash[udg_TEMP_String])
set BonusSkill[GetUnitId(f)] = udg_TEMP_String
endif
set f = null
return false
endfunction
function GiveEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetUnitOwner( GetFilterUnit(), Player(udg_TEMP_Integer-1), true )
endif
return false
endfunction
function ClearTrainingRoomEnumUnits takes nothing returns nothing
local location loc = GetUnitLoc(GetFilterUnit())
local location loc2 = GetUnitLoc(udg_TRAIN_CurRoom)
local real distance = DistanceBetweenPoints(loc, loc2)
call RemoveLocation(loc)
call RemoveLocation(loc2)
set loc = null
set loc2 = null
if GetOwningPlayer(GetFilterUnit()) == Player(0) then
if distance < 900 then
if IsKillableTrainUnit(GetFilterUnit()) then
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call KillUnit(GetFilterUnit())
endif
endif
endif
endif
endfunction
function ClearTrainingRoomMonsters takes unit un returns nothing
local location trainloc
local group grp
set udg_TRAIN_CurRoom = un
set trainloc = GetUnitLoc(udg_TRAIN_CurRoom)
call MoveRectToLoc( gg_rct_TrainingRoom, trainloc )
set grp = GetUnitsInRectAll(gg_rct_TrainingRoom)
call ForGroup( grp, function ClearTrainingRoomEnumUnits )
call DestroyGroup(grp)
call RemoveLocation(trainloc)
endfunction
function KillEnumUnitSelected takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit()) == 'h00B' then
call ClearTrainingRoomMonsters(GetFilterUnit())
endif
if not(IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT))and not(GetOwningPlayer(GetFilterUnit()) == Player(15))then
call RemoveKeepAliveUnit(GetFilterUnit())
call KillUnit( GetFilterUnit() )
endif
return false
endfunction
function KeepAliveEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call KeepAliveUnit( GetFilterUnit() )
endif
return false
endfunction
function RemoveEnumUnitSelected takes nothing returns boolean
local real x = GetUnitX(GetFilterUnit())
local real y = GetUnitY(GetFilterUnit())
if IsPlayerInForce(GetOwningPlayer(GetFilterUnit()), udg_Force[2]) or IsPlayerInForce(GetOwningPlayer(GetFilterUnit()), udg_Force[3]) then
call RemoveKeepAliveUnit(GetFilterUnit())
if GetUnitTypeId(GetFilterUnit()) == 'h00B' then
call ClearTrainingRoomMonsters(GetFilterUnit())
call RemoveUnit(GetFilterUnit())
else
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", x, y) )
call RemoveUnit( GetFilterUnit() )
endif
endif
endif
return false
endfunction
function SetLifeEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetWidgetLife(GetFilterUnit(), udg_TEMP_Integer)
endif
return false
endfunction
function SetLifeEnumDoodadSelected takes nothing returns boolean
call SetWidgetLife(GetFilterDestructable(), udg_TEMP_Integer)
return false
endfunction
function HurtEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetWidgetLife(GetFilterUnit(), GetWidgetLife(GetFilterUnit()) - udg_TEMP_Integer)
endif
return false
endfunction
function SetManaEnumUnitSelected takes nothing returns boolean
call SetUnitState(GetFilterUnit(), UNIT_STATE_MANA, udg_TEMP_Integer)
return false
endfunction
function RechargeManaEnumUnitSelected takes nothing returns boolean
call SetUnitState(GetFilterUnit(), UNIT_STATE_MANA, GetUnitState(GetFilterUnit(), UNIT_STATE_MANA) - udg_TEMP_Integer)
return false
endfunction
function UnitSizeEnumUnitSelected takes nothing returns boolean
if IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) != true then
call SetUnitScale( GetFilterUnit(), udg_TEMP_Integer*0.01, udg_TEMP_Integer*0.01, udg_TEMP_Integer*0.01)
endif
return false
endfunction
function UnitFacingEnumUnitSelected takes nothing returns boolean
if IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
call UnitRemoveType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
call SetUnitPosition(GetFilterUnit(), GetUnitX(GetFilterUnit()), GetUnitY(GetFilterUnit()))
call SetUnitFacing(GetFilterUnit(), udg_TEMP_Real)
call UnitAddType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
else
call SetUnitFacing( GetFilterUnit(), udg_TEMP_Real)
endif
return false
endfunction
function BountyAmount takes nothing returns boolean
set UnitBounty[GetUnitId(GetFilterUnit())] = udg_TEMP_Integer
return false
endfunction
function SkillAmount takes nothing returns boolean
local integer id = GetPlayerId(GetOwningPlayer(GetFilterUnit()))+1
set SKILL_PTS[GetUnitId(udg_HERO_Ref2[id])] = udg_TEMP_Integer
call LeaderboardAddItemBJ( Player(14), udg_Board[id], "|cff7cfc00Skill Points: |r|c00FFFFFF" + I2S(SKILL_PTS[GetUnitId(udg_HERO_Ref2[id])]) + "|r|n|cffffff00Stat Points: |r|c00FFFFFF" + I2S(STAT_PTS[GetUnitId(udg_HERO_Ref2[id])])+"|r", 0 )
return false
endfunction
function StatAmount takes nothing returns boolean
local integer id = GetPlayerId(GetOwningPlayer(GetFilterUnit()))+1
set STAT_PTS[GetUnitId(udg_HERO_Ref2[id])] = udg_TEMP_Integer
call LeaderboardAddItemBJ( Player(14), udg_Board[id], "|cff7cfc00Skill Points: |r|c00FFFFFF" + I2S(SKILL_PTS[GetUnitId(udg_HERO_Ref2[id])]) + "|r|n|cffffff00Stat Points: |r|c00FFFFFF" + I2S(STAT_PTS[GetUnitId(udg_HERO_Ref2[id])])+"|r", 0 )
return false
endfunction
function ForceClass takes nothing returns boolean
local integer id = GetPlayerId(GetOwningPlayer(GetFilterUnit()))+1
if HeroClass[GetUnitId(GetFilterUnit())] == "" then
call DetermineClass(GetFilterUnit(), udg_TEMP_String, null)
else
set HeroClass[GetUnitId(GetFilterUnit())] = StringCase(SubString(udg_TEMP_String, 0, 1), true) + SubString(udg_TEMP_String, 1, StringLength(udg_TEMP_String))
endif
call LeaderboardSetLabel(udg_Board[id], HeroClass[GetUnitId(GetFilterUnit())] + " " + SubClass[GetUnitId(GetFilterUnit())])
return false
endfunction
function ForceSub takes nothing returns boolean
local integer id = GetPlayerId(GetOwningPlayer(GetFilterUnit()))+1
debug call BJDebugMsg(GetUnitName(GetFilterUnit()) + " " + SubClass[GetUnitId(GetFilterUnit())])
if SubClass[GetUnitId(GetFilterUnit())] == "" then
call DetermineClass(GetFilterUnit(), udg_TEMP_String, null)
else
set SubClass[GetUnitId(GetFilterUnit())] = StringCase(SubString(udg_TEMP_String, 0, 1), true) + SubString(udg_TEMP_String, 1, StringLength(udg_TEMP_String))
endif
call LeaderboardSetLabel(udg_Board[id], HeroClass[GetUnitId(GetFilterUnit())] + " " + SubClass[GetUnitId(GetFilterUnit())])
return false
endfunction
function GoldAt takes nothing returns boolean
call SetResourceAmount(GetFilterUnit(), udg_TEMP_Integer)
return false
endfunction
function SideSwapEnumUnitSelected takes nothing returns boolean
if IsPlayerInForce(GetOwningPlayer(GetFilterUnit()), udg_Force[3]) then
if GetOwningPlayer(GetFilterUnit()) == Player(0) then
call SetUnitOwner( GetFilterUnit(), Player(4), true )
else
call SetUnitOwner( GetFilterUnit(), Player(0), true )
endif
endif
return false
endfunction
function HeroLevelEnumUnitSelected takes nothing returns boolean
local texttag tag = null
local unit f = GetFilterUnit()
local integer id = GetPlayerId(GetOwningPlayer(f))+1
local integer lvl = GetHeroLevel(f)
local integer dif = udg_TEMP_Integer - lvl
if IsUnitType(f, UNIT_TYPE_HERO) then
set tag = CreateTextTag()
if udg_TEMP_Integer < 1 then
set udg_TEMP_Integer = 1
endif
if (udg_TEMP_Integer > lvl) then
set dif = udg_TEMP_Integer - lvl -1
call SetHeroLevel( f, udg_TEMP_Integer, true )
elseif (udg_TEMP_Integer < lvl) then
call UnitStripHeroLevel(f, lvl - udg_TEMP_Integer)
endif
set SKILL_PTS[GetUnitId(GetPlayerHero(id))] = SKILL_PTS[GetUnitId(GetPlayerHero(id))] + dif
set STAT_PTS[GetUnitId(GetPlayerHero(id))] = STAT_PTS[GetUnitId(GetPlayerHero(id))] + dif*3
if IsPlayerInForce(GetOwningPlayer(f), udg_Force[1]) then
call LeaderboardAddItemBJ( Player(14), udg_Board[id], "|cff7cfc00Skill Points: |r|c00FFFFFF" + I2S(SKILL_PTS[GetUnitId(GetPlayerHero(id))]) + "|r|n|cffffff00Stat Points: |r|c00FFFFFF" + I2S(STAT_PTS[GetUnitId(GetPlayerHero(id))])+"|r", 0 )
endif
call SetTextTagText(tag, "Level " + I2S(udg_TEMP_Integer), 0.024)
call SetTextTagPos(tag, GetUnitX(f)-25, GetUnitY(f), 150.00)
call SetTextTagColor(tag, GetPlayerTagColor(GetOwningPlayer(f), "red"), GetPlayerTagColor(GetOwningPlayer(f), "green"), GetPlayerTagColor(GetOwningPlayer(f), "blue"), 0 )
call SetTextTagVelocity(tag, 0, 0.04)
call SetTextTagVisibility(tag, true)
call SetTextTagFadepoint(tag, 1)
call SetTextTagLifespan(tag, 3)
call SetTextTagPermanent(tag, false)
endif
set f = null
return false
endfunction
function HeroIntEnumUnitSelected takes nothing returns boolean
if IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) then
call SetUnitBonus(GetFilterUnit(), BONUS_INTELLIGENCE, udg_TEMP_Integer)
endif
return false
endfunction
function HeroIntSetEnumUnitSelected takes nothing returns boolean
if IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) then
call SetHeroInt(GetFilterUnit(), udg_TEMP_Integer, true)
endif
return false
endfunction
function HeroStrEnumUnitSelected takes nothing returns boolean
if IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) then
call SetUnitBonus(GetFilterUnit(), BONUS_STRENGTH, udg_TEMP_Integer)
endif
return false
endfunction
function HeroStrSetEnumUnitSelected takes nothing returns boolean
if not(IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT)) and not(IsUnitOwnedByPlayer(GetFilterUnit(), Player(PLAYER_NEUTRAL_PASSIVE))) then
if IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) then
call SetHeroStr(GetFilterUnit(), udg_TEMP_Integer, true)
endif
endif
return false
endfunction
function HeroAgiEnumUnitSelected takes nothing returns boolean
if IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) then
call SetUnitBonus(GetFilterUnit(), BONUS_AGILITY, udg_TEMP_Integer)
endif
return false
endfunction
function HeroAgiSetEnumUnitSelected takes nothing returns boolean
if IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) then
call SetHeroAgi(GetFilterUnit(), udg_TEMP_Integer, true)
endif
return false
endfunction
function BonusARMEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetUnitBonus(GetFilterUnit(), BONUS_ARMOR, udg_TEMP_Integer)
endif
return false
endfunction
function BonusDMGEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetUnitBonus(GetFilterUnit(), BONUS_DAMAGE, udg_TEMP_Integer)
endif
return false
endfunction
function BonusAttackSpeedEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetUnitBonus(GetFilterUnit(), BONUS_ATTACK_SPEED, udg_TEMP_Integer)
endif
return false
endfunction
function LifeEnumUnitSelected takes nothing returns boolean
if udg_TEMP_Integer > 99000 then
set udg_TEMP_Integer = 99000
endif
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call AddUnitMaxState(GetFilterUnit(), UNIT_STATE_MAX_LIFE, udg_TEMP_Integer)
endif
return false
endfunction
function ManaEnumUnitSelected takes nothing returns boolean
if udg_TEMP_Integer > 99000 then
set udg_TEMP_Integer = 99000
endif
if GetUnitState(GetFilterUnit(), UNIT_STATE_MAX_MANA) < 1 then
call AddUnitBonus(GetFilterUnit(), BONUS_MANA_REGEN, 1)
call AddUnitMaxState(GetFilterUnit(), UNIT_STATE_MAX_MANA, udg_TEMP_Integer)
call SetUnitState(GetFilterUnit(), UNIT_STATE_MAX_MANA, udg_TEMP_Integer)
else
call AddUnitMaxState(GetFilterUnit(), UNIT_STATE_MAX_MANA, udg_TEMP_Integer)
endif
return false
endfunction
function RegenEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetUnitBonus(GetFilterUnit(), BONUS_MANA_REGEN, udg_TEMP_Integer)
endif
return false
endfunction
function RegenPercentEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetUnitBonus(GetFilterUnit(), BONUS_MANA_REGEN_PERCENT, udg_TEMP_Integer)
endif
return false
endfunction
function RecovEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call SetUnitBonus(GetFilterUnit(), BONUS_LIFE_REGEN, udg_TEMP_Integer)
endif
return false
endfunction
function SetMSPDEnumUnitSelected takes nothing returns boolean
call SetUnitBonus(GetFilterUnit(), BONUS_MOVEMENT_SPEED, udg_TEMP_Integer)
return false
endfunction
function IsMechanicalEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
if IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) then
call UnitRemoveType(GetFilterUnit(), UNIT_TYPE_MECHANICAL)
else
call UnitAddType(GetFilterUnit(), UNIT_TYPE_MECHANICAL)
endif
endif
return false
endfunction
function IsUndeadEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
if IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD) then
call UnitRemoveType(GetFilterUnit(), UNIT_TYPE_UNDEAD)
else
call UnitAddType(GetFilterUnit(), UNIT_TYPE_UNDEAD)
endif
endif
return false
endfunction
function IsSummonEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
if IsUnitType(GetFilterUnit(), UNIT_TYPE_SUMMONED) then
call UnitRemoveType(GetFilterUnit(), UNIT_TYPE_SUMMONED)
else
call UnitAddType(GetFilterUnit(), UNIT_TYPE_SUMMONED)
endif
endif
return false
endfunction
function IsTaurenEnumUnitSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
if IsUnitType(GetFilterUnit(), UNIT_TYPE_TAUREN) then
call UnitRemoveType(GetFilterUnit(), UNIT_TYPE_TAUREN)
else
call UnitAddType(GetFilterUnit(), UNIT_TYPE_TAUREN)
endif
endif
return false
endfunction
function WaygateSelected takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call UnitAddAbility( GetFilterUnit(), 'A080' )
call UnitAddAbility( GetFilterUnit(), 'Awrp' )
endif
return false
endfunction
function AddInventory takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call Inventory.create(GetFilterUnit(), GetHeroProperName(GetFilterUnit()), GetInventoryFromStr(udg_TEMP_String))
endif
return false
endfunction
function SemiColonSpeak takes nothing returns boolean
local unit f = GetFilterUnit()
if udg_TEMP_Integer >= 16 then
set udg_TEMP_Integer = GetPlayerId(GetOwningPlayer(f))
endif
if SemiColonName[GetUnitId(f)] == null then
set SemiColonName[GetUnitId(f)] = GetUnitName(f)
endif
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, ColorName(SemiColonName[GetUnitId(f)] + ": ",udg_TEMP_Integer) + udg_TEMP_String)
set f = null
return false
endfunction
function SemiColonSet takes nothing returns boolean
set SemiColonName[GetUnitId(GetFilterUnit())] = udg_TEMP_String
return false
endfunction
function AllyPlayers takes integer p1, integer p2 returns nothing
local integer i = 0
/* local integer px
local boolean allied = GetPlayerAlliance(Player(p1), Player(p2), ALLIANCE_SHARED_VISION)
if all then
loop
exitwhen i > 11
if i != p1 and not IsPlayerInForce(Player(i), udg_Force[2]) and not IsPlayerInForce(Player(i), udg_Force[3]) then
if allied then
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, ColorNamePl(Player(p1)) + "|r is now allies with everyone.")
call SetPlayerAllianceStateAllyBJ( Player(p1), Player(i), false )
call SetPlayerAllianceStateAllyBJ( Player(i), Player(p1), false )
else
call SetPlayerAllianceStateAllyBJ( Player(p1), Player(i), true )
call SetPlayerAllianceStateAllyBJ( Player(i), Player(p1), true )
endif
endif
set i = i + 1
endloop
return
endif
if allied then
call SetPlayerAllianceStateAllyBJ( Player(p1), Player(p2), false )
call SetPlayerAllianceStateAllyBJ( Player(p2), Player(p1), false )
else
call SetPlayerAllianceStateAllyBJ( Player(p1), Player(p2), true )
call SetPlayerAllianceStateAllyBJ( Player(p2), Player(p1), true )
endif
*/
if IsPlayerEnemy(Player(p1), Player(p2)) or (p1 == 15 and IsPlayerEnemy(Player(0), Player(p2))) or(p2 == 15 and IsPlayerEnemy(Player(0), Player(p1))) then
if p2 == 15 then
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, GetPlayerTextColor(Player(p1)) + GetPlayerName(Player(p1)) + "|r is now allies with everyone.")
loop
exitwhen i > 11
if i != p1 then
call SetPlayerAllianceStateAllyBJ( Player(p1), Player(i), true )
if not(IsPlayerInForce(Player(p1), udg_Force[2]) or IsPlayerInForce(Player(p1), udg_Force[3])) then
call SetPlayerAlliance( Player(p1), Player(i), ALLIANCE_SHARED_VISION, true)
endif
call SetPlayerAllianceStateAllyBJ( Player(i), Player(p1), true )
if not(IsPlayerInForce(Player(i), udg_Force[2]) or IsPlayerInForce(Player(i), udg_Force[3])) then
call SetPlayerAlliance( Player(i), Player(p1), ALLIANCE_SHARED_VISION, true)
endif
endif
set i = i + 1
endloop
elseif p1 == 15 then
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, GetPlayerTextColor(Player(p2)) + GetPlayerName(Player(p2)) + "|r is now allies with everyone.")
loop
exitwhen i > 11
if i != p2 then
call SetPlayerAllianceStateAllyBJ( Player(p2), Player(i), true )
if not(IsPlayerInForce(Player(p2), udg_Force[2]) or IsPlayerInForce(Player(p2), udg_Force[3])) then
call SetPlayerAlliance( Player(p2), Player(i), ALLIANCE_SHARED_VISION, true)
endif
call SetPlayerAllianceStateAllyBJ( Player(i), Player(p2), true )
if not(IsPlayerInForce(Player(i), udg_Force[2]) or IsPlayerInForce(Player(i), udg_Force[3])) then
call SetPlayerAlliance( Player(i), Player(p2), ALLIANCE_SHARED_VISION, true)
endif
endif
set i = i + 1
endloop
else
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, GetPlayerTextColor(Player(p1)) + GetPlayerName(Player(p1)) + "|r is now allied to " + GetPlayerTextColor(Player(p2)) + GetPlayerName(Player(p2)))
call SetPlayerAllianceStateAllyBJ( Player(p1), Player(p2), true )
if not(IsPlayerInForce(Player(p1), udg_Force[2]) or IsPlayerInForce(Player(p1), udg_Force[3])) then
call SetPlayerAlliance( Player(p1), Player(p2), ALLIANCE_SHARED_VISION, true)
endif
call SetPlayerAllianceStateAllyBJ( Player(p2), Player(p1), true )
if not(IsPlayerInForce(Player(p2), udg_Force[2]) or IsPlayerInForce(Player(p2), udg_Force[3])) then
call SetPlayerAlliance( Player(p2), Player(p1), ALLIANCE_SHARED_VISION, true)
endif
endif
else
if p2 == 15 then
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, GetPlayerTextColor(Player(p1)) + GetPlayerName(Player(p1)) + "|r is now enemies with everyone.")
loop
exitwhen i > 11
if i != p1 then
call SetPlayerAllianceStateAllyBJ( Player(p1), Player(i), false )
if not(IsPlayerInForce(Player(p1), udg_Force[2]) or IsPlayerInForce(Player(p1), udg_Force[3])) then
call SetPlayerAlliance( Player(p1), Player(i), ALLIANCE_SHARED_VISION, false)
endif
call SetPlayerAllianceStateAllyBJ( Player(i), Player(p1), false )
if not(IsPlayerInForce(Player(i), udg_Force[2]) or IsPlayerInForce(Player(i), udg_Force[3])) then
call SetPlayerAlliance( Player(i), Player(p1), ALLIANCE_SHARED_VISION, false)
endif
endif
set i = i + 1
endloop
elseif p1 == 15 then
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, GetPlayerTextColor(Player(p2)) + GetPlayerName(Player(p2)) + "|r is now enemies with everyone.")
loop
exitwhen i > 11
if i != p2 then
call SetPlayerAllianceStateAllyBJ( Player(p2), Player(i), false )
if not(IsPlayerInForce(Player(p2), udg_Force[2]) or IsPlayerInForce(Player(p2), udg_Force[3])) then
call SetPlayerAlliance( Player(p2), Player(i), ALLIANCE_SHARED_VISION, false)
endif
call SetPlayerAllianceStateAllyBJ( Player(i), Player(p2), false )
if not(IsPlayerInForce(Player(i), udg_Force[2]) or IsPlayerInForce(Player(i), udg_Force[3])) then
call SetPlayerAlliance( Player(i), Player(p2), ALLIANCE_SHARED_VISION, false)
endif
endif
set i = i + 1
endloop
else
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, GetPlayerTextColor(Player(p1)) + GetPlayerName(Player(p1)) + "|r is now enemies with " + GetPlayerTextColor(Player(p2)) + GetPlayerName(Player(p2)))
call SetPlayerAllianceStateAllyBJ( Player(p1), Player(p2), false )
if not(IsPlayerInForce(Player(p1), udg_Force[2]) or IsPlayerInForce(Player(p1), udg_Force[3])) then
call SetPlayerAlliance( Player(p1), Player(p2), ALLIANCE_SHARED_VISION, false)
endif
call SetPlayerAllianceStateAllyBJ( Player(p2), Player(p1), false )
if not(IsPlayerInForce(Player(p2), udg_Force[2]) or IsPlayerInForce(Player(p2), udg_Force[3])) then
call SetPlayerAlliance( Player(p2), Player(p1), ALLIANCE_SHARED_VISION, false)
endif
endif
endif
endfunction
function VisionPlayers takes integer p1, integer p2, boolean all returns nothing
local integer i = 0
local integer px
local boolean allied = GetPlayerAlliance(Player(p1), Player(p2), ALLIANCE_SHARED_VISION)
if IsPlayerInForce(Player(p1), udg_Force[2]) or IsPlayerInForce(Player(p1), udg_Force[3]) then
return
elseif IsPlayerInForce(Player(p2), udg_Force[2]) or IsPlayerInForce(Player(p2), udg_Force[3]) then
return
endif
if all then
loop
exitwhen i > 11
if i != p1 and not IsPlayerInForce(Player(i), udg_Force[2]) and not IsPlayerInForce(Player(i), udg_Force[3]) then
if allied then
call SetPlayerAlliance(Player(p1), Player(i), ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance(Player(i), Player(p1), ALLIANCE_SHARED_VISION, false)
else
call SetPlayerAlliance(Player(p1), Player(i), ALLIANCE_SHARED_VISION, true)
call SetPlayerAlliance(Player(i), Player(p1), ALLIANCE_SHARED_VISION, true)
endif
endif
set i = i + 1
endloop
return
endif
if allied then
call SetPlayerAlliance(Player(p1), Player(p2), ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance(Player(p2), Player(p1), ALLIANCE_SHARED_VISION, false)
else
call SetPlayerAlliance(Player(p1), Player(p2), ALLIANCE_SHARED_VISION, true)
call SetPlayerAlliance(Player(p2), Player(p1), ALLIANCE_SHARED_VISION, true)
endif
endfunction
function ItemBestow takes nothing returns boolean
if not(IsUnitOwnedByPlayer(GetFilterUnit(), Player(PLAYER_NEUTRAL_PASSIVE)))then
if udg_TEMP_String == "all" then
call UnitAddItemById( GetFilterUnit(), GetItemTypeId(udg_TEMP_ItemArray[udg_TEMP_Integer]))
else
call UnitAddItem( GetFilterUnit(), udg_TEMP_ItemArray[udg_TEMP_Integer])
endif
endif
return false
endfunction
function ItemCharges takes nothing returns boolean
if not(IsUnitOwnedByPlayer(GetFilterUnit(), Player(PLAYER_NEUTRAL_PASSIVE)))then
call SetItemCharges(UnitItemInSlot(GetFilterUnit(), udg_TEMP_IntegerArray[1]-1), udg_TEMP_IntegerArray[2])
endif
return false
endfunction
function ItemDestroy takes nothing returns boolean
call RemoveItem(UnitItemInSlot(GetFilterUnit(), udg_TEMP_Integer-1))
return false
endfunction
function PetSpell1 takes nothing returns boolean
set SpellID1[GetUnitId(GetFilterUnit())] = udg_TEMP_Integer
return false
endfunction
function PetSpell2 takes nothing returns boolean
set SpellID2[GetUnitId(GetFilterUnit())] = udg_TEMP_Integer
return false
endfunction
function PetSpell3 takes nothing returns boolean
set SpellID3[GetUnitId(GetFilterUnit())] = udg_TEMP_Integer
return false
endfunction
function InfoTag takes nothing returns boolean
set Info[GetUnitId(GetFilterUnit())] = udg_TEMP_String
return false
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library TerrainPathability initializer Init
//******************************************************************************
//* BY: Rising_Dusk
//*
//* This script can be used to detect the type of pathing at a specific point.
//* It is valuable to do it this way because the IsTerrainPathable is very
//* counterintuitive and returns in odd ways and aren't always as you would
//* expect. This library, however, facilitates detecting those things reliably
//* and easily.
//*
//******************************************************************************
//*
//* > function IsTerrainDeepWater takes real x, real y returns boolean
//* > function IsTerrainShallowWater takes real x, real y returns boolean
//* > function IsTerrainLand takes real x, real y returns boolean
//* > function IsTerrainPlatform takes real x, real y returns boolean
//* > function IsTerrainWalkable takes real x, real y returns boolean
//*
//* These functions return true if the given point is of the type specified
//* in the function's name and false if it is not. For the IsTerrainWalkable
//* function, the MAX_RANGE constant below is the maximum deviation range from
//* the supplied coordinates that will still return true.
//*
//* The IsTerrainPlatform works for any preplaced walkable destructable. It will
//* return true over bridges, destructable ramps, elevators, and invisible
//* platforms. Walkable destructables created at runtime do not create the same
//* pathing hole as preplaced ones do, so this will return false for them. All
//* other functions except IsTerrainWalkable return false for platforms, because
//* the platform itself erases their pathing when the map is saved.
//*
//* After calling IsTerrainWalkable(x, y), the following two global variables
//* gain meaning. They return the X and Y coordinates of the nearest walkable
//* point to the specified coordinates. These will only deviate from the
//* IsTerrainWalkable function arguments if the function returned false.
//*
//* Variables that can be used from the library:
//* [real] TerrainPathability_X
//* [real] TerrainPathability_Y
//*
globals
private constant real MAX_RANGE = 10.
private constant integer DUMMY_ITEM_ID = 'wolg'
endglobals
globals
private item Item = null
private rect Find = null
private item array Hid
private integer HidMax = 0
public real X = 0.
public real Y = 0.
endglobals
function IsTerrainDeepWater takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endfunction
function IsTerrainShallowWater takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
endfunction
function IsTerrainLand takes real x, real y returns boolean
return IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY)
endfunction
function IsTerrainPlatform takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
endfunction
private function HideItem takes nothing returns nothing
if IsItemVisible(GetEnumItem()) then
set Hid[HidMax] = GetEnumItem()
call SetItemVisible(Hid[HidMax], false)
set HidMax = HidMax + 1
endif
endfunction
function IsTerrainWalkable takes real x, real y returns boolean
//Hide any items in the area to avoid conflicts with our item
call MoveRectTo(Find, x, y)
call EnumItemsInRect(Find ,null, function HideItem)
//Try to move the test item and get its coords
call SetItemPosition(Item, x, y) //Unhides the item
set X = GetItemX(Item)
set Y = GetItemY(Item)
static if LIBRARY_IsTerrainWalkable then
//This is for compatibility with the IsTerrainWalkable library
set IsTerrainWalkable_X = X
set IsTerrainWalkable_Y = Y
endif
call SetItemVisible(Item, false)//Hide it again
//Unhide any items hidden at the start
loop
exitwhen HidMax <= 0
set HidMax = HidMax - 1
call SetItemVisible(Hid[HidMax], true)
set Hid[HidMax] = null
endloop
//Return walkability
return (X-x)*(X-x)+(Y-y)*(Y-y) <= MAX_RANGE*MAX_RANGE and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endfunction
private function Init takes nothing returns nothing
set Find = Rect(0., 0., 128., 128.)
set Item = CreateItem(DUMMY_ITEM_ID, 0, 0)
call SetItemVisible(Item, false)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library IsTerrainWalkable requires TerrainPathability
globals
public real X
public real Y
endglobals
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library UnitIndexingUtils requires AutoIndex
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library LastOrder initializer Init needs UnitIndexingUtils
//******************************************************************************
//* BY: Rising_Dusk
//*
//* This library has a lot of usefulness for when you want to interface with the
//* last order a unit was given. This can be useful for simulating spell errors
//* and where you'd want to give them back the order they had prior to the spell
//* cast (whereas without this library, they'd just forget their orders).
//*
//* There are some handy interfacing options for your use here --
//* function GetLastOrderId takes unit u returns integer
//* function GetLastOrderString takes unit u returns string
//* function GetLastOrderType takes unit u returns integer
//* function GetLastOrderX takes unit u returns real
//* function GetLastOrderY takes unit u returns real
//* function GetLastOrderTarget takes unit u returns widget
//* function AbortOrder takes unit u returns boolean
//*
//* There are also some order commands that can be useful --
//* function IssueLastOrder takes unit u returns boolean
//* function IssueSecondLastOrder takes unit u returns boolean
//* function IsLastOrderFinished takes unit u returns boolean
//*
//* You can access any information you'd like about the orders for your own
//* order handling needs.
//*
globals
//* Storage for last order
private integer array Order
private integer array Type
private widget array Targ
private boolean array Flag
private real array X
private real array Y
//* Storage for second last order
private integer array P_Order
private integer array P_Type
private widget array P_Targ
private boolean array P_Flag
private real array P_X
private real array P_Y
//* Order type variables
constant integer ORDER_TYPE_TARGET = 1
constant integer ORDER_TYPE_POINT = 2
constant integer ORDER_TYPE_IMMEDIATE = 3
//* Trigger for the order catching
private trigger OrderTrg = CreateTrigger()
endglobals
//**********************************************************
function GetLastOrderId takes unit u returns integer
return Order[GetUnitId(u)]
endfunction
function GetLastOrderString takes unit u returns string
return OrderId2String(Order[GetUnitId(u)])
endfunction
function GetLastOrderType takes unit u returns integer
return Type[GetUnitId(u)]
endfunction
function GetLastOrderX takes unit u returns real
return X[GetUnitId(u)]
endfunction
function GetLastOrderY takes unit u returns real
return Y[GetUnitId(u)]
endfunction
function GetLastOrderTarget takes unit u returns widget
return Targ[GetUnitId(u)]
endfunction
//**********************************************************
private function OrderExclusions takes unit u, integer id returns boolean
//* Excludes specific orders or unit types from registering with the system
//*
//* 851972: stop
//* Stop is excluded from the system, but you can change it by
//* adding a check for it below. id == 851972
//*
//* 851971: smart
//* 851986: move
//* 851983: attack
//* 851984: attackground
//* 851990: patrol
//* 851993: holdposition
//* These are the UI orders that are passed to the system.
//*
//* >= 852055, <= 852762
//* These are all spell IDs from defend to incineratearrowoff with
//* a bit of leeway at the ends for orders with no strings.
//*
return id == 851971 or id == 851986 or id == 851983 or id == 851984 or id == 851990 or id == 851993 or (id >= 852055 and id <= 852762)
endfunction
private function LastOrderFilter takes unit u returns boolean
//* Some criteria for whether or not a unit's last order should be given
//*
//* INSTANT type orders are excluded because generally, reissuing an instant
//* order doesn't make sense. You can remove that check below if you'd like,
//* though.
//*
//* The Type check is really just to ensure that no spell recursion can
//* occur with IssueLastOrder. The problem with intercepting the spell cast
//* event is that it happens after the order is 'caught' and registered to
//* this system. Therefore, to just IssueLastOrder tells it to recast the
//* spell! That's a problem, so we need a method to eliminate it.
//*
local integer id = GetUnitId(u)
return u != null and GetWidgetLife(u) > 0.405 and Type[id] != ORDER_TYPE_IMMEDIATE
endfunction
private function SecondLastOrderFilter takes unit u returns boolean
//* Same as above but with regard to the second last order issued
local integer id = GetUnitId(u)
return u != null and GetWidgetLife(u) > 0.405 and P_Type[id] != ORDER_TYPE_IMMEDIATE and P_Order[id] != Order[id]
endfunction
//**********************************************************
function IsLastOrderFinished takes unit u returns boolean
return (GetUnitCurrentOrder(u) == 0 and Order[GetUnitId(u)] != 851972) or Flag[GetUnitId(u)]
endfunction
function IssueLastOrder takes unit u returns boolean
local integer id = GetUnitId(u)
local boolean b = false
if LastOrderFilter(u) and Order[id] != 0 and not Flag[id] then
if Type[id] == ORDER_TYPE_TARGET then
set b = IssueTargetOrderById(u, Order[id], Targ[id])
elseif Type[id] == ORDER_TYPE_POINT then
set b = IssuePointOrderById(u, Order[id], X[id], Y[id])
elseif Type[id] == ORDER_TYPE_IMMEDIATE then
set b = IssueImmediateOrderById(u, Order[id])
endif
endif
return b
endfunction
function IssueSecondLastOrder takes unit u returns boolean
//* This function has to exist because of spell recursion
local integer id = GetUnitId(u)
local boolean b = false
if SecondLastOrderFilter(u) and P_Order[id] != 0 and not P_Flag[id] then
if P_Type[id] == ORDER_TYPE_TARGET then
set b = IssueTargetOrderById(u, P_Order[id], P_Targ[id])
elseif P_Type[id] == ORDER_TYPE_POINT then
set b = IssuePointOrderById(u, P_Order[id], P_X[id], P_Y[id])
elseif P_Type[id] == ORDER_TYPE_IMMEDIATE then
set b = IssueImmediateOrderById(u, P_Order[id])
endif
endif
return b
endfunction
function AbortOrder takes unit u returns boolean
local boolean b = true
if IsUnitPaused(u) then
set b = false
else
call PauseUnit(u, true)
call IssueImmediateOrder(u, "stop")
call PauseUnit(u, false)
endif
return b
endfunction
//**********************************************************
private function Conditions takes nothing returns boolean
return OrderExclusions(GetTriggerUnit(), GetIssuedOrderId())
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer id = GetUnitId(u)
//* Store second to last order to eliminate spell recursion
set P_Order[id] = Order[id]
set P_Targ[id] = Targ[id]
set P_Type[id] = Type[id]
set P_Flag[id] = Flag[id]
set P_X[id] = X[id]
set P_Y[id] = Y[id]
set Flag[id] = false
set Order[id] = GetIssuedOrderId()
if GetTriggerEventId() == EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER then
set Targ[id] = GetOrderTarget()
set Type[id] = ORDER_TYPE_TARGET
set X[id] = GetWidgetX(GetOrderTarget())
set Y[id] = GetWidgetY(GetOrderTarget())
elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER then
set Targ[id] = null
set Type[id] = ORDER_TYPE_POINT
set X[id] = GetOrderPointX()
set Y[id] = GetOrderPointY()
elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_ISSUED_ORDER then
set Targ[id] = null
set Type[id] = ORDER_TYPE_IMMEDIATE
set X[id] = GetUnitX(u)
set Y[id] = GetUnitY(u)
debug else
debug call BJDebugMsg(SCOPE_PREFIX+" Error: Order Doesn't Exist")
endif
set u = null
endfunction
//**********************************************************
private function SpellActions takes nothing returns nothing
set Flag[GetUnitId(GetTriggerUnit())] = true
endfunction
//**********************************************************
private function Init takes nothing returns nothing
local trigger trg = CreateTrigger()
call TriggerAddAction(OrderTrg, function Actions)
call TriggerAddCondition(OrderTrg, Condition(function Conditions))
call TriggerRegisterAnyUnitEventBJ(OrderTrg, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
call TriggerRegisterAnyUnitEventBJ(OrderTrg, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
call TriggerRegisterAnyUnitEventBJ(OrderTrg, EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerAddAction(trg, function SpellActions)
call TriggerRegisterAnyUnitEventBJ(trg, EVENT_PLAYER_UNIT_SPELL_EFFECT)
set trg = null
endfunction
endlibrary
//TESH.scrollpos=24
//TESH.alwaysfold=0
library TimerUtils initializer init
//*********************************************************************
//* TimerUtils (red+blue+orange flavors for 1.24b+)
//* ----------
//*
//* To implement it , create a custom text trigger called TimerUtils
//* and paste the contents of this script there.
//*
//* To copy from a map to another, copy the trigger holding this
//* library to your map.
//*
//* (requires vJass) More scripts: htt://www.wc3c.net
//*
//* For your timer needs:
//* * Attaching
//* * Recycling (with double-free protection)
//*
//* set t=NewTimer() : Get a timer (alternative to CreateTimer)
//* ReleaseTimer(t) : Relese a timer (alt to DestroyTimer)
//* SetTimerData(t,2) : Attach value 2 to timer
//* GetTimerData(t) : Get the timer's value.
//* You can assume a timer's value is 0
//* after NewTimer.
//*
//* Multi-flavor:
//* Set USE_HASH_TABLE to true if you don't want to complicate your life.
//*
//* If you like speed and giberish try learning about the other flavors.
//*
//********************************************************************
//================================================================
globals
//How to tweak timer utils:
// USE_HASH_TABLE = true (new blue)
// * SAFEST
// * SLOWEST (though hash tables are kind of fast)
//
// USE_HASH_TABLE = false, USE_FLEXIBLE_OFFSET = true (orange)
// * kinda safe (except there is a limit in the number of timers)
// * ALMOST FAST
//
// USE_HASH_TABLE = false, USE_FLEXIBLE_OFFSET = false (red)
// * THE FASTEST (though is only faster than the previous method
// after using the optimizer on the map)
// * THE LEAST SAFE ( you may have to tweak OFSSET manually for it to
// work)
//
private constant boolean USE_HASH_TABLE = true
private constant boolean USE_FLEXIBLE_OFFSET = true
private constant integer OFFSET = 0x100000
private integer VOFFSET = OFFSET
//Timers to preload at map init:
private constant integer QUANTITY = 1024
//Changing this to something big will allow you to keep recycling
// timers even when there are already AN INCREDIBLE AMOUNT of timers in
// the stack. But it will make things far slower so that's probably a bad idea...
private constant integer ARRAY_SIZE = 8190
endglobals
//==================================================================================================
globals
private integer array data[ARRAY_SIZE]
private hashtable ht
endglobals
//It is dependent on jasshelper's recent inlining optimization in order to perform correctly.
function SetTimerData takes timer t, integer value returns nothing
static if(USE_HASH_TABLE) then
// new blue
call SaveInteger(ht,0,GetHandleId(t), value)
elseif (USE_FLEXIBLE_OFFSET) then
// orange
static if (DEBUG_MODE) then
if(GetHandleId(t)-VOFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
set data[GetHandleId(t)-VOFFSET]=value
else
// new red
static if (DEBUG_MODE) then
if(GetHandleId(t)-OFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
set data[GetHandleId(t)-OFFSET]=value
endif
endfunction
function GetTimerData takes timer t returns integer
static if(USE_HASH_TABLE) then
// new blue
return LoadInteger(ht,0,GetHandleId(t) )
elseif (USE_FLEXIBLE_OFFSET) then
// orange
static if (DEBUG_MODE) then
if(GetHandleId(t)-VOFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
return data[GetHandleId(t)-VOFFSET]
else
// new red
static if (DEBUG_MODE) then
if(GetHandleId(t)-OFFSET<0) then
call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
endif
endif
return data[GetHandleId(t)-OFFSET]
endif
endfunction
//==========================================================================================
globals
private timer array tT[ARRAY_SIZE]
private integer tN = 0
private constant integer HELD=0x28829022
//use a totally random number here, the more improbable someone uses it, the better.
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, make sure all timers are getting recycled correctly")
static if( not USE_HASH_TABLE) then
debug call BJDebugMsg("In case of errors, please increase it accordingly, or set TimerUtils_USE_HASH_TABLE to true")
set tT[0]=CreateTimer()
static if( USE_FLEXIBLE_OFFSET) then
if (GetHandleId(tT[0])-VOFFSET<0) or (GetHandleId(tT[0])-VOFFSET>=ARRAY_SIZE) then
//all right, couldn't fix it
call BJDebugMsg("NewTimer: Unable to allocate a timer, you should probably set TimerUtils_USE_HASH_TABLE to true or fix timer leaks.")
return null
endif
else
if (GetHandleId(tT[0])-OFFSET<0) or (GetHandleId(tT[0])-OFFSET>=ARRAY_SIZE) then
//all right, couldn't fix it
call BJDebugMsg("NewTimer: Unable to allocate a timer, you should probably set TimerUtils_USE_HASH_TABLE to true or fix timer leaks.")
return null
endif
endif
endif
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==ARRAY_SIZE) then
debug call BJDebugMsg("Warning: Timer stack is full, destroying timer!!")
//stack is full, the map already has much more troubles than the chance of bug
call DestroyTimer(t)
else
call PauseTimer(t)
if(GetTimerData(t)==HELD) then
debug call BJDebugMsg("Warning: ReleaseTimer: Double free!")
return
endif
call SetTimerData(t,HELD)
set tT[tN]=t
set tN=tN+1
endif
endfunction
private function init takes nothing returns nothing
local integer i=0
local integer o=-1
local boolean oops = false
static if( USE_HASH_TABLE ) then
set ht = InitHashtable()
loop
exitwhen(i==QUANTITY)
set tT[i]=CreateTimer()
call SetTimerData(tT[i], HELD)
set i=i+1
endloop
set tN = QUANTITY
else
loop
set i=0
loop
exitwhen (i==QUANTITY)
set tT[i] = CreateTimer()
if(i==0) then
set VOFFSET = GetHandleId(tT[i])
static if(USE_FLEXIBLE_OFFSET) then
set o=VOFFSET
else
set o=OFFSET
endif
endif
if (GetHandleId(tT[i])-o>=ARRAY_SIZE) then
exitwhen true
endif
if (GetHandleId(tT[i])-o>=0) then
set i=i+1
endif
endloop
set tN = i
exitwhen(tN == QUANTITY)
set oops = true
exitwhen not USE_FLEXIBLE_OFFSET
debug call BJDebugMsg("TimerUtils_init: Failed a initialization attempt, will try again")
endloop
if(oops) then
static if ( USE_FLEXIBLE_OFFSET) then
debug call BJDebugMsg("The problem has been fixed.")
//If this message doesn't appear then there is so much
//handle id fragmentation that it was impossible to preload
//so many timers and the thread crashed! Therefore this
//debug message is useful.
elseif(DEBUG_MODE) then
call BJDebugMsg("There were problems and the new timer limit is "+I2S(i))
call BJDebugMsg("This is a rare ocurrence, if the timer limit is too low:")
call BJDebugMsg("a) Change USE_FLEXIBLE_OFFSET to true (reduces performance a little)")
call BJDebugMsg("b) or try changing OFFSET to "+I2S(VOFFSET) )
endif
endif
endif
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Table
//***************************************************************
//* Table object 3.0
//* ------------
//*
//* set t=Table.create() - instanceates a new table object
//* call t.destroy() - destroys it
//* t[1234567] - Get value for key 1234567
//* (zero if not assigned previously)
//* set t[12341]=32 - Assigning it.
//* call t.flush(12341) - Flushes the stored value, so it
//* doesn't use any more memory
//* t.exists(32) - Was key 32 assigned? Notice
//* that flush() unassigns values.
//* call t.reset() - Flushes the whole contents of the
//* Table.
//*
//* call t.destroy() - Does reset() and also recycles the id.
//*
//* If you use HandleTable instead of Table, it is the same
//* but it uses handles as keys, the same with StringTable.
//*
//* You can use Table on structs' onInit if the struct is
//* placed in a library that requires Table or outside a library.
//*
//* You can also do 2D array syntax if you want to touch
//* mission keys directly, however, since this is shared space
//* you may want to prefix your mission keys accordingly:
//*
//* set Table["thisstring"][ 7 ] = 2
//* set Table["thisstring"][ 5 ] = Table["thisstring"][7]
//*
//***************************************************************
//=============================================================
globals
private constant integer MAX_INSTANCES=8100 //400000
//Feel free to change max instances if necessary, it will only affect allocation
//speed which shouldn't matter that much.
//=========================================================
private hashtable ht
endglobals
private struct GTable[MAX_INSTANCES]
method reset takes nothing returns nothing
call FlushChildHashtable(ht, integer(this) )
endmethod
private method onDestroy takes nothing returns nothing
call this.reset()
endmethod
//=============================================================
// initialize it all.
//
private static method onInit takes nothing returns nothing
set ht = InitHashtable()
endmethod
endstruct
//Hey: Don't instanciate other people's textmacros that you are not supposed to, thanks.
//! textmacro Table__make takes name, type, key
struct $name$ extends GTable
method operator [] takes $type$ key returns integer
return LoadInteger(ht, integer(this), $key$)
endmethod
method operator []= takes $type$ key, integer value returns nothing
call SaveInteger(ht, integer(this) ,$key$, value)
endmethod
method flush takes $type$ key returns nothing
call RemoveSavedInteger(ht, integer(this), $key$)
endmethod
method exists takes $type$ key returns boolean
return HaveSavedInteger( ht, integer(this) ,$key$)
endmethod
static method flush2D takes string firstkey returns nothing
call $name$(- StringHash(firstkey)).reset()
endmethod
static method operator [] takes string firstkey returns $name$
return $name$(- StringHash(firstkey) )
endmethod
endstruct
//! endtextmacro
//! runtextmacro Table__make("Table","integer","key" )
//! runtextmacro Table__make("StringTable","string", "StringHash(key)" )
//! runtextmacro Table__make("HandleTable","handle","GetHandleId(key)" )
endlibrary
//TESH.scrollpos=17
//TESH.alwaysfold=0
library SimError initializer init
//**************************************************************************************************
//*
//* SimError
//*
//* Mimic an interface error message
//* call SimError(ForPlayer, msg)
//* ForPlayer : The player to show the error
//* msg : The error
//*
//* To implement this function, copy this trigger and paste it in your map.
//* Unless of course you are actually reading the library from wc3c's scripts section, then just
//* paste the contents into some custom text trigger in your map.
//*
//**************************************************************************************************
//==================================================================================================
globals
private sound error
endglobals
//====================================================================================================
function SimError takes player ForPlayer, string msg returns nothing
set msg="\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+msg+"|r"
if (GetLocalPlayer() == ForPlayer) then
call DisplayTimedTextToPlayer( ForPlayer, 0.52, 0.96, 2.00, msg )
call StartSound( error )
endif
endfunction
private function init takes nothing returns nothing
set error=CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
set error=CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
//call StartSound( error ) //apparently the bug in which you play a sound for the first time
//and it doesn't work is not there anymore in patch 1.22
endfunction
endlibrary
//TESH.scrollpos=24
//TESH.alwaysfold=0
library GroupUtils initializer Init requires optional xebasic
//******************************************************************************
//* BY: Rising_Dusk
//*
//* This library is a combination of several features relevant to groups. First
//* and foremost, it contains a group stack that you can access dynamic groups
//* from. It also provides means to refresh groups and clear any shadow
//* references within them. The included boolexprs are there for backwards
//* compatibility with maps that happen to use them. Since the 1.24c patch,
//* null boolexprs used in GroupEnumUnits* calls no longer leak, so there is no
//* performance gain to using the BOOLEXPR_TRUE constant.
//*
//* Instead of creating/destroying groups, we have moved on to recycling them.
//* NewGroup pulls a group from the stack and ReleaseGroup adds it back. Always
//* remember to call ReleaseGroup on a group when you are done using it. If you
//* fail to do so enough times, the stack will overflow and no longer work.
//*
//* GroupRefresh cleans a group of any shadow references which may be clogging
//* its hashtable. If you remove a unit from the game who is a member of a unit
//* group, it will 'effectively' remove the unit from the group, but leave a
//* shadow in its place. Calling GroupRefresh on a group will clean up any
//* shadow references that may exist within it. It is only worth doing this on
//* groups that you plan to have around for awhile.
//*
//* Constants that can be used from the library:
//* [group] ENUM_GROUP As you might expect, this group is good for
//* when you need a group just for enumeration.
//* [boolexpr] BOOLEXPR_TRUE This is a true boolexpr, which is important
//* because a 'null' boolexpr in enumeration
//* calls results in a leak. Use this instead.
//* [boolexpr] BOOLEXPR_FALSE This exists mostly for completeness.
//*
//* This library also includes a simple implementation of a group enumeration
//* call that factors collision of units in a given area of effect. This is
//* particularly useful because GroupEnumUnitsInRange doesn't factor collision.
//*
//* In your map, you can just replace all instances of GroupEnumUnitsInRange
//* with GroupEnumUnitsInArea with identical arguments and your spells will
//* consider all units colliding with the area of effect. After calling this
//* function as you would normally call GroupEnumUnitsInRange, you are free to
//* do anything with the group that you would normally do.
//*
//* If you don't use xebasic in your map, you may edit the MAX_COLLISION_SIZE
//* variable below and the library will use that as the added radius to check.
//* If you use xebasic, however, the script will automatically use xe's
//* collision size variable.
//*
//* You are also able to use GroupUnitsInArea. This function returns all units
//* within the area, no matter what they are, which can be convenient for those
//* instances where you actually want that.
//*
//* Example usage:
//* local group MyGroup = NewGroup()
//* call GroupRefresh(MyGroup)
//* call ReleaseGroup(MyGroup)
//* call GroupEnumUnitsInArea(ENUM_GROUP, x, y, 350., BOOLEXPR_TRUE)
//* call GroupUnitsInArea(ENUM_GROUP, x, y, 350.)
//*
globals
//If you don't have xebasic in your map, this value will be used instead.
//This value corresponds to the max collision size of a unit in your map.
private constant real MAX_COLLISION_SIZE = 197.
//If you are insane and don't care about any of the protection involved in
//this library, but want this script to be really fast, set this to true.
private constant boolean LESS_SAFETY = false
endglobals
globals
//* Constants that are available to the user
group ENUM_GROUP = CreateGroup()
boolexpr BOOLEXPR_TRUE = null
boolexpr BOOLEXPR_FALSE = null
endglobals
globals
//* Hashtable for debug purposes
private hashtable ht = InitHashtable()
//* Temporary references for GroupRefresh
private boolean Flag = false
private group Refr = null
//* Arrays and counter for the group stack
private group array Groups
private integer Count = 0
//* Variables for use with the GroupUnitsInArea function
private real X = 0.
private real Y = 0.
private real R = 0.
private hashtable H = InitHashtable()
endglobals
private function HookDestroyGroup takes group g returns nothing
if g == ENUM_GROUP then
call BJDebugMsg(SCOPE_PREFIX+"Warning: ENUM_GROUP destroyed")
endif
endfunction
debug hook DestroyGroup HookDestroyGroup
private function AddEx takes nothing returns nothing
if Flag then
call GroupClear(Refr)
set Flag = false
endif
call GroupAddUnit(Refr, GetEnumUnit())
endfunction
function GroupRefresh takes group g returns nothing
set Flag = true
set Refr = g
call ForGroup(Refr, function AddEx)
if Flag then
call GroupClear(g)
endif
endfunction
function NewGroup takes nothing returns group
if Count == 0 then
set Groups[0] = CreateGroup()
else
set Count = Count - 1
endif
static if not LESS_SAFETY then
call SaveInteger(ht, 0, GetHandleId(Groups[Count]), 1)
endif
return Groups[Count]
endfunction
function ReleaseGroup takes group g returns boolean
local integer id = GetHandleId(g)
static if LESS_SAFETY then
if g == null then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Null groups cannot be released")
return false
elseif Count == 8191 then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Max groups achieved, destroying group")
call DestroyGroup(g)
return false
endif
else
if g == null then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Null groups cannot be released")
return false
elseif not HaveSavedInteger(ht, 0, id) then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Group not part of stack")
return false
elseif LoadInteger(ht, 0, id) == 2 then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Groups cannot be multiply released")
return false
elseif Count == 8191 then
debug call BJDebugMsg(SCOPE_PREFIX+"Error: Max groups achieved, destroying group")
call DestroyGroup(g)
return false
endif
call SaveInteger(ht, 0, id, 2)
endif
call GroupClear(g)
set Groups[Count] = g
set Count = Count + 1
return true
endfunction
private function Filter takes nothing returns boolean
return IsUnitInRangeXY(GetFilterUnit(), X, Y, R)
endfunction
private function HookDestroyBoolExpr takes boolexpr b returns nothing
local integer bid = GetHandleId(b)
if HaveSavedHandle(H, 0, bid) then
//Clear the saved boolexpr
call DestroyBoolExpr(LoadBooleanExprHandle(H, 0, bid))
call RemoveSavedHandle(H, 0, bid)
endif
endfunction
hook DestroyBoolExpr HookDestroyBoolExpr
private constant function GetRadius takes real radius returns real
static if LIBRARY_xebasic then
return radius+XE_MAX_COLLISION_SIZE
else
return radius+MAX_COLLISION_SIZE
endif
endfunction
function GroupEnumUnitsInArea takes group whichGroup, real x, real y, real radius, boolexpr filter returns nothing
local real prevX = X
local real prevY = Y
local real prevR = R
local integer bid = 0
//Set variables to new values
set X = x
set Y = y
set R = radius
if filter == null then
//Adjusts for null boolexprs passed to the function
set filter = Condition(function Filter)
else
//Check for a saved boolexpr
set bid = GetHandleId(filter)
if HaveSavedHandle(H, 0, bid) then
//Set the filter to use to the saved one
set filter = LoadBooleanExprHandle(H, 0, bid)
else
//Create a new And() boolexpr for this filter
set filter = And(Condition(function Filter), filter)
call SaveBooleanExprHandle(H, 0, bid, filter)
endif
endif
//Enumerate, if they want to use the boolexpr, this lets them
call GroupEnumUnitsInRange(whichGroup, x, y, GetRadius(radius), filter)
//Give back original settings so nested enumerations work
set X = prevX
set Y = prevY
set R = prevR
endfunction
function GroupUnitsInArea takes group whichGroup, real x, real y, real radius returns nothing
local real prevX = X
local real prevY = Y
local real prevR = R
//Set variables to new values
set X = x
set Y = y
set R = radius
//Enumerate
call GroupEnumUnitsInRange(whichGroup, x, y, GetRadius(radius), Condition(function Filter))
//Give back original settings so nested enumerations work
set X = prevX
set Y = prevY
set R = prevR
endfunction
private function True takes nothing returns boolean
return true
endfunction
private function False takes nothing returns boolean
return false
endfunction
private function Init takes nothing returns nothing
set BOOLEXPR_TRUE = Condition(function True)
set BOOLEXPR_FALSE = Condition(function False)
endfunction
endlibrary
//TESH.scrollpos=766
//TESH.alwaysfold=0
library AutoIndex
//===========================================================================
// Information:
//==============
//
// AutoIndex is a very simple script to utilize. Just call GetUnitId(unit)
// to get get the unique value assigned to a particular unit. The GetUnitId
// function is extremely fast because it inlines directly to a GetUnitUserData
// call. AutoIndex automatically assigns an ID to each unit as it enters the
// map, and instantly frees that ID as the unit leaves the map. Detection of
// leaving units is accomplished in constant time without a periodic scan.
//
// AutoIndex uses UnitUserData by default. If something else in your map
// would conflict with that, you can set the UseUnitUserData configuration
// constant to false, and a hashtable will be used instead. Note that hash-
// tables are about 60% slower.
//
// If you turn on debug mode, AutoIndex will be able to display several
// helpful error messages. The following issues will be detected:
// -Passing a removed or decayed unit to GetUnitId
// -Code outside of AutoIndex has overwritten a unit's UserData value.
// -GetUnitId was used on a filtered unit (a unit you don't want indexed).
//
// AutoIndex provides events upon indexing or deindexing units. This
// effectively allows you to notice when units enter or leave the game. Also
// included are the AutoData, AutoCreate, and AutoDestroy modules, which allow
// you to fully utilize AutoIndex's enter/leave detection capabilities in
// conjunction with your structs.
//
//===========================================================================
// How to install AutoIndex:
//===========================
//
// 1.) Copy and paste this script into your map.
// 2.) Save it to allow the ObjectMerger macro to generate the "Leave Detect"
// ability for you. Close and re-open the map. After that, disable the macro
// to prevent the delay while saving.
//
//===========================================================================
// How to use AutoIndex:
//=======================
//
// So you can get a unique integer for each unit, but how do you use that to
// attach data to a unit? GetUnitId will always return a number in the range of
// 1-8190. This means it can be used as an array index, as demonstrated below:
/*
globals
integer array IntegerData
real array RealData
SomeStruct array SomeStructData
englobals
function Example takes nothing returns nothing
local unit u = CreateUnit(Player(0), 'hpea', 0., 0., 0.)
local integer id = GetUnitId(u)
//You now have a unique index for the unit, so you can
//attach or retrieve data about the unit using arrays.
set IntegerData[id] = 5
set RealData[id] = 25.0
set SomeStructData[id] = SomeStruct.create()
//If you have access to the same unit in another function, you can
//retrieve the data by using GetUnitId() and reading the arrays.
endfunction
*/
// The UnitFilter function in the configuration section is provided so that
// you can make AutoIndex completely ignore certain unit-types. Ignored units
// won't be indexed or fire indexed/deindexed events. You may want to filter out
// dummy casters or system-private units, especially ones that use UnitUserData
// internally. xe dummy units are automatically filtered.
//
//===========================================================================
// How to use OnUnitIndexed / OnUnitDeindexed:
//=============================================
//
// AutoIndex will fire the OnUnitIndexed event when a unit enters the map,
// and the OnUnitDeindexed event when a unit leaves the map. Functions used
// as events must take a unit and return nothing. An example is given below:
/*
function UnitEntersMap takes unit u returns nothing
call BJDebugMsg(GetUnitName(u)+" with ID "+I2S(GetUnitId(u))+" entered the map.")
endfunction //Using GetUnitId() during Indexed events works fine...
function UnitLeavesMap takes unit u returns nothing
call BJDebugMsg(GetUnitName(u)+" with ID "+I2S(GetUnitId(u))+" left the map.")
endfunction //So does using GetUnitId() during Deindexed events.
function Init takes nothing returns nothing
call OnUnitIndexed(UnitEntersMap)
call OnUnitDeindexed(UnitLeavesMap)
endfunction
*/
// If you call OnUnitIndexed during map initialization, every existing
// unit will be considered as entering the map. This saves you from the need
// to manually enumerate preplaced units (or units created by initialization
// code that ran before OnUnitIndexed was called).
//
// OnUnitDeindexed runs while a unit still exists, which means you can
// still do things such as destroy special effects attached to the unit.
// The unit will cease to exist immediately after the event is over.
//
//===========================================================================
// AutoIndex API:
//================
//
// GetUnitId(unit) -> integer
// This function returns a unique ID in the range of 1-8190 for the
// specified unit. Returns 0 if a null unit was passed. This function
// inlines directly to GetUnitUserData or LoadInteger if debug mode
// is disabled. If debug mode is enabled, this function will print
// an error message when passed a decayed or filtered unit.
//
// IsUnitIndexed(unit) -> boolean
// This function returns a boolean indicating whether the specified
// unit has been indexed. The only time this will return false is
// for units you have filtered using the UnitFilter function, or
// for xe dummy units. You can use this function to easily detect
// dummy units and avoid performing certain actions on them.
//
// OnUnitIndexed(IndexFunc)
// This function accepts an IndexFunc, which must take a unit and
// return nothing. The IndexFunc will be fired instantly whenever
// a unit enters the map. You may use GetUnitId on the unit. When
// you call this function during map initialization, every existing
// unit will be considered as entering the map.
//
// OnUnitDeindexed(IndexFunc)
// Same as above, but runs whenever a unit is leaving the map. When
// this event runs, the unit still exists, but it will cease to exist
// as soon as the event ends. You may use GetUnitId on the unit.
//
//===========================================================================
// How to use AutoData:
//======================
//
// The AutoData module allows you to associate one or more instances
// of the implementing struct with units, as well as iterate through all
// of the instances associated with each unit.
//
// This association is accomplished through the "me" instance member,
// which the module will place in the implementing struct. Whichever unit
// you assign to "me" becomes the owner of that instance. You may change
// ownership by reassigning "me" to another unit at any time, or you may
// make the instance unowned by assigning "me" to null.
//
// AutoData implements the static method operator [] in your struct
// to allow you to access instances from their owning units. For example,
// you may type: local StructName s = StructName[u]. If u has been set
// to own an instance of StructName, s will be set to that instance.
//
// So, what happens if you assign the same owning unit to multiple
// instances? You may use 2D array syntax to access instances assigned to
// the same unit: local StructName s = StructName[u][n], where u is the
// owning unit, and n is the index beginning with 0 for each unit. You
// can access the size of a unit's instance list (i.e. the number of
// instances belonging to the unit) by using the .size instance member.
/*
struct Example
implement AutoData
static method create takes unit u returns Example
local Example this = allocate()
set me = u //Assigning the "me" member from AutoData.
return this
endmethod
endstruct
function Test takes nothing returns nothing
local unit u = CreateUnit(Player(0), 'hpea', 0., 0., 0.)
local Example e1 = Example.create(u)
local Example e2 = Example.create(u)
local Example e3 = Example.create(u)
local Example e
call BJDebugMsg(I2S(Example[u].size)) //Prints 3 because u owns e1, e2, and e3.
set e = Example[u][GetRandomInt(0, Example[u].size - 1)] //Random instance belonging to u.
set e = Example[u] //This is the fastest way to iterate the instances belonging
loop //to a specific unit, starting with the first instance.
exitwhen e == 0 //e will be assigned to 0 when no instances remain.
call BJDebugMsg(I2S(e)) //Prints the values of e1, e2, e3.
set e = e[e.index + 1] //"e.index" refers to the e's position in u's instance list.
endloop //Thus, index + 1 is next, and index - 1 is previous.
endfunction //This trick allows you to avoid a local counter.
*/
// AutoData restrictions:
// -You may not implement AutoData in any struct which has already
// declared static or non-static method operator [].
// -AutoData will conflict with anything named "me", "size", or
// "index" in the implementing struct.
// -AutoData may not be implemented in structs that extend array.
// -You may not declare your own destroy method. (This restriction
// can be dropped as soon as JassHelper supports module onDestroy).
//
// AutoData information:
// -You do not need to null the "me" member when destroying an
// instance. That is done for you automatically during destroy().
// (But if you use deallocate(), you must null "me" manually.)
// -StructName[u] and StructName[u][0] refer to the same instance,
// which is the first instance that was associated with unit u.
// -StructName[u][StructName[u].size - 1] refers to the instance that
// was most recently associated with unit u.
// -Instances keep their relative order in the list when one is removed.
//
//===========================================================================
// How to use AutoCreate:
//=======================
//
// The AutoCreate module allows you to automatically create instances
// of the implementing struct for units as they enter the game. AutoCreate
// automatically implements AutoData into your struct. Any time an instance
// is automatically created for a unit, that instance's "me" member will be
// assigned to the entering unit.
//
// AutoCreate restrictions:
// -All of the same restrictions as AutoData.
// -If your struct's allocate() method takes parameters (i.e. the parent
// type's create method takes parameters), you must declare a create
// method and pass those extra parameters to allocate yourself.
//
// AutoCreate information:
// -You may optionally declare the createFilter method, which specifies
// which units should recieve an instance as they enter the game. If
// you do not declare it, all entering units will recieve an instance.
// -You may optionally declare the onCreate method, which will run when
// AutoCreate automatically creates an instance. (This is just a stand-
// in until JassHelper supports the onCreate method.)
// -You may declare your own create method, but it must take a single
// unit parameter (the entering unit) if you do so.
/*
struct Example
private static method createFilter takes unit u returns boolean
return GetUnitTypeId(u) == 'hfoo' //Created only for Footmen.
endmethod
private method onCreate takes nothing returns nothing
call BJDebugMsg(GetUnitName(me)+" entered the game!")
endmethod
implement AutoCreate
endstruct
*/
//===========================================================================
// How to use AutoDestroy:
//=========================
//
// The AutoDestroy module allows you to automatically destroy instances
// of the implementing struct when their "me" unit leaves the game. AutoDestroy
// automatically implements AutoData into your struct. You must assign a unit
// to the "me" member of an instance for this module to have any effect.
//
// AutoDestroy restrictions:
// -All of the same restrictions as AutoData.
//
// AutoDestroy information:
// -If you also implement AutoCreate in the same struct, remember that it
// assigns the "me" unit automatically. That means you can have fully
// automatic creation and destruction.
/*
struct Example
static method create takes unit u returns Example
local Example this = allocate()
set me = u //You should assign a unit to "me",
return this //otherwise AutoDestroy does nothing.
endmethod //Not necessary if using AutoCreate.
private method onDestroy takes nothing returns nothing
call BJDebugMsg(GetUnitName(me)+" left the game!")
endmethod
implement AutoDestroy
endstruct
*/
//===========================================================================
// Configuration:
//================
///! external ObjectMerger w3a Adef lvdt anam "Leave Detect" aart "" arac 0
//Save your map with this Object Merger call enabled, then close and reopen your
//map. Disable it by removing the exclamation to remove the delay while saving.
globals
private constant integer LeaveDetectAbilityID = 'lvdt'
//This rawcode must match the parameter after "Adef" in the
//ObjectMerger macro above. You may change both if you want.
private constant boolean UseUnitUserData = true
//If this is set to true, UnitUserData will be used. You should only set
//this to false if something else in your map already uses UnitUserData.
//A hashtable will be used instead, but it is about 60% slower.
private constant boolean SafeMode = true
//This is set to true by default so that GetUnitId() will ALWAYS work.
//If if this is set to false, GetUnitId() may fail to work in a very
//rare circumstance: creating a unit that has a default-on autocast
//ability, and using GetUnitId() on that unit as it enters the game,
//within a trigger that detects any order. Set this to false for a
//performance boost only if you think you can avoid this issue.
private constant boolean AutoDataFastMode = true
//If this is set to true, AutoData will utilize one hashtable per time
//it is implemented. If this is set to false, all AutoDatas will share
//a single hashtable, but iterating through the instances belonging to
//a unit will become about 12.5% slower. Your map will break if you
//use more than 255 hashtables simultaneously. Only set this to false
//if you suspect you will run out of hashtable instances.
endglobals
private function UnitFilter takes unit u returns boolean
return true
endfunction
//Make this function return false for any unit-types you want to ignore.
//Ignored units won't be indexed or fire OnUnitIndexed/OnUnitDeindexed
//events. The unit parameter "u" to refers to the unit being filtered.
//Do not filter out xe dummy units; they are automatically filtered.
//===========================================================================
// AutoData / AutoCreate / AutoDestroy modules:
//==============================================
function interface AutoCreator takes unit u returns nothing
function interface AutoDestroyer takes unit u returns nothing
globals
hashtable AutoData = null //If AutoDataFastMode is disabled, this hashtable will be
endglobals //initialized and shared between all AutoData implementations.
module AutoData
private static hashtable ht
private static thistype array data
private static integer array listsize
private static key typeid //Good thing keys exist to identify each implementing struct.
private unit meunit
private integer id
readonly integer index //The user can avoid using a local counter because this is accessable.
static method operator [] takes unit u returns thistype
return data[GetUnitId(u)]
endmethod //This is as fast as retrieving an instance from a unit gets.
method operator [] takes integer index returns thistype
static if AutoDataFastMode then //If fast mode is enabled...
return LoadInteger(ht, id, index)
else //Each instance has its own hashtable to associate unit and index.
return LoadInteger(AutoData, id, index*8190+typeid)
endif //Otherwise, simulate a 3D array associating unit, struct-type ID, and index.
endmethod //Somehow, this version is 12.5% slower just because of the math.
private method setIndex takes integer index, thistype data returns nothing
static if AutoDataFastMode then //Too bad you can't have a module-private operator []=.
call SaveInteger(ht, id, index, data)
else
call SaveInteger(AutoData, id, index*8190+typeid, data)
endif
endmethod
private method remove takes nothing returns nothing
if meunit == null then //If the struct doesn't have an owner...
return //Nothing needs to be done.
endif
loop
exitwhen index == listsize[id] //The last value gets overwritten by 0.
call setIndex(index, this[index + 1]) //Shift each element down by one.
set this[index].index = index //Update the shifted instance's index.
set index = index + 1
endloop
set listsize[id] = listsize[id] - 1
set data[id] = this[0] //Ensure thistype[u] returns the same value as thistype[u][0].
set meunit = null
endmethod
private method add takes unit u returns nothing
if meunit != null then //If the struct has an owner...
call remove() //remove it first.
endif
set meunit = u
set id = GetUnitId(u) //Cache GetUnitId for slight performance boost.
if data[id] == 0 then //If this is the first instance for this unit...
set data[id] = this //Update the value that thistype[u] returns.
endif
set index = listsize[id] //Remember the index for removal.
call setIndex(index, this) //Add to the array.
set listsize[id] = index + 1
endmethod
method operator me takes nothing returns unit
return meunit
endmethod
method operator me= takes unit u returns nothing
if u != null then //If assigning "me" a non-null value...
call add(u) //Add this instance to that unit's array.
else //If assigning "me" a null value...
call remove() //Remove this instance from that unit's array.
endif
endmethod
method operator size takes nothing returns integer
return listsize[id]
endmethod
method destroy takes nothing returns nothing
call deallocate()
call remove() //This makes removal automatic when an instance is destroyed.
endmethod
private static method onInit takes nothing returns nothing
static if AutoDataFastMode then //If fast mode is enabled...
set ht = InitHashtable() //Initialize one hashtable per instance.
else //If fast mode is disabled...
if AutoData == null then //If the hashtable hasn't been initialized yet...
set AutoData = InitHashtable() //Initialize the shared hashtable.
endif
endif
endmethod
endmodule
module AutoCreate
implement AutoData //AutoData is necessary for AutoCreate.
private static method creator takes unit u returns nothing
local thistype this
local boolean b = true //Assume that the instance will be created.
static if thistype.createFilter.exists then //If createFilter exists...
set b = createFilter(u) //evaluate it and update b.
endif
if b then //If the instance should be created...
static if thistype.create.exists then //If the create method exists...
set this = create(u) //Create the instance, passing the entering unit.
else //If the create method doesn't exist...
set this = allocate() //Just allocate the instance.
endif
set me = u //Assign the instance's owner as the entering unit.
static if thistype.onCreate.exists then //If onCreate exists...
call onCreate() //Call it, because JassHelper should do this anyway.
endif
endif
endmethod
private static method onInit takes nothing returns nothing
call AutoIndex.addAutoCreate(thistype.creator)
endmethod //During module initialization, pass the creator function to AutoIndex.
endmodule
module AutoDestroy
implement AutoData //AutoData is necessary for AutoDestroy.
static method destroyer takes unit u returns nothing
loop
exitwhen thistype[u] == 0
call thistype[u].destroy()
endloop
endmethod //Destroy each instance owned by the unit until none are left.
private static method onInit takes nothing returns nothing
call AutoIndex.addAutoDestroy(thistype.destroyer)
endmethod //During module initialization, pass the destroyer function to AutoIndex.
endmodule
//===========================================================================
// AutoIndex struct:
//===================
function interface IndexFunc takes unit u returns nothing
hook RemoveUnit AutoIndex.hook_RemoveUnit
hook ReplaceUnitBJ AutoIndex.hook_ReplaceUnitBJ
debug hook SetUnitUserData AutoIndex.hook_SetUnitUserData
private keyword getIndex
private keyword getIndexDebug
private keyword isUnitIndexed
private keyword onUnitIndexed
private keyword onUnitDeindexed
struct AutoIndex
private static trigger enter = CreateTrigger()
private static trigger order = CreateTrigger()
private static trigger creepdeath = CreateTrigger()
private static group preplaced = CreateGroup()
private static timer allowdecay = CreateTimer()
private static hashtable ht
private static boolean array dead
private static boolean array summoned
private static boolean array animated
private static boolean array nodecay
private static boolean array removing
private static IndexFunc array indexfuncs
private static integer indexfuncs_n = -1
private static IndexFunc array deindexfuncs
private static integer deindexfuncs_n = -1
private static IndexFunc indexfunc
private static AutoCreator array creators
private static integer creators_n = -1
private static AutoDestroyer array destroyers
private static integer destroyers_n = -1
private static unit array allowdecayunit
private static integer allowdecay_n = -1
private static boolean duringinit = true
private static boolean array altered
private static unit array idunit
//===========================================================================
static method getIndex takes unit u returns integer
static if UseUnitUserData then
return GetUnitUserData(u)
else
return LoadInteger(ht, 0, GetHandleId(u))
endif
endmethod //Resolves to an inlinable one-liner after the static if.
static method getIndexDebug takes unit u returns integer
if u == null then
return 0
elseif GetUnitTypeId(u) == 0 then
call BJDebugMsg("AutoIndex error: Removed or decayed unit passed to GetUnitId.")
elseif idunit[getIndex(u)] != u and GetIssuedOrderId() != 852056 then
call BJDebugMsg("AutoIndex error: "+GetUnitName(u)+" is a filtered unit.")
endif
return getIndex(u)
endmethod //If debug mode is enabled, use the getIndex method that shows errors.
private static method setIndex takes unit u, integer index returns nothing
static if UseUnitUserData then
call SetUnitUserData(u, index)
else
call SaveInteger(ht, 0, GetHandleId(u), index)
endif
endmethod //Resolves to an inlinable one-liner after the static if.
static method isUnitIndexed takes unit u returns boolean
return u != null and idunit[getIndex(u)] == u
endmethod
static method isUnitAnimateDead takes unit u returns boolean
return animated[getIndex(u)]
endmethod //Don't use this; use IsUnitAnimateDead from AutoEvents instead.
//===========================================================================
private static method onUnitIndexed_sub takes nothing returns nothing
call indexfunc.evaluate(GetEnumUnit())
endmethod
static method onUnitIndexed takes IndexFunc func returns nothing
set indexfuncs_n = indexfuncs_n + 1
set indexfuncs[indexfuncs_n] = func
if duringinit then //During initialization, evaluate the indexfunc for every preplaced unit.
set indexfunc = func
call ForGroup(preplaced, function AutoIndex.onUnitIndexed_sub)
endif
endmethod
static method onUnitDeindexed takes IndexFunc func returns nothing
set deindexfuncs_n = deindexfuncs_n + 1
set deindexfuncs[deindexfuncs_n] = func
endmethod
static method addAutoCreate takes AutoCreator func returns nothing
set creators_n = creators_n + 1
set creators[creators_n] = func
endmethod
static method addAutoDestroy takes AutoDestroyer func returns nothing
set destroyers_n = destroyers_n + 1
set destroyers[destroyers_n] = func
endmethod
//===========================================================================
private static method hook_RemoveUnit takes unit whichUnit returns nothing
set removing[getIndex(whichUnit)] = true
endmethod //Intercepts whenever RemoveUnit is called and sets a flag.
private static method hook_ReplaceUnitBJ takes unit whichUnit, integer newUnitId, integer unitStateMethod returns nothing
set removing[getIndex(whichUnit)] = true
endmethod //Intercepts whenever ReplaceUnitBJ is called and sets a flag.
private static method hook_SetUnitUserData takes unit whichUnit, integer data returns nothing
static if UseUnitUserData then
if idunit[getIndex(whichUnit)] == whichUnit then
if getIndex(whichUnit) == data then
call BJDebugMsg("AutoIndex error: Code outside AutoIndex attempted to alter "+GetUnitName(whichUnit)+"'s index.")
else
call BJDebugMsg("AutoIndex error: Code outside AutoIndex altered "+GetUnitName(whichUnit)+"'s index.")
if idunit[data] != null then
call BJDebugMsg("AutoIndex error: "+GetUnitName(whichUnit)+" and "+GetUnitName(idunit[data])+" now have the same index.")
endif
set altered[data] = true
endif
endif
endif //In debug mode, intercepts whenever SetUnitUserData is used on an indexed unit.
endmethod //Displays an error message if outside code tries to alter a unit's index.
//===========================================================================
private static method allowDecay takes nothing returns nothing
local integer n = allowdecay_n
loop
exitwhen n < 0
set nodecay[getIndex(allowdecayunit[n])] = false
set allowdecayunit[n] = null
set n = n - 1
endloop
set allowdecay_n = -1
endmethod //Iterate through all the units in the stack and allow them to decay again.
private static method detectStatus takes nothing returns boolean
local unit u = GetTriggerUnit()
local integer index = getIndex(u)
local integer n
if idunit[index] == u then //Ignore non-indexed units.
if not IsUnitType(u, UNIT_TYPE_DEAD) then
if dead[index] then //The unit was dead, but now it's alive.
set dead[index] = false //The unit has been resurrected.
//! runtextmacro optional RunAutoEvent("Resurrect")
//If AutoEvents is in the map, run the resurrection events.
if IsUnitType(u, UNIT_TYPE_SUMMONED) and not summoned[index] then
set summoned[index] = true //If the unit gained the summoned flag,
set animated[index] = true //it's been raised with Animate Dead.
//! runtextmacro optional RunAutoEvent("AnimateDead")
//If AutoEvents is in the map, run the Animate Dead events.
endif
endif
else
if not removing[index] and not dead[index] and not animated[index] then
set dead[index] = true //The unit was alive, but now it's dead.
set nodecay[index] = true //A dead unit can't decay for at least 0. seconds.
set allowdecay_n = allowdecay_n + 1 //Add the unit to a stack. After the timer
set allowdecayunit[allowdecay_n] = u //expires, allow the unit to decay again.
call TimerStart(allowdecay, 0., false, function AutoIndex.allowDecay)
//! runtextmacro optional RunAutoEvent("Death")
//If AutoEvents is in the map, run the Death events.
elseif removing[index] or (dead[index] and not nodecay[index]) or (not dead[index] and animated[index]) then
//If .nodecay was false and the unit is dead and was previously dead, the unit decayed.
//If .animated was true and the unit is dead, the unit died and exploded.
//If .removing was true, the unit is being removed or replaced.
set n = deindexfuncs_n
loop //Run the OnUnitDeindexed events.
exitwhen n < 0
call deindexfuncs[n].evaluate(u)
set n = n - 1
endloop
set n = destroyers_n
loop //Destroy AutoDestroy structs for the leaving unit.
exitwhen n < 0
call destroyers[n].evaluate(u)
set n = n - 1
endloop
call AutoIndex(index).destroy() //Free the index by destroying the AutoIndex struct.
set idunit[index] = null //Null this unit reference to prevent a leak.
endif
endif
endif
set u = null
return false
endmethod
//===========================================================================
private static method unitEntersMap takes unit u returns nothing
local integer index
local integer n = 0
if getIndex(u) != 0 then
return //Don't index a unit that already has an ID.
endif
static if LIBRARY_xebasic then
if GetUnitTypeId(u) == XE_DUMMY_UNITID then
return //Don't index xe dummy units.
endif
endif
if not UnitFilter(u) then
return //Don't index units that fail the unit filter.
endif
set index = create()
call setIndex(u, index) //Assign an index to the entering unit.
call UnitAddAbility(u, LeaveDetectAbilityID) //Add the leave detect ability to the entering unit.
call UnitMakeAbilityPermanent(u, true, LeaveDetectAbilityID) //Prevent it from disappearing on morph.
set dead[index] = IsUnitType(u, UNIT_TYPE_DEAD) //Reset all of the flags for the entering unit.
set summoned[index] = IsUnitType(u, UNIT_TYPE_SUMMONED) //Each of these flags are necessary to detect
set animated[index] = false //when a unit leaves the map.
set nodecay[index] = false
set removing[index] = false
debug set altered[index] = false //In debug mode, this flag tracks wheter a unit's index was altered.
set idunit[index] = u //Attach the unit that is supposed to have this index to the index.
if duringinit then //If a unit enters the map during initialization...
call GroupAddUnit(preplaced, u) //Add the unit to the preplaced units group. This ensures that
endif //all units are noticed by OnUnitIndexed during initialization.
loop //Create AutoCreate structs for the entering unit.
exitwhen n > creators_n
call creators[n].evaluate(u)
set n = n + 1
endloop
set n = 0
loop //Run the OnUnitIndexed events.
exitwhen n > indexfuncs_n
call indexfuncs[n].evaluate(u)
set n = n + 1
endloop
endmethod
private static method onIssuedOrder takes nothing returns boolean
static if SafeMode then //If SafeMode is enabled, perform this extra check.
if getIndex(GetTriggerUnit()) == 0 then //If the unit doesn't already have
call unitEntersMap(GetTriggerUnit()) //an index, then assign it one.
endif
endif
return GetIssuedOrderId() == 852056 //If the order is Undefend, allow detectStatus to run.
endmethod
private static method initEnteringUnit takes nothing returns boolean
call unitEntersMap(GetFilterUnit())
return false
endmethod
//===========================================================================
private static method afterInit takes nothing returns nothing
set duringinit = false //Initialization is over; set a flag.
call DestroyTimer(GetExpiredTimer()) //Destroy the timer.
call GroupClear(preplaced) //The preplaced units group is
call DestroyGroup(preplaced) //no longer needed, so clean it.
set preplaced = null
endmethod
private static method onInit takes nothing returns nothing
local region maparea = CreateRegion()
local rect bounds = GetWorldBounds()
local group g = CreateGroup()
local integer i = 15
static if not UseUnitUserData then
set ht = InitHashtable() //Only create a hashtable if it will be used.
endif
loop
exitwhen i < 0
call SetPlayerAbilityAvailable(Player(i), LeaveDetectAbilityID, false)
//Make the LeaveDetect ability unavailable so that it doesn't show up on the command card of every unit.
call TriggerRegisterPlayerUnitEvent(order, Player(i), EVENT_PLAYER_UNIT_ISSUED_ORDER, null)
//Register the "EVENT_PLAYER_UNIT_ISSUED_ORDER" event for each player.
call GroupEnumUnitsOfPlayer(g, Player(i), function AutoIndex.initEnteringUnit)
//Enum every non-filtered unit on the map during initialization and assign it a unique
//index. By using GroupEnumUnitsOfPlayer, even units with Locust can be detected.
set i = i - 1
endloop
call TriggerAddCondition(order, And(function AutoIndex.onIssuedOrder, function AutoIndex.detectStatus))
//The detectStatus method will fire every time a non-filtered unit recieves an undefend order.
//And() is used here to avoid using a trigger action, which starts a new thread and is slower.
call TriggerRegisterPlayerUnitEvent(creepdeath, Player(12), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddCondition(creepdeath, function AutoIndex.detectStatus)
//The detectStatus method must also fire when a neutral hostile creep dies, in case it was
//sleeping. Sleeping creeps don't fire undefend orders on non-damaging deaths.
call RegionAddRect(maparea, bounds) //GetWorldBounds() includes the shaded boundry areas.
call TriggerRegisterEnterRegion(enter, maparea, function AutoIndex.initEnteringUnit)
//The filter function of an EnterRegion trigger runs instantly when a unit is created.
call TimerStart(CreateTimer(), 0., false, function AutoIndex.afterInit)
//After any time elapses, perform after-initialization actions.
call GroupClear(g)
call DestroyGroup(g)
call RemoveRect(bounds)
set g = null
set bounds = null
endmethod
endstruct
//===========================================================================
// User functions:
//=================
function GetUnitId takes unit u returns integer
static if DEBUG_MODE then //If debug mode is enabled...
return AutoIndex.getIndexDebug(u) //call the debug version of GetUnitId.
else //If debug mode is disabled...
return AutoIndex.getIndex(u) //call the normal, inlinable version.
endif
endfunction
function IsUnitIndexed takes unit u returns boolean
return AutoIndex.isUnitIndexed(u)
endfunction
function OnUnitIndexed takes IndexFunc func returns nothing
call AutoIndex.onUnitIndexed(func)
endfunction
function OnUnitDeindexed takes IndexFunc func returns nothing
call AutoIndex.onUnitDeindexed(func)
endfunction
endlibrary
//TESH.scrollpos=45
//TESH.alwaysfold=0
library UnitMaxState initializer Initialize requires optional AbilityPreload, optional xepreload
//==============================================================================
// UnitMaxState v2.1
//==============================================================================
// Credits:
//------------------------------------------------------------------------------
// Written By:
// Earth-Fury
//
// Original System By:
// Blade.dk
//
// Intermittent Version By:
// Deaod
//
// With Thanks To:
// - weaaddar for BonusMod and thus inspiration
// - PitzerMike for the ObjectMerger
// - Vexorian for vJass and Jass Helper
// - PipeDream for Grimoire
// - SFilip for TESH
// - MindWorX for maintaining NewGen
//------------------------------------------------------------------------------
// If you use this library in your map, please at least give credit to Blade.dk.
// Without him, this library would not exist.
//==============================================================================
// Introduction:
//------------------------------------------------------------------------------
// UnitMaxState is a library which allows you to modify a unit's maximum life,
// or maximum mana. To achieve this, the library abuses a bug with the AIlf and
// AImz abilities, which is too complex to explain here.
//
// I do believe it was indeed Blade.dk who initially found this bug. If not,
// it's still his system I stole and rewrote. Further, let me thank Deaod for
// writing up his version of this system, which inspired both the reality of
// this rewrite, and the method abilities are handled within it.
//
//==============================================================================
// Requirements:
//------------------------------------------------------------------------------
// UnitMaxState is written in vJass and requires the NewGen editor, or
// Jass Helper with PitzerMike's Object Merger configured for it.
//
// UnitMaxState requires the latest version of Jass Helper.
//
// Preloading of abilities requires either AbilityPreload or xepreload. Neither
// are required for the library to function; however, having one or the other
// will remove the slight delay the first time a unit's max state is changed.
//
//==============================================================================
// Using UnitMaxState:
//------------------------------------------------------------------------------
// UnitMaxState comes with two useful functions:
//
// nothing SetUnitMaxState(unit <target>, unitstate <state>, real <value>)
// Changes <target>'s unitstate <state> to be equal to <value>.
//
// nothing AddUnitMaxState(unit <target>, unitstate <state>, real <value>)
// Adds <value> to <target>'s <state> unitstate. Note that you can use
// negative values with this function.
//
// Both of these functions accept unitstate's other than UNIT_STATE_MAX_LIFE and
// UNIT_STATE_MAX_MANA. There is a small performance penalty in using these over
// direct usage of SetUnitState.
//
// You must not use life/mana boosting upgrades in combination with this system.
//
// Attempting to set a unit's maximum life below 1, or mana below 0 will do
// nothing. A debug message will be output if the script is compiled in
// debug mode.
//==============================================================================
//==============================================================================
// Configuration:
//------------------------------------------------------------------------------
// The below textmacro call is an all-in-one configuration line.
//------------------------------------------------------------------------------
// The first parameter is a boolean.
//
// If true, the abilities used by this system will be created on save. This adds
// a slight delay to saving your map. You only ever have to create the abilities
// the first time this library is added to your map, or if you modify any of
// the other configuration options.
//
// Note that to make the ability creation permanent, you must save with ability
// creation enabled, close your map, and reopen it in the editor. You can then
// disable ability creation, as the abilities will be permanently in your map.
//------------------------------------------------------------------------------
// The second parameter is an integer.
//
// This is the number of abilities this system will use for adding/removing
// life/mana. Note that this system uses four sets of abilities, so the actual
// number of abilities generated and used will be the value you pass here,
// multiplied by 4.
//
// The higher this number, the faster large bonuses will be added. This number
// should never have to go above 13. Between 3 and 5 will work fine for most
// maps.
//------------------------------------------------------------------------------
// The fourth and fifth parameters are 3 character prefixes for rawcodes.
//
// The first one is for the life-modifying abilities, while the second is for
// the mana-modifying abilities.
//
// Please, make sure your map has no abilities whose rawcodes begin with either
// of these prefixes before saving! Otherwise, those abilities will be
// overwritten. You can change these to any 3 character combination, if your
// map does already contain abilities whose rawcodes begin with these prefixes.
//------------------------------------------------------------------------------
//*
//! runtextmacro UnitMaxState_Configuration("false", "3", "ZxL", "ZxM")
//------------------------------------------------------------------------------
// End of configuration
//------------------------------------------------------------------------------
//! textmacro UnitMaxState_Configuration takes LOAD_ABILITIES, ABILITY_COUNT, LIFE_PREFIX, MANA_PREFIX
//! externalblock extension=lua ObjectMerger $FILENAME$
//! i function CreateAbilities(baseAbility, rawcodePrefix, field, name, icon)
//! i k = 0
//! i for sign = -1, 1, 2 do
//! i signStr = "+"
//! i if sign < 0 then
//! i signStr = "-"
//! i end
//! i j = 0
//! i for i = 0, (abilityCount - 1) * 3, 3 do
//! i j = j + 1
//! i createobject(baseAbility, rawcodePrefix .. string.sub(Chars, k + 1, k + 1))
//! i makechange(current, "anam", "UnitMaxState - " .. name)
//! i makechange(current, "ansf", "(" .. signStr .. tostring(j) .. ")")
//! i makechange(current, "aart", "ReplaceableTextures\\CommandButtons\\" .. icon)
//! i makechange(current, "aite", 0)
//! i makechange(current, "alev", 4)
//! i makechange(current, field, 1, 0)
//! i makechange(current, field, 2, 2^(i + 0) * sign)
//! i makechange(current, field, 3, 2^(i + 1) * sign)
//! i makechange(current, field, 4, 2^(i + 2) * sign)
//! i k = k + 1
//! i end
//! i end
//! i end
//! i if $LOAD_ABILITIES$ then
//! i setobjecttype("abilities")
//! i abilityCount = $ABILITY_COUNT$
//! i Chars = "abcdefghijklmnopqrstuvwxyz"
//! i CreateAbilities("AIlf", "$LIFE_PREFIX$", "Ilif", "Life", "BTNHealthStone.blp")
//! i CreateAbilities("AImz", "$MANA_PREFIX$", "Iman", "Mana", "BTNManaStone.blp")
//! i end
//! endexternalblock
// */
globals
private constant integer RAWCODE_LIFE = '$LIFE_PREFIX$a'
private constant integer RAWCODE_MANA = '$MANA_PREFIX$a'
public constant integer ABILITY_COUNT = $ABILITY_COUNT$
endglobals
//! endtextmacro
globals
private constant boolean PRELOAD_ABILITIES = true
private integer array POWERS_OF_2
endglobals
private function ErrorMsg takes string s returns nothing
debug call BJDebugMsg("SetUnitMaxState: " + s)
endfunction
function SetUnitMaxState takes unit target, unitstate state, real targetValue returns nothing
local integer difference
local integer rawcode
local integer abilityId
local integer abilityLevel
local integer currentAbility
if state == UNIT_STATE_MAX_LIFE then
set rawcode = RAWCODE_LIFE
if targetValue < 1 then
call ErrorMsg("You can not set a unit's max life to below 1")
return
endif
elseif state == UNIT_STATE_MAX_MANA then
set rawcode = RAWCODE_MANA
if targetValue < 0 then
call ErrorMsg("You can not set a unit's max mana to below 0")
return
endif
else
call SetUnitState(target, state, targetValue)
return
endif
set difference = R2I(targetValue) - R2I(GetUnitState(target, state))
if difference < 0 then
set difference = -difference
set rawcode = rawcode + ABILITY_COUNT
endif
set abilityId = ABILITY_COUNT - 1
set abilityLevel = 4
set currentAbility = rawcode + abilityId
loop
exitwhen difference == 0
if difference >= POWERS_OF_2[abilityId * 3 + (abilityLevel - 2)] then
call UnitAddAbility(target, currentAbility)
call SetUnitAbilityLevel(target, currentAbility, abilityLevel)
call UnitRemoveAbility(target, currentAbility)
set difference = difference - POWERS_OF_2[abilityId * 3 + (abilityLevel - 2)]
else
set abilityLevel = abilityLevel - 1
if abilityLevel <= 1 then
set abilityId = abilityId - 1
set abilityLevel = 4
set currentAbility = rawcode + abilityId
endif
endif
endloop
endfunction
function AddUnitMaxState takes unit target, unitstate state, real additionalValue returns nothing
call SetUnitMaxState(target, state, GetUnitState(target, state) + additionalValue)
endfunction
//! textmacro UnitMaxState_Preload takes RAWCODE
set i = 0
loop
exitwhen i == ABILITY_COUNT * 2 - 1
static if LIBRARY_AbilityPreload then
call AbilityPreload($RAWCODE$ + i)
elseif LIBRARY_xepreload then
call XE_PreloadAbility($RAWCODE$ + i)
endif
set i = i + 1
endloop
//! endtextmacro
private function Initialize takes nothing returns nothing
local integer i
local integer k
set i = 1
set POWERS_OF_2[0] = 1
loop
exitwhen i == ABILITY_COUNT * 2 * 2 * 3 + 1
set POWERS_OF_2[i] = POWERS_OF_2[i - 1] * 2
set i = i + 1
endloop
static if DEBUG_MODE and PRELOAD_ABILITIES and not LIBRARY_AbilityPreload and not LIBRARY_xepreload then
call ErrorMsg("Ability preloading was enabled, but neither of the supported preload libraries are present")
elseif PRELOAD_ABILITIES then
//! runtextmacro UnitMaxState_Preload("RAWCODE_LIFE")
//! runtextmacro UnitMaxState_Preload("RAWCODE_MANA")
endif
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library UnitMaxStateBonuses initializer OnInit requires BonusMod, UnitMaxState, AutoIndex
////////////////////////////////////////////////////////////////////////////////
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@ UnitMaxStateBonuses for BonusMod
//@=============================================================================
//@ Credits:
//@-----------------------------------------------------------------------------
//@ Written by:
//@ Earth-Fury
//@=============================================================================
//@ Requirements:
//@-----------------------------------------------------------------------------
//@ This library requires the BonusMod library, the UnitMaxState library by
//@ Earth-Fury, and the AutoIndex library by grim001.
//@
//@=============================================================================
//@ Readme:
//@-----------------------------------------------------------------------------
//@ This library provides two new bonus types:
//@
//@ - BONUS_LIFE
//@ - BONUS_MANA
//@
//@ These bonuses, of course, raise a unit's maximum life and mana.
//@
//@ Note that if you simply wish to permanently increase or decrease the maximum
//@ life or mana of a unit, you are likely best off using UnitMaxState directly.
//@
//@ The minimum life and mana bonuses are 1 more than -(unit's max state).
//@ That is to say, these bonuses can not fully remove a unit's life or mana.
//@
//@ There is no maximum bonus.
//@
//@ There is nothing to configure.
//@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
////////////////////////////////////////////////////////////////////////////////
globals
Bonus BONUS_LIFE
Bonus BONUS_MANA
endglobals
private function ErrorMsg takes string func, string s returns nothing
call BJDebugMsg("|cffFF0000UnitMaxStateBonus Error|r|cffFFFF00:|r |cff8080FF" + func + "|r|cffFFFF00:|r " + s)
endfunction
private struct BonusValues
public integer mana = 0
public integer life = 0
public unit owner
private static thistype array owners
private static method create takes unit u returns thistype
local thistype this = thistype.allocate()
set this.owner = u
set thistype.owners[GetUnitId(u)] = this
return this
endmethod
private method onDestroy takes nothing returns nothing
set thistype.owners[GetUnitId(this.owner)] = thistype(0)
set this.owner = null
endmethod
public static method getInstance takes unit u returns thistype
if thistype.owners[GetUnitId(u)] == 0 then
return thistype.create(u)
else
return thistype.owners[GetUnitId(u)]
endif
endmethod
public static method operator[] takes unit u returns thistype
return thistype.owners[GetUnitId(u)]
endmethod
public static method operator[]= takes unit u, thistype i returns nothing
set thistype.owners[GetUnitId(u)] = i
endmethod
endstruct
//! textmacro UnitMaxStateBonus_DefineBonus takes NAME, STATE, MIN
private struct MaxStateBonus_$NAME$ extends Bonus
integer minBonus = -2147483648
integer maxBonus = 2147483647
method setBonus takes unit u, integer amount returns integer
local BonusValues values
local integer actual
local integer new
local real factor
/*
if AutoIndex.getIndex(u) == 0 then
debug call ErrorMsg("MaxStateBonus_$NAME$.setBonus()", "Unit that is not indexed by AutoIndex given")
return 0
endif
*/
set values = BonusValues.getInstance(u)
set actual = R2I(GetUnitState(u, UNIT_STATE_MAX_$STATE$)) - values.$NAME$
set new = actual + amount
set factor = GetUnitState(u, UNIT_STATE_$STATE$) / GetUnitState(u, UNIT_STATE_MAX_$STATE$)
if new < $MIN$ then
if actual < $MIN$ then
set values.$NAME$ = 0
else
set values.$NAME$ = -actual + $MIN$
endif
call SetUnitState(u, UNIT_STATE_$STATE$, $MIN$)
call SetUnitMaxState(u, UNIT_STATE_MAX_$STATE$, $MIN$)
return values.$NAME$
else
set values.$NAME$ = amount
call SetUnitMaxState(u, UNIT_STATE_MAX_$STATE$, new)
call SetUnitState(u, UNIT_STATE_$STATE$, new * factor)
return values.$NAME$
endif
endmethod
method getBonus takes unit u returns integer
local BonusValues values
local integer actual
local integer new
local real factor
/*
if AutoIndex.getIndex(u) == 0 then
debug call ErrorMsg("MaxStateBonus_$NAME$.getBonus()", "Unit that is not indexed by AutoIndex given")
return 0
endif
*/
set values = BonusValues[u]
if values == 0 then
return 0
endif
set values.$NAME$ = R2I(GetUnitState(u, UNIT_STATE_MAX_$STATE$)) - (R2I(GetUnitState(u, UNIT_STATE_MAX_$STATE$)) - values.$NAME$)
return values.$NAME$
endmethod
method removeBonus takes unit u returns nothing
call this.setBonus(u, 0)
endmethod
method isValidBonus takes unit u, integer value returns boolean
local integer currentBonus
/*
if AutoIndex.getIndex(u) == 0 then
return false
endif
*/
set currentBonus = this.getBonus(u)
return R2I(GetUnitState(u, UNIT_STATE_MAX_$STATE$)) - currentBonus + value >= $MIN$
endmethod
endstruct
//! endtextmacro
//! runtextmacro UnitMaxStateBonus_DefineBonus("life", "LIFE", "1")
//! runtextmacro UnitMaxStateBonus_DefineBonus("mana", "MANA", "1")
private function OnLeaveMap takes unit u returns nothing
if BonusValues[u] != 0 then
call BonusValues[u].destroy()
endif
endfunction
private function OnInit takes nothing returns nothing
call OnUnitDeindexed(OnLeaveMap)
set BONUS_LIFE = MaxStateBonus_life.create()
set BONUS_MANA = MaxStateBonus_mana.create()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library BonusMod initializer OnInit requires optional AbilityPreload, optional xepreload
private keyword AbilityBonus
////////////////////////////////////////////////////////////////////////////////
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@ BonusMod - v3.3.1
//@=============================================================================
//@ Credits:
//@-----------------------------------------------------------------------------
//@ Written by:
//@ Earth-Fury
//@ Based on the work of:
//@ weaaddar
//@-----------------------------------------------------------------------------
//@ If you use this system, please at least credit weaaddar. Without him, this
//@ system would not exist. I would be happy if you credited me as well.
//@=============================================================================
//@ Requirements:
//@-----------------------------------------------------------------------------
//@ This library is written in vJass and thus requires JASS Helper in order to
//@ function correctly. This library also uses the ObjectMerger created by
//@ PitzerMike. The ObjectMerger must be configured as an external tool for
//@ JASS Helper.
//@
//@ All of these things are present in the NewGen world editor.
//@
//@=============================================================================
//@ Introduction:
//@-----------------------------------------------------------------------------
//@ BonusMod is a system for applying reversible bonuses to certain stats, such
//@ as attack speed or mana regen, for specific units. Most of the bonuses
//@ provided by BonusMod show green or red numbers in the command card, exactly
//@ like the bonuses provided by items.
//@
//@ BonusMod has two kinds of bonuses:
//@ 1. Ability based bonuses
//@ 2. Code based bonuses
//@
//@ All of the bonuses in the configuration section for the basic BonusMod
//@ library are ability-based bonuses. Code-based bonuses are provided by
//@ additional libraries.
//@
//@ Ability based bonuses have a limit to how much of a bonus they can apply.
//@ The actual limit depends on the number of abilities that type of bonus uses.
//@ See the "Default bonuses" section of this readme for the default limits
//@ of the bonuses that come with BonusMod. For changing the limits of the
//@ default bonuses, or for adding new types of bonuses, see the below
//@ configuration section.
//@
//@ Code based bonuses may or may not have a limit to how much of a bonus they
//@ can apply. The limits for code based bonuses depend entirely on how the
//@ bonus is implemented. See their documentation for more information.
//@
//@=============================================================================
//@ Adding BonusMod to your map:
//@-----------------------------------------------------------------------------
//@ First, you must place the BonusMod library in a custom-text trigger in your
//@ map.
//@
//@ You must then save your map with ability generation enabled. After you save
//@ your map with ability generation enabled, you must close your map in the
//@ editor, and reopen it. You can then disable ability generation.
//@ See the configuration section for information on how to enable and disable
//@ ability generation.
//@
//@=============================================================================
//@ Default bonuses:
//@-----------------------------------------------------------------------------
//@
//@ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//@ | Bonus Type constants: | Minimum bonus: | Maximum bonus: |
//@ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//@ | BONUS_SIGHT_RANGE | -2048 | +2047 |
//@ | BONUS_ATTACK_SPEED | -512 | +511 |
//@ | BONUS_ARMOR | -1024 | +1023 |
//@ | BONUS_MANA_REGEN_PERCENT | -512% | +511% |
//@ | BONUS_LIFE_REGEN | -256 | +255 |
//@ | BONUS_DAMAGE | -1024 | +1023 |
//@ | BONUS_STRENGTH | -256 | +255 |
//@ | BONUS_AGILITY | -256 | +255 |
//@ | BONUS_INTELLIGENCE | -256 | +255 |
//@ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//@
//@ Notes:
//@ - The bonuses for stength, agility, and intelligence can only be
//@ applied to heroes. Attempting to add them to normal units will
//@ fail to work completely.
//@ - Using a negative BONUS_STRENGTH bonus can give a unit negative
//@ maximum life. Don't do that. It really messes stuff up.
//@ - Using a negative BONUS_INTELLIGENCE bonus can remove a hero's
//@ mana. This is not a big issue, as mana will return when the
//@ bonus is removed.
//@ - The maximum effective sight range for a unit is 1800.
//@ - There is a maximum attack speed. I have no idea what it is.
//@
//@ See the configuration section for information on how to change the range of
//@ bonuses, as well as how to add new ability-based bonuses, and remove unused
//@ ones.
//@
//@=============================================================================
//@ Public API / Function list:
//@-----------------------------------------------------------------------------
//@ Note that BonusMod will only output error messages if JASS Helper is set to
//@ compile in debug mode.
//@
//@ Bonus constants such as BONUS_DAMAGE have .min and .max properties which
//@ are the minimum and maximum bonus that type of bonus can apply. Note that
//@ for code based bonuses, these constants may not reflect the minimum or
//@ maximum bonus for a specific unit. Use the IsBonusValid() function to check
//@ if the given bonus value is okay for a given unit.
//@
//@ function SetUnitBonus
//@ takes unit u, Bonus bonusType, integer amount
//@ returns integer
//@
//@ This function sets the bonus of the type bonusType for the given unit to
//@ the given amount. The returned integer is the unit's actual current
//@ bonus, after it has been changed. If the given amount is above the
//@ maximum possible bonus for this type, then the maximum possible bonus
//@ is applied to the unit. The same is true if the given value is below
//@ the minimum possible bonus.
//@
//@ function GetUnitBonus
//@ takes unit u, Bonus bonusType
//@ returns integer
//@
//@ Returns the given unit's current bonus of bonusType. A value of 0 means
//@ that the given unit does not have a bonus of the given type.
//@
//@ function AddUnitBonus
//@ takes unit u, Bonus bonusType, integer amount
//@ returns integer
//@
//@ Increases the unit's bonus by the given amount. You can use a negitive
//@ amount to subtract from the unit's current bonus. Note that the same
//@ rules SetUnitBonus has apply for going over/under the maximum bonus.
//@ The returned value is the unit's actual new bonus.
//@
//@ function RemoveUnitBonus
//@ takes unit u, Bonus bonusType
//@ returns nothing
//@
//@ Sets the bonus of the type bonusType to 0 for the given unit. This
//@ function is faster then using SetUnitBonus(u, bonusType, 0).
//@
//@ function IsBonusValid
//@ takes unit u, Bonus abstractBonus, integer value
//@ returns boolean
//@
//@ Returns true if the given value is a valid bonus value for the given
//@ unit. This will also return false if the given bonus type is a hero-
//@ only bonus type, and the given unit is not a hero.
//@
//@=============================================================================
//@ Writing code-based bonuses:
//@-----------------------------------------------------------------------------
//@ This section of the readme tells you how to create your own bonus types
//@ that apply their bonuses using vJass code instead of abilities. You do not
//@ need to read or understand this to use BonusMod as-is.
//@
//@ Creating a new bonus type is simple. Extend the Bonus struct, implement the
//@ methods provided within it, and create a single instance of your struct
//@ within a variable named BONUS_YOUR_BONUS_TYPES_NAME of the type Bonus.
//@
//@ The methods you must implement are:
//@
//@ method setBonus takes unit u, integer amount returns integer
//@ This method sets the given unit's current bonus to amount, returning
//@ the actual bonus that was applied. If the given amount is higher then
//@ the maximum amount your bonus type can apply to a unit, you must apply
//@ the maximum possible bonus, and return that amount. The same holds true
//@ for the minimum bonus.
//@
//@ method getBonus takes unit u returns integer
//@ This method returns the current bonus the given unit has.
//@
//@ method removeBonus takes unit u returns nothing
//@ This method sets the current bonus of the given unit to 0.
//@
//@ method isValueInRange takes integer value returns boolean
//@ This method returns true if the given integer is a valid bonus amount
//@ for this bonus type, and false otherwise.
//@
//@ Note that it is your responsibility to do any clean up in the event a unit
//@ dies or is removed with an active bonus on it. There is no guarantee that
//@ removeBonus() will be called before a unit dies or is removed.
//@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
////////////////////////////////////////////////////////////////////////////////
//==============================================================================
// Configuration:
//==============================================================================
//------------------------------------------------------------------------------
// If the following constant is set to true, the abilities used by this library
// will be preloaded at map initialization. This will slightly increase loading
// time, but will prevent a slight to medium lag spike the first time a bonus
// of a type is applied.
//
// Note that your map must contain either the xepreload library, or the
// AbilityPreload library for preloading to work.
//
// It is highly recommended that you do not set this to false.
//------------------------------------------------------------------------------
globals
private constant boolean PRELOAD_ABILITIES = true
endglobals
//------------------------------------------------------------------------------
// The BonusMod_BeginBonuses macro takes a single boolean type parameter.
// If set to true, bonus abilities will be created (or recreated) on save.
// If set to false, abilities will not be generated.
//
// If you modify any of the bonus declaration macros, or add new ones, you must
// regenerate abilities.
//
// Note that if you remove a bonus, the abilities it had created will not be
// automatically removed. This is also true of reducing the number of abilities
// a bonus uses.
//
// After you generate abilities, you must close your map and reopen it in the
// editor. You can then disable ability generation until the next time you
// modify the bonus types.
//------------------------------------------------------------------------------
//! runtextmacro BonusMod_BeginBonuses("false")
//--------------------------------------------------------------------------
// Below are where bonus types are defined.
//
// The first parameter is the name of the bonus type. A constant will be
// generated for each bonus type, that will take the form: BONUS_NAME
//
// The second parameter is the maximum power of 2 the bonus type can add
// to a unit. For example, 8 abilities gives a range of -256 to +255.
//
// The third parameter is the base ability. The base ability must give the
// desired effect when the given field is changed.
//
// The fourth parameter is the rawcode prefix of the bonuses generated
// abilities. The prefix must be 3 characters long. Your map must not
// already contain bonuses which start with the given prefix.
//
// The fifth parameter is the object field to modify for each generated
// ability.
//
// The sixth parameter must be true of the bonus should only work on hero
// units, and false otherwise.
//
// The final parameter is the icon that will be displayed in the object
// editor. This has no effect on anything ingame.
//--------------------------------------------------------------------------
// | NAME |ABILITY|SOURCE |PREFIX|FIELD | HERO | ICON
// | | COUNT |ABILITY| | | ONLY |
//! runtextmacro BonusMod_DeclareBonus("ARMOR", "24", "AId1", "(A)", "Idef", "false", "BTNHumanArmorUpOne.blp")
//! runtextmacro BonusMod_DeclareBonus("DAMAGE", "24", "AItg", "(B)", "Iatt", "false", "BTNSteelMelee.blp")
//! runtextmacro BonusMod_DeclareBonus("SIGHT_RANGE", "10", "AIsi", "(C)", "Isib", "false", "BTNTelescope.blp")
//! runtextmacro BonusMod_DeclareBonus("LIFE_REGEN", "20", "Arel", "(E)", "Ihpr", "false", "BTNRingSkull.blp")
//! runtextmacro BonusMod_DeclareBonus("STRENGTH", "20", "AIa1", "(F)", "Istr", "true" , "BTNGoldRing.blp")
//! runtextmacro BonusMod_DeclareBonus("AGILITY", "20", "AIa1", "(G)", "Iagi", "true" , "BTNGoldRing.blp")
//! runtextmacro BonusMod_DeclareBonus("INTELLIGENCE", "20", "AIa1", "(H)", "Iint", "true" , "BTNGoldRing.blp")
// | NAME |ABILITY|SOURCE |PREFIX|FIELD |HERO | ICON
// | | COUNT |ABILITY| | | ONLY |
//! runtextmacro BonusMod_DeclareBonus("MANA_REGEN", "20", "ZxI1", "(I)", "Arm1", "false", "BTNHeal.blp")
//! runtextmacro BonusMod_DeclarePercentBonus("ATTACK_SPEED", "20", "AIsx", "(J)", "Isx1", "false", "BTNGlove.blp")
//! runtextmacro BonusMod_DeclarePercentBonus("MANA_REGEN_PERCENT", "20", "AIrm", "(D)", "Imrp", "false", "BTNSobiMask.blp")
//! runtextmacro BonusMod_EndBonuses()
//==============================================================================
// End of configuration
//==============================================================================
//! textmacro BonusMod_BeginBonuses takes SHOULD_GENERATE_ABILITIES
private function Setup takes nothing returns nothing
// The following is a lua script for the ObjectMerger, used to generate abilities
//*
//! externalblock extension=lua ObjectMerger $FILENAME$
//! i if "$SHOULD_GENERATE_ABILITIES$" == "true" then
//! i function FormatName(name)
//! i name = string.lower(name)
//! i name = string.gsub(name, "_", " ")
//! i s = name
//! i name = ""
//! i for w in string.gmatch(s, "%a%w*") do
//! i name = name .. string.upper(string.sub(w, 1, 1)) .. string.sub(w, 2, -1)
//! i name = name .. " "
//! i end
//! i name = string.sub(name, 1, string.len(name) - 1)
//! i return name
//! i end
//! i function SetupAbility(name, suffix, icon, hero)
//! i makechange(current, "anam", "BonusMod - " .. FormatName(name))
//! i makechange(current, "ansf", "(" .. suffix .. ")")
//! i makechange(current, "aart", "ReplaceableTextures\\CommandButtons\\" .. icon)
//! i makechange(current, "aite", 0)
//! i if hero then
//! i makechange(current, "Iagi", 1, 0)
//! i makechange(current, "Iint", 1, 0)
//! i makechange(current, "Istr", 1, 0)
//! i end
//! i end
//! i function CreateAbility(sourceAbility, prefix, field, abilityCount, name, icon)
//! i powOf2 = abilityCount - 1
//! i lengthOfMax = string.len(tostring(2^abilityCount))
//! i for i = 0, powOf2 do
//! i padding = ""
//! i for k = 0, lengthOfMax - string.len(tostring(2^i)) - 1 do
//! i padding = padding .. "0"
//! i end
//! i createobject(sourceAbility, prefix .. string.sub(chars, i + 1, i + 1))
//! i SetupAbility(name, "+" .. padding .. tostring(2 ^ i), icon, true)
//! i makechange(current, field, 1, tostring(2^i))
//! i end
//! i createobject(sourceAbility, prefix .. "-")
//! i SetupAbility(name, "-" .. tostring(2 ^ abilityCount), icon, true)
//! i makechange(current, field, 1, tostring(-(2^abilityCount)))
//! i end
//! i function CreatePercentageAbility(sourceAbility, prefix, field, abilityCount, name, icon)
//! i powOf2 = abilityCount - 1
//! i lengthOfMax = string.len(tostring(2^abilityCount))
//! i for i = 0, powOf2 do
//! i padding = ""
//! i for k = 0, lengthOfMax - string.len(tostring(2^i)) - 1 do
//! i padding = padding .. "0"
//! i end
//! i createobject(sourceAbility, prefix .. string.sub(chars, i + 1, i + 1))
//! i SetupAbility(name, "+" .. padding .. tostring(2 ^ i) .. "%", icon, false)
//! i makechange(current, field, 1, tostring((2 ^ i) / 100))
//! i end
//! i createobject(sourceAbility, prefix .. "-")
//! i SetupAbility(name, "-" .. tostring(2 ^ abilityCount) .. "%", icon, false)
//! i makechange(current, field, 1, tostring(-((2 ^ abilityCount) / 100)))
//! i end
//! i setobjecttype("abilities")
//! i chars = "abcdefghijklmnopqrstuvwxyz"
//! i
// */
//! endtextmacro
//! textmacro BonusMod_DeclareBonus takes NAME, ABILITY_COUNT, SOURCE_ABILITY, RAWCODE_PREFIX, FIELD, HERO_ONLY, ICON
//! i CreateAbility("$SOURCE_ABILITY$", "$RAWCODE_PREFIX$", "$FIELD$", $ABILITY_COUNT$, "$NAME$", "$ICON$")
globals
Bonus BONUS_$NAME$
endglobals
set BONUS_$NAME$ = AbilityBonus.create('$RAWCODE_PREFIX$a', $ABILITY_COUNT$, '$RAWCODE_PREFIX$-', $HERO_ONLY$)
//! endtextmacro
//! textmacro BonusMod_DeclarePercentBonus takes NAME, ABILITY_COUNT, SOURCE_ABILITY, RAWCODE_PREFIX, FIELD, HERO_ONLY, ICON
//! i CreatePercentageAbility("$SOURCE_ABILITY$", "$RAWCODE_PREFIX$", "$FIELD$", $ABILITY_COUNT$, "$NAME$", "$ICON$")
globals
Bonus BONUS_$NAME$
endglobals
set BONUS_$NAME$ = AbilityBonus.create('$RAWCODE_PREFIX$a', $ABILITY_COUNT$, '$RAWCODE_PREFIX$-', $HERO_ONLY$)
//! endtextmacro
//! textmacro BonusMod_EndBonuses
//*
//! i end
//! endexternalblock
// */
endfunction
//! endtextmacro
// ===
// Precomputed integer powers of 2
// ===
globals
private integer array powersOf2
private integer powersOf2Count = 0
endglobals
// ===
// Utility functions
// ===
private function ErrorMsg takes string func, string s returns nothing
call BJDebugMsg("|cffFF0000BonusMod Error|r|cffFFFF00:|r |cff8080FF" + func + "|r|cffFFFF00:|r " + s)
endfunction
private function LoadAbility takes integer abilityId returns nothing
static if PRELOAD_ABILITIES then
static if LIBRARY_xepreload then
call XE_PreloadAbility(abilityId)
else
static if LIBRARY_AbilityPreload then
call AbilityPreload(abilityId)
endif
endif
endif
endfunction
// ===
// Bonus Types
// ===
private interface BonusInterface
integer minBonus = 0
integer maxBonus = 0
private method destroy takes nothing returns nothing defaults nothing
endinterface
private keyword isBonusObject
struct Bonus extends BonusInterface
boolean isBonusObject = false
public static method create takes nothing returns thistype
local thistype this = thistype.allocate()
set this.isBonusObject = true
return this
endmethod
stub method setBonus takes unit u, integer amount returns integer
debug call ErrorMsg("Bonus.setBonus()", "I have no idea how or why you did this, but don't do it.")
return 0
endmethod
stub method getBonus takes unit u returns integer
debug call ErrorMsg("Bonus.getBonus()", "I have no idea how or why you did this, but don't do it.")
return 0
endmethod
stub method removeBonus takes unit u returns nothing
call this.setBonus(u, 0)
endmethod
stub method isValidBonus takes unit u, integer value returns boolean
return true
endmethod
method operator min takes nothing returns integer
return this.minBonus
endmethod
method operator max takes nothing returns integer
return this.maxBonus
endmethod
endstruct
private struct AbilityBonus extends Bonus
public integer count
public integer rawcode
public integer negativeRawcode
public integer minBonus = 0
public integer maxBonus = 0
public boolean heroesOnly
public static method create takes integer rawcode, integer count, integer negativeRawcode, boolean heroesOnly returns thistype
local thistype bonus = thistype.allocate()
local integer i
debug local boolean error = false
// Error messages
static if DEBUG_MODE then
if rawcode == 0 then
call ErrorMsg("AbilityBonus.create()", "Bonus constructed with a rawcode of 0?!")
call bonus.destroy()
return 0
endif
if count < 0 or count == 0 then
call ErrorMsg("AbilityBonus.create()", "Bonus constructed with an ability count <= 0?!")
call bonus.destroy()
return 0
endif
endif
// Grow powers of 2
if powersOf2Count < count then
set i = powersOf2Count
loop
exitwhen i > count
set powersOf2[i] = 2 * powersOf2[i - 1]
set i = i + 1
endloop
set powersOf2Count = count
endif
// Preload this bonus' abilities
static if PRELOAD_ABILITIES then
set i = 0
loop
exitwhen i == count
call LoadAbility(rawcode + i)
set i = i + 1
endloop
if negativeRawcode != 0 then
call LoadAbility(negativeRawcode)
endif
endif
// Set up this bonus object
set bonus.count = count
set bonus.negativeRawcode = negativeRawcode
set bonus.rawcode = rawcode
set bonus.heroesOnly = heroesOnly
// Calculate the minimum and maximum bonuses
if negativeRawcode != 0 then
set bonus.minBonus = -powersOf2[count]
else
set bonus.minBonus = 0
endif
set bonus.maxBonus = powersOf2[count] - 1
// Return the bonus object
return bonus
endmethod
// Interface methods:
method setBonus takes unit u, integer amount returns integer
return SetUnitBonus.evaluate(u, this, amount)
endmethod
method getBonus takes unit u returns integer
return GetUnitBonus.evaluate(u, this)
endmethod
method removeBonus takes unit u returns nothing
call RemoveUnitBonus.evaluate(u, this)
endmethod
public method isValidBonus takes unit u, integer value returns boolean
return (value >= this.minBonus) and (value <= this.maxBonus)
endmethod
endstruct
// ===
// Public API
// ===
function IsBonusValid takes unit u, Bonus abstractBonus, integer value returns boolean
local AbilityBonus bonus = AbilityBonus(abstractBonus)
static if DEBUG_MODE then
if not abstractBonus.isBonusObject then
call ErrorMsg("IsBonusValid()", "Invalid bonus type given")
endif
endif
if abstractBonus.min > value or abstractBonus.max < value then
return false
endif
if abstractBonus.getType() != AbilityBonus.typeid then
return abstractBonus.isValidBonus(u, value)
endif
if bonus.heroesOnly and not IsUnitType(u, UNIT_TYPE_HERO) then
return false
endif
return (value >= bonus.minBonus) and (value <= bonus.maxBonus)
endfunction
function RemoveUnitBonus takes unit u, Bonus abstractBonus returns nothing
local integer i = 0
local AbilityBonus bonus = AbilityBonus(abstractBonus)
static if DEBUG_MODE then
if not abstractBonus.isBonusObject then
call ErrorMsg("RemoveUnitBonus()", "Invalid bonus type given")
endif
endif
if abstractBonus.getType() != AbilityBonus.typeid then
call abstractBonus.removeBonus(u)
return
endif
if bonus.heroesOnly and not IsUnitType(u, UNIT_TYPE_HERO) then
debug call ErrorMsg("RemoveUnitBonus()", "Trying to remove a hero-only bonus from a non-hero unit")
return
endif
call UnitRemoveAbility(u, bonus.negativeRawcode)
loop
exitwhen i == bonus.count
call UnitRemoveAbility(u, bonus.rawcode + i)
set i = i + 1
endloop
endfunction
function SetUnitBonus takes unit u, Bonus abstractBonus, integer amount returns integer
local integer i
local integer output = 0
local AbilityBonus bonus = AbilityBonus(abstractBonus)
local boolean applyMinBonus = false
static if DEBUG_MODE then
if not abstractBonus.isBonusObject then
call ErrorMsg("SetUnitBonus()", "Invalid bonus type given")
endif
endif
if amount == 0 then
call RemoveUnitBonus(u, bonus)
return 0
endif
if abstractBonus.getType() != AbilityBonus.typeid then
return abstractBonus.setBonus(u, amount)
endif
if bonus.heroesOnly and not IsUnitType(u, UNIT_TYPE_HERO) then
debug call ErrorMsg("SetUnitBonus()", "Trying to set a hero-only bonus on a non-hero unit")
return 0
endif
if amount < bonus.minBonus then
debug call ErrorMsg("SetUnitBonus()", "Attempting to set a bonus to below its min value")
set amount = bonus.minBonus
elseif amount > bonus.maxBonus then
debug call ErrorMsg("SetUnitBonus()", "Attempting to set a bonus to above its max value")
set amount = bonus.maxBonus
endif
if amount < 0 then
set amount = -(bonus.minBonus - amount)
set applyMinBonus = true
endif
call UnitRemoveAbility(u, bonus.negativeRawcode)
set i = bonus.count - 1
loop
exitwhen i < 0
if amount >= powersOf2[i] then
call UnitAddAbility(u, bonus.rawcode + i)
call UnitMakeAbilityPermanent(u, true, bonus.rawcode + i)
static if DEBUG_MODE then
if GetUnitAbilityLevel(u, bonus.rawcode + i) <= 0 then
call ErrorMsg("SetUnitBonus()", "Failed to give the 2^" + I2S(i) + " ability to the unit!")
endif
endif
set amount = amount - powersOf2[i]
set output = output + powersOf2[i]
else
call UnitRemoveAbility(u, bonus.rawcode + i)
static if DEBUG_MODE then
if GetUnitAbilityLevel(u, bonus.rawcode + i) > 0 then
call ErrorMsg("SetUnitBonus()", "Unit still has the 2^" + I2S(i) + " ability after it was removed!")
endif
endif
endif
set i = i - 1
endloop
if applyMinBonus then
call UnitAddAbility(u, bonus.negativeRawcode)
call UnitMakeAbilityPermanent(u, true, bonus.negativeRawcode)
else
call UnitRemoveAbility(u, bonus.negativeRawcode)
endif
return output
endfunction
function GetUnitBonus takes unit u, Bonus abstractBonus returns integer
local integer i = 0
local integer amount = 0
local AbilityBonus bonus = AbilityBonus(abstractBonus)
static if DEBUG_MODE then
if not abstractBonus.isBonusObject then
call ErrorMsg("GetUnitBonus()", "Invalid bonus type given")
endif
endif
if abstractBonus.getType() != AbilityBonus.typeid then
return abstractBonus.getBonus(u)
endif
if bonus.heroesOnly and not IsUnitType(u, UNIT_TYPE_HERO) then
debug call ErrorMsg("GetUnitBonus()", "Trying to get a hero-only bonus from a non-hero unit")
return 0
endif
if GetUnitAbilityLevel(u, bonus.negativeRawcode) > 0 then
set amount = bonus.minBonus
endif
loop
exitwhen i == bonus.count
if GetUnitAbilityLevel(u, bonus.rawcode + i) > 0 then
set amount = amount + powersOf2[i]
endif
set i = i + 1
endloop
return amount
endfunction
function AddUnitBonus takes unit u, Bonus bonus, integer amount returns integer
return SetUnitBonus(u, bonus, GetUnitBonus(u, bonus) + amount)
endfunction
// ===
// Initialization
// ===
private function OnInit takes nothing returns nothing
local integer i
// Set up powers of 2
set powersOf2[0] = 1
set powersOf2Count = 1
static if DEBUG_MODE and PRELOAD_ABILITIES and not LIBRARY_xepreload and not LIBRARY_AbilityPreload then
call ErrorMsg("Initialization", "PRELOAD_ABILITIES is set to true, but neither usable preloading library is detected")
endif
// Setup bonuses
call Setup()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MovementBonus initializer OnInit requires BonusMod, AutoIndex
////////////////////////////////////////////////////////////////////////////////
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@ MovementBonus for BonusMod
//@=============================================================================
//@ Credits:
//@-----------------------------------------------------------------------------
//@ Written by:
//@ Earth-Fury
//@=============================================================================
//@ Requirements:
//@-----------------------------------------------------------------------------
//@ This library requires the BonusMod library, and the AutoIndex library.
//@
//@=============================================================================
//@ Readme:
//@-----------------------------------------------------------------------------
//@ This library provides one new bonus type:
//@
//@ - BONUS_MOVEMENT_SPEED
//@ Modifies a unit's movement speed.
//@
//@ A unit's movement speed can never go below or above the values configured
//@ in the gameplay constants for a map.
//@
//@ You should not modify a unit's movement speed any way other than via
//@ BonusMod. Doing so will cause issues.
//@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
////////////////////////////////////////////////////////////////////////////////
//==============================================================================
// Configuration:
//==============================================================================
//------------------------------------------------------------------------------
// The following constants must be equal to the equivalent gameplay constants.
// By default, these are set to the default vlues for the gameplay constants.
//------------------------------------------------------------------------------
globals
constant integer MAX_UNIT_MOVEMENT = 522
constant integer MIN_UNIT_MOVEMENT = 1
constant integer MAX_BUILDING_MOVEMENT = 400
constant integer MIN_BUILDING_MOVEMENT = 25
endglobals
//==============================================================================
// End of configuration
//==============================================================================
globals
Bonus BONUS_MOVEMENT_SPEED
endglobals
private function ErrorMsg takes string func, string s returns nothing
call BJDebugMsg("|cffFF0000MovementBonus Error|r|cffFFFF00:|r |cff8080FF" + func + "|r|cffFFFF00:|r " + s)
endfunction
private struct BonusValue
public integer speed = 0
public unit owner
private static thistype array owners
public static thistype array all
public static integer count = 0
public integer index
private static method create takes unit u returns thistype
local thistype this = thistype.allocate()
set this.owner = u
set thistype.owners[GetUnitId(u)] = this
set thistype.all[thistype.count] = this
set this.index = thistype.count
set thistype.count = thistype.count + 1
return this
endmethod
private method onDestroy takes nothing returns nothing
set thistype.owners[GetUnitId(this.owner)] = thistype(0)
set thistype.all[this.index] = thistype.all[thistype.count]
set thistype.count = thistype.count - 1
set this.owner = null
endmethod
public static method getInstance takes unit u returns thistype
if thistype.owners[GetUnitId(u)] == 0 then
return thistype.create(u)
else
return thistype.owners[GetUnitId(u)]
endif
endmethod
public static method operator[] takes unit u returns thistype
return thistype.owners[GetUnitId(u)]
endmethod
public static method operator[]= takes unit u, thistype i returns nothing
set thistype.owners[GetUnitId(u)] = i
endmethod
endstruct
private struct MovementBonus extends Bonus
integer minBonus
integer maxBonus
static method create takes integer min, integer max returns thistype
local thistype this = allocate()
set this.minBonus = min
set this.maxBonus = max
return this
endmethod
method setBonus takes unit u, integer amount returns integer
local BonusValue value
local integer min
local integer max
local integer actualSpeed
/*
if AutoIndex.getIndex(u) == 0 then
debug call ErrorMsg("MovementBonus.setBonus()", "Unit that is not indexed by AutoIndex given")
return 0
endif
*/
set value = BonusValue.getInstance(u)
if IsUnitType(u, UNIT_TYPE_STRUCTURE) then
set min = MIN_BUILDING_MOVEMENT
set max = MAX_BUILDING_MOVEMENT
else
set min = MIN_UNIT_MOVEMENT
set max = MAX_UNIT_MOVEMENT
endif
set actualSpeed = R2I(GetUnitMoveSpeed(u)) - value.speed
if actualSpeed + amount < min then
debug call ErrorMsg("MovementBonus.setBonus()", "Attempting to set a unit's speed below it's minimum")
set amount = -actualSpeed + min
elseif actualSpeed + amount > max then
debug call ErrorMsg("MovementBonus.setBonus()", "Ateempting to set a unit's speed above it's maximum")
set amount = max - actualSpeed
endif
call SetUnitMoveSpeed(u, actualSpeed + amount)
set value.speed = amount
return amount
endmethod
method getBonus takes unit u returns integer
local BonusValue value
/*
if AutoIndex.getIndex(u) == 0 then
debug call ErrorMsg("MovementBonus.getBonus()", "Unit that is not indexed by AutoIndex given")
return 0
endif
*/
set value = BonusValue[u]
if value == 0 then
return 0
endif
return value.speed
endmethod
method removeBonus takes unit u returns nothing
call this.setBonus(u, 0)
endmethod
method isValidBonus takes unit u, integer value returns boolean
local integer min
local integer max
local integer currentBonus
local integer actualSpeed
/*
if AutoIndex.getIndex(u) == 0 then
return false
endif
*/
if IsUnitType(u, UNIT_TYPE_STRUCTURE) then
set min = MIN_BUILDING_MOVEMENT
set max = MAX_BUILDING_MOVEMENT
else
set min = MIN_UNIT_MOVEMENT
set max = MAX_UNIT_MOVEMENT
endif
set actualSpeed = R2I(GetUnitMoveSpeed(u)) - this.getBonus(u)
if actualSpeed + value < min then
return false
elseif actualSpeed + value > max then
return false
else
return true
endif
endmethod
endstruct
private function OnLeaveMap takes unit u returns nothing
if BonusValue[u] != 0 then
call BonusValue[u].destroy()
endif
endfunction
private function OnInit takes nothing returns nothing
local integer min
local integer max
call OnUnitDeindexed(OnLeaveMap)
if MAX_UNIT_MOVEMENT > MAX_BUILDING_MOVEMENT then
set max = MAX_UNIT_MOVEMENT
else
set max = MAX_BUILDING_MOVEMENT
endif
if MIN_UNIT_MOVEMENT < MIN_BUILDING_MOVEMENT then
set min = MIN_UNIT_MOVEMENT
else
set min = MIN_BUILDING_MOVEMENT
endif
set BONUS_MOVEMENT_SPEED = MovementBonus.create(min, max)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library xebasic
//**************************************************************************
//
// xebasic 0.4
// =======
// 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.
//
// XE_MAX_COLLISION_SIZE: The maximum unit collision size in your map, if
// you got a unit bigger than 197.0 it would be
// a good idea to update this constant, since some
// enums will not find it. Likewise, if none of
// your units can go bellow X and X is much smaller
// than 197.0, it would be a good idea to update
// as well, since it will improve the performance
// those enums.
//
// Notice you probably don't have to update this library, unless I specify
// there are new constants which would be unlikely.
//
//**************************************************************************
//===========================================================================
globals
constant integer XE_DUMMY_UNITID = 'e002'
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 = 197.0
endglobals
endlibrary
library xepreload initializer init requires xebasic, optional TimerUtils
//******************************************************************************
// xepreload 0.8
// ---------
// 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
private keyword DebugIdInteger2IdString
//inline friendly (when debug mode is off..)
function XE_PreloadAbility takes integer abilid returns nothing
call UnitAddAbility(dum, abilid)
static if DEBUG_MODE then
if(dum==null) then
call BJDebugMsg("XE_PreloadAbility: do not load abilities after map init or during structs' onInit")
elseif GetUnitAbilityLevel(dum, abilid) == 0 then
call BJDebugMsg("XE_PreloadAbility: Ability "+DebugIdInteger2IdString.evaluate(abilid)+" does not exist.")
endif
endif
endfunction
// ................................................................................
//================================================================================
// Convert a integer id value into a 4-letter id code.
// * Taken from cheats.j so I don't have to code it again.
// * Used only on debug so making a whole library for it seemed silly
// * Private so people don't begin using xepreload just to call this function....
// * It will not work correctly if you paste this code in the custom script section
// due to the infamous % bug. Then again, if you do that then you probably
// deserve it....
//
private function DebugIdInteger2IdString takes integer value returns string
local string charMap = ".................................!.#$%&'()*+,-./0123456789:;<=>.@ABCDEFGHIJKLMNOPQRSTUVWXYZ[.]^_`abcdefghijklmnopqrstuvwxyz{|}~................................................................................................................................."
local string result = ""
local integer remainingValue = value
local integer charValue
local integer byteno
set byteno = 0
loop
set charValue = ModuloInteger(remainingValue, 256)
set remainingValue = remainingValue / 256
set result = SubString(charMap, charValue, charValue + 1) + result
set byteno = byteno + 1
exitwhen byteno == 4
endloop
return result
endfunction
//--------------------------------
private function kill takes nothing returns nothing
call RemoveUnit(dum)
set dum=null
static if (LIBRARY_TimerUtils ) then
call ReleaseTimer( GetExpiredTimer() )
else
call DestroyTimer(GetExpiredTimer())
endif
endfunction
private function init takes nothing returns nothing
local timer t
set dum = CreateUnit( Player(15), XE_DUMMY_UNITID, 0,0,0)
if( dum == null) then
debug call BJDebugMsg("xePreload : XE_DUMMY_UNITID ("+DebugIdInteger2IdString.evaluate(XE_DUMMY_UNITID)+") not added correctly to the map.")
endif
static if (LIBRARY_TimerUtils) then
set t=NewTimer()
else
set t=CreateTimer()
endif
call TimerStart(t,0.0,false,function kill)
set t=null
endfunction
endlibrary
//TESH.scrollpos=116
//TESH.alwaysfold=0
library xecast initializer init requires xebasic
//******************************************************************************
// xecast 0.7
// ------
// Because dummy casters REALLY ARE this complicated!
//
//******************************************************************************
//==============================================================================
globals
private constant integer MAXINSTANCES = 8190
//this is a lot, unless you leak xecast objects (which is a bad thing)
private constant integer INITIAL_DUMMY_COUNT = 12
//don't allow to keep more than DUMMY_STACK_LIMIT innactive dummy units :
private constant integer DUMMY_STACK_LIMIT = 50
// If your map does not give visibility to all players, or
// for other reasons, you might want xecast to work on
// units that are not visible to the player, in that case
// change this to true, else it is just a performance loss.
private constant boolean FORCE_INVISIBLE_CAST = false
//When AUTO_RESET_MANA_COOLDOWN is set to true, xecast will reset
// the dummy unit's cooldown and mana before casting every spell.
// it is a performance penalty, so if you are sure that all dummy spells
// in your map got 0 mana and cooldown cost, you may set it to false.
private constant boolean AUTO_RESET_MANA_COOLDOWN = true
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 SetUnitUserData(u,0)
call SetUnitFlyHeight(u,0,0)
call PauseUnit(u,false)
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)
static if AUTO_RESET_MANA_COOLDOWN then
call UnitResetCooldown(dummy)
call SetUnitState(dummy, UNIT_STATE_MANA, 10000.0)
endif
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 unit target returns nothing
local unit dummy
local unit tar
//! 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
if (FORCE_INVISIBLE_CAST) then
call UnitShareVision(target, .owningplayer, true)
call IssueTargetOrderById(dummy,this.oid,target)
call UnitShareVision(target, .owningplayer, false)
else
call IssueTargetOrderById(dummy,this.oid,target)
endif
//! runtextmacro xecast_deallocdummy()
if(.autodestroy ) then
call this.destroy()
endif
endmethod
//accepts units, items and destructables, if you know it is
// a unit it is better to use castOnTarget since that would
// be able to use FORCE_INVISIBLE_CAST if necessary.
//
method castOnWidgetTarget takes widget target returns nothing
local unit dummy
local unit tar
//! 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
local boolean ad=this.autodestroy
if(ad) then
set this.autodestroy=false
endif
set .aoex=x
set .aoey=y
set .aoeradius=radius
set .cinstance=this
call GroupEnumUnitsInRange(.enumgroup,x,y,radius + XE_MAX_COLLISION_SIZE , .aoefunc)
if(ad) 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 boolean ad=this.autodestroy
local unit t
if(ad) then
set this.autodestroy=false
endif
loop
set t=FirstOfGroup(g)
exitwhen(t==null)
call GroupRemoveUnit(g,t)
call .castOnTarget(t)
endloop
if(ad) then
call this.destroy()
endif
endmethod
private static method removeAbility takes nothing returns boolean
local unit u=GetTriggerUnit()
if(GetUnitUserData(u)!=0) then
call PauseUnit(u,true)
endif
//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, so it is
// a good idea to pause it...
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
library xefx initializer init requires xebasic
//**************************************************
// xefx 0.7
// --------
// Recommended: ARGB (adds ARGBrecolor method)
// For your movable fx needs
//
//**************************************************
//==================================================
globals
private constant integer MAX_INSTANCES = 8190 //change accordingly.
private constant real RECYCLE_DELAY = 4.0
//recycling, in order to show the effect correctly, must wait some time before
//removing the unit.
private timer recycler
private timer NOW
endglobals
private struct recyclebin extends array
unit u
real schedule
static recyclebin end=0
static recyclebin begin=0
static method Recycle takes nothing returns nothing
call RemoveUnit(.begin.u) //this unit is private, systems shouldn't mess with it.
set .begin.u=null
set .begin=recyclebin(integer(.begin)+1)
if(.begin==.end) then
set .begin=0
set .end=0
else
call TimerStart(recycler, .begin.schedule-TimerGetElapsed(NOW), false, function recyclebin.Recycle)
endif
endmethod
endstruct
private function init takes nothing returns nothing
set recycler=CreateTimer()
set NOW=CreateTimer()
call TimerStart(NOW,43200,true,null)
endfunction
struct xefx[MAX_INSTANCES]
public integer tag=0
private unit dummy
private effect fx=null
private real zang=0.0
private integer r=255
private integer g=255
private integer b=255
private integer a=255
private integer abil=0
static method create takes real x, real y, real facing returns xefx
local xefx this=xefx.allocate()
set this.dummy= CreateUnit(Player(15), XE_DUMMY_UNITID, x,y, facing*bj_RADTODEG)
call UnitAddAbility(this.dummy,XE_HEIGHT_ENABLER)
call UnitAddAbility(this.dummy,'Aloc')
call UnitRemoveAbility(this.dummy,XE_HEIGHT_ENABLER)
call SetUnitX(this.dummy,x)
call SetUnitY(this.dummy,y)
return this
endmethod
method operator owner takes nothing returns player
return GetOwningPlayer(this.dummy)
endmethod
method operator owner= takes player p returns nothing
call SetUnitOwner(this.dummy,p,false)
endmethod
method operator teamcolor= takes playercolor c returns nothing
call SetUnitColor(this.dummy,c)
endmethod
method operator scale= takes real value returns nothing
call SetUnitScale(this.dummy,value,value,value)
endmethod
//! textmacro XEFX_colorstuff takes colorname, colorvar
method operator $colorname$ takes nothing returns integer
return this.$colorvar$
endmethod
method operator $colorname$= takes integer value returns nothing
set this.$colorvar$=value
call SetUnitVertexColor(this.dummy,this.r,this.g,this.b,this.a)
endmethod
//! endtextmacro
//! runtextmacro XEFX_colorstuff("red","r")
//! runtextmacro XEFX_colorstuff("green","g")
//! runtextmacro XEFX_colorstuff("blue","b")
//! runtextmacro XEFX_colorstuff("alpha","a")
method recolor takes integer r, integer g , integer b, integer a returns nothing
set this.r=r
set this.g=g
set this.b=b
set this.a=a
call SetUnitVertexColor(this.dummy,this.r,this.g,this.b,this.a)
endmethod
implement optional ARGBrecolor
method operator abilityid takes nothing returns integer
return this.abil
endmethod
method operator abilityid= takes integer a returns nothing
if(this.abil!=0) then
call UnitRemoveAbility(this.dummy,this.abil)
endif
if(a!=0) then
call UnitAddAbility(this.dummy,a)
endif
set this.abil=a
endmethod
method operator abilityLevel takes nothing returns integer
return GetUnitAbilityLevel( this.dummy, this.abil)
endmethod
method operator abilityLevel= takes integer newLevel returns nothing
call SetUnitAbilityLevel(this.dummy, this.abil, newLevel)
endmethod
method flash takes string fx returns nothing
call DestroyEffect(AddSpecialEffectTarget(fx,this.dummy,"origin"))
endmethod
method operator xyangle takes nothing returns real
return GetUnitFacing(this.dummy)*bj_DEGTORAD
endmethod
method operator xyangle= takes real value returns nothing
call SetUnitFacing(this.dummy,value*bj_RADTODEG)
endmethod
method operator zangle takes nothing returns real
return this.zang
endmethod
method operator zangle= takes real value returns nothing
local integer i=R2I(value*bj_RADTODEG+90.5)
set this.zang=value
if(i>=180) then
set i=179
elseif(i<0) then
set i=0
endif
call SetUnitAnimationByIndex(this.dummy, i )
endmethod
method operator x takes nothing returns real
return GetUnitX(this.dummy)
endmethod
method operator y takes nothing returns real
return GetUnitY(this.dummy)
endmethod
method operator z takes nothing returns real
return GetUnitFlyHeight(this.dummy)
endmethod
method operator z= takes real value returns nothing
call SetUnitFlyHeight(this.dummy,value,0)
endmethod
method operator x= takes real value returns nothing
call SetUnitX(this.dummy,value)
endmethod
method operator y= takes real value returns nothing
call SetUnitY(this.dummy,value)
endmethod
method operator fxpath= takes string newpath returns nothing
if (this.fx!=null) then
call DestroyEffect(this.fx)
endif
if (newpath=="") then
set this.fx=null
else
set this.fx=AddSpecialEffectTarget(newpath,this.dummy,"origin")
endif
endmethod
method hiddenReset takes string newfxpath, real newfacing returns nothing
local real x = GetUnitX(this.dummy)
local real y = GetUnitY(this.dummy)
local real z = this.z
local real za = this.zangle
local integer level = this.abilityLevel
set fxpath=null
call RemoveUnit(this.dummy)
set this.dummy= CreateUnit(Player(15), XE_DUMMY_UNITID, x,y, newfacing*bj_RADTODEG)
if(level != 0) then
call UnitAddAbility(this.dummy, abilityid)
endif
call UnitAddAbility(this.dummy,XE_HEIGHT_ENABLER)
call UnitAddAbility(this.dummy,'Aloc')
call UnitRemoveAbility(this.dummy,XE_HEIGHT_ENABLER)
call SetUnitX(this.dummy,x)
call SetUnitY(this.dummy,y)
set this.z = z
set zangle = za
endmethod
private method onDestroy takes nothing returns nothing
if(this.abil!=0) then
call UnitRemoveAbility(this.dummy,this.abil)
endif
if(this.fx!=null) then
call DestroyEffect(this.fx)
set this.fx=null
endif
if (recyclebin.end==MAX_INSTANCES) then
//I'd like to see this happen...
call TimerStart(recycler,0,false,function recyclebin.Recycle)
call ExplodeUnitBJ(this.dummy)
else
set recyclebin.end.u=this.dummy
set recyclebin.end.schedule=TimerGetElapsed(NOW)+RECYCLE_DELAY
set recyclebin.end= recyclebin( integer(recyclebin.end)+1)
if( recyclebin.end==1) then
call TimerStart(recycler, RECYCLE_DELAY, false, function recyclebin.Recycle)
endif
call SetUnitOwner(this.dummy,Player(15),false)
endif
set this.dummy=null
endmethod
method hiddenDestroy takes nothing returns nothing
call ShowUnit(dummy,false)
call destroy()
endmethod
endstruct
endlibrary
//TESH.scrollpos=329
//TESH.alwaysfold=0
library xedamage initializer init requires xebasic
//************************************************************************
// xedamage 0.8
// --------
// For all your damage and targetting needs.
//
//************************************************************************
//===========================================================================================================
globals
private constant integer MAX_SUB_OPTIONS = 3
private constant real FACTOR_TEST_DAMAGE = 0.01
// a low damage to do on units to test their damage factors for specific
// attacktype/damagetype combos.
// You'll need something as high as 20.0 to make it work well with armor resistances.
// (Yes, you read it correctly, 20 ...
//
// If you use such a large value, there may be conflicts with some things relying on damage
// (ie they are not away of the isDummyDamage tag that xedamage posseses.) which may be quite bad if you think about it...
// then maybe it is better to change it to 0.01 ... then will work fine, just fine - but it will generally ignore armor -
// I am leaving it as 0.01 by default, because honestly, I'd rather make it ignore armor than have a lot of people sending me
// rants about how they detect 20.0 damage where none is visible...
private constant real MAX_DAMAGE_FACTOR = 3.00
// The maximum damage factor in the map. I think 3 is fine.
//=======================================================
private constant real EPSILON = 0.000000001
private unit dmger
private constant integer MAX_SPACE = 8190 // MAX_SPACE/MAX_SUB_OPTIONS is the instance limit for xedamage, usually big enough...
endglobals
private keyword structInit
struct xedamage[MAX_SPACE]
//----
// fields and methods for a xedamage object, they aid determining valid targets and special
// damage factor conditions.
//
// Notice the default values.
//
boolean damageSelf = false // the damage and factor methods usually have a source unit parameter
// xedamage would consider this unit as immune unless you set damageSelf to true
boolean damageAllies = false // Alliance dependent target options.
boolean damageEnemies = true // *
boolean damageNeutral = true // *
boolean ranged = true // Is the attack ranged? This has some effect on the AI of the affected units
// true by default, you may not really need to modify this.
boolean visibleOnly = false // Should only units that are visible for source unit's owner be affected?
boolean deadOnly = false // Should only corpses be affected by "the damage"? (useful when using xedamage as a target selector)
boolean alsoDead = false // Should even corpses and alive units be considered?
boolean damageTrees = false //Also damage destructables? Notice this is used only in certain methods.
//AOE for example targets a circle, so it can affect the destructables
//in that circle, a custom spell using xedamage for targetting configuration
//could also have an if-then-else implemented so it can verify if it is true
//then affect trees manually.
//
// Damage type stuff:
// .dtype : the "damagetype" , determines if the spell is physical, magical or ultimate.
// .atype : the "attacktype" , deals with armor.
// .wtype : the "weapontype" , determines the sound effect to be played when damage is done.
//
// Please use common.j/blizzard.j/ some guide to know what damage/attack/weapon types can be used
//
damagetype dtype = DAMAGE_TYPE_UNIVERSAL
attacktype atype = ATTACK_TYPE_NORMAL
weapontype wtype = WEAPON_TYPE_WHOKNOWS
//
// Damage type 'tag' people might use xedamage.isInUse() to detect xedamage usage, there are other static
// variables like xedamage.CurrentDamageType and xedamage.CurrentDamageTag. The tag allows you to specify
// a custom id for the damage type ** Notice the tag would aid you for some spell stuff, for example,
// you can use it in a way similar to Rising_Dusk's damage system.
//
integer tag = 0
//
// if true, forceDamage will make xedamage ignore dtype and atype and try as hard as possible to deal 100%
// damage.
boolean forceDamage = false
//
// Ally factor! Certain spells probably have double purposes and heal allies while harming enemies. This
// field allows you to do such thing.
//
real allyfactor = 1.0
//
// field: .exception = SOME_UNIT_TYPE
// This field adds an exception unittype (classification), if the unit belongs to this unittype it will
// be ignored.
//
method operator exception= takes unittype ut returns nothing
set this.use_ex=true
set this.ex_ut=ut
endmethod
//
// field: .required = SOME_UNIT_TYPE
// This field adds a required unittype (classification), if the unit does not belong to this unittype
// it will be ignored.
//
method operator required= takes unittype ut returns nothing
set this.use_req=true
set this.req_ut=ut
endmethod
private boolean use_ex = false
private unittype ex_ut = null
private boolean use_req = false
private unittype req_ut = null
private unittype array fct[MAX_SUB_OPTIONS]
private real array fc[MAX_SUB_OPTIONS]
private integer fcn=0
//
// method .factor(SOME_UNIT_TYPE, factor)
// You might call factor() if you wish to specify a special damage factor for a certain classification,
// for example call d.factor(UNIT_TYPE_STRUCTURE, 0.5) makes xedamage do half damage to structures.
//
method factor takes unittype ut, real fc returns nothing
if(this.fcn==MAX_SUB_OPTIONS) then
debug call BJDebugMsg("In one instance of xedamage, you are doing too much calls to factor(), please increase MAX_SUB_OPTIONS to allow more, or cut the number of factor() calls")
return
endif
set this.fct[this.fcn] = ut
set this.fc[this.fcn] = fc
set this.fcn = this.fcn+1
endmethod
private integer array abifct[MAX_SUB_OPTIONS]
private real array abifc[MAX_SUB_OPTIONS]
private integer abifcn=0
//
// method .abilityFactor('abil', factor)
// You might call abilityFactor() if you wish to specify a special damage factor for units that have a
// certain ability/buff.
// for example call d.abilityFactor('A000', 1.5 ) makes units that have the A000 ability take 50% more
// damage than usual.
//
method abilityFactor takes integer abilityId, real fc returns nothing
if(this.abifcn==MAX_SUB_OPTIONS) then
debug call BJDebugMsg("In one instance of xedamage, you are doing too much calls to abilityFactor(), please increase MAX_SUB_OPTIONS to allow more, or cut the number of abilityFactor() calls")
return
endif
set this.abifct[this.abifcn] = abilityId
set this.abifc[this.abifcn] = fc
set this.abifcn = this.abifcn+1
endmethod
private boolean usefx = false
private string fxpath
private string fxattach
//
// method .useSpecialEffect("effect\\path.mdl", "origin")
// Makes it add (and destroy) an effect when damage is performed.
//
method useSpecialEffect takes string path, string attach returns nothing
set this.usefx = true
set this.fxpath=path
set this.fxattach=attach
endmethod
//********************************************************************
//* Now, the usage stuff:
//*
//================================================================================
// static method xedamage.isInUse() will return true during a unit damaged
// event in case this damage was caused by xedamage, in this case, you can
// read variables like CurrentDamageType, CurrentAttackType and CurrentDamageTag
// to be able to recognize what sort of damage was done.
//
readonly static damagetype CurrentDamageType=null
readonly static attacktype CurrentAttackType=null
readonly static integer CurrentDamageTag =0
private static integer inUse = 0
static method isInUse takes nothing returns boolean
return (inUse>0) //inline friendly.
endmethod
readonly static boolean isDummyDamage = false
//========================================================================================================
// This function calculates the damage factor caused by a certain attack and damage
// type, it is static : xedamage.getDamageTypeFactor(someunit, ATTAcK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, 100)
//
static method getDamageTypeFactor takes unit u, attacktype a, damagetype d returns real
local real hp=GetWidgetLife(u)
local real mana=GetUnitState(u,UNIT_STATE_MANA)
local real r
local real fc = FACTOR_TEST_DAMAGE
//Since a unit is in that point, we don't need checks.
call SetUnitX(dmger,GetUnitX(u))
call SetUnitY(dmger,GetUnitY(u))
call SetUnitOwner(dmger,GetOwningPlayer(u),false)
set r=hp
if (hp< FACTOR_TEST_DAMAGE*MAX_DAMAGE_FACTOR) then
call SetWidgetLife(u, hp + FACTOR_TEST_DAMAGE*MAX_DAMAGE_FACTOR )
set r = hp + FACTOR_TEST_DAMAGE*MAX_DAMAGE_FACTOR
set fc = GetWidgetLife(u)-hp + EPSILON
endif
set isDummyDamage = true
call UnitDamageTarget(dmger,u, fc ,false,false,a,d,null)
static if DEBUG_MODE then
if IsUnitType(u, UNIT_TYPE_DEAD) and (hp>0.405) then
call BJDebugMsg("xedamage: For some reason, the unit being tested by getDamageTypeFactor has died. Verify MAX_DAMAGE_FACTOR is set to a correct value. ")
endif
endif
set isDummyDamage = false
call SetUnitOwner(dmger,Player(15),false)
if (mana>GetUnitState(u,UNIT_STATE_MANA)) then
//Unit had mana shield, return 1 and restore mana too.
call SetUnitState(u,UNIT_STATE_MANA,mana)
set r=1
else
set r= (r-GetWidgetLife(u)) / fc
endif
call SetWidgetLife(u,hp)
return r
endmethod
private method getTargetFactorCore takes unit source, unit target, boolean usetypes returns real
local player p=GetOwningPlayer(source)
local boolean allied=IsUnitAlly(target,p)
local boolean enemy =IsUnitEnemy(target,p)
local boolean neutral=allied
local real f
local real negf=1.0
local integer i
if(this.damageAllies != this.damageNeutral) then
set neutral= allied and not (GetPlayerAlliance(GetOwningPlayer(target),p, ALLIANCE_HELP_REQUEST ))
//I thought accuracy was not as important as speed , I think that REQUEST is false is enough to consider
// it neutral.
//set neutral= allied and not (GetPlayerAlliance(GetOwningPlayer(target),p, ALLIANCE_HELP_RESPONSE ))
//set neutral= allied and not (GetPlayerAlliance(GetOwningPlayer(target),p, ALLIANCE_SHARED_XP ))
//set neutral= allied and not (GetPlayerAlliance(GetOwningPlayer(target),p, ALLIANCE_SHARED_SPELLS ))
set allied= allied and not(neutral)
endif
if (not this.damageAllies) and allied then
return 0.0
elseif (not this.damageEnemies) and enemy then
return 0.0
elseif( (not this.damageSelf) and (source==target) ) then
return 0.0
elseif (not this.damageNeutral) and neutral then
return 0.0
elseif( this.use_ex and IsUnitType(target, this.ex_ut) ) then
return 0.0
elseif( this.visibleOnly and not IsUnitVisible(target,p) ) then
return 0.0
elseif ( this.deadOnly and not IsUnitType(target,UNIT_TYPE_DEAD) ) then
return 0.0
elseif ( not(this.alsoDead) and IsUnitType(target,UNIT_TYPE_DEAD) ) then
return 0.0
endif
set f=1.0
if ( IsUnitAlly(target,p) ) then
set f=f*this.allyfactor
if(f<=-EPSILON) then
set f=-f
set negf=-1.0
endif
endif
if (this.use_req and not IsUnitType(target,this.req_ut)) then
return 0.0
endif
set i=.fcn-1
loop
exitwhen (i<0)
if( IsUnitType(target, this.fct[i] ) ) then
set f=f*this.fc[i]
if(f<=-EPSILON) then
set f=-f
set negf=-1.0
endif
endif
set i=i-1
endloop
set i=.abifcn-1
loop
exitwhen (i<0)
if( GetUnitAbilityLevel(target,this.abifct[i] )>0 ) then
set f=f*this.abifc[i]
if(f<=-EPSILON) then
set f=-f
set negf=-1.0
endif
endif
set i=i-1
endloop
set f=f*negf
if ( f<EPSILON) and (f>-EPSILON) then
return 0.0
endif
if( this.forceDamage or not usetypes ) then
return f
endif
set f=f*xedamage.getDamageTypeFactor(target,this.atype,this.dtype)
if ( f<EPSILON) and (f>-EPSILON) then
return 0.0
endif
return f
endmethod
//====================================================================
// With this you might decide if a unit is a valid target for a spell.
//
method getTargetFactor takes unit source, unit target returns real
return this.getTargetFactorCore(source,target,true)
endmethod
//======================================================================
// a little better, I guess
//
method allowedTarget takes unit source, unit target returns boolean
return (this.getTargetFactorCore(source,target,false)!=0.0)
endmethod
//=======================================================================
// performs damage to the target unit, for unit 'source'.
//
method damageTarget takes unit source, unit target, real damage returns boolean
local damagetype dt=.CurrentDamageType
local attacktype at=.CurrentAttackType
local integer tg=.CurrentDamageTag
local real f = this.getTargetFactorCore(source,target,false)
local real pl
if(f!=0.0) then
set .CurrentDamageType = .dtype
set .CurrentAttackType = .atype
set .CurrentDamageTag = .tag
set .inUse = .inUse +1
set pl=GetWidgetLife(target)
call UnitDamageTarget(source,target, f*damage, true, .ranged, .atype, .dtype, .wtype )
set .inUse = .inUse -1
set .CurrentDamageTag = tg
set .CurrentDamageType = dt
set .CurrentAttackType = at
if(pl != GetWidgetLife(target) ) then
if(usefx) then
call DestroyEffect( AddSpecialEffectTarget(this.fxpath, target, this.fxattach) )
endif
return true
endif
endif
return false
endmethod
//=======================================================================================
// The same as damageTarget, but it forces a specific damage value, good if you already
// know the target.
//
method damageTargetForceValue takes unit source, unit target, real damage returns nothing
local damagetype dt=.CurrentDamageType
local attacktype at=.CurrentAttackType
local integer tg=.CurrentDamageTag
set .CurrentDamageType = .dtype
set .CurrentAttackType = .atype
set .CurrentDamageTag = .tag
if( usefx) then
call DestroyEffect( AddSpecialEffectTarget(this.fxpath, target, this.fxattach) )
endif
set .inUse = .inUse +1
call UnitDamageTarget(source,target, damage, true, .ranged, null, null, .wtype )
set .inUse = .inUse -1
set .CurrentDamageTag = tg
set .CurrentDamageType = dt
set .CurrentAttackType = at
endmethod
//=====================================================================================
// Notice: this will not Destroy the group, but it will certainly empty the group.
//
method damageGroup takes unit source, group targetGroup, real damage returns integer
local damagetype dt=.CurrentDamageType
local attacktype at=.CurrentAttackType
local integer tg=.CurrentDamageTag
local unit target
local real f
local integer count=0
local real hp
set .CurrentDamageType = .dtype
set .CurrentAttackType = .atype
set .CurrentDamageTag = .tag
set .inUse = .inUse +1
loop
set target=FirstOfGroup(targetGroup)
exitwhen (target==null)
call GroupRemoveUnit(targetGroup,target)
set f= this.getTargetFactorCore(source,target,false)
if (f!=0.0) then
set count=count+1
if(usefx) then
set hp = GetWidgetLife(target)
endif
call UnitDamageTarget(source,target, f*damage, true, .ranged, .atype, .dtype, .wtype )
if(usefx and (hp > GetWidgetLife(target)) ) then
call DestroyEffect( AddSpecialEffectTarget(this.fxpath, target, this.fxattach) )
endif
endif
endloop
set .inUse = .inUse -1
set .CurrentDamageTag=tg
set .CurrentDamageType = dt
set .CurrentAttackType = at
return count
endmethod
private static xedamage instance
private integer countAOE
private unit sourceAOE
private real AOEx
private real AOEy
private real AOEradius
private real AOEdamage
private static boolexpr filterAOE
private static boolexpr filterDestAOE
private static group enumgroup
private static rect AOERect
private static method damageAOE_Enum takes nothing returns boolean
local unit target=GetFilterUnit()
local xedamage this=.instance //adopting a instance.
local real f
local real hp
if( not IsUnitInRangeXY(target,.AOEx, .AOEy, .AOEradius) ) then
set target=null
return false
endif
set f=.getTargetFactorCore(.sourceAOE, target, false)
if(f!=0.0) then
set .countAOE=.countAOE+1
if(this.usefx) then
set hp =GetWidgetLife(target)
endif
call UnitDamageTarget(.sourceAOE,target, f*this.AOEdamage, true, .ranged, .atype, .dtype, .wtype )
if(this.usefx and (hp > GetWidgetLife(target) ) ) then
call DestroyEffect( AddSpecialEffectTarget(this.fxpath, target, this.fxattach) )
endif
endif
set .instance= this //better restore, nesting IS possible!
set target=null
return false
endmethod
private static method damageAOE_DestructablesEnum takes nothing returns boolean
local destructable target=GetFilterDestructable()
local xedamage this=.instance //adopting a instance.
local real dx=.AOEx-GetDestructableX(target)
local real dy=.AOEy-GetDestructableY(target)
if( dx*dx + dy*dy >= .AOEradius+EPSILON ) then
set target=null
return false
endif
set .countAOE=.countAOE+1
if(.usefx) then
call DestroyEffect( AddSpecialEffectTarget(this.fxpath, target, this.fxattach) )
endif
call UnitDamageTarget(.sourceAOE,target, this.AOEdamage, true, .ranged, .atype, .dtype, .wtype )
set .instance= this //better restore, nesting IS possible!
set target=null
return false
endmethod
//==========================================================================================
// will affect trees if damageTrees is true!
//
method damageAOE takes unit source, real x, real y, real radius, real damage returns integer
local damagetype dt=.CurrentDamageType
local attacktype at=.CurrentAttackType
local integer tg=.CurrentDamageTag
set .CurrentDamageType = .dtype
set .CurrentAttackType = .atype
set .CurrentDamageTag = .tag
set .inUse = .inUse +1
set .instance=this
set .countAOE=0
set .sourceAOE=source
set .AOEx=x
set .AOEradius=radius
set .AOEy=y
set .AOEdamage=damage
call GroupEnumUnitsInRange(.enumgroup,x,y,radius+XE_MAX_COLLISION_SIZE, .filterAOE)
if(.damageTrees) then
call SetRect(.AOERect, x-radius, y-radius, x+radius, y+radius)
set .AOEradius=.AOEradius*.AOEradius
call EnumDestructablesInRect(.AOERect, .filterDestAOE, null)
endif
set .inUse = .inUse -1
set .CurrentDamageTag = tg
set .CurrentDamageType = dt
set .CurrentAttackType = at
return .countAOE
endmethod
method damageAOELoc takes unit source, location loc, real radius, real damage returns integer
return .damageAOE(source, GetLocationX(loc), GetLocationY(loc), radius, damage)
endmethod
//==========================================================================================
// only affects trees, ignores damageTrees
//
method damageDestructablesAOE takes unit source, real x, real y, real radius, real damage returns integer
set .instance=this
set .countAOE=0
set .sourceAOE=source
set .AOEx=x
set .AOEradius=radius*radius
set .AOEy=y
set .AOEdamage=damage
//if(.damageTrees) then
call SetRect(.AOERect, x-radius, y-radius, x+radius, y+radius)
call EnumDestructablesInRect(.AOERect, .filterDestAOE, null)
//endif
return .countAOE
endmethod
method damageDestructablesAOELoc takes unit source, location loc, real radius, real damage returns integer
return .damageDestructablesAOE(source,GetLocationX(loc), GetLocationY(loc), radius, damage)
endmethod
//'friend' with the library init
static method structInit takes nothing returns nothing
set .AOERect= Rect(0,0,0,0)
set .filterAOE= Condition(function xedamage.damageAOE_Enum)
set .filterDestAOE = Condition( function xedamage.damageAOE_DestructablesEnum)
set .enumgroup = CreateGroup()
endmethod
endstruct
private function init takes nothing returns nothing
set dmger=CreateUnit(Player(15), XE_DUMMY_UNITID , 0.,0.,0.)
call UnitAddAbility(dmger,'Aloc')
call xedamage.structInit()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library xecollider initializer init requires xefx, xebasic
//****************************************************************
//*
//* xecollider 0.8
//* --------------
//* A xecollider object is a special effect that has a collision
//* size that can trigger a hit event and also many options to
//* configure its automatic movement.
//*
//* Please use .terminate() instead of .destroy() this ensures
//* that it will be safe to destroy it (else you would have to
//* worry about destroying it during the animation loop/etc.)
//*
//* To use this struct is a little different than the other
//* current parts of xe. Instead of just creating the xecollider
//* (which works, but it would only be a xefx that can have speed)
//* you probably need to make it do something special on the
//* unit hit event... For this reason, you need to make a new
//* struct extending xecollider that declares an onUnitHit method
//* you may also declare a loopControl method, very useful, can
//* help you reduce 'attaching'.
//*
//****************************************************************
//================================================================
globals
private constant real DEFAULT_COLLISION_SIZE = 50.0 // These are defaults, on one hand you can change them
private constant real DEFAULT_MAX_SPEED = 1500.0 // on the other hand, if a spell relies on the defaults
private constant real DEFAULT_EXPIRATION_TIME = 5.0 // changing them would make the behavior vary...
private constant real PI2 = 6.28318 //It might not be wise to change this
endglobals
//===========================================================================
// So, this exists merely so you can declare your own event handler methods
// if interfaces make your brain blow out, please skip the next four lines.
//
private interface eventHandler
method onUnitHit takes unit hitTarget returns nothing defaults nothing
method loopControl takes nothing returns nothing defaults nothing
endinterface
//===========================================================================
struct xecollider extends eventHandler
// use terminate() instead of .destroy() to "kill" the collider.
// don't worry, terminate will call destroy automatically.
//============================================================================
// delegates:
// We are delegating a xefx object so that people call all the xefx methods
// and member from a xecollider object. This means that from a user
// perspective a xecollider is also an instance of xefx.
//
// Notable ones are: .x , .y , .fxpath and .z ,
// check out xefx's documentation for more info.
//
private delegate xefx fx
//##==========================================================================
// public variables:
//
public real expirationTime = DEFAULT_EXPIRATION_TIME
// Movement speed for the missile.
public real speed = 0.0
// Speed added per second (notice you can use a negative value here)
public real acceleration = 0.0
// If there is acceleration, it is wise to have a cap...
public real maxSpeed = DEFAULT_MAX_SPEED
public real minSpeed = 0.0
public real angleSpeed = 0.0 //The increment in radians per second to the
// direction angle, allows curved movement.
private static integer lastSeen = 0
private group seen
private boolean silent = false
//##==========================================================================
// public methods:
//
//----
// Well, it is a good idea to actually create the missiles.
// notice that if your custom missile struct needs to declare its own create
// method, you can call this as allocate(x,y,dir).
//
// Sorry, no Loc version.
//
public static method create takes real x, real y, real dir returns xecollider
local xecollider xc= xecollider.allocate()
set xc.fx = xefx.create(x,y,dir)
set xc.dir=dir
set xecollider.V[xecollider.N]=xc
set xecollider.N=xecollider.N+1
if(xecollider.N==1) then
call TimerStart(xecollider.T, XE_ANIMATION_PERIOD, true, xecollider.timerLoopFunction )
endif
if(.lastSeen < integer(xc)) then //with this I do group recycling
set .lastSeen = integer(xc)
set xc.seen = CreateGroup()
endif
return xc
endmethod
//----
// The direction is just the angle in radians to which the missile's model faces
// and the automatic movement uses.
//
method operator direction takes nothing returns real
return this.dir
endmethod
method operator direction= takes real v returns nothing
set this.dir=v
set this.fx.xyangle=v
endmethod
//----
// The collisionSize
//
method operator collisionSize takes nothing returns real
return this.csize
endmethod
method operator collisionSize= takes real value returns nothing
set this.csize = value
//good long attribute name, but we use csize in the loop
//don't worry this gets inlined, it would also be helpful if
//I ever decide to add a control for assignment.
endmethod
//---
// targetUnit is a unit to follow (or try to follow), notice that homing
// options require an angleSpeed different to 0.0
//
public method operator targetUnit takes nothing returns unit
return this.homingTargetUnit
endmethod
public method operator targetUnit= takes unit u returns nothing
if(u==null) then
set this.angleMode= ANGLE_NO_MOVEMENT
else
set this.angleMode= ANGLE_HOMING_UNIT
endif
set this.homingTargetUnit=u
endmethod
//----
// targetPoint is a point to reach (or try to reach), notice that homing
// options require an angleSpeed different to 0.0
//
public method setTargetPoint takes real x, real y returns nothing
set this.angleMode= ANGLE_HOMING_POINT
set this.homingTargetX=x
set this.homingTargetY=y
endmethod
public method setTargetPointLoc takes location loc returns nothing
set this.angleMode= ANGLE_HOMING_POINT
set this.homingTargetX=GetLocationX(loc)
set this.homingTargetY=GetLocationY(loc)
endmethod
//----
// Call this in case you used targetUnit or TargetPoint so the missile
// forgets the order to home that target.
//
public method forgetTarget takes nothing returns nothing
set this.angleMode = ANGLE_NO_MOVEMENT
endmethod
public method operator rotating takes nothing returns boolean
return (angleMode ==ANGLE_ROTATING)
endmethod
public method operator rotating= takes boolean val returns nothing
if(val) then
set angleMode = ANGLE_ROTATING
elseif (angleMode == ANGLE_ROTATING) then
set angleMode = ANGLE_NO_MOVEMENT
endif
endmethod
method terminate takes nothing returns nothing
set this.dead=true
set this.fxpath=""
endmethod
/* declare hiddenDestroy so people don't call directly on the delegate xefx */
method hiddenDestroy takes nothing returns nothing
set silent = true
call terminate()
endmethod
//--------
private static timer T
private static integer N=0
private static xecollider array V
private static code timerLoopFunction //I use a code var so create can be above the timerloop function, more readable
private boolean dead=false
private real csize = DEFAULT_COLLISION_SIZE
private real dir
private static constant integer ANGLE_HOMING_UNIT =1
private static constant integer ANGLE_HOMING_POINT=2
private static constant integer ANGLE_NO_MOVEMENT=0
private static constant integer ANGLE_ROTATING=3
private integer angleMode =0
private unit homingTargetUnit = null
private real homingTargetX
private real homingTargetY
private method onDestroy takes nothing returns nothing
call GroupClear(this.seen)
if(this.silent) then
call this.fx.hiddenDestroy()
else
call this.fx.destroy()
endif
endmethod
private static xecollider cinstance
private static real newx
private static real newy
private static group enumGroup
private static boolexpr enumBoolexpr
private static unit array picked
private static integer pickedN
static method timerLoop takes nothing returns nothing
local integer i=0
local integer j=0
local integer c=0
local xecollider this
local real d
local real ns
local real wa
local real df1
local real df2
local unit u
loop
exitwhen (i== xecollider.N )
set this=.V[i] //adopt-a-instance
set this.expirationTime = this.expirationTime - XE_ANIMATION_PERIOD
if(.dead or (this.expirationTime <=0.0) ) then
call this.destroy()
else
set ns=this.angleSpeed*XE_ANIMATION_PERIOD
if (ns!=0.0) then
if(this.angleMode== ANGLE_HOMING_UNIT ) then
set u=this.homingTargetUnit
if ( (GetUnitTypeId(u)==0) or IsUnitType(u, UNIT_TYPE_DEAD) ) then
set this.angleMode= ANGLE_NO_MOVEMENT
set this.homingTargetUnit = null
else
set this.homingTargetX=GetUnitX(u)
set this.homingTargetY=GetUnitY(u)
endif
set u=null
endif
if (this.angleMode == ANGLE_ROTATING) then
//nothing (ns is already ns)
elseif( this.angleMode != ANGLE_NO_MOVEMENT) then
if(ns<=0) then
set ns=-ns
endif
set wa=Atan2(this.homingTargetY - this.y , this.homingTargetX-this.x)
//if(wa<0.0) then
// set wa=wa+PI2
//endif
set df1=wa-this.dir
set df2=(PI2+wa)-this.dir
if (df1<=0) then
if(df2<=0) then
if(df2>=df1) then
set df1=df2
endif
else
if(-df1>=df2) then
set df1=df2
endif
endif
else
if(df2<=0) then
if(-df2<=df1) then
set df1=df2
endif
else
if(df2<=df1) then
set df1=df2
endif
endif
endif
if(df1<=0) then
if(-df1>=ns) then
set ns=-ns
else
set ns=df1
endif
else
if(df1<=ns) then
set ns=df1
endif
endif
else
set ns = 0
endif
set d=this.dir
set d = d + ns
if(d>=PI2) then
set d=d - PI2
elseif(d<0) then
set d=d + PI2
endif
set this.dir = d
set this.xyangle = d
endif
// function calls are expensive, damned we are, long code inside of loop
// correct software dev. tells us this should go to another function,
// but this is Jass, not real life.
set .cinstance = this
set ns = this.speed + this.acceleration*XE_ANIMATION_PERIOD
if ( ns<this.minSpeed) then
set ns=this.minSpeed
elseif (ns>this.maxSpeed) then
set ns=this.maxSpeed
endif
set d=((this.speed+ns)/2) * XE_ANIMATION_PERIOD
set this.speed=ns
set .newx= .x+d*Cos(this.dir)
set .newy= .y+d*Sin(this.dir)
set .x=.newx
set .y=.newy
set xecollider.pickedN = 0
call GroupEnumUnitsInRange( .enumGroup, .newx, .newy, .csize + XE_MAX_COLLISION_SIZE, .enumBoolexpr)
call GroupClear(this.seen)
set j=0
loop
exitwhen (j==xecollider.pickedN)
call GroupAddUnit( this.seen, xecollider.picked[j])
set j=j+1
endloop
set .V[c]=this
set c=c+1
if( this.loopControl.exists and not this.dead ) then
call this.loopControl()
endif
endif
set i=i+1
endloop
//call BJDebugMsg("}")
set xecollider.N=c
if(c==0) then
call PauseTimer(xecollider.T)
endif
endmethod
private static method inRangeEnum takes nothing returns boolean
local xecollider this= .cinstance //adopt-a-instance
local unit u=GetFilterUnit()
if not IsUnitType(u, UNIT_TYPE_DEAD) and not(this.dead) and (GetUnitTypeId(u)!=XE_DUMMY_UNITID) and IsUnitInRangeXY(u, .newx, .newy, .csize) then
// ah, the advantages of a standardized unit id...
set xecollider.picked[xecollider.pickedN] = u
set xecollider.pickedN=xecollider.pickedN + 1
if not IsUnitInGroup (u, this.seen ) then
call this.onUnitHit(u)
endif
endif
set u=null
return false
endmethod
//============================================================================
// you aren't supposed to call doInit yourself, try not to do it.
//
static method doInit takes nothing returns nothing
set xecollider.enumGroup = CreateGroup()
set xecollider.enumBoolexpr = Condition( function xecollider.inRangeEnum)
set xecollider.timerLoopFunction = (function xecollider.timerLoop)
set xecollider.T=CreateTimer()
endmethod
endstruct
private function init takes nothing returns nothing
call xecollider.doInit()
endfunction
endlibrary
xe
--
Q. Why xe?
A. As the caster system grew bigger vJass also appeared, there are also a lot
of things in the caster system that could have been done better but cannot
be fixed without dropping the caster system's function interface.
Q. No, really, WHY IS IT NAMED XE?
A. I have no idea.
Q. What's wrong with the caster system?
A. Instead of answering that I will list what's right with xe:
* It is modular. You can make a whole spell with just xebasic which is just
like a "constant package" that comes with the dummy model and unit. All the
other parts are disposable or replaceable.
Still, I made them and will probably keep making new modules as I advance,
right now xe can only do some basic functions, still cannot 100% replace
the caster system in functionality, certain parts like the parabolic
projectiles most notably, don't have a xe module yet, maybe later...
xebasic is so minimal I personally hope people could use it on their spells
and systems as a way to make it common to use these constants as constants of
that kind are often required to make things work.
* It is quite OOP, this is more related to the modules themselves, I wanted it
to exploit OOP for two reasons: 1) It prevents the 'ultra long function calls'
disease that has plagued the caster system since the beginning of time. 2) I
personally think it is easier this way instead of memorizing function names
and their argument lists.
xebasic
-------
xebasic is the nucleous of all xe, in order to use a xe module you would most
likely need xebasic. It is also meant to be the only part of xe that most users
would really need to tweak for their map.
This section is supposed to be a rapid guide on copying xebasic. The rest of
the xe modules should be rather easy to implement (just copy the 'trigger' that
contains it to the map).
1) Make a backup of your map.
2) Get vJass support. The most usual way would be using the newgen pack. There
are plenty of other ways. I for example do my vJass coding on Linux using just
jasshelper.exe, WINE and some editor tricks using a tool called Warcity.
Getting vJass to work is a wide area, if just installing and using the
"Jass newgen pack" doesn't work to you, please request/search help somehow. As
of now there really is no vJass support in OS/X, so you would need virtualization
and things of that style.
-- Note: You can have two maps open in the editor, and it is the only way to
make copy and paste work.
3) Copy the model, in this map's import manager you may find dummy.mdx, select
it and export it to some temp folder, then go to your map and import it, use
war3mapimported\dummy.mdx for path.
Please save the map immediatelly after importing the model to prevent it from
getting unimported due to a rare WE bug.
4) Copy the dummy unit: In the object editor under neutral passive, you may
find the dummy unit, select it, go to 'edit' then click copy. Now switch to
your map's object editor and use 'paste'.
5) Write down the rawcode: While you are in the object editor select your map's
recently pasted dummy unit, then go to the 'view' menu and click the option to
show values as raw data. Now take a look to the selected unit type. It will now
come with a code like "ewsp:e001", the last four characters of the code are
what matter, write them down.
6) Copy this map's xebasic trigger to your map.
7) Update your map's xebasic: change the value assigned to XE_DUMMY_UNITID to
'XXXX' where XXXX is the four character code you wrote down in step 5.
8) Save your map and pray, if it compiles correctly then it is done. Make sure
to test (after implementing) whatever needed you to install xebasic. If it
doesn't work correctly then it is likely you made a mistake when copying the
unit or the model or updating the rawcode.
9) Update the other values if you think it is necessary.
Using xebasic
-------------
Well, once you state your trigger/spell/system requires xebasic, just use
its constants, on a map that has implemented xebasic XE_DUMMY_UNITID will be
your key to creating dummy units, just remember to add it 'Aloc' ...
Contact
-------
I got a forum that's supposed to hold questions related to my systems at:
http://wc3campaigns.net/vexorian
I'd really appreciate that you used that forum for your questions, for starters
it is a lot more likely I would actually find the questions in that case.
Changelog
---------
0.5:
- xecollider.terminate now prevents events from firing.
- fixed a unit handle index kidnap in inRangeEnum (xecollider).
- fixed a small documentation bug about xecollider.terminate
- xecast's anti-AI protection now pauses the unit instead of removing the
ability (since that seemed to have bad side effects)
- xecast is now able to deal with units not visible to the player by setting
a constant to true.
- Due to technical split, xecast.castOnTarget now only takes unit and not
widget, old castOnTarget that takes widget has been renamed castOnWidgetTarget.
- xecollider now will not miss the detection of certain units that get inside
the range too fast anymore, however now creates a group per collider (damn) I
hope to find a better solution.
- Added a notice in xepreload's documentation about order events firing during
the preload.
- Added gem of double green fire
0.4:
- More documentation fixes.
- xecast no longer has double frees when using create/Basic/A and the
AOE/group methods.
- damageDestructablesInAOE now actually works and does not leak a xedamage
reference.
- damageTarget now returns true if it was succesful and false if it wasn't.
- xefx's recycle bin now extends array.
- added rune of illusions sample.
0.3:
- More documentation fixes.
- xefx requires xebasic in the library declaration (as it was supposed to)
- xefx now creates the effects at the correct place (used to consider pathing
during creation for some reason).
- xebasic sample uses 197.0 for max collision size since that's the default in
warcraft 3 (The default + 1)
- xebasic now includes an explanation for max collision size and its effects.
- added useSpecialEffect to xedamage
- included BoundSentinel
- added xecollider
- xedamage's required unittype field is not ignored anymore.
- Added the fireNovaStrike example.
0.2:
- Fixed a bug with xecast.castInPoint basically ignoring the arguments.
- Fixed a bug with xecast.createBasic ignoring the order id.
- Fixed documentation bugs.
- Added xedamage.
- Added sheep staff sample.
0.1 : Initial release
//TESH.scrollpos=5
//TESH.alwaysfold=0
xepreload
---------
xepreload attacks the ability preloading issue. It is a good idea to preload
abilities you are going to add to units during the game to avoid the typical
"first-cast freeze". xepreload exploits jasshelper's inline and a timer to
minimize the time spent preloading each ability.
Install
-------
Copy the xepreload trigger to your map.
Usage
-----
_____________________________________________________________________________
function XE_PreloadAbility takes integer abilid returns nothing
----
Preloads the ability, pass it an ability id (rawcode). Notice that this
function may only work during map init. In order to use it in a library's
initializer, make sure the library requires xepreload.
* Please notice that the ability removal might trigger certain order events, try
ignoring xe dummy units in those events if necessary.
//TESH.scrollpos=95
//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 create and createBasic , 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=30
//TESH.alwaysfold=0
xefx
----
This module just allows you to have movable special effects, they are actually
dummy units, you can do plenty of things like changing their position, their
height, their rotation (in the xy and in the z axis as well), color, and things
like that. It is all about assigning attributes, the only two important methods
xefx objects have are create and destroy. There are other accessory methods.
implementation
--------------
Just copy the xefx trigger to your map.
xefx object
-------------
__________________________________________________________________________________________________
static method create takes real x, real y, real facing returns xefx
--
This is the create method, it will make a new xefx for you to use, there are
initial values you must specify, like the x,y coordinate and the facing angle.
facing is in radians.
Eg. set myfx = xefx.create()
__________________________________________________________________________________________________
method destroy takes nothing returns nothing
--
This just destroys your xefx object. (call myfx.destroy() )
* List of attributes *
________________________________________________________________________________
string fxpath
----
Determines the model of the special effect, yes, you may change it after
assigning it if necessary to change the model path.
Example: set myfx.path = "abilities\thisisamadeup\modelpath.mdl"
________________________________________________________________________________
method hiddenReset takes string newfxpath, real newfacing returns nothing
----
Resets the xefx with a new effect path and a new facing angle (radians).
Avoids playing the dead animation of the previous model, notice that it is
impossible to do this withouth playing the birth animation of the new model
and without playing the sound of the dead animation of the previous model.
Example: call myfx.hiddenReset("abilities\thisisamadeup\modelpath.mdl", 0.4)
________________________________________________________________________________
method hiddenDestroy takes nothing returns nothing
----
Destroys the xefx without playing the death animation of the model. Notice
that it is impossible to do this without playing the sound of the
dead animation.
Example: call myfx.hiddenDestroy()
________________________________________________________________________________
real x
real y
real z
----
Determine the position of your special effect, you can keep moving the
effect in a periodic loop, etc.
Example: set myfx.x=myfx.x + 65.0
set myfx.y=GetUnitY(u)
set myfx.z=JumpParabola(t)
________________________________________________________________________________
real xyangle
----
The angle in the xy plane, also called 'facing' angle. (Note: uses radians)
Example: set myfx.xyangle = AngleBetweenPoints(target, source)*bj_DEGTORAD
________________________________________________________________________________
real zangle
----
The angle in the z-axis (inclination?), (Note: uses radians)
Example: set myfx.zangle = bj_PI/2 //Now the model will look towards the sky
________________________________________________________________________________
integer r
integer g
integer b
integer a
----
Well, the model's vertex coloring in RGB , a is the opacity value (use
values from 0 to 255 here)
Example: set myfx.r=255
set myfx.g=0
set myfx.b=255
set myfx.a=128
______________________________________________________________________________________
method recolor takes integer r, integer g , integer b, integer a returns nothing
----
This one assigns all the color values in one pass.
________________________________________________________________________________
real scale (write-only)
----
Allows you to resize the xefx object, the default scale is 1.
Example: set myfx.scale=2.0 //double size (in fact 8x)
set myfx.scale=0.5 //half size (in fact 1/8x)
________________________________________________________________________________
player owner
----
For some reason you might want to change ownership of the effect, for
example, if you use abilityid (see bellow) and the ability does damage.
Example: set myfx.owner = GetOwningPlayer(GetTriggerUnit() )
________________________________________________________________________________
integer abilityid
----
Well, you may use a xefx object to grab a passive ability, perhaps you need
it for ye candy reasons or you want to use it as a damage dealer.
Example: set myfx.abilityid = 'Hphf'
________________________________________________________________________________
integer abilityLevel
----
And with this one, you change the level of that ability.
Example: set myfx.abilityLevel = GetUnitAbilityLevel( u, s)
________________________________________________________________________________
playercolor teamcolor
----
The team color to use for the model.
Example: set somevar.teamcolor=PLAYER_COLOR_RED
set somevar.teamcolor=GetPlayerColor(GetOwningPlayer(u))
________________________________________________________________________________
method flash takes string modelpath returns nothing
----
It shows the dead animation of the model specified by modelpath. This is
in case you need this sort of eye candy.
________________________________________________________________________________
method ARGBrecolor takes ARGB color returns nothing
----
If you got the ARGB library in your map, xefx then acquires the ARGBrecolor
method, that you can use to use an ARGB object to recolor the fx's model,
in a way similar to how recolor() works.
//TESH.scrollpos=232
//TESH.alwaysfold=0
xedamage
------
When blizzard released UnitDamageTarget and UnitDamagePoint there were some
issue, both had a lot of parameters that were undocumented, but more importantly
DamagePoint was not a good enough solution, UnitDamagePoint causes issues with
apple players and it also misses ways to specify what sort of unit to target.
What many people missed was a way to specify these things in a similar way
to targets allowed in the object editor.
Determining and configuring valid targets and things like damage factors is
always a hassle, xedamage can automatize that process in a nice way.
xedamage is the successor of damageoptions it is also a little less messy.
bitflags are not used anymore, instead xedamage uses struct members to specify
most of it. So, when using xedamage, you may end up feeling like feeling a
table of fields. An example is worth a thousand of words:
local xedamage d=xedamage.create()
set d.damageAllies=true // also harm allies
set d.exception = UNIT_TYPE_FLYING // don't harm fliers
call d.factor ( UNIT_TYPE_STRUCTURE, 0.5) // half damage to buildings
set d.dtype = DAMAGE_TYPE_UNIVERSAL // Do universal damage.
//Execute AOE damage using those options:
call d.damageAOE(GetTriggerUnit(), point_x, point_y, 250.0, 450)
But there is more, xedamage also has a couple of members like isInUse() that
would add some event responses for the damaged unit event. That will allow you
to recognize when xedamage was in use to inflict the damage, the damagetype and
attacktype used, and even a custom tag that you could specify as a xedamage
field, this would allow you to have a bridge between xedamage and certain damage
detection systems that rely on such things.
About damage factors and dummy damages
----------------------------------------
Typically xedamage does some dummy damage to test the damage factor of a unit
because blizzard has not provided us with such a native... This damage is
invisible to the player, but not invisible to spells and damage detect systems
which could be a problem.
By default, the dummy damage is 0.01 and it is a common practice in these
spells and systems to ignore such low damage values. However, a bug from
blizzard makes it so we require a HUGE damage of 20.0 to be actually able to
detect all armor resistances. Something as low as 0.01 will not even detect
hero resistance. This blows. So if you want xedamage to consider resistance
correctly, you should use a test damage of 1/(armor reduction you wish to detect)
(change the FACTOR_TEST_DAMAGE constant in the xedamage trigger).
Of course, if you do this change, then you'll confuse spells/systems that
detect damage, that's the reason I have added a variable isDummyDamage to
xedamage (call it xedamage.isDummyDamage ) that you may read during a damage
event to ignore this dummy damage.
implementation
--------------
Just copy the xedamage trigger to your map.
xedamage object
----------------
xedamage fields include a bunch of boolean fields that you can set to
true/false, they hopefully got self-explaining names, I just list them and
their default values, remember I got a whole forum in wc3c, if you got doubts
don't forget to ask questions there:
boolean damageSelf = false
boolean damageAllies = false
boolean damageEnemies = true
boolean damageNeutral = true
boolean visibleOnly = false
boolean deadOnly = false
boolean alsoDead = false
boolean damageTrees = false
Something to notice is that damageTrees is probably only considered by AOE
damage and perhaps by some spells using xedamage to specify targets.
_______________________
boolean ranged = true
-----------------------
This is a special boolean field, it doesn't really determine valid targets
like the ones above, it merely determines if the damage should be considered
ranged, this merely determines how the AI reacts to the damage, a lot of people
don't care that much and just use true, that's the default.
___________________________________________________
damagetype dtype = DAMAGE_TYPE_UNIVERSAL
attacktype atype = ATTACK_TYPE_NORMAL
weapontype wtype = WEAPON_TYPE_WHOKNOWS
---------------------------------------------------
These fields determine the types to use in the damage native, the damage type
usually determines if the damage would be magical, universal (ultimate) or
physical, attacktype determines armor stuff, and weapon type determines sound.
There's some work on knowing what each combination does, for example:
http://www.wc3campaigns.net/showthread.php?t=100752
Some basic knowledge: For spells it is fine to use ATTACK_TYPE_NORMAL, and
that is default in xedamage, wtype usually doesn't need to be updated . dtype
is the important one, _UNIVERSAL makes the damage behave as a ultimate, there
is also _UNKNOWN which seems to ignore a lot of things, _FIRE, _LIGHTNING and
similar damagetypes are all magical, while DAMAGE_TYPE_NORMAL is physical.
Ultimate damage can harm both ethereal and spell immune units, magical damage
harms ethereal (with bonus) but cannot harm spell immune, physical damage can't
hurt ethereal units.
___________________________
integer tag = 0
---------------------------
This little field allows you to have a custom damage response CurrentDamageTag
(see bellow for event responses) basically, you can use whatever you want here
it all depends on what the thing that uses the event responses will do about it.
____________________________
unittype exception
unittype required
----------------------------
Learn a little about unittype, it is what blizzard calls unit classifications,
basically a unit can be a building, a flier, etc. exception specifies a
unittype that is required for a unit to receive damage. required, does the
opposite, for example:
set d.exception = UNIT_TYPE_FLYING
set d.required = UNIT_TYPE_SUMMONED
This xedamage instance can only hit ground summoned units.
* factor stuff:
Factor options in xedamage, specify some rules, if those rules are matched,
the damage will be multiplied by the specified factor, you can use negative
factor, half factor, etc. Notice that when using negative factors, these
things stack, so if you make a xedamage instance that does negative damage to
undead and negative damage to allies, it might do possitive damage to undead
allies.
If the total damage factor is 0.0 it is the same as adding an exception.
_____________________________
real allyfactor = 1.0
-----------------------------
If the xedamage can affect allies (damageAllies is true), then the damage
will be multiplied by allyfactor, for example, you can make a spell that does
half damage to allies. Or one that heals allies while hurting enemies.
_____________________________________________________________
method factor takes unittype ut, real fc returns nothing
-------------------------------------------------------------
This method allows you to add a specific factor for a unit type, by default
a xedamage instance allows up to three of these rules, you can increase this
cap by increasing MAX_SUB_OPTIONS in the top of the library.
For example:
call d.factor(UNIT_TYPE_STRUCTURE, 0.5)
call d.factor(UNIT_TYPE_SUMMONED, 2.0)
This instance of xedamage would do half damage to structures and double
damage to summoned units. Notice these things stack, so if for some reason
there was a "summoned building" in your map, it would do 100% damage.
_________________________________________________________________________
method abilityFactor takes integer abilityId, real fc returns nothing
-------------------------------------------------------------------------
Let's say you want a passive ability that makes you receive half damage
from fire spells, a way to do this is to make a whole damage detection system
and use xedamage's event responses to find out fire was used in the spell.
Then block the damage somehow... another way is to just change the spell so
when a unit has such passive ability, the damage is multiplied by 0.5 .
The 3 rules cap also works with abilityFactor and can as well be increased
by changing MAX_SUB_OPTIONS.
call d.abilityFactor( 'A000', 0.5)
____________________________________________________________________________
method useSpecialEffect takes string path, string attach returns nothing
----------------------------------------------------------------------------
This will make a special effect show up whenever succesful damage is done
using the xedamage object.
call d.useSpecialEffect("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl","origin")
xedamage methods
----------------
There would be little point in using all those fields without the methods that
make use of them.
____________________________________________________________________________________
method damageTarget takes unit source, unit target, real damage returns boolean
------------------------------------------------------------------------------------
A single unit targetting method, it will consider all the rules we just
reviewed when doing the damage, if the damage would get a factor of 0.0 it will
not perform any damage.
local unit u = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local xedamage d= xedamage.create()
set d.dtype = DAMAGE_TYPE_FIRE
set d.damageAllies = true
set d.allyfactor = -1.0
call d.damageTarget(u,t, 100)
call d.destroy()
This would be a simple spell that does 100.0 fire damage on enemy units or
heals for 100 hitpoints to allies.
This method returns true if non zero damage was done, and false otherwise.
____________________________________________________________________________________________
method damageTargetForceValue takes unit source, unit target, real damage returns nothing
---------------------------------------------------------------------------------------------
This is an analogue for damageTarget, but it will IGNORE every specified
field, and try to do the specified damage, no matter the circumstances, however
it will use the xedamage instances' dtype, atype and tag for the xedamage event
responses (see bellow).
This could be useful when you already know the factor
(you have previously used getTargetFactor)
__________________________________________________________________________
method allowedTarget takes unit source, unit target returns boolean
--------------------------------------------------------------------------
Returns true if xedamage would do a damage different than 0.0 in this case.
It is useful if you intend to use xedamage to configure a spell's allowed
targets.
if ( d.allowedTarget(u,t) ) then
//...
____________________________________________________________________________
method getTargetFactor takes unit source, unit target returns real
----------------------------------------------------------------------------
For applications similar to allowedTarget, this returns the whole damage
factor, so you can decide what to do based on it.
set fc = d.getTargetFactor(u, t)
________________________________________________________________________________________
method damageGroup takes unit source, group targetGroup, real damage returns integer
----------------------------------------------------------------------------------------
This method does what damageTarget does, but it executes it on a whole unit
group, probably faster than calling damageTarget on every unit in the group.
Notice this method will empty the provided group.
_________________________________________________________________________________________________
method damageAOE takes unit source, real x, real y, real radius, real damage returns integer
method damageAOELoc takes unit source, location loc, real radius, real damage returns integer
-------------------------------------------------------------------------------------------------
It will perform damage on units and destructables (if damageTrees is true)
that are inside the circle, notice collision sizes are considered. The returned
value is the number of targets that were affected by the function, the loc
version allows you to use a location instead of the more sane x,y coordinates.
______________________________________________________________________________________________________________
method damageDestructablesAOE takes unit source, real x, real y, real radius, real damage returns integer
method damageDestructablesAOELoc takes unit source, location loc, real radius, real damage returns integer
-----------------------------------------------------------------------------------------------------------
This one damages all the destructables in a circle, regardless of damageTrees
being true or not.
xedamage static method
-----------------------
________________________________________________________________________________________________
static method getDamageTypeFactor takes unit u, attacktype a, damagetype d returns real
------------------------------------------------------------------------------------------------
This method is used by one of the factor methods up there, thought it would be
useful to make it available as a public method, it just returns the factor that
a specific attacktype/damagetype couple would do on a certain unit u:
set fc = xedamage.getDamageTypeFactor( GetTriggerUnit(), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE)
Would return 1.0 if the unit is a normal unit, 1.66 if it is ethereal and 0 if it is spell immune.
xedamage event responses
------------------------
______________________________________________________________________
boolean isDummyDamage
----------------------------------------------------------------------
This variable is true when xedamage has performed "dummy damage" see
above for more details.
______________________________________________________________________
static method isInUse takes nothing returns boolean
----------------------------------------------------------------------
This method will return true if xedamage was in use during a damaged event,
this would help you determine if the damage was inflicted by a xedamage call.
_______________________________________________________________________
readonly static damagetype CurrentDamageType=null
readonly static attacktype CurrentAttackType=null
readonly static integer CurrentDamageTag =0
-----------------------------------------------------------------------
When isInUse() returns true, you can use these event responses to determine
how was the damage inflicted, you can get the damage type, the attack type and
the tag (specified by the field tag in the xedamage object) of the call.
if (xedamage.isInUse() ) then
if(xedamage.CurrentDamageType == DAMAGE_TYPE_FIRE ) then
call BJDebugMsg(R2S(GetEventDamage())+" fire damage was inflicted to "+GetUnitName(GetTriggerUnit() ) )
endif
call BJDebugMsg("tag used: "+I2S(xedamage.CurrentDamageTag) )
endif
--
The FireNovaStrike sample attempts to be a quick example on
how to use xedamage.
//TESH.scrollpos=18
//TESH.alwaysfold=0
xecollider
----------
A specialization xefx, aids at creating 2D missiles with collision and speed
and that sort of stuff, notice you'd usually have to make a new struct and
extend xecollider from it so you can declare your own methods for handling
the hit event.
implementation
--------------
First of all, you need xefx, after you implement xefx, you may just copy
the xecollider trigger to your map.
I'd also recommend you to implement the BoundSentinel library to prevent
crashes related to the xecolliders moving too down in the map, you can find the
BoundSentinel in the "Extras" trigger category.
Notice this needs at least jasshelper 0.9.E.0 to compile.
xecollider object
-----------------
__________________________________________________________________________________________________
static method create takes real x, real y, real dir returns xecollider
- - - ----------
This is the create method, it will make a new xecollider object for you to
use, If you are extending xecollider and wish to have a custom create method
on your struct, remember that you will need to call allocate(x,y,dir)
set somevariable = myxecollider.create( GetUnitX(u), GetUnitY(u), angl )
_________________________________________________________________________________________________
method terminate takes nothing returns nothing
- - --------------
Call terminate() when you wish to 'kill' the missile, it will call .destroy()
automatically, I recommend you not to call .destroy() manually. Use onDestroy
to detect when it was called. You can use .x and .y on onDestroy...
Example: call somevariable.terminate()
_____________________________________________________________________________________________________
delegate xefx
-
A xecollider object is practically also a xefx object, you may call all of
the members in xefx for your disposal, including x,y,z (to change the position)
and height of the missile) and fxpath (the model used by the missile) please,
read the xefx documentation as it includes a lot of members used by xecollider.
________________________________________________________________________________
real expirationTime
- ------------------------------------------------------------
The missile will die after expirationTime seconds, notice this is just a
variable so you can modify and read it as you will, when the expirationTime
ends, the missile is 'killed' so onDestroy will be called. If you do not assign
this manually, the expirationTime will be 100.0 by default
Example: set somevar.expirationTime = 3.0 // Die after three seconds.
________________________________________________________________________________
real direction
- -----------------------------------------------------------------
Direction determines two things, the facing angle of the missile and the
direction at which the missile will move (if you enable speed, etc) Since
just about everything else uses radians this does as well.
Example: set somevar.direction = 0.5 * bj_PI // face north...
________________________________________________________________________________
real collisionSize
- -------------------------------------------------------------
xecollider wouldn't have that name if it wasn't for collision, if a unit's
collision circle collides with the xecollider's collisionSize, then your
onUnitHit method will be called. Notice that you can change collisionSize
dynamically.
Example: set somevar.collisionSize = 50.0
________________________________________________________________________________
real speed = 0.0
real acceleration = 0.0
real maxSpeed = DEFAULT_MAX_SPEED
real minSpeed = 0.0
- ------------------------------------------------------
The automatic movement is just 2D over the xy axis, so is the collision, simple
spells don't usually mess a lot with 3D... Speed would be the distance a
xecollider can move in a second, the acceleration is an increment of speed
per second, notice acceleration can be negative.
maxSpeed and minSpeed are caps for the speed in case acceleration was used.
Initially a missile has zero speed and zero acceleration , the minimum speed
is 0, which means a negative acceleration can never make speed go negative
(which would probably make the missile look as it is going backwards) The
default max speed is 1500, but you can tweak that by changing the constant
at the top of the xecollider library.
________________________________________________________________________________
real angleSpeed = 0.0
- ------------------------------------------------
Although it lacks a more formal name, this is the increment to the direction
angle during a second, this like the other variables, is in radians. It will
allow you to have missiles with curved movement, angleSpeed is also used by
homing (see bellow)
________________________________________________________________________________
unit targetUnit = null
- ---------------------------------------------------------
By assigning this member to a living unit, the xecollider will home towards
the unit's position. Notice that for this to work it will require an angleSpeed
higher than 0.0.
________________________________________________________________________________
method setTargetPoint takes real x, real y returns nothing
method setTargetPointLoc takes real x, real y returns nothing
- -----------------
This one makes the missile home towards a point. Same as targetUnit , it will
need an angleSpeed higher than 0.
________________________________________________________________________________
method forgetTargetPoint takes nothing returns nothing
- ------------------------
This method makes the xecollider forget it was homing towards a unit or point
then it becomes a normal missile, you may like to change angleSpeed as well
though.
xecollider event methods
------------------------
These are methods you may declare on your custom struct in order to listen to
the xecollider events.
________________________________________________________________________________
method onUnitHit takes unit hitTarget returns nothing defaults nothing
- - --------- -
The onUnitHit method is called whenever the missile hits a unit (the collision
circles intersect) it is similar to the UnitInRange event. hitTarget is the
unit that just collided with the missile.
________________________________________________________________________________
method loopControl takes nothing returns nothing defaults nothing
- ------- --------
This is a method that, if declared will be called every XE_ANIMATION_PERIOD
seconds, may allow you to save a timer loop.
The FireNovaStrike sample attempts to be a well explained example on how to
use xecollider, get used to this whole 'extends' stuff, as you'd see in the
example it makes things easier since you will not need to attach things anymore.
//TESH.scrollpos=45
//TESH.alwaysfold=0
library Quests
globals
private constant integer QR_MAXINDEX = 27
private constant integer QO_MAXINDEX = 37
endglobals
function QRTitle takes integer QNumber returns string
if QNumber == 1 then
return "Player Commands"
elseif QNumber == 2 then
return "Thanks To"
elseif QNumber == 3 then
return "Version Notes"
elseif QNumber == 4 then
return "Bugs?! Crashes?!"
elseif QNumber == 5 then
return "Chat System"
elseif QNumber == 6 then
return "Camera & Hero Functions"
elseif QNumber == 7 then
return "Shaman Class"
elseif QNumber == 8 then
return "Warrior Class"
elseif QNumber == 9 then
return "Cleric Class"
elseif QNumber == 10 then
return "Monk Class"
elseif QNumber == 11 then
return "Pyromancer Class"
elseif QNumber == 12 then
return "Cryomancer Class"
elseif QNumber == 13 then
return "Electromancer Class"
elseif QNumber == 14 then
return "Assassin Class"
elseif QNumber == 15 then
return "Samurai Class"
elseif QNumber == 16 then
return "Paladin Class"
elseif QNumber == 17 then
return "Berserker Class"
elseif QNumber == 18 then
return "Dark Priest Class"
elseif QNumber == 19 then
return "Witch Doctor Class"
elseif QNumber == 20 then
return "Necromancer Class"
elseif QNumber == 21 then
return "Warlock Class"
elseif QNumber == 22 then
return "Blue Mage Class"
elseif QNumber == 23 then
return "Ranger Class"
elseif QNumber == 24 then
return "Hunter Class"
elseif QNumber == 25 then
return "Druid Class"
elseif QNumber == 26 then
return "Bard Class"
elseif QNumber == 27 then
return "Gambler Class"
endif
return "No Title!"+"["+I2S(QNumber)+"]"
endfunction
function QOTitle takes integer QNumber returns string
if QNumber == 1 then
return "DMs: Tips"
elseif QNumber == 2 then
return "DMs: Items and Shops"
elseif QNumber == 3 then
return "DMs: Alliance settings"
elseif QNumber == 4 then
return "DMs: Terrain"
elseif QNumber == 5 then
return "DMs: Create"
elseif QNumber == 6 then
return "DMs: Unit Settings 1"
elseif QNumber == 7 then
return "DMs: Unit Settings 2"
elseif QNumber == 8 then
return "DMs: Advanced Unit Settings"
elseif QNumber == 9 then
return "DMs: Expert"
elseif QNumber == 10 then
return "DMs: Globals"
elseif QNumber == 11 then
return "DMs: More Globals & Expert"
elseif QNumber == 12 then
return "Inventory System"
elseif QNumber == 13 then
return "Stat & Skill System"
elseif QNumber == 14 then
return "Attach List 1"
elseif QNumber == 15 then
return "List 2"
elseif QNumber == 16 then
return "List 3"
elseif QNumber == 17 then
return "List 4"
elseif QNumber == 18 then
return "List 5"
elseif QNumber == 19 then
return "List 6"
elseif QNumber == 20 then
return "List 7"
elseif QNumber == 21 then
return "List 8 (Gear)"
elseif QNumber == 22 then
return "List 9 (Gear)"
elseif QNumber == 23 then
return "Abilties"
elseif QNumber == 24 then
return "Human Abilities #1"
elseif QNumber == 25 then
return "Human Abilities #2"
elseif QNumber == 26 then
return "Orc Abilities #1"
elseif QNumber == 27 then
return "Orc Abilities #2"
elseif QNumber == 28 then
return "Undead Abilities #1"
elseif QNumber == 29 then
return "Undead Abilities #2"
elseif QNumber == 30 then
return "Night Elf Abilities #1"
elseif QNumber == 31 then
return "Night Elf Abilities #2"
elseif QNumber == 32 then
return "TerrainList 1"
elseif QNumber == 33 then
return "Terrain List 2"
elseif QNumber == 34 then
return "Terrain List 3"
elseif QNumber == 35 then
return "Terrain List 4"
elseif QNumber == 36 then
return "Terrain List 5"
elseif QNumber == 37 then
return "Terrain Floors"
endif
return "No Title!"+"["+I2S(QNumber)+"]"
endfunction
function QuestsRequired takes integer QNumber returns string
//Player Commands
if QNumber == 1 then
return "Players have a set of commands they can use.
Besides the obvious set#(name), players may -
Roll a random dice with x sides:
(roll)/(dice) #
Attach models to their hero from the Attach List:
attach #(1-9) (whatmodel) (where)
Toggle their vision with other Heroes:
vision (color/all)
Customize their Hero:
+(stat)/(class)/(skill)
size (80-130)
color (color)
tint r(0.#) g(0.#) b(0.#) a(0.#)
info (heroinfo)
Play an Animation:
play (whatanimation)
disp (points/board/skillname)
The + command allows you to use points given on level and declare
you hero class or subclass."
//Thanks To
elseif QNumber == 2 then
return "A special thanks goes out to the following people for their
help with the Vuen's D&D Grand Project by giving a hand.
WhiteGolem for helping playtest the latest build.
ma1031 and Pingas for assisting in much of the testing.
r3p28 for long nights assissting with Mac compatibility.
Orlandeau my co-creator terrainer.
Adikutz for his spell contributions." + "
Mini-Mackeroni for helping me remove XE bug.
Vuen for the base map & SMW for the necessary files.
The friends of Titanhex in the Vuen's community include:
Zhou_Yu, Master Lich, Nathica," + "
Undead_Ravager, Nebulosus, Drakenfoul.
Please show them the same amount of respect you'd show me."
//Version Notes
elseif QNumber == 3 then
return "The SMW (Spiritman's Work) version of DnD is a modified
version of Vuen's D&D V2.5a Final. The Grand Project
addition of DnD used SMW's own version as a base.
Further, the doodads of VYM were added. " + " Beyond that
I have modded Vuen's system to support more commands and
optomize his already spectacular code.
This version of Vuen's will be known as TE, to differentiate it from
GP's Finale, which will have the classic models.
May 06, '12"
//Bugs?!
elseif QNumber == 4 then
return "So you've found a bug? My apologies, the version hasn't
been tested extensively. Please report it to me at my
email, [email protected] so that I can get " + "
it taken care of. Since many of the changes to VD&D GP
have been done by me, I should be able to pinpoint and
fix most bugs."
//Chat System
elseif QNumber == 5 then
return "To set a name, enter set#name, for some number 0-9. Then
enter the number before your messages. Example:
set1Jack
1Hello!
will message 'Jack: Hello!' Once you've set up your
names, press F12 and choose Observers so that
players only see the chat once.
To set your ooc, type setoocname. A new feature for DMs
has been added. Select a unit and type set; to set the
name specifically for that unit. While selected, type
;words to make it talk, or :words to make it talk with
it's own colored name.
Info can be attached to units. Heroes can only set their own
info, but DMs can set any unit with info. To see the info, simply
use patrol on a unit when near it. ''info'' followed by any text will
set the info for units."
//Player Functions
elseif QNumber == 6 then
return "To unlock the camera, press |c00FFFF00ESC|r.
To look left or right, hold the left or right arrow key.
to swivel your camera up or down, hit the up or down
arrow key. Both birds eye view and first person are
available. " + "
If you die, press |c00FFFF00ESC|r to revive."
//Shaman Class
elseif QNumber == 7 then
return "|cffffff00'Shamans'|r may use |cff00bfff" + Shamans + "'|r.
They are adept casters of land, totem and spirit magic.
Learns:
Earth Harness (disp earthharness)
Blas|cffffcc00t |rWard (disp blastward)
Lan|cff8b4513d|r Slide (disp landslide)
Ancest|cffff8c00r|ral Blessing (disp ancestralblessing)
Sand Blast (|cfff4a460Q|r) (disp sandblast)
[ULT]|cffaca899W|rhirlwind (disp whirlwind)
[ULT]|cff779d2fG|reode|n (disp geode)"
elseif QNumber == 8 then
return "|cffffff00'Warriors'|r may use |cff00bfff" + Warriors + "'|r.
They are stalwart attackers that employ mixed skills of defending and attacking.
Crushing Blow (disp crushingblow)
Inspirin|cffffa500g|r Shout (disp inspiringshout)
S|cffffcc00t|romp (disp stomp)
Wa|cffbdb76br|r-threat (disp warthreat)
Resolve (disp resolve)
[ULT]|cff00ced1B|rlasting Zone (disp blastingzone)
[ULT]Counter Pierce (disp counterpierce)"
elseif QNumber == 9 then
return "|cffffff00'Clerics'|r may use |cff00bfff" + Mages + "'|r.
They are the ultimate healing class, granting buffs and replenishment to allies.
|cffffcc00D|rivine Light (disp divinelight)
Ma|cff3d95ffg|ric Curtain (disp magiccurtain)
Inne|cffff6347r|r Stregth (disp innterstrength)
Clarity Aura (disp clarityaura)
??? (disp x)
[ULT]Li|cffffff00f|re (disp life)
[ULT]Call Holy Phoeni|cfffddb55x|r (disp callholyphoenix)"
elseif QNumber == 10 then
return "|cffffff00'Monks'|r may use |cff00bfff" + Monks + "'|r.
A versatile fighting class that employs martial arts and meditation.
Zen (disp zen)
Cleaving |cff708090F|rist (disp cleavingfist)
Bla|cffff4500z|ring Palm (disp blazingpalm)
|cffffcc00C|rhakra (disp chakra)
Pumm|cffbdb9ace|rl (disp pummel)
[ULT]Combo Mastery (disp combomastery)
[ULT]|cffd2691eE|rarthbreaker (disp earthcleave)"
elseif QNumber == 11 then
return "|cffffff00'Pyromancer'|r may use |cff00bfff" + Mages + "'|r.
A focused fire caster with a love for AoE.
Li|cfffd8c42v|ring Embers (disp livingembers)
|cffff4500F|rireball (disp fireball)
|cffffcc00F|rire Wall (disp firewall)
Warmth (disp warmth)
Blaze Shield (disp blazeshield)
[ULT]Double Cast (disp doublecast)
[ULT]In|cffffcc00f|rerno (disp inferno)"
elseif QNumber == 12 then
return "|cffffff00'Cryomancer'|r may use |cff00bfff" + Mages + "'|r.
A focused ice caster with a love for disables.
Free|cff00ffffz|ring Blast (disp freezingblast)
Chilling Aura (disp chillingaura)
|cffffcc00T|ridal Haven (disp tidalhaven)
I|cff40e0d0c|re Wall (disp icewall)
Tidal Wave (c) (disp tidalwave)
[ULT]Double Cast (disp doublecast)
[ULT]Freeze Ray (disp freezeray)"
elseif QNumber == 13 then
return "|cffffff00'Electromancer'|r may use |cff00bfff" + Mages + "'|r.
A focused storm caster with a talent for arcing spells.
Summon |cffba55d3T|rhunder Elemental (disp summonthunderelemental)
Shock (disp shock)
Storm|cffffff00b|rolt (disp stormbolt)
Storm (|cff99b4d1G|r) (disp storm)
Thunderclap (disp hthunderclap)
[ULT]Double Cast (disp doublecast)
[ULT]|cffffff00E|rlectrocute (disp electrocute)"
elseif QNumber == 14 then
return "|cffffff00'Assassin'|r may use |cff00bfff" + Rogues + "'|r.
A stealthy killer employing subterfuge, poison, and debilitation.
Assassinate (|cffff0000X|r) (disp assassinate)
Backstab (disp backstab)
|cffffcc00B|rlink Slash (disp blinkslash)
|cff7fff00P|roison Daggers (disp poisondaggers)
Smoke |cff716f64B|romb (disp smokebomb)
[ULT]Swi|cffffd700f|rt as Shadows (disp swiftasshadows)
[ULT]|cff8fbc8bC|rrippling Blow (disp cripplingblow)"
elseif QNumber == 15 then
return "|cffffff00'Samurai'|r may use |cff00bfff" + Samurais + "'|r.
An honorbound master of the sword employing damage and evasion.
Third Eye (disp thirdeye)
Sword T|cffffcc00o|rss (disp swordtoss)
|cff5f9ea0W|rhirring Blade (disp whirringblade)
Sword Mastery (disp swordmastery)
Zen (disp zen)
[ULT]Pier|cffaca899c|re (disp pierce)
[ULT]|cff8fbc8bC|rrippling Blow (disp cripplingblow)"
elseif QNumber == 16 then
return "|cffffff00'Paladin'|r may use |cff00bfff" + Paladins + "'|r.
Holy zealots capable of buffing, healing, and ultimately providing defense.
Ri|cffffff00g|rhteous Hammer (disp righteoushammer)
|cffebd143C|rover (disp cover)
Shiel|cffaca899d|r Block (disp shieldblock)
|cffffff00D|rivine Shield (disp divineshield)
??? (disp x)
[ULT]Sanctua|cffffff00r|ry (disp sanctuary)
[ULT]Anci|cffffcc00e|rnt Hammer (disp ancienthammer)"
elseif QNumber == 17 then
return "|cffffff00'Berserker'|r may use |cff00bfff" + Barbarians + "'|r.
Barbarians capable of dishing out high physical damage with fericious, fast, and savage blows.
Flurry (disp flurry)
Inspire (disp inspire)
Critical Aura (disp criticalaura)
La|cffa73610c|rerate (disp lacerate)
|cffff0000B|rerserk (disp berserk)
[ULT]Massive Cleave (disp massivecleave)
[ULT]Axe |cffaca899T|ross (disp axetoss)"
elseif QNumber == 18 then
return "|cffffff00'Dark Priest'|r may use |cff00bfff" + Mages + "'|r.
Those under a cultist priesthood of death, decay, and unholy bestowments.
|cff008000D|rrain (disp drain)
|cff7bca64G|rrim Gift (disp grimgift)
Under|cff804000w|rorld Pull (disp underworldpull)
Unholy Inter|cff9acd32v|rention (disp unholyintervention)
Soul Trap (disp soultrap)
[ULT]P|cff9acd32e|rstilence (disp pestilence)
[ULT]Raise |cff778899H|rero (disp raisehero)"
elseif QNumber == 19 then
return "|cffffff00'Witch Doctor'|r may use |cff00bfff" + Mages + "'|r.
Practicioners of Voodoo, Hexs, and Healing Arts, they're a great support.
Bene|cff008000v|roodoo (disp benevoodoo)
|cff00ff7fD|rrowsy Cask (disp drowsycask)
Hydra |cff3cb371W|rard (disp hydraward)
Malvoo|cffda70d6d|roo (disp malvoodoo)
Moon Fi|cff648bcbr|re (disp moonfire)
[ULT]|cff008000R|ritual Dance (disp ritualdance)
[ULT]Insect S|cff9acd32w|rarm (disp insectswarm)"
elseif QNumber == 20 then
return "|cffffff00'Necromancers'|r may use |cff00bfff" + Mages + "'|r.
Summoners of the dead and manipulator of bones, they conjure armies.
Animate |cff5f9ea0B|rones (disp animatebones)
|cffffcc00R|raise Corpse (disp raisecorpse)
Bone Shiel|cffd2b48cd|r (disp boneshield)
|cffffcc00C|rursed Soul (disp cursedsoul)
Revel in Dead (disp revelindead)
[ULT]Summon Shado|cff8a2be2w|r Bane (disp summonshadowbane)
[ULT]xxx (disp boneprison)"
elseif QNumber == 21 then
return "|cffffff00'Warlocks'|r may use |cff00bfff" + Mages + "'|r.
Power hungry manipulators of magical energies, they twist them to their will.
Mana |cff0054e3D|risplacement (disp manadisplacement)
Life and Mana Combustion (disp combustion)
Or|cff01e779b|r (disp orb)
Siphon (|cff483d8bW|r) (disp siphon)
Pac|cff4169e1t|r (disp pact)
[ULT]Blood Star (|cffff0000Q|r) (disp bloodstar)
[ULT]|cff708090D|room (disp doom)"
elseif QNumber == 22 then
return "|cffffff00'Blue Mages'|r may use |cff00bfff" + Spellswords + "'|r.
Capable of wielding limited elemental magic, they bend it to enhance their melee combat.
|cff778899E|rlemental Shift (disp elementalshift)
|cff778899B|rolt (disp bolt)
Mimi|cffdb7093c|r (disp mimic)
|cffffd700W|rall (disp wall)
Phase (disp phase)
[ULT]Double Cast (disp doublecast)
[ULT]Mat|cff0054e3r|ra M. (disp matram)"
elseif QNumber == 23 then
return "|cffffff00'Rangers'|r may use |cff00bfff" + Rangers + "'|r.
Bow and arrow wielding archers with scouting and survival techniques.
Summon O|cffffcc00w|rl (disp summonowl)
Poison A|cff7fff00r|rrows (disp poisonarrows)
Psionic Arrow (disp psionicarrow)
Arrow |cff779d2fV|rolley (disp arrowvolley)
|cffffcc00T|rrueshot Aura (disp htrueshotaura)
[ULT]Elemental |cff0054e3Q|ruiver (disp elementalquiver)
[ULT]Scavang|cff8fbc8be|r (disp scavange)"
elseif QNumber == 24 then
return "|cffffff00'Hunters'|r may use |cff00bfff" + Rangers + "'|r.
They use long range weaponary to find and kill wary prey.
Summon Trained |cffd2691eW|rolf (disp summontrainedwolf)
Sp|cffffa500r|read Shot (disp spreadshot)
E|cffffa500x|rploding Bullet (disp explodingbullet)
Exploding |cffff8c00S|rhells (disp explodingshells)
Re|cffffd700a|rdy, Aim, Fire! (disp readyaimfire)
[ULT]|cffcd853fC|rloying Powder (disp clowingpowder)
[ULT]Heavy Shot (disp heavyshot)"
elseif QNumber == 25 then
return "|cffffff00'Druids'|r may use |cff00bfff" + Shamans + "'|r.
Capable fighters who employ animal instincts with the magic of the grove.
Dr|cff8fbc8by|rad Strike (disp dryadstrike)
Thorns Aura (disp thornsaura)
Petal |cffffcc00W|rard (disp petalward)
Animal Aspect (disp animalaspect)
Insect S|cff9acd32w|rarm (disp insectswarm)
[ULT]Moss Armo|cff808000r|r (disp mossarmor)
[ULT]Maneater |cff32cd32G|rrove (disp maneatergrove)"
elseif QNumber == 26 then
return "|cffffff00'Bards'|r may use |cff00bfff" + Rangers + "'|r.
Entertainers who use the power of song and dance to boost allies.
Sound |cff1e90ffB|rlast (disp soundblast)
|cff6d6d6dB|rlade Bolero (disp bladebolero)
Sound Blast (|cff1e90ffC|r) (disp soundblast)
Book of Son|cff6b8e23g|rs (disp bookofsongs)
H|cffffcc00e|raling Rift (disp healingrift)
[ULT]|cff5f9ea0R|rapido (disp rapido)
[ULT]|cff9370dbE|rchoes (disp echoes)"
elseif QNumber == 27 then
return "|cffffff00'Gamblers'|r may use |cff00bfff" + Rangers + "'|r.
Drunken brawlers who rely on the power of chance and coin.
|cffd2691eW|rasted/ (disp wasted)
Dic|cff708090e|r (disp dice)
|cffffd700C|roin Toss/ (disp cointoss)
Spinning |cffb8860bB|reer Bottles (disp spinningbeerbottles)
Breath of |cffffcc00F|rire (disp hbreathoffire)
[ULT]Last Call (|cffff8c00F|r) (disp lastcall)
[ULT]Improved Odds (disp improved odds)"
endif
return "No Data"
endfunction
function QuestsOptional takes integer QNumber returns string
//DM Tips
if QNumber == 1 then
return "Your first steps into DMing may be daunting.
Here are some tips to ease you along:
- Try typing out the names and commands instead of scrolling
to the pallete in the bottom right. This will speed up your
quest creation time tendfold.
- Hitting F1 will reselect the Pointer, which allow you to place
units and objects faster.
- Try a private game by yourself, and read F9 while trying things
out. Make up scenarios in your private game then try them out
in a public one."
//DM Items and Shops
elseif QNumber == 2 then
return "To access the Item Shops, try typing: itemshop(1,2,3..16)
which hold almost all items in the game.
To give an item directly to a player, use the item grab command on
an item and use it on a player. It can also move items around.
The skill addtostock when placed on a building like the tavern will
allow you to cast it on a unit or item and add 99 of that to the shop.
When cast on a unit it lets players use that units skills.
destroy # - Destroys the item in that slot.
charges # - Sets the charges on the item in that slot."
//DM Alliance settings
elseif QNumber == 3 then
return "There are two computer players called Ally (white) and
Enemy (black) with their respective allegiances to the players;
the DMs have shared control over them. When you create units,
you choose what side you want them to be on, and you can switch
unit sides using the Units->Side function.
Unlike previous versions, you can control your own colored
units. This allows dynamic stroylines with greater conflict
and opposition, even amongst players.
To ally and unally players, type (un)ally (color) and (color).
To vision and unvision colors, type vision (color) and (color)"
//DM Terrain
elseif QNumber == 4 then
return "You may have noticed that the terrain looks extremely
plain, and has way too many ramps. It's your job to fill
it in. Use the tree creation, pathing blocker, and sight blocker
functions to create a path for the players to follow, blocking many
of the ramps. Create paths and environments with the terrain
command. Please note though, there is a limit to how many
extra tilesets you get. Choose wisely.
Add gates and bridges at important quest points; use walls
to enclose kingdoms"+" and terrain raisers to modify
the land." + " Brush size and shape help greatly.
Use doodads and dood commands to decorate.
(terrainname) will allow you to paint the terrain with
your chosen tileset.
terrain # sets the terrain variation. Use random instead of #
for random variations."
//DMs: Create
elseif QNumber == 5 then
return "You can use commands instead of the GUI to create units,
items and doodads. To create, say, a 'mudgolem' or
'icecrownobelisk' or 'grove', just type it in (without
single quotes).
The map will teach you the names of everything as you
choose them from the palettes; this also works for units
that have not been placed in the pallette.
Note, some doodads have dood commands to differentiate them
from their unit counterparts."
//DM Commands: Unit Settings 1
elseif QNumber == 6 then
return "This is a list of DM commands for Units and Heroes.
level #
invuln
vuln
immune
mune
reset/rcool
xprate #
These can be toggled on/off by typing them:
isundead
issummon
iseancient
istauren
isstructure
istownhall
allyattack
To change the owner of a unit, type either:
give color
give #
give self
give ally
give enemy
To change stats:
life
lifeat
hurt
mana
manaat
rech
recov
regen
regen%
int
intset
agi
agiset
str
strset
armor
damage
aspeed
mspeed
size
tint
color"
//DM Commands: Unit Settings 2
elseif QNumber == 7 then
return "Some of these commands are new or advanced:
fly # - Set the fly height of a unit.
anim # - Set the animation speed of a unit.
play - Play a unit's animation
bounty # - Set the bounty reward for a unit when it's killed, and determines it's skill power.
'skillname - gives a skill to a unit
@skillname - removes a skill from a unit
=skillname - sets and gives a skill to a unit
face (# or direction) - Make a unit or building face an angle. Type twice for buildings
goldat # - Set the amount of gold in a gold mine
attach #1-9 (whatFX) (where) - Attaches an FX to a unit.
queston/questoff - Creates a ! above the units head or removes it.
pause - Pauses and unpauses a unit."
//DM Commands: Advanced Unit Settings
elseif QNumber == 8 then
return "The permanence command works like a companion system.
pskill(1-3) (skillname) - Sets a skill to that slot to add to companions on revival.
nc/ncoff - No collision. Allows a unit to move through obstacles.
(un)control - Use to change your control over Players, letting you buy for them or force them to perform an action.
freehero - Makes it so heroes are not removed during selection."
//DM Commands: Expert
elseif QNumber == 9 then
return "The following commands are available to expert DMs. Use them wisely.
ka - Toggles KeepAlive healing on selected units.
allyattack - Toggles allowing Players to attack allies.
brush 1-9, 200-2000: This will change the brush size for the terrain
tool [1-9] and the doodads [200-2000].
custom - place add, remove, sfx, a #, b #, c #, s #, tail #, and
fx (fxname) at the end to modify a units custom specs. SFX gives
reoccuring animations set with s, t and fx. Affects CastSpell.
a, b, and c affect the movement. t is the tail, which is how often
the effect occurs as it trails along.
" + "
'permanence and @permanence - Part of the pet system. Permanence
allows you to cast a spell and bind a unit to you. The pet unit is
then commandable via a spellbook by the master unit. @permanence
releases units from that bond.
bonus on/off/add - On and off determine if a unit will be created with
the same bonuses as the selector. Add adds the selector's bonus
to the units selected."
//DM Commands: Globals
elseif QNumber == 10 then
return "The following commands are used to change gameplay or environment.
weather # (weathertype) - Allows you to create a weather region.
- wind
- heavyrain
- raysofmoonlight
- raysoflight
- heavysnow
- blizzard
- dalaranshield
- whitefog
- heavywind
- none
watertint # # # # - Sets the water tint.
fog # # # # - Sets the fog tint.
timestart
timestop
timescale
time #.##
xprate #.#
music (bold/credits/doom/defeat/heroic/holy/hope/march/pursuit/sad/strange/stop)
rez on/off/alt - Alt toggles a markerstone rez system, on enables
player rezing, off disables, and as-is rezes a selected marker.
ally (player) (player) - You can (un)ally players. All can be used.
This is toggled, so typing it again will unally."
//DM Commands: More Globals & Expert
elseif QNumber == 11 then
return "More changes to the state of the game can be made with:
dark(off) (player)
Typing one of these by itself will add or remove a deep darkness for all players.
Setting a player at the end will set it only for that player.
promote or demote (color/#) - This command does exactly what you expect.
It demotes or promotes to/from DM. Careful, you can demote yourself.
csleep (player) - Toggles nuetral creep sleeping for that player.
Emitters release units periodically from the unit selected. These modify it.
emit - Turns on emitting.
emit unit (unitname)
emit max # - How many can be out at once.
emit limit # - How many will emit over a lifetime.
emit time #
emit skill (name)
emit bounty #
emit bonus (on/off)
emit remove
show - Returns all heroes to the map."
//Inventory System
elseif QNumber == 12 then
return "The inventory system supports 8 equipment slots and
12 inventory slots. Certain items can stack when put in your
backpack.
Use the hinv command to give a hero the inventory. The
following are presets to type after is hero.
Paladin
Warrior
Barbarian
Samurai
Ranger
Rogue
Monk
Spellsword
Mage
Shaman
EquipAll
Here are the item and weapon types. Type these followed
by commas after hinv to create your own inventory specs.
Heavy Armors, Heavy Gloves, Claws, Leather Armors, Cloth Armors, Shields
Mauls, Swords, Daggers, Offhands, Bows, Arrows, Axes, Wands, Staffs"
//Skill System
elseif QNumber == 13 then
return "You may notice the new skill system in place, and want some control over it.
DMs have the following commands:
*# - Gives the selected unit # of stat points.
^# - Gives the selected unit # of skill points.
class - Toggles on/off the ability to declare classes or learn skills.
slvl # - Sets the level required to declare a subclass. Default is 10.
cforce (class) - Forces a class onto a hero.
sforce (class) - Forces a subclass onto a hero.
cclass # (name) - Create a class in the # slot by that name.
cgear # (whatGear) - Restricts the class to that gear. (See Inv System)
cskill(1-7) # (skill) - Set skills 1-7 to hero slot #. 6 and 7 are ultimates.
publish # - Publishes that class # in the quest log."
//Attachment List
elseif QNumber == 14 then
return "barkskin
fireballmissile
deathcoilmissile
ancientprotectormissile" + "
orbofdeathmissile
arrowmissile
banditmissile
spiritofvengeancemissile" + "
bansheemissile
harpymissile
reddragonmissile
bloodelfmissile " + "
cryptfiendmissile
cannontowermissile
guardtowermissile " + "
chimaeraacidmissile
chimaeralightningmissile
wingedserpentmissile
corrosivebreathmissile " + "
demolishermissile
demonhuntermissile
catapultmissile
dragonhawkmissile "+ "
druidofthetalonmissile
dryadmissile
voidwalkermissile
faeriedragonmissile " + "
farseermissile
lordofflamemissile
gyrocopterimpact
gyrocoptermissile " + "
frostwyrmmissile
gargoylemissile
glaivemissile "+ "
poisonarrowmissile
fragdriller
greendragonmissile
gryphonridermissile " + "
zigguratfrostmissile
boatmissile
sentinelmissile
hydraliskimpact " + "
illidanmissile
keepergrovemissile
axemissile " + "
lavaspawnmissile
lichmissile
locustmissile
makuramissile " + "
meatwagonmissile
mortarmissile
murgulmagicmissile
nagaarrowmissile "
//Missiles2
elseif QNumber == 15 then
return "necromancermissile
zigguratmissile
brewmastermissile
phoenixmissile " + "
priestmissile
moonpriestessmissile
bristlebackmissile
seaelementalmissile " + "
rexxarmissile
rifleimpact
blackkeepermissile
serpentwardmissile "+ "
shadowhuntermissile
rocketmissile
steamtankimpact
skeletalmagemissile "+ "
ancestralguardianmissile
sludgemissile
sorceressmissile
spellbreakermissile "+ "
vengeancemissile
snapmissile
battrollmissile
huntermissile "+ "
witchdoctormissile
tuskarspear
wardenmissile
waterelementalmissile "+ "
wyvernspearmissile
ucanceldeath
hcanceldeath
nagadeath "+ "
necanceldeath
humanlargedeathexplode
orclargedeathexplode
demonlargedeathexplode "+ "
undeadlargedeathexplode
nightelflargedeathexplode
glaivemissiletarget
gryphonridermissiletarget "+ "
orcsmalldeathexplode
demonsmalldeathexplode
wispexplode
battlestandard "+ "
bundleoflumber
penguin
treasurechest
glyph" + "
potofgold
humancaptureflag
barrelsunit
nightelfcaptureflag "+ "
orccaptureflag
runicobject
questionmark
crystalshard "
//Special FXs
elseif QNumber == 16 then
return "shimmerweed
thunderlizardegg
phoenixegg
tomegreen " + "
tomeblue
tome
tomebrown
tomered " + "
undeadcaptureflag
dispelmagic
absorbmana
bottlemissile "+ "
ancestralspirit
animatedead
obsidianregenaura
avatar "+ "
roar
trollbeserker
blackarrowmissile
undeadminecircle "+ "
blinktarget
blinkcaster
breathoffiredamage
breathoffire "+ "
breathoffrost
brilliance
demolisherfiremissile
carrionswarmmissile "+ "
carrionswarmdamage
lightningboltmissile
boltimpact
charm "+ "
resourceeffect
cleavedamage
tinkerrocketmissile
coldarrowmissile "+ "
drumscaster
controlmagic
spiritwalkerchange
gravemarker "+ "
crushingwavemissile
crushingwave
darkportal
darkritualcaster "+ "
darkritualtarget
darksummonmissile
darksummon
deathcoil "+ "
deathpactcaster
deathpacttarget
defend
devotionaura "+ "
devour
devourmagicmissile
plaguecloud
disenchant "
//Abilities 1
elseif QNumber == 17 then
return "brewmastermissile
eattree
commandaura
ensnaremissile "+ "
roots
fanofknives
fanofknivesmissile
arcanetowerattack "+ "
spellbreakerattack
feralspirit
demonboltimpact
flak " + "
flamestrike
flamestrike1
flare
flyingmachineimpact " + "
freezingbreathmissile
nagacoldarrowmissile
frostboltmissile
frostnova "+ "
gather
heal
healingsalve
healbottlemissile "+ "
healingwave
holybolt
howlcaster
rockboltmissile "+ "
impale
infernal
invisibility
agilitygain "+ "
orbdarkness
orbcorruptionmissile
orbcorruptionspecial
orbcorruption "+ "
fireorbspecial
fireorbtarget
frostorbspecial
frostorbtarget "+ "
venomorbmissile
venomorbspecial
venomorb
itemcommand "+ "
itemdispel
experiencegame
itemhealing
illusion
itemgain "+ "
intgain
reveal
soultheft
strgain
armorgain "
//Abilities 2
elseif QNumber == 18 then
return "areagain
iteminvis
lifesteal
magicsentry "+ "
manaburntarget
massteleport
massteleportcaster
massteleporttarget
mirrorimagemissile " + "
mirrorimage
levelup
annihilationmissile
lightningorbspecial " + "
lightningorbtarget
sloworbmissile
sloworb
parasitemissile
phaseshift " + "
markofchaos
phoenixfiremissile
pocketfactorymissile
poisonstringmissile "+ "
fallingsheep
polymorph
possessionmissile
purge
quillspraymissile "+ "
raiseskeleton
neutralizationmissile
reincarnation
reinforce
replenish "+ "
replenishoverhead
replenishmana
replenishmanaoverhead
moonwellcaster "+ "
moonwelltarget
ressurectcaster
ressurecttarget
revive "+ "
awaken
scoutmissile
shadowstrikemissile
shockwavemissile
arrow
shopsharing "+ "
blackarrow
silence
sleep
slow "+ "
spellshield
spellstealmissile
spellsteal
sphere "
//Abilities 3
elseif QNumber == 19 then
return "bloodelfball
snapmissile
battrollmissile
taunt "+ "
spikedbarricade
spiritlinkzap
spirittouch
stampedemissiledeath "+ "
stampedemissile
manadraincaster
manadraintarget
stormboltmissile
stormearthandfiremissile
polymorphground "+ "
feralspiritdone
summoningritualtarget
thornsaura
thunderclap " + "
tomeofretraining
goldbottlemissile
treeoflifeupgrade
trueshotaura
unholyaura
vampiricaura "+ "
vamppotion
warstomp
webmissile
bottleimpact
aerialshacklestarget "+ "
antimagicshell
banish
berserk
voodooaura "+ "
voodooaura
blizzard
bloodlust
breathoffrost "+ "
brillianceaura
largefire
mediumfire
smallfire
elflargefire "+ "
elfmediumfire
elfsmallfire
undeadlargefire
undeadmediumfire
undeadsmallfire "+ "
cloud
chimaeraacid
cripple
curse
cyclone "+ "
zombify
deathanddecay
deathanddecaydamage
plaguecloud "
//Abilities 4
elseif QNumber == 20 then
return "stun
doomdeath
doom
draincaster
draintarget "+ "
siphoncaster
siphontarget
drunkenhaze
earthquake
ensnareair "+ "
ensnare
entanglingroots
faeriefire
flamestrikeembers "+ "
flamestrikedamage
flare
freezingbreath
frostarmordamage "+ "
frostarmor
howl
immolationdamage
immolation
impalehit "+ "
stun2
incinerate
incineratebuff
innerfire
divineshield "+ "
lavaspawnmissile
lightningshieldbuff
lightningshield
liquidfire "+ "
manaflaremissile
manaflareimpact
manaflaretarget
manaflare
manaregen "+ "
manashield
mirrorimagedeath
monsoonrain
monsoon
parasite "+ "
immolationreddamage
immolationred
phaseshift
poisonsting
possession
possessiontarget "+ "
purge
rainoffire
rejuvenation
revealeffect "+ "
roartarget
sanctuary
scrollofprotection
owl
redsun
negativeaura
light"
//Buffs
elseif QNumber == 21 then
return "shadowstrike
silence
sleepspecial
sleeptarget "+ "
slow
slowed
soulburn
soulthefttarget "+ "
speedbonus
spellshield
cryptfiendmissile
thornyshield "+ "
spiritlink
starfall
starfalltarget
thornsauradamage "+ "
tornado
tranquility
tranquilitytarget
transmute "+ "
unholyfrenzy
unsummon
volcanomissile
volcano
webair
web "+ "
toonboom
dissipate
udeath
smallflamespawn "+ "
dust
footprint
enbirth
wizardshat
demonwings
crownarmor
knighthelmet
knighthelmet2
guardhelmet
crownhelmet
crownbootr
crownbootl
crownshield
nightelfshield
hydrobane
pyrebane
woodenbow
spikedclub
skullmask
frostwings
scarf
royalscepter
royalscepter2
royalcrown2"
//Armor and Weapon Attachments
elseif QNumber == 22 then
return "royalcrown
royalcloak
voodoomask
truthsword
rodofnecromancy
plateshoulders
obsidianhelmet
sword
spear
mace
dagger
axe
mindstaff
armor
magicianstaff
magehat
infernalhammer
shroud
blackcape
plateshoulders2
hawkmask
hawkmask2
dragonwings
dragontail
lightningdagger
holylongsword
lance
rod
hellbow
hellsword
staff
druidstaff
barbarianshoulders
corruptedsword
crystalwings
clotharmor
clotharmor2
bardiche
dogbags
mask
arcanestaff
voodoomask
woodbow
crossbow
bloodelfarmor
humanarmor
undeadarmor
maul
hammerofdawn
deathfrost
rainbowstaff
lionshield
basicshield
clothhat
piratehat
bandana
hornedhelm
batstaff
blackhelm
negationstaff
quarterstaff
frostaxe
carapacehelm
wand
wolfcap
torch"
//Ability Documentation 1
elseif QNumber == 23 then
return " It's been requested that I give a list of abilities you can give.
Well, I say look 'em up on their respective hero, but
I know, that's not easy. So I will document some abilities." + "
It's also important to note the abilities work like so:
ability# if there is multiple in the list. If removing or
adding a normal ability doesn't work, try putting 1,2,3
after it.
hability for hero abilties. This is because many have non
hero counterparts. You may want to remove those. Who knows.
The h prefix doesn't apply to custom abilities." + "
Here are some unique skills that come in handy:" + "
noattack
addtostock
wander1
wander2
heroglow
load
ethereal
permanentinvisibility
buildingdamageaura
inventory
meleeimmunity
rangedimmunity
dmteleport"
//Abilities Human #1
elseif QNumber == 24 then
return "
|cffffcc00Dwarf Warrior Skills|r
warthreat
ancienthammer
crushingblow
shieldblock
drinkinggame
|cffffcc00Dwarf Rifleman Skills|r
explodingbullet
explodingshells
spreadshot
cloyingpowder
dwarvenmastery
|cffffcc00Human Mage Skills|r
fireball
doublecast
stormbolt
freezingblast
icewall
" + "
|cffffcc00Human Swordsman Skills|r
fierceslash
inspiringshout
swordmastery
blastingzone
|cffffcc00Human Crusader Skills|r
shieldofdivinity
cover
righteoushammer
sanctuary"
//Abilities Human #2
elseif QNumber == 25 then
return "
|cffffcc00Human Assassin Skills|r
swiftasshadows
assassinate
backstab
smokebomb
" + "
|cffffcc00Elven Cleric Skills|r
wall
divinelight
innerstrength
life
callholyphoenix
sacremento
|cffffcc00Elven Archer Skills|r
magiccurtain
psionicarrow
elementalvolley
mimic
|cffffcc00Lightning Lord Skills|r
summonlightningelemental"
//Abilities Orc #1
elseif QNumber == 26 then
return "
|cffffcc00Dragoon Skills|r
grandblood
draconiclance
|cffffcc00Troll Witchdoctor Skills|r
trollherb
hydraward
ritualdance
malvoodoo
benevoodoo
clarityaura
|cffffcc00Orc Shaman Skills|r
tidalhaven
blazeshield
landslide
whirlwind
" + "
|cffffcc00Orc Warlock Skills|r
firewall
apocalypse
pact
manadisplacement
|cffffcc00Gambler Skills|r
wasted
spinningbeerbottles
cointoss
hbreathoffire
dice
lastcall
improvedodds"
//Abilities Orc #2
elseif QNumber == 27 then
return"
|cffffcc00Orc Samurai Skills|r
whirringblade
swordtoss
pierce
thirdeye
|cffffcc00Orc Gruntie Skills|r
bloodlife
lacerate
flurry
axetoss
" + "
|cffffcc00Troll Voodoo Hunter Skills|r
vodunspin
blastward
drowsycask
insectswarm
MORE SKILLS?
" + "'addtostock - Use on a marketplace or other shoptype to make
a shop sell a targeted item or unit. Useful for making custom shops.
Also serves to make spells accessable on NPCs."
//Undead Abilities #1
elseif QNumber == 28 then
return "
|cffffcc00Undead Baron Skills|r
chillingdeath
grimgift
petrify
doom
|cffffcc00Undead Knight Skills|r
unholyintervention
siphon
overwhelmingpresence
reaperspull
" + "
|cffffcc00Dark Waywalker Skills|r
souleater
shadestrike
criticalaura
massivecleave
|cffffcc00Vampire Skills|r
bloodpower
auspice
drink"
//Undead Abilities #2
elseif QNumber == 29 then
return"
|cffffcc00Undead Ranger Skills|r
drain
cursedsoul
carrionarrow
pestilence
" + "
|cffffcc00Undead Summoner Skills|r
raisecorpse
animatebones
boneshield
summonshadowbane
|cffffcc00Undead Banshee Skills|r
deafeningscream
echoes
wailingessence
tormentedsound"
//NightElf Abilities
elseif QNumber == 30 then
return "
|cffffcc00Nightelf Giant Skills|r
smashdown
giantquake
mossarmor
tauntpassive
" + "
|cffffcc00Nightelf Ranger Skills|r
arrowvolley
poisonarrows
summonowl
scavange
|cffffcc00Nightelf Slayer Skills|r
lifeandmanacombustion
dryadstrike
orb
counterpierce"
//NightElf Abilities
elseif QNumber == 31 then
return "
|cffffcc00Spell Sword Skills|r
matram
bolt
phase
elementalshift
" + "
|cffffcc00Geomancer Skills|r
sandblast
livingember
earthharness
|cffffcc00Druid Skills|r
growtreants
petalward
callplant
|cffffcc00Random Skills|r
doublecastactive
comet
meteorstorm
megaflare
summonthunderelemental"
//Terrain List 1
elseif QNumber == 32 then
return "summerdirt
summerroughdirt
summergrassydirt
summergrass
summerdarkgrass
" + "
fallgrass
fallroughdirt
fallgrassdirt
fallrock
fallgrass
falldarkgrass
" + "
winterdirt
winterroughdirt
wintergrassysnow
winterrock
wintersnow
" + "
ashenvaleroughdirt
ashenvalegrass
ashenvalerock
ashenvalelumpygrass
ashenvalevines
ashenvalegrassydirt
ashenvaleleaves
ashenvaledirt"
//Terrain List 2
elseif QNumber == 33 then
return "cityscapedirt
cityscaperoughdirt
cityscapeblackmarble
cityscapebrick
cityscapesquaretiles
cityscaperoundtiles
cityscapegrass
cityscapegrasstrim
cityscapewhitemarble
" + "
villagedirt
villageroughdirt
villagecrops
villagecobblepath
villagestonepath
villageshortgrass
villagerock
villagethickgrass
villagefalldirt
villagefallroughdirt
villagefallcrops
villagefallcobblepath
villagefallstonepath
villagefallshortgrass
villagefallrock
villagefallthickgrass
" + "
dalarandirt
dalaranblackmarble
dalaranbricktiles
dalaransquaretiles
dalaranroundtiles
dalarangrass
dalarantrimgrass
dalaranwhitemarble
dalaranwhitemarble
dalaranruinsdirt
dalaranruinsroughdirt
dalaranruinsblackmarble
dalaranruinsbricktiles
dalaranruinssquaretiles
dalaranruinsroundtiles
dalaranruinsgrass
dalaranruinstrimgrass
dalaranruinswhitemarble"
//Terrain List 3
elseif QNumber == 34 then
return "ashenvaledirtcliff
ashenvalegrasscliff
" + "
barrensgrasscliff
barrensdirtcliff
" + "
blackcitadeldirtcliff
blackcitadeldarktilescliff
" + "
cityscapedirtcliff
cityscapesquaretilescliff
" + "
dalarandirtcliff
dalaransquaretilescliff
dalaranruinsdirtcliff
dalaransquaretilescliff
" + "
dungeondirtcliff
dungeonsquaretilescliff
" + "
felwooddirtcliff
felwoodgrasscliff
" + "
icecrownrunebrickscliff
icecrownsnowcliff
" + "
falldirtcliff
" + "
summerdirtcliff
summergrasscliff
" + "
wintergrasscliff
wintersnowcliff
" + "
northrenddirtcliff
northrendsnowcliff
outlandabysscliff
outlandroughdirtcliff
" + "
sunkenruinsdirtcliff
sunkenruinslargebrickscliff
undergrounddirtcliff
undergroundsquaretilescliff
" + "
villagedirtcliff
villagegrassthickcliff
villagefalldirtcliff
villagefallgrassthickcliff"
//Terrain List 4
elseif QNumber == 35 then
return "outlanddirt
outlandlightdirt
outlandroughdirt
outlandcrackeddirt
outlandflatstones
outlandrock
outlandlightflatstones
outlandabyss
" + "
blackcitadeldirt
blackcitadellightdirt
blackcitadelroughdirt
blackcitadelflatstones
blackcitadelsmallbricks
blackcitadellargebricks
blackcitadelsquaretiles
blackcitadeldarktiles"
//Terrain List 5
elseif QNumber == 36 then
return "barrensdirt
barrensroughdirt
barrenspebbles
barrensgrassydirt
barrensdesert
barrensdarkdesert
barrensrocks
barrensgrass
" + "
felwooddirt
felwoodroughdirt
felwoodpoison
felwoodrock
felwoodvines
felwoodgrass
felwoodleaves
" + "
northrenddirt
northrenddarkdirt
northrendrock
northrendgrass
northrendice
northrendsnow
northrendrockysnow
" + "
dungeondirt
dungeonbrick
dungeonredstones
dungeonlavacracks
dungeonlava
dungeondarkrock
dungeongraystones
dungeonsquaretiles
" + "
undergrounddirt
undergroundbrick
undergroundroundstones
undergroundlavacracks
undergroundlava
undergrounddarkrocks
undergroundgraystones
undergroundsquaretiles
" + "
sunkenruinsdirt
sunkenruinsroughdirt
sunkenruinsgrassydirt
sunkenruinssmallbricks
sunkenruinssand
sunkenruinslargebricks
sunkenruinsroundtiles
sunkenruinsgrass
sunkenruinsdarkgrass
" + "
icecrowndirt
icecrownroughdirt
icecrowndarkice
icecrownblackbricks
icecrownrunebricks
icecrowntiledbricks
icecrownice
icecrownblacksquares
icecrownsnow"
elseif QNumber == 37 then
return "floors (use terrain #)
terrain 1 = Brown Cobble
terrain 2 = Light Bricks
terrain 3 = Purple Consortium Tiles
terrain 4 = Orange Cobble
terrain 5 = Dark Cobble
terrain 6 = Pink Slabs
terrain 7 = Sandy Ruins
terrain 8 = Dark Tile
terrain 9 = Stone Brick
terrain 10 = Dark Slabs
terrain 11 = Stone Bricks Large
terrain 12 = Wood Planks
terrain 13 = Webbed Floors
terrain 14 = Outter Space
terrain 15 = Dark Gold Tile
terrain 16 = Green Bricks
terrain 17 = Fel Rocks
terrain 18 = Brown Floor Tile
terrain random"
endif
return "No data."
endfunction
function QRLoop takes nothing returns nothing
local integer i = 1
loop
set bj_lastCreatedQuest = CreateQuest()
call QuestSetTitle(bj_lastCreatedQuest, QRTitle(i))
call QuestSetDescription(bj_lastCreatedQuest, QuestsRequired(i))
call QuestSetIconPath(bj_lastCreatedQuest, "UI\\Widgets\\Console\\Human\\human-minimap-ally-off-disabled.blp")
call QuestSetRequired(bj_lastCreatedQuest, true)
call QuestSetDiscovered(bj_lastCreatedQuest, true)
call QuestSetCompleted(bj_lastCreatedQuest, false)
exitwhen i == QR_MAXINDEX
set i = i + 1
endloop
set bj_lastCreatedQuest = null
endfunction
function QOLoop takes nothing returns nothing
local integer i = 1
loop
set bj_lastCreatedQuest = CreateQuest()
call QuestSetTitle(bj_lastCreatedQuest, QOTitle(i))
call QuestSetDescription(bj_lastCreatedQuest, QuestsOptional(i))
call QuestSetIconPath(bj_lastCreatedQuest, "UI\\Widgets\\Console\\Human\\human-minimap-ally-off.blp")
call QuestSetRequired(bj_lastCreatedQuest, false)
call QuestSetDiscovered(bj_lastCreatedQuest, true)
call QuestSetCompleted(bj_lastCreatedQuest, false)
exitwhen i == QO_MAXINDEX
set i = i + 1
endloop
set bj_lastCreatedQuest = null
call QRLoop()
endfunction
//===========================================================================
function InitTrig_Quests takes nothing returns nothing
set gg_trg_Quests = CreateTrigger( )
call TriggerAddAction( gg_trg_Quests, function QOLoop )
endfunction
endlibrary
//TESH.scrollpos=19
//TESH.alwaysfold=0
function Bounty_Actions takes unit c, unit t, force f, player p, integer pv returns nothing
local integer i = 0
call ForceEnumAllies(f, p, null)
call ForceAddPlayer(f, p)
loop
exitwhen i == 11
if IsPlayerInForce(Player(i), f) then
call SetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD) + pv)
endif
set i = i + 1
endloop
call DestroyForce(f)
endfunction
function Bounty_Conditions takes nothing returns boolean
local integer i = GetUnitBounty(GetTriggerUnit())
local texttag tag = CreateTextTag()
local texttag tag2 = CreateTextTag()
if IsUnitEnemy(GetKillingUnit(), GetTriggerPlayer()) and IsUnitInForce(GetKillingUnit(), udg_Force[1]) then
call Bounty_Actions(GetKillingUnit(), GetTriggerUnit(), CreateForce(), GetOwningPlayer(GetKillingUnit()), i)
call SetTextTagText(tag, "+ " + I2S(i),(12*0.023/10))
call SetTextTagColor(tag, 255, 220, 0, 255)
call SetTextTagVelocity(tag, 0, 0.03)
call SetTextTagPermanent(tag,false)
call SetTextTagLifespan(tag,2)
call SetTextTagFadepoint(tag,1)
call SetTextTagPos(tag,GetUnitX(GetTriggerUnit())-20,GetUnitY(GetTriggerUnit()),8.00)
if not(IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)) then
set i = R2I((25 + GetUnitLevel(GetTriggerUnit()) * 5 + 5 )*GetPlayerHandicapXP(GetOwningPlayer(GetKillingUnit())))
else
set i = R2I(50*GetHeroLevel(GetTriggerUnit())*GetPlayerHandicapXP(GetOwningPlayer(GetKillingUnit())))
endif
if IsUnitType(GetTriggerUnit(), UNIT_TYPE_SUMMONED) then
set i = R2I(i*0.5)
endif
call SetTextTagText(tag2, "+ " + I2S(i),(12*0.023/10))
call SetTextTagColor(tag2, GetPlayerTagColor(GetOwningPlayer(GetKillingUnit()), "red"), GetPlayerTagColor(GetOwningPlayer(GetKillingUnit()), "green"), GetPlayerTagColor(GetOwningPlayer(GetKillingUnit()), "blue"), 255)
call SetTextTagVelocity(tag2, 0, -0.03)
call SetTextTagPermanent(tag2,false)
call SetTextTagLifespan(tag2,2)
call SetTextTagFadepoint(tag2,1)
call SetTextTagPos(tag2,GetUnitX(GetTriggerUnit())+20,GetUnitY(GetTriggerUnit()),8.00)
endif
return false
endfunction
//===========================================================================
function InitTrig_Bounty_System takes nothing returns nothing
set gg_trg_Bounty_System = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bounty_System, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Bounty_System, Condition( function Bounty_Conditions ) )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Flush_Attachments_Actions takes unit u returns nothing
local integer i = 0
loop
exitwhen i == 10
call DestroyEffect(LoadEffectHandle(QuestTable, i, GetHandleId(u)))
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_Flush_Attachments_On_Death takes nothing returns nothing
call OnUnitDeindexed(Trig_Flush_Attachments_Actions)
endfunction
//TESH.scrollpos=15
//TESH.alwaysfold=0
//******************************************************************************
//* *
//* K N O C K B A C K *
//* Actual Code *
//* v1.07 *
//* *
//* By: Rising_Dusk *
//* *
//******************************************************************************
library Knockback initializer Init needs TerrainPathability, GroupUtils, UnitIndexingUtils, LastOrder
globals
//*********************************************************
//* These are the configuration constants for the system
//*
//* EFFECT_ATTACH_POINT: Where on the unit the effect attaches
//* EFFECT_PATH_WATER: What special effect to attach over water
//* EFFECT_PATH_GROUND: What special effect to attach over ground
//* DEST_RADIUS: Radius around which destructs die
//* DEST_RADIUS_SQUARED: Radius squared around which destructs die
//* ADJACENT_RADIUS: Radius for knocking back adjacent units
//* ADJACENT_FACTOR: Factor for collision speed transfers
//* TIMER_INTERVAL: The interval for the timer that gets run
//* ISSUE_LAST_ORDER: A boolean to issue last orders or not
//*
private constant string EFFECT_ATTACH_POINT = "origin"
private constant string EFFECT_PATH_WATER = "MDX\\KnockbackWater.mdx"
private constant string EFFECT_PATH_GROUND = "MDX\\KnockbackDust.mdx"
private constant real DEST_RADIUS = 180.
private constant real DEST_RADIUS_SQUARED = DEST_RADIUS*DEST_RADIUS
private constant real ADJACENT_RADIUS = 180.
private constant real ADJACENT_FACTOR = 0.75
private constant real TIMER_INTERVAL = 0.05
private constant boolean ISSUE_LAST_ORDER = true
//*********************************************************
//* These are static constants used by the system and shouldn't be changed
//*
//* Timer: The timer that runs all of the effects for the spell
//* Counter: The counter for how many KB instances exist
//* HitIndex: Indexes for a given unit's knockback
//* Knockers: The array of all struct instances that exist
//* Entries: Counters for specific unit instances in system
//* ToClear: How many instances to remove on next run
//* DesBoolexpr: The check used for finding destructables
//* AdjBoolexpr: The check for picking adjacent units to knockback
//* DestRect: The rect used to check for destructables
//*
private timer Timer = CreateTimer()
private integer Counter = 0
private integer array HitIndex
private integer array Knockers
private integer array Entries
private integer array ToClear
private boolexpr DesBoolexpr = null
private boolexpr AdjBoolexpr = null
private rect DestRect = Rect(0,0,1,1)
//* Temporary variables used by the system
private real TempX = 0.
private real TempY = 0.
private unit TempUnit1 = null
private unit TempUnit2 = null
endglobals
//* Boolean for whether or not to display effects on a unit
private function ShowEffects takes unit u returns boolean
return not IsUnitType(u, UNIT_TYPE_FLYING)
endfunction
//* Functions for the destructable destruction
private function KillDests_Check takes nothing returns boolean
local real x = GetDestructableX(GetFilterDestructable())
local real y = GetDestructableY(GetFilterDestructable())
return (TempX-x)*(TempX-x) + (TempY-y)*(TempY-y) <= DEST_RADIUS_SQUARED
endfunction
private function KillDests takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
//* Functions for knocking back adjacent units
private function KnockAdj_Check takes nothing returns boolean
return TempUnit2 != GetFilterUnit() and IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempUnit1)) and IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) and GetWidgetLife(GetFilterUnit()) > 0.405 and GetUnitAbilityLevel(GetFilterUnit(), 'Avul') <= 0
endfunction
//******************************************************************************
//* Some additional functions that can be used
function KnockbackStop takes unit targ returns boolean
local integer id = GetUnitId(targ)
set ToClear[id] = Entries[id]
return ToClear[id] > 0
endfunction
function IsKnockedBack takes unit targ returns boolean
return Entries[GetUnitId(targ)] > 0
endfunction
//* Struct for the system, I recommend leaving it alone
private struct knocker
unit Source = null
unit Target = null
group HitGroup = null
effect KBEffect = null
integer FXMode = 0
boolean KillDest = false
boolean KnockAdj = false
boolean ChainAdj = false
boolean ShowEff = false
real Decrement = 0.
real Displace = 0.
real CosA = 0.
real SinA = 0.
string knockMdl = ""
public method checkterrain takes knocker n returns integer
local integer i = 0
local real x = GetUnitX(n.Target)
local real y = GetUnitY(n.Target)
if IsTerrainLand(x, y) then
set i = 1
elseif IsTerrainShallowWater(x, y) then
set i = 2
endif
return i
endmethod
static method create takes unit source, unit targ, real angle, real disp, real dec, boolean killDestructables, boolean knockAdjacent, boolean chainAdjacent, string knockModel returns knocker
local knocker n = knocker.allocate()
set n.Target = targ
set n.Source = source
set n.FXMode = n.checkterrain(n)
set n.HitGroup = NewGroup()
set n.KillDest = killDestructables
set n.KnockAdj = knockAdjacent
set n.ChainAdj = chainAdjacent
set n.ShowEff = ShowEffects(targ)
set n.Decrement = dec
set n.Displace = disp
set n.CosA = Cos(angle)
set n.SinA = Sin(angle)
set n.knockMdl = knockModel
if n.ShowEff then
if n.FXMode == 1 then
set n.KBEffect = AddSpecialEffectTarget(n.knockMdl, n.Target, EFFECT_ATTACH_POINT)
elseif n.FXMode == 2 then
set n.KBEffect = AddSpecialEffectTarget(EFFECT_PATH_WATER, n.Target, EFFECT_ATTACH_POINT)
debug else
debug call BJDebugMsg(SCOPE_PREFIX+" Error (On Create): Unknown Terrain Type")
endif
endif
return n
endmethod
private method onDestroy takes nothing returns nothing
local integer id = GetUnitId(this.Target)
set Entries[id] = Entries[id] - 1
if GetWidgetLife(this.Target) > 0.405 and Entries[id] <= 0 and ISSUE_LAST_ORDER then
//* Issue last order if activated
call IssueLastOrder(this.Target)
endif
if this.ShowEff then
//* Destroy effect if it exists
call DestroyEffect(this.KBEffect)
endif
call ReleaseGroup(this.HitGroup)
endmethod
endstruct
private function Update takes nothing returns nothing
local unit u = null
local unit s = null
local rect r = null
local knocker n = 0
local knocker m = 0
local integer i = Counter - 1
local integer j = 0
local integer mode = 0
local integer id = 0
local real xi = 0.
local real yi = 0.
local real xf = 0.
local real yf = 0.
loop
exitwhen i < 0
set n = Knockers[i]
set u = n.Target
set mode = n.FXMode
set id = GetUnitId(u)
set xi = GetUnitX(u)
set yi = GetUnitY(u)
if n.Displace <= 0 or ToClear[id] > 0 then
//* Clean up the knockback when it is over
if ToClear[id] > 0 then
set ToClear[id] = ToClear[id] - 1
endif
call n.destroy()
set Counter = Counter - 1
if Counter < 0 then
call PauseTimer(Timer)
set Counter = 0
else
set Knockers[i] = Knockers[Counter]
endif
else
//* Propagate the knockback in space and time
set xf = xi + n.Displace*n.CosA
set yf = yi + n.Displace*n.SinA
call SetUnitPosition(u, xf, yf)
set n.FXMode = n.checkterrain(n)
//* Modify the special effect if necessary
if n.ShowEff then
if n.FXMode == 1 and mode == 2 then
call DestroyEffect(n.KBEffect)
set n.KBEffect = AddSpecialEffectTarget(EFFECT_PATH_GROUND, n.Target, EFFECT_ATTACH_POINT)
elseif n.FXMode == 2 and mode == 1 then
call DestroyEffect(n.KBEffect)
set n.KBEffect = AddSpecialEffectTarget(EFFECT_PATH_WATER, n.Target, EFFECT_ATTACH_POINT)
debug elseif n.FXMode == 0 then
debug call BJDebugMsg(SCOPE_PREFIX+" Error (In Update): Unknown Terrain Type")
endif
endif
//* Decrement displacement left to go
set n.Displace = n.Displace - n.Decrement
//* Destroy destructables if desired
if n.KillDest then
set TempX = GetUnitX(u)
set TempY = GetUnitY(u)
call MoveRectTo(DestRect, TempX, TempY)
call EnumDestructablesInRect(DestRect, DesBoolexpr, function KillDests)
endif
//* Knockback nearby units if desired
if n.KnockAdj then
set xi = GetUnitX(u)
set yi = GetUnitY(u)
set TempUnit1 = n.Source
set TempUnit2 = u
call GroupEnumUnitsInRange(ENUM_GROUP, xi, yi, ADJACENT_RADIUS, AdjBoolexpr)
loop
set s = FirstOfGroup(ENUM_GROUP)
exitwhen s == null
if not IsUnitInGroup(s, n.HitGroup) then
set xf = GetUnitX(s)
set yf = GetUnitY(s)
call GroupAddUnit(n.HitGroup, s)
set m = knocker.create(n.Source, s, Atan2(yf-yi, xf-xi), n.Displace*ADJACENT_FACTOR, n.Decrement, n.KillDest, n.ChainAdj, n.ChainAdj, n.knockMdl)
call GroupAddUnit(m.HitGroup, u)
set Knockers[Counter] = m
set Counter = Counter + 1
endif
call GroupRemoveUnit(ENUM_GROUP, s)
endloop
endif
endif
set i = i - 1
endloop
set u = null
set s = null
endfunction
//******************************************************************************
//* How to knockback a unit
function KnockbackTarget takes unit source, unit targ, real angle, real startspeed, real decrement, boolean killDestructables, boolean knockAdjacent, boolean chainAdjacent, string knockModel returns boolean
local knocker n = 0
local integer id = GetUnitId(targ)
local boolean b = true
//* Protect users from themselves
if decrement <= 0. or startspeed <= 0. or targ == null then
debug call BJDebugMsg(SCOPE_PREFIX+" Error (On Call): Invalid Starting Conditions")
set b = false
else
//* Can't chain if you don't knockback adjacent units
if not knockAdjacent and chainAdjacent then
set chainAdjacent = false
endif
set n = knocker.create(source, targ, angle*bj_DEGTORAD, startspeed*TIMER_INTERVAL, decrement*TIMER_INTERVAL*TIMER_INTERVAL, killDestructables, knockAdjacent, chainAdjacent, knockModel)
if Counter == 0 then
call TimerStart(Timer, TIMER_INTERVAL, true, function Update)
endif
set Entries[id] = Entries[id] + 1
set HitIndex[id] = Counter + 1
set Knockers[Counter] = n
set Counter = Counter + 1
endif
return b
endfunction
private function Init takes nothing returns nothing
call SetRect(DestRect, -DEST_RADIUS, -DEST_RADIUS, DEST_RADIUS, DEST_RADIUS)
set DesBoolexpr = Condition(function KillDests_Check)
set AdjBoolexpr = Condition(function KnockAdj_Check)
endfunction
endlibrary
//TESH.scrollpos=12
//TESH.alwaysfold=0
The system is totally self-reliant. The only thing you'll have to do to
implement the system is choose a special effect for knockbacks over water and
also one for over land. I included two special effects of my own making in the
testmap that do the job well, in case you can't find any of your own. Just
import the effects or choose some from in-game and go with it! The effects need
a 'stand' animation, so make sure you choose proper effects.
In order to move the system to your own map, just copy and paste the entire
trigger called "Knockback" in the "Knockback System" folder of the trigger editor
to your map anywhere you'd like. It will then be ready for use!
Included in the testmap are two spells taking advantage of the knockback system
in different ways. You are more than welcome to use these sample spells in your
own maps too if you would like.
#######################################################################################################
call KnockbackTarget(TargetUnit, AngleInDegrees, InitialSpeed, SpeedLossPerInterval, KillDestructables, KnockbackAdjacent, ChainAdjacent)
That is the call that you would use to apply the system to your map. Make sure to
call it using scaled up values. Refer to the sample spells for more info there. It may
be rather difficult to see what all of those ending booleans do, so let me explain it
here. KillDestructables tells the system whether or not you want that specific knockback
to destroy any destructables (ie. trees, rocks) the knocked back unit encounters.
KnockbackAdjacent tells the system whether you want to internally have the system impact
and knockback any units the initially struck unit runs into. ChainAdjacent extends that
to tell the system whether you want the secondary units hit by the primary target to
chain on and on. This option was provided because with AOE knockbacks, you might start
accidentally readd the same unit to the system dozens of times. Toy with these until you
get exactly what you want.
#######################################################################################################
call KnockbackStop(TargetUnitToStop)
This will instantly stop a unit's knockback no matter what. This can be useful in
some cases, so I included it in the event someone else might be able to use it.
#######################################################################################################
call IsKnockedBack(TargetUnitToCheck)
This call returns true if a unit is being knocked back or not. This may be useful
if you want to not multi-knockback a unit or if you want to link knockbacks together.
(Not internal to the system, that is)
Hopefully you like the system!
~Rising_Dusk
//TESH.scrollpos=113
//TESH.alwaysfold=0
library ItemList requires optional xepreload, optional AbilityPreload
globals
//If true, item abilitys will be preloaded on map init, when adding one to the systen (longer laod time, but no laggs if first time used/equipped)
private constant boolean PRELOAD_ABILITYS = false
//The unit for preloading item abilitys
private constant integer PRELOAD_DUMMY_ID = 'hpea'
endglobals
//The struct for each item you have registred
struct Item
integer Life = 0
integer Mana = 0
integer Str = 0
integer Agi = 0
integer Int = 0
integer Dmg = 0
integer Armor = 0
integer Level = 1
integer HpReg = 0
integer MpReg = 0
integer As = 0
integer Abil = 0
integer Ms = 0
integer AltSlot = 0
integer UnSlot = -1
string ATag = ""
string Effect = ""
string EffectAttach = ""
string altEffectAttach = "hand right"
boolean Ranged = false
readonly string ItemClass = ""
readonly string HeroClasses = ""
readonly integer ItemId = 0
readonly integer Slot = -1
readonly boolean AllowStacks = false
readonly boolean Equipment = true
readonly integer MaxStacks = 0
private static Table table
private static boolean allowAdd = true
private static trigger Disabler = CreateTrigger()
private integer id = 0
private static unit dummy = null
//Use this method to register an Item, which IS equippable to the system
//Example: call Item.addEquipment('I000', 2, "Bloogmages", "Cloth Armors")
//This would register the item as a weapon (see above), which ItemTypeId is 'I000' to the system
//has the ItemClass "Cloth Armors" and is only equippable by "Bloodmages"
static method addEquipment takes integer ItemId, integer Slot, string availableHeroClasses, string itemClass returns thistype
local thistype this = 0
if .allowAdd then
set this = .allocate()
set .ItemId = ItemId
set .Slot = Slot
set .UnSlot = Slot
set .HeroClasses = availableHeroClasses
set .ItemClass = itemClass
set .id = .id + 1
set .table[.ItemId] = this
return this
debug else
call BJDebugMsg("Can only register Items in Map Initialization")
endif
return 0
endmethod
//Use this method to register an Item, which IS NOT equippable to the system
//Example: call Item.addNormalItem('I001', true, 6)
//This would register the item, which ItemTypeId is 'I001' to the system, enables Stacks for it and sets its MaxStacks to 6
static method addNormalItem takes integer ItemId, boolean AllowStacks, integer MaxStacks returns thistype
local thistype this = 0
if .allowAdd then
set this = .allocate()
set .ItemId = ItemId
set .Equipment = false
set .MaxStacks = MaxStacks
if .MaxStacks > 0 then
set .AllowStacks = true
endif
set .id = .id + 1
set .table[.ItemId] = this
return this
debug else
call BJDebugMsg("Can only register Items in Map Initialization")
endif
return 0
endmethod
//call this method after adding an ability to an item. If you set the boolean "inSpellbook" to true,
//the system disables the spellbook for every player (not the ability in it!)
method HasAbility takes boolean inSpellbook returns nothing
local integer i = 0
static if PRELOAD_ABILITYS then
static if LIBRARY_xepreload then
call XE_PreloadAbility(.Abil)
elseif LIBRARY_AbilityPreload then
call AbilityPreload(.Abil)
else
call UnitAddAbility(.dummy, .Abil)
call UnitRemoveAbility(.dummy, .Abil)
endif
endif
if inSpellbook then
loop
call SetPlayerAbilityAvailable(Player(i), .Abil, false)
set i = i + 1
exitwhen i >= bj_MAX_PLAYER_SLOTS
endloop
endif
endmethod
//Returns the Item struct by using its index
static method getItemByIndex takes integer Id returns Item //INLINE FRIENDLY
return Item(Id)
endmethod
//Returns the Item Struct by the item Type Id
static method getItemById takes integer ItemId returns Item //INLINE FRIENDLY
return Item(.table[ItemId])
endmethod
//Disables the registring after map Initialization
private static method disableAdd takes nothing returns boolean
set .allowAdd = false
call DestroyTrigger(.Disabler)
static if PRELOAD_ABILITYS and not LIBRARY_xepreload and not LIBRARY_AbilityPreload then
call KillUnit(.dummy)
endif
return .allowAdd
endmethod
//self-explanatory
private static method onInit takes nothing returns nothing
static if PRELOAD_ABILITYS and not LIBRARY_xepreload and not LIBRARY_AbilityPreload then
set .dummy = CreateUnit(Player(15), PRELOAD_DUMMY_ID, 0., 0., 0.)
endif
call TriggerRegisterTimerEvent(.Disabler, 0., false)
call TriggerAddCondition(.Disabler, Condition(function Item.disableAdd))
set .table = Table.create()
endmethod
endstruct
endlibrary
//TESH.scrollpos=657
//TESH.alwaysfold=0
library InventorySystem requires TimerUtils, Table, ItemList, SimError BonusMod UnitMaxStateBonuses MovementBonus
globals
//The Rawcodes of the Items for opening the backpack and equipment
private constant integer EQUIPMENT_OPEN_ID = 'eopn'
private constant integer BACKPACK_OPEN_ID = 'bopn'
//The rawcodes of the Items for closing the backpack and equipment
private constant integer EQUIPMENT_CLOSE_ID = 'ecls'
private constant integer BACKPACK_CLOSE_ID = 'bcls'
//The rawcodes of the Items changing the pages of the backpack and equipment menu
private constant integer EQUIPMENT_PAGE_1 = 'epg1'
private constant integer BACKPACK_PAGE_1 = 'bpg1'
private constant integer EQUIPMENT_PAGE_2 = 'epg2'
private constant integer BACKPACK_PAGE_2 = 'bpg2'
//The slots, where the items for opening backpack and equipment menu should be created
private constant integer EQUIPMENT_SLOT = 4
private constant integer BACKPACK_SLOT = 5
//The place, where required items should be stored
private constant real STORE_ITEM_X = 0.
private constant real STORE_ITEM_Y = 0.
//The Max Number of Charges, an item can has maximum
constant integer MAX_ITEM_CHARGES = 80
//If true, the equipment menu will change to first page when opened
private constant boolean CHANGE_TO_FIRST = true
//If true, an item being picked up will be auto equipped, if its slot is emtpy and the hero can wear it
private constant boolean AUTO_EQUIP = true
//The distance, an item can be picked up by a hero
private constant real ITEM_PICKUP_DIST = 150.00
//Don't change this!!!
private integer array DUMMY_ITEMS[8]
endglobals
private function SETUP_DUMMY_ITEMS takes nothing returns nothing
set DUMMY_ITEMS[0] = 'head' //Head
set DUMMY_ITEMS[1] = 'ches' //Chest
set DUMMY_ITEMS[2] = 'maha' //Main Hand
set DUMMY_ITEMS[3] = 'seha' //Secondary Hand
set DUMMY_ITEMS[4] = 'glov' //Gloves
set DUMMY_ITEMS[5] = 'feet' //Feet
set DUMMY_ITEMS[6] = 'fiac' //First Acessory
set DUMMY_ITEMS[7] = 'seac' //Second Acessory
endfunction
//EVERYTHING BELOW HERE IS SYSTEM CODE!!!
private keyword addItem
//This is the triggered item pickup and stack detection System.
private struct StackData
private delegate Inventory inv = 0
item item = null
real x = 0
real y = 0
integer order = 0
private static integer count = 0
private static thistype array datas
private static trigger walkTo
//creates a new instance of the stackdata
static method create takes unit hero, item which returns StackData
local StackData this = StackData.allocate()
set .inv = Inventory.table[hero]
set .item = which
set .x = GetItemX(.item)
set .y = GetItemY(.item)
call IssuePointOrder(.Owner, "move", .x, .y)
set .order = GetUnitCurrentOrder(.Owner)
set .datas[.count] = this
set .count = .count + 1
return this
endmethod
//checks if the issued target was an item and the order is correct
static method check takes nothing returns boolean
if GetOrderTargetItem() != null and (GetIssuedOrderId() == 851971) then
call StackData.create(GetTriggerUnit(), GetOrderTargetItem())
return true
endif
return false
endmethod
//just sorts and checks each stackdata...
static method periodic takes nothing returns nothing
local integer i = .count - 1
loop
exitwhen i < 0
if not .datas[i].control() then
set .count = .count - 1
if .count < 0 then
set .count = 0
else
set .datas[i] = .datas[.count]
endif
endif
set i = i - 1
endloop
endmethod
//checks the hero and the item every interval
method control takes nothing returns boolean
local real dx = GetUnitX(.Owner) - .x
local real dy = GetUnitY(.Owner) - .y
local Item it = Item.getItemById(GetItemTypeId(.item))
if GetUnitCurrentOrder(.Owner) != .order or GetItemX(.item) != .x or GetItemY(.item) != .y or GetWidgetLife(.Owner) <= 0.405 then
return false
elseif SquareRoot(dx * dx + dy * dy) <= ITEM_PICKUP_DIST and GetItemX(.item) == .x or GetItemY(.item) == .y and GetWidgetLife(.Owner) > 0.405 then
call IssueImmediateOrder(.Owner, "stop")
if (AUTO_EQUIP and it.Equipment and .isSlotEmpty(it.Slot) and .checkHero(it, false) and .allowauto) then
return Inventory.equipItem(.Owner, .item, it)
endif
if not .checkItemForStack(.item) then
if not .getSlotForItem(.item) then
call SimError(GetOwningPlayer(.Owner), "Inventory and Backpack are full.")
return false
endif
endif
return false
elseif SquareRoot(dx * dx + dy * dy) > ITEM_PICKUP_DIST then
return true
endif
return false
endmethod
//self explanatory..
static method onInit takes nothing returns nothing
set .walkTo = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(.walkTo, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
call TriggerAddCondition(.walkTo, Condition(function thistype.check))
call TimerStart(CreateTimer(), 0.05, true, function thistype.periodic)
endmethod
endstruct
//private struct required to "recreate" items in their slots when their are dragged or dropped incorrect
private struct addItem
delegate Inventory inv
integer id
integer charges
integer slot
private timer t
//creates a new instance for an item to a move it to a slot
static method create takes item it, integer slot, Inventory inv returns thistype
local thistype this = thistype.allocate()
set .inv = inv
set .id = GetItemTypeId(it)
set .charges = GetItemCharges(it)
set .slot = slot
set .dropped = false
call RemoveItem(it)
set .dropped = true
set .t = NewTimer()
call SetTimerData(.t, this)
call TimerStart(.t, 0.0, false, function thistype.expire)
return this
endmethod
//0.0 second tiemr interval is required...
private static method expire takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
call UnitAddItemToSlotById(.Owner, .id, .slot)
call SetItemCharges(UnitItemInSlot(.Owner, .slot), .charges)
call ReleaseTimer(.t)
call .destroy()
endmethod
endstruct
//Thanks to D1000 for creating this function
public function SearchString takes string WhichString, string ForWhat returns boolean
local integer BaseLength = StringLength(WhichString)
local integer SearchLength = StringLength(ForWhat)
local integer i = 0
loop
exitwhen ForWhat == SubString(WhichString, i, i + SearchLength)
set i = i + 1
if i + SearchLength > BaseLength then
return false
endif
endloop
return true
endfunction
//The Inventory struct..
struct Inventory
unit Owner
string HeroClass = ""
string ItemClasses = ""
item array equip[8]
integer array items[6]
integer array backp[8]
integer array charges[6]
integer array bcharges[8]
boolean allowauto = true
integer bfree = 8
boolean dropped = true
private boolean open = false
private boolean bopen = false
private integer page = 1
private integer bpage = 1
public static HandleTable table
//creates a new Inventory for the unit
static method create takes unit whichUnit, string heroClass, string availableItemClasses returns thistype
local thistype this = 0
local integer i = 0
if not .table.exists(whichUnit) then
set this = thistype.allocate()
set .Owner = whichUnit
set .HeroClass = heroClass
set .ItemClasses = availableItemClasses
loop
exitwhen i > 8
set .equip[i] = CreateItem(DUMMY_ITEMS[i], STORE_ITEM_X, STORE_ITEM_Y)
call SetItemVisible(.equip[i], false)
set i = i + 1
endloop
call TriggerRegisterUnitEvent(.Use, .Owner, EVENT_UNIT_USE_ITEM)
call TriggerRegisterUnitEvent(.Pickup, .Owner, EVENT_UNIT_PICKUP_ITEM)
call TriggerRegisterUnitEvent(.Drag, .Owner, EVENT_UNIT_ISSUED_TARGET_ORDER)
call TriggerRegisterUnitEvent(.Drop, .Owner, EVENT_UNIT_DROP_ITEM)
call UnitAddItemToSlotById(.Owner, EQUIPMENT_OPEN_ID, EQUIPMENT_SLOT)
call UnitAddItemToSlotById(.Owner, BACKPACK_OPEN_ID, BACKPACK_SLOT)
call SetItemCharges(UnitItemInSlot(.Owner, BACKPACK_SLOT), .bfree)
set .table[.Owner] = this
return this
endif
return 0
endmethod
//opens the backpack for the unit
public static method openBackpack takes unit whichUnit returns boolean
local integer i = 0
local integer i2 = 0
local thistype this = .table[whichUnit]
local item temp = null
local integer add = 0
if not .table.exists(whichUnit) then
return false
elseif not .bopen and not .open then
set .bopen = true
set .allowauto = false
loop
exitwhen i > 5
set temp = UnitItemInSlot(.Owner, i)
set .charges[i] = GetItemCharges(temp)
set .items[i] = GetItemTypeId(temp)
call RemoveItem(temp)
set i = i + 1
endloop
call UnitAddItemToSlotById(.Owner, BACKPACK_CLOSE_ID, 5)
if .bpage <= 1 then
set i = 0
loop
exitwhen i > 3
if .backp[i] != 0 then
call UnitAddItemToSlotById(.Owner, .backp[i], i)
call SetItemCharges(UnitItemInSlot(.Owner, i), .bcharges[i])
endif
set i = i + 1
endloop
call UnitAddItemToSlotById(.Owner, BACKPACK_PAGE_2, 4)
elseif .bpage >= 2 then
set i = 0
loop
exitwhen i > 3
if .backp[i+4] != 0 then
call UnitAddItemToSlotById(.Owner, .backp[i+4], i)
call SetItemCharges(UnitItemInSlot(.Owner, i), .bcharges[i+4])
endif
set i = i + 1
endloop
call UnitAddItemToSlotById(.Owner, BACKPACK_PAGE_1, 4)
endif
set temp = null
set .allowauto = true
return true
endif
return true
endmethod
//opens the equipment menu
public static method openEquipment takes unit whichUnit returns boolean
local integer i = 0
local thistype this = .table[whichUnit]
local item temp = null
if not .table.exists(whichUnit) then
return false
elseif not .open and not .bopen then
set .open = true
set .allowauto = false
if .page <= 1 or CHANGE_TO_FIRST then
loop
exitwhen i > 5
set temp = UnitItemInSlot(.Owner, i)
set .charges[i] = GetItemCharges(temp)
set .items[i] = GetItemTypeId(temp)
call RemoveItem(temp)
if i < 4 then
call SetItemVisible(.equip[i], true)
call UnitAddItem(.Owner, .equip[i])
endif
set i = i + 1
endloop
call UnitAddItemToSlotById(.Owner, EQUIPMENT_PAGE_2, 4)
elseif .page >= 2 and not CHANGE_TO_FIRST then
loop
exitwhen i > 5
set temp = UnitItemInSlot(.Owner, i)
set .charges[i] = GetItemCharges(temp)
set .items[i] = GetItemTypeId(temp)
call RemoveItem(temp)
if i < 4 then
call SetItemVisible(.equip[i+4], true)
call UnitAddItem(.Owner, .equip[i+4])
endif
set i = i + 1
endloop
call UnitAddItemToSlotById(.Owner, EQUIPMENT_PAGE_1, 4)
endif
call UnitAddItemToSlotById(.Owner, EQUIPMENT_CLOSE_ID, 5)
set .allowauto = true
return true
endif
return true
endmethod
//closes the hero's backpack
public static method closeBackpack takes unit whichUnit returns boolean
local integer i = 0
local item t = null
local thistype this = .table[whichUnit]
local item temp = null
if not .table.exists(whichUnit) then
return false
elseif .bopen then
set .bopen = false
set .allowauto = false
call RemoveItem(UnitItemInSlot(.Owner, 5))
call RemoveItem(UnitItemInSlot(.Owner, 4))
if .bpage <= 1 then
loop
exitwhen i > 3
set temp = UnitRemoveItemFromSlot(.Owner, i)
set .backp[i] = GetItemTypeId(temp)
set .bcharges[i] = GetItemCharges(temp)
call RemoveItem(temp)
set i = i + 1
endloop
elseif .bpage >= 2 then
loop
exitwhen i > 3
set temp = UnitRemoveItemFromSlot(.Owner, i)
set .backp[i+4] = GetItemTypeId(temp)
set .bcharges[i+4] = GetItemCharges(temp)
call RemoveItem(temp)
set i = i + 1
endloop
endif
set i = 0
loop
exitwhen i > 5
if .items[i] != 0 then
call UnitAddItemToSlotById(.Owner, .items[i], i)
call SetItemCharges(UnitItemInSlot(.Owner, i), .charges[i])
endif
set i = i + 1
endloop
set .bfree = .getBackpackPlace()
call SetItemCharges(UnitItemInSlot(.Owner, BACKPACK_SLOT), .bfree)
set .allowauto = true
set temp = null
return true
endif
return false
endmethod
//closes the hero's equipment menu
public static method closeEquipment takes unit whichUnit returns boolean
local integer i = 0
local item t = null
local thistype this = .table[whichUnit]
local integer add = 0
if not .table.exists(whichUnit) then
return false
elseif .open then
set .open = false
set .allowauto = false
if .page >= 2 then
set add = 4
endif
loop
exitwhen i > 3
set .equip[i+add] = UnitRemoveItemFromSlot(.Owner, i)
call SetItemPosition(.equip[i+add], STORE_ITEM_X, STORE_ITEM_Y)
call SetItemVisible(.equip[i+add], false)
set i = i + 1
endloop
call RemoveItem(UnitItemInSlot(.Owner, 5))
call RemoveItem(UnitItemInSlot(.Owner, 4))
set i = 0
loop
exitwhen i > 5
if .items[i] != 0 then
call UnitAddItemToSlotById(.Owner, .items[i], i)
call SetItemCharges(UnitItemInSlot(.Owner, i), .charges[i])
endif
set i = i + 1
endloop
call SetItemCharges(UnitItemInSlot(.Owner, BACKPACK_SLOT), .bfree)
if CHANGE_TO_FIRST then
set .page = 1
endif
set .allowauto = true
return true
endif
return false
endmethod
//changes the backpack pages of the unit
public static method changePageBackpack takes unit whichUnit returns boolean
local integer i = 0
local thistype this = .table[whichUnit]
local item temp = null
if .bopen and this != 0 then
set .dropped = false
call RemoveItem(UnitItemInSlot(.Owner, 4))
set .dropped = true
set .allowauto = false
if .bpage <= 1 then
loop
exitwhen i > 3
set temp = UnitRemoveItemFromSlot(.Owner, i)
set .backp[i] = GetItemTypeId(temp)
set .bcharges[i] = GetItemCharges(temp)
call UnitAddItemToSlotById(.Owner, .backp[i+4], i)
call SetItemCharges(UnitItemInSlot(.Owner, i), .bcharges[i+4])
call RemoveItem(temp)
set i = i + 1
endloop
call UnitAddItemToSlotById(.Owner, BACKPACK_PAGE_1, 4)
set .bpage = 2
elseif .bpage >= 2 then
loop
exitwhen i > 3
set temp = UnitRemoveItemFromSlot(.Owner, i)
set .backp[i+4] = GetItemTypeId(temp)
set .bcharges[i+4] = GetItemCharges(temp)
call UnitAddItemToSlotById(.Owner, .backp[i], i)
call SetItemCharges(UnitItemInSlot(.Owner, i), .bcharges[i])
call RemoveItem(temp)
set i = i + 1
endloop
call UnitAddItemToSlotById(.Owner, BACKPACK_PAGE_2, 4)
set .bpage = 1
endif
set .allowauto = true
set temp = null
return true
endif
return false
endmethod
//changes the equipment menu pages for the unit
public static method changePageEquipment takes unit whichUnit returns boolean
local integer i = 0
local thistype this = .table[whichUnit]
local integer add = 0
if .open and this != 0 then
if .page >= 2 then
set add = 4
endif
set .allowauto = false
loop
exitwhen i > 3
set .equip[i+add] = UnitRemoveItemFromSlot(.Owner, i)
call SetItemPosition(.equip[i+add], STORE_ITEM_X, STORE_ITEM_Y)
call SetItemVisible(.equip[i+add], false)
call UnitAddItem(.Owner, .equip[i+4-add])
set i = i + 1
endloop
set .dropped = false
call RemoveItem(UnitItemInSlot(.Owner, 4))
set .dropped = true
if .page >= 2 then
call UnitAddItemToSlotById(.Owner, EQUIPMENT_PAGE_2, 4)
set .page = 1
elseif .page <= 1 then
call UnitAddItemToSlotById(.Owner, EQUIPMENT_PAGE_1, 4)
set .page = 2
endif
set .allowauto = true
return true
endif
return false
endmethod
//Only call this method, if you can be shure, that the Item's slot is empty or it will bug!
public static method quickEquip takes unit u, Item it returns boolean
local thistype this = .table[u]
if .checkHero(it, true) then
set .equip[it.UnSlot] = CreateItem(it.ItemId, STORE_ITEM_X, STORE_ITEM_Y)
call SetItemVisible(.equip[it.UnSlot], false)
call SetItemDroppable(.equip[it.UnSlot], false)
call .applyItemStats(it)
return true
endif
return false
endmethod
//equips an item for a hero
public static method equipItem takes unit u, item t, Item it returns boolean
local thistype this = .table[u]
local integer itd1 = 0
local integer itd2 = 0
local integer slot = 0
local integer i = 0
if .checkHero(it, true) then
if it.AltSlot > 0 then
if not .isSlotEmpty(it.Slot) then
set it.UnSlot = it.Slot+it.AltSlot
endif
endif
if not .isItemEquipped(t) and .isSlotEmpty(it.UnSlot) then
if not .open then
call RemoveItem(.equip[it.UnSlot])
set .equip[it.UnSlot] = t
call SetItemPosition(.equip[it.UnSlot], STORE_ITEM_X, STORE_ITEM_Y)
call SetItemVisible(.equip[it.UnSlot], false)
call SetItemDroppable(.equip[it.UnSlot], false)
call .applyItemStats(it)
return true
elseif .open then
set .dropped = false
if .page <= 1 then
if it.UnSlot <= 3 then
if not (GetItemTypeId(UnitItemInSlot(.Owner, it.UnSlot)) == DUMMY_ITEMS[it.UnSlot]) then
if not .getSlotForItem(UnitItemInSlot(.Owner, it.UnSlot)) then
call SimError(GetOwningPlayer(.Owner), "Inventory and Backpack are full.")
return false
endif
else
call RemoveItem(UnitItemInSlot(.Owner, it.UnSlot))
endif
call UnitAddItemToSlotById(.Owner, it.ItemId, it.UnSlot)
call .applyItemStats(it)
return true
elseif it.UnSlot > 3 then
if not (GetItemTypeId(.equip[it.UnSlot]) == DUMMY_ITEMS[it.UnSlot]) then
if not .getSlotForItem(.equip[it.UnSlot]) then
call SimError(GetOwningPlayer(.Owner), "Inventory and Backpack are full.")
return false
endif
else
call RemoveItem(.equip[it.UnSlot])
endif
set .equip[it.UnSlot] = t
call SetItemPosition(.equip[it.UnSlot], STORE_ITEM_X, STORE_ITEM_Y)
call SetItemVisible(.equip[it.UnSlot], false)
call SetItemDroppable(.equip[it.UnSlot], false)
call .applyItemStats(it)
return true
endif
elseif .page >= 2 then
if it.UnSlot > 3 then
if not (GetItemTypeId(UnitItemInSlot(.Owner, it.UnSlot - 4)) == DUMMY_ITEMS[it.UnSlot]) then
if not .getSlotForItem(UnitItemInSlot(.Owner, it.UnSlot - 4)) then
call SimError(GetOwningPlayer(.Owner), "Inventory and Backpack are full.")
return false
endif
else
call RemoveItem(UnitItemInSlot(.Owner, it.UnSlot - 4))
endif
call UnitAddItemToSlotById(.Owner, it.ItemId, it.UnSlot - 4)
call .applyItemStats(it)
return true
elseif it.UnSlot <= 3 then
if not (GetItemTypeId(.equip[it.UnSlot]) == DUMMY_ITEMS[it.UnSlot]) then
if not .getSlotForItem(UnitItemInSlot(.Owner, it.UnSlot)) then
call SimError(GetOwningPlayer(.Owner), "Inventory and Backpack are full.")
return false
endif
else
call RemoveItem(.equip[it.UnSlot])
endif
set .equip[it.UnSlot] = t
call SetItemPosition(.equip[it.UnSlot], STORE_ITEM_X, STORE_ITEM_Y)
call SetItemVisible(.equip[it.UnSlot], false)
call SetItemDroppable(.equip[it.UnSlot], false)
call .applyItemStats(it)
return true
endif
endif
endif
elseif not .isSlotEmpty(it.UnSlot) then
set itd1 = GetItemTypeId(t)
set slot = .getItemSlot(t)
call RemoveItem(t)
set itd2 = GetItemTypeId(.equip[it.UnSlot])
call RemoveItem(.equip[it.UnSlot])
call .removeItemStats(Item.getItemById(itd2))
call .applyItemStats(it)
set .equip[it.UnSlot] = CreateItem(itd1, STORE_ITEM_X, STORE_ITEM_Y)
call SetItemVisible(.equip[it.UnSlot], false)
call UnitAddItemToSlotById(.Owner, itd2, slot)
call SetItemDroppable(.equip[it.UnSlot], false)
return true
endif
endif
return false
endmethod
//un-equips an item for the hero
public static method unequipItem takes unit u, item t, Item it returns boolean
local thistype this = .table[u]
if not .getSlotForItem(t) then
call SimError(GetOwningPlayer(.Owner), "Inventory and Backpack are full.")
return false
else
call .removeItemStats(it)
set .equip[it.UnSlot] = UnitAddItemById(.Owner, DUMMY_ITEMS[it.UnSlot])
set it.UnSlot = it.Slot
return true
endif
endmethod
//Returns true, if the given item is equipped (or an item with the same ItemTypeId)
public method isItemEquipped takes item whichItem returns boolean //INLINE FRIENDLY
return GetItemTypeId(.equip[Item.getItemById(GetItemTypeId(whichItem)).UnSlot]) == GetItemTypeId(whichItem)
endmethod
//Returns true, if the given slot is empty
public method isSlotEmpty takes integer Slot returns boolean //INLINE FRIENDLY
return GetItemTypeId(.equip[Slot]) == DUMMY_ITEMS[Slot]
endmethod
//checks, if the hero has the possibility to stack the given item with another
public method checkItemForStack takes item for returns boolean
local integer i = 0
local integer id = GetItemTypeId(for)
local integer bonus = 0
local Item it = Item.getItemById(GetItemTypeId(for))
if not .open and not .bopen and not it.Equipment then
loop
exitwhen i > 5
if GetItemTypeId(UnitItemInSlot(.Owner, i)) == id and GetItemCharges(UnitItemInSlot(.Owner, i)) + GetItemCharges(for) <= MAX_ITEM_CHARGES and GetItemCharges(UnitItemInSlot(.Owner, i)) + GetItemCharges(for) <= it.MaxStacks then
set bonus = GetItemCharges(for)
call RemoveItem(for)
call SetItemCharges(UnitItemInSlot(.Owner, i), GetItemCharges(UnitItemInSlot(.Owner, i)) + bonus)
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 7
if .backp[i] == id and .bcharges[i] + GetItemCharges(for) <= MAX_ITEM_CHARGES and .bcharges[i] + GetItemCharges(for) <= it.MaxStacks then
set bonus = GetItemCharges(for)
set .bcharges[i] = .bcharges[i] + bonus
call RemoveItem(for)
return true
endif
set i = i + 1
endloop
elseif .open then
loop
exitwhen i > 5
if .items[i] == id and .charges[i] + GetItemCharges(for) <= MAX_ITEM_CHARGES and .charges[i] + GetItemCharges(for) <= it.MaxStacks then
set bonus = GetItemCharges(for)
call RemoveItem(for)
set .charges[i] = .charges[i] + bonus
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 7
if .backp[i] == id and .bcharges[i] + GetItemCharges(for) <= MAX_ITEM_CHARGES and .bcharges[i] + GetItemCharges(for) <= it.MaxStacks then
set bonus = GetItemCharges(for)
call RemoveItem(for)
set .bcharges[i] = .bcharges[i] + bonus
return true
endif
set i = i + 1
endloop
elseif .bopen then
loop
exitwhen i > 5
if .items[i] == id and .charges[i] + GetItemCharges(for) <= MAX_ITEM_CHARGES and .charges[i] + GetItemCharges(for) <= it.MaxStacks then
set bonus = GetItemCharges(for)
call RemoveItem(for)
set .charges[i] = .charges[i] + bonus
return true
endif
set i = i + 1
endloop
if .bpage <= 1 then
set i = 0
loop
exitwhen i > 3
if GetItemTypeId(UnitItemInSlot(.Owner, i)) == id and GetItemCharges(UnitItemInSlot(.Owner, i)) + GetItemCharges(for) <= MAX_ITEM_CHARGES and GetItemCharges(UnitItemInSlot(.Owner, i)) + GetItemCharges(for) <= it.MaxStacks then
set bonus = GetItemCharges(for)
call RemoveItem(for)
call SetItemCharges(UnitItemInSlot(.Owner, i), GetItemCharges(UnitItemInSlot(.Owner, i)) + bonus)
return true
endif
set i = i + 1
endloop
set i = 4
loop
exitwhen i > 7
if .backp[i] == id and .bcharges[i] + GetItemCharges(for) <= MAX_ITEM_CHARGES and .bcharges[i] + GetItemCharges(for) <= it.MaxStacks then
set bonus = GetItemCharges(for)
call RemoveItem(for)
set .bcharges[i] = .bcharges[i] + bonus
return true
endif
set i = i + 1
endloop
elseif .bpage >= 2 then
set i = 0
loop
exitwhen i > 3
if GetItemTypeId(UnitItemInSlot(.Owner, i)) == id and GetItemCharges(UnitItemInSlot(.Owner, i)) + GetItemCharges(for) <= MAX_ITEM_CHARGES and GetItemCharges(UnitItemInSlot(.Owner, i)) + GetItemCharges(for) <= it.MaxStacks then
set bonus = GetItemCharges(for)
call RemoveItem(for)
call SetItemCharges(UnitItemInSlot(.Owner, i), GetItemCharges(UnitItemInSlot(.Owner, i)) + bonus)
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 3
if .backp[i] == id and .bcharges[i] + GetItemCharges(for) <= MAX_ITEM_CHARGES and .bcharges[i] + GetItemCharges(for) <= it.MaxStacks then
set bonus = GetItemCharges(for)
set .bcharges[i] = .bcharges[i] + bonus
call RemoveItem(for)
return true
endif
set i = i + 1
endloop
endif
endif
return false
endmethod
//checks if the hero has a empty item slot
public method getSlotForItem takes item for returns boolean
local integer i = 0
local integer id = GetItemTypeId(for)
if not .open and not .bopen then
loop
exitwhen i > 5
if UnitItemInSlot(.Owner, i) == null then
call UnitAddItemToSlotById(.Owner, id, i)
call SetItemCharges(UnitItemInSlot(.Owner, i), GetItemCharges(for))
call RemoveItem(for)
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 7
if .backp[i] == 0 then
set .backp[i] = id
set .bcharges[i] = GetItemCharges(for)
call RemoveItem(for)
set .bfree = .bfree - 1
if not .open or .bopen then
call SetItemCharges(UnitItemInSlot(.Owner, BACKPACK_SLOT), .bfree)
endif
return true
endif
set i = i + 1
endloop
elseif .open then
loop
exitwhen i > 5
if .items[i] == 0 then
set .items[i] = id
set .charges[i] = GetItemCharges(for)
call RemoveItem(for)
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 7
if .backp[i] == 0 then
set .backp[i] = id
set .bcharges[i] = GetItemCharges(for)
call RemoveItem(for)
set .bfree = .bfree - 1
if not .open or .bopen then
call SetItemCharges(UnitItemInSlot(.Owner, BACKPACK_SLOT), .bfree)
endif
return true
endif
set i = i + 1
endloop
elseif .bopen then
if .bpage <= 1 then
set i = 0
loop
exitwhen i > 3
if UnitItemInSlot(.Owner, i) == null then
call UnitAddItemToSlotById(.Owner, id, i)
call SetItemCharges(UnitItemInSlot(.Owner, i), GetItemCharges(for))
call RemoveItem(for)
return true
endif
set i = i + 1
endloop
set i = 4
loop
exitwhen i > 7
if .backp[i] == 0 then
set .backp[i] = id
set .bcharges[i] = GetItemCharges(for)
call RemoveItem(for)
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 5
if .items[i] == 0 then
set .items[i] = id
set .charges[i] = GetItemCharges(for)
call RemoveItem(for)
return true
endif
set i = i + 1
endloop
elseif .bpage >= 2 then
set i = 0
loop
exitwhen i > 3
if UnitItemInSlot(.Owner, i) == null then
call UnitAddItemToSlotById(.Owner, id, i)
call SetItemCharges(UnitItemInSlot(.Owner, i), GetItemCharges(for))
call RemoveItem(for)
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 3
if .backp[i] == 0 then
set .backp[i] = id
set .bcharges[i] = GetItemCharges(for)
call RemoveItem(for)
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 5
if .items[i] == 0 then
set .items[i] = id
set .charges[i] = GetItemCharges(for)
call RemoveItem(for)
return true
endif
set i = i + 1
endloop
endif
endif
return false
endmethod
private effect array fx[16] //attached effects of the items
//Applies the item's stats to the hero
private method applyItemStats takes Item it returns nothing
local integer alt = 1
call AddUnitBonus(.Owner, BONUS_ARMOR, it.Armor)
call AddUnitBonus(.Owner, BONUS_DAMAGE, it.Dmg)
call AddUnitBonus(.Owner, BONUS_ATTACK_SPEED, it.As)
call AddUnitBonus(.Owner, BONUS_LIFE_REGEN, it.HpReg)
call AddUnitBonus(.Owner, BONUS_MANA_REGEN_PERCENT, it.MpReg)
call AddUnitBonus(.Owner, BONUS_STRENGTH, it.Str)
call AddUnitBonus(.Owner, BONUS_AGILITY, it.Agi)
call AddUnitBonus(.Owner, BONUS_INTELLIGENCE, it.Int)
call AddUnitBonus(.Owner, BONUS_LIFE, it.Life)
call AddUnitBonus(.Owner, BONUS_MANA, it.Mana)
call AddUnitBonus(.Owner, BONUS_MOVEMENT_SPEED, it.Ms)
if it.Slot != it.UnSlot then
set alt = 2
endif
if it.Abil != 0 then
call UnitAddAbility(.Owner, it.Abil)
call UnitMakeAbilityPermanent(.Owner, true, it.Abil)
endif
if GetUnitTypeId(.Owner) == 'XXXX' then
/*if it.Ranged then
call RangedSwap(GetOwningPlayer(.Owner), true)
call IssueImmediateOrder(.Owner, "metamorphosis")
call RangedSwap(GetOwningPlayer(.Owner), false)
endif*/
if it.ATag != "" then
call AddUnitAnimationProperties(.Owner, it.ATag, true)
endif
if it.Effect != "" and it.EffectAttach != "" then
if it.UnSlot != it.Slot then
set .fx[it.Slot*alt] = AddSpecialEffectTarget(it.Effect, .Owner, it.altEffectAttach)
else
set .fx[it.Slot*alt] = AddSpecialEffectTarget(it.Effect, .Owner, it.EffectAttach)
endif
endif
endif
endmethod
//removes the ItemStats for the hero
private method removeItemStats takes Item it returns nothing
local integer alt = 1
call AddUnitBonus(.Owner, BONUS_ARMOR, - it.Armor)
call AddUnitBonus(.Owner, BONUS_DAMAGE, - it.Dmg)
call AddUnitBonus(.Owner, BONUS_ATTACK_SPEED, - it.As)
call AddUnitBonus(.Owner, BONUS_LIFE_REGEN, - it.HpReg)
call AddUnitBonus(.Owner, BONUS_MANA_REGEN_PERCENT, - it.MpReg)
call AddUnitBonus(.Owner, BONUS_STRENGTH, - it.Str)
call AddUnitBonus(.Owner, BONUS_AGILITY, - it.Agi)
call AddUnitBonus(.Owner, BONUS_INTELLIGENCE, - it.Int)
call AddUnitBonus(.Owner, BONUS_LIFE, - it.Life)
call AddUnitBonus(.Owner, BONUS_MANA, - it.Mana)
call AddUnitBonus(.Owner, BONUS_MOVEMENT_SPEED, - it.Ms)
if it.Slot != it.UnSlot then
set alt = 2
endif
if it.Abil != 0 then
call UnitRemoveAbility(.Owner, it.Abil)
endif
if GetUnitTypeId(.Owner) == 'O001' then
if it.Effect != "" and it.EffectAttach != "" then
call DestroyEffect(.fx[it.Slot*alt])
endif
if it.ATag != "" then
call AddUnitAnimationProperties(.Owner, it.ATag, false)
endif
/*if it.Ranged then
call RangedSwap(GetOwningPlayer(.Owner), true)
call IssueImmediateOrder(.Owner, "metamorphosis")
call RangedSwap(GetOwningPlayer(.Owner), false)
endif*/
endif
endmethod
//returns the slot of an item
private method getItemSlot takes item it returns integer
local item temp = null
local integer i = 0
loop
set temp = UnitItemInSlot(.Owner, i)
exitwhen i > 5 or temp == it
set i = i + 1
endloop
set temp = null
return i
endmethod
//Returns the first free Inventory slot of the hero
private method getFreeSlot takes nothing returns integer
local integer i = 0
local integer free
loop
exitwhen i > 4
if .items[i] == 0 then
set free = i
endif
exitwhen .items[i] == 0
set i = i + 1
endloop
return free
endmethod
//Returns the first free backpack slot of the hero
private method getFreeBackpackSlot takes nothing returns integer
local integer i = 0
local integer free
loop
exitwhen i > 7
if .backp[i] == 0 then
set free = i
endif
exitwhen .backp[i] == 0
set i = i + 1
endloop
return free
endmethod
//Returns the free place of the hero's backpack
private method getBackpackPlace takes nothing returns integer
local integer i = 0
local integer i2 = 8
loop
exitwhen i > 7
if .backp[i] != 0 then
set i2 = i2 - 1
endif
set i = i + 1
endloop
return i2
endmethod
//Returns the free place of the hero's Inventory
private method getInventoryPlace takes nothing returns integer
local integer i = 0
local integer i2 = 4
loop
exitwhen i > 3
if .items[i] != 0 then
set i2 = i2 - 1
endif
set i = i + 1
endloop
return i2
endmethod
//moves an item to the hero's backpack
private method moveToBackpack takes item Moved, item Bag returns boolean
local integer i = 0
local integer id = GetItemTypeId(Moved)
local integer Slot
local Item it = Item.getItemById(id)
if .getBackpackPlace() > 0 then
loop
exitwhen i > 7
if .backp[i] == id and .bcharges[i] + GetItemCharges(Moved) <= MAX_ITEM_CHARGES and .bcharges[i] + GetItemCharges(Moved) <= it.MaxStacks and it.AllowStacks then
set .bcharges[i] = .bcharges[i] + GetItemCharges(Moved)
call RemoveItem(Bag)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_OPEN_ID, BACKPACK_SLOT)
call SetItemCharges(UnitItemInSlot(.Owner, BACKPACK_SLOT), .bfree)
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 7
if .backp[i] == 0 then
set .backp[i] = id
set .bcharges[i] = GetItemCharges(Moved)
set .bfree = .bfree - 1
call RemoveItem(Bag)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_OPEN_ID, BACKPACK_SLOT)
call SetItemCharges(UnitItemInSlot(.Owner, BACKPACK_SLOT), .bfree)
return true
endif
set i = i + 1
endloop
elseif .getBackpackPlace() <= 0 then
set Slot = .getItemSlot(Moved)
set i = GetItemCharges(Moved)
call RemoveItem(Bag)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_OPEN_ID, BACKPACK_SLOT)
call SetItemCharges(UnitItemInSlot(.Owner, BACKPACK_SLOT), .bfree)
call UnitAddItemToSlotById(.Owner, id, Slot)
call SetItemCharges(UnitItemInSlot(.Owner, Slot), i)
call SimError(GetOwningPlayer(.Owner), "Backpack is full!")
return false
endif
return false
endmethod
//moves an item from the first page to the second page
private method moveToSecondPage takes item Moved, item Second returns boolean
local integer i = 0
local integer id = GetItemTypeId(Moved)
local integer Slot
loop
exitwhen i > 3
if .backp[i+4] == id and .bcharges[i+4] + GetItemCharges(Moved) <= MAX_ITEM_CHARGES and .bcharges[i+4] + GetItemCharges(Moved) <= Item.getItemById(GetItemTypeId(Moved)).MaxStacks then
set .bcharges[i+4] = .bcharges[i+4] + GetItemCharges(Moved)
call RemoveItem(Second)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_PAGE_2, 4)
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 3
if .backp[i+4] == 0 then
set .backp[i+4] = id
set .bcharges[i+4] = GetItemCharges(Moved)
call RemoveItem(Second)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_PAGE_2, 4)
return true
endif
set i = i + 1
endloop
set Slot = .getItemSlot(Moved)
set i = GetItemCharges(Moved)
call RemoveItem(Second)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_PAGE_2, 4)
call UnitAddItemToSlotById(.Owner, id, Slot)
call SetItemCharges(UnitItemInSlot(.Owner, Slot), i)
call SimError(GetOwningPlayer(.Owner), "Cannot move item to a full page!")
return false
endmethod
//moves an item from the second page to the first page
private method moveToFirstPage takes item Moved, item First returns boolean
local integer i = 0
local integer id = GetItemTypeId(Moved)
local integer Slot
loop
exitwhen i > 3
if .backp[i] == id and .bcharges[i] + GetItemCharges(Moved) <= MAX_ITEM_CHARGES and .bcharges[i] + GetItemCharges(Moved) <= Item.getItemById(GetItemTypeId(Moved)).MaxStacks then
set .bcharges[i] = .bcharges[i] + GetItemCharges(Moved)
call RemoveItem(First)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_PAGE_1, 4)
return true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 3
if .backp[i] == 0 then
set .backp[i] = id
set .bcharges[i] = GetItemCharges(Moved)
call RemoveItem(First)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_PAGE_1, 4)
return true
endif
set i = i + 1
endloop
set Slot = .getItemSlot(Moved)
set i = GetItemCharges(Moved)
call RemoveItem(First)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_PAGE_1, 4)
call UnitAddItemToSlotById(.Owner, id, Slot)
call SetItemCharges(UnitItemInSlot(.Owner, Slot), i)
call SimError(GetOwningPlayer(.Owner), "Cannot move item to a full page!")
return false
endmethod
//moves an item to the heroes inventory
private method moveToInventory takes item Moved, item Close returns boolean
local integer i = 0
local integer id = GetItemTypeId(Moved)
local integer Slot
local Item it = Item.getItemById(id)
set .allowauto = false
if .getInventoryPlace() > 0 then
loop
exitwhen i > 3
if .items[i] == id and .charges[i] + GetItemCharges(Moved) <= MAX_ITEM_CHARGES and .charges[i] + GetItemCharges(Moved) <= it.MaxStacks and it.AllowStacks then
set .charges[i] = .charges + GetItemCharges(Moved)
set .bfree = .bfree + 1
call RemoveItem(Close)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_CLOSE_ID, 5)
set .allowauto = true
return true
endif
set i = i + 1
endloop
set i = .getFreeSlot()
set .items[i] = id
set .charges[i] = GetItemCharges(Moved)
set .bfree = .bfree + 1
call RemoveItem(Close)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_CLOSE_ID, 5)
set .allowauto = true
return true
elseif .getInventoryPlace() <= 0 then
set Slot = .getItemSlot(Moved)
set i = GetItemCharges(Moved)
call RemoveItem(Close)
call RemoveItem(Moved)
call UnitAddItemToSlotById(.Owner, BACKPACK_CLOSE_ID, 5)
call UnitAddItemToSlotById(.Owner, id, Slot)
call SetItemCharges(UnitItemInSlot(.Owner, Slot), i)
call SimError(GetOwningPlayer(.Owner), "Inventory is full!")
set .allowauto = true
return false
endif
set .allowauto = true
return false
endmethod
//checks, if a hero can equip an item
public method checkHero takes Item it, boolean UseError returns boolean
if it.HeroClasses != "" then
if not SearchString(it.HeroClasses, .HeroClass) then
if UseError then
call SimError(GetOwningPlayer(.Owner), "Only " + it.HeroClasses + " can equip this item.")
endif
return false
endif
endif
if it.ItemClass != "" then
if not SearchString(.ItemClasses, it.ItemClass) then
if UseError then
call SimError(GetOwningPlayer(.Owner), "This unit can't equip " + it.ItemClass + ".")
endif
return false
endif
endif
if GetHeroLevel(.Owner) >= it.Level then
return true
else
if UseError then
call SimError(GetOwningPlayer(.Owner), "This item requires a hero level of " + I2S(it.Level) + " or greater.")
endif
endif
return false
endmethod
//will be runned, whenever an item is used
private static method useItem takes nothing returns boolean
local thistype this = .table[GetTriggerUnit()]
local Item it = Item.getItemById(GetItemTypeId(GetManipulatedItem()))
if GetItemTypeId(GetManipulatedItem()) == EQUIPMENT_OPEN_ID then
return .openEquipment(GetTriggerUnit())
elseif GetItemTypeId(GetManipulatedItem()) == BACKPACK_OPEN_ID then
return .openBackpack(GetTriggerUnit())
elseif GetItemTypeId(GetManipulatedItem()) == EQUIPMENT_CLOSE_ID or GetItemTypeId(GetManipulatedItem()) == BACKPACK_CLOSE_ID then
if .open then
return .closeEquipment(GetTriggerUnit())
elseif .bopen then
return .closeBackpack(GetTriggerUnit())
endif
elseif GetItemTypeId(GetManipulatedItem()) == EQUIPMENT_PAGE_1 or GetItemTypeId(GetManipulatedItem()) == EQUIPMENT_PAGE_2 or GetItemTypeId(GetManipulatedItem()) == BACKPACK_PAGE_1 or GetItemTypeId(GetManipulatedItem()) == BACKPACK_PAGE_2 then
if .open then
return .changePageEquipment(GetTriggerUnit())
elseif .bopen then
return .changePageBackpack(GetTriggerUnit())
endif
elseif it.Equipment and not .isItemEquipped(GetManipulatedItem()) then
return .equipItem(GetTriggerUnit(), GetManipulatedItem(), it)
elseif it.Equipment and .isItemEquipped(GetManipulatedItem()) and .open then
return .unequipItem(GetTriggerUnit(), GetManipulatedItem(), it)
endif
return false
endmethod
//Will be runned, whenever an item is dragged on another item or on an empty slot
private static method dragItem takes nothing returns boolean
local item manipul = GetOrderTargetItem()
local integer slot = GetIssuedOrderId() - 852002
local thistype this = .table[GetTriggerUnit()]
local item dropped = UnitItemInSlot(.Owner, slot)
local integer id = GetItemTypeId(manipul)
local integer idd = GetItemTypeId(dropped)
if (GetIssuedOrderId() > 852001) and (GetIssuedOrderId() < 852008) and this != 0 then
if manipul != dropped and id != BACKPACK_PAGE_1 and id != BACKPACK_PAGE_2 and id != BACKPACK_CLOSE_ID and id != BACKPACK_OPEN_ID then
if idd == BACKPACK_OPEN_ID then
set .dropped = false
call .moveToBackpack(manipul, dropped)
set .dropped = true
set manipul = null
set dropped = null
return false
elseif idd == BACKPACK_CLOSE_ID then
set .dropped = false
call .moveToInventory(manipul, dropped)
set .dropped = true
set manipul = null
set dropped = null
return false
elseif idd == BACKPACK_PAGE_2 then
set .dropped = false
call .moveToSecondPage(manipul, dropped)
set .dropped = true
set manipul = null
set dropped = null
return false
elseif idd == BACKPACK_PAGE_1 then
set .dropped = false
call .moveToFirstPage(manipul, dropped)
set .dropped = true
set manipul = null
set dropped = null
return false
endif
endif
endif
if id == BACKPACK_OPEN_ID or id == BACKPACK_CLOSE_ID or id == BACKPACK_PAGE_1 or id == BACKPACK_PAGE_2 and dropped == null then
if id == BACKPACK_OPEN_ID and not .bopen and not .open then
call SimError(GetOwningPlayer(.Owner), "Cannot drop this item.")
call addItem.create(manipul, BACKPACK_SLOT, this)
set manipul = null
set dropped = null
return false
elseif id == BACKPACK_CLOSE_ID or id == BACKPACK_PAGE_1 or id == BACKPACK_PAGE_2 and .bopen then
call SimError(GetOwningPlayer(.Owner), "Cannot drop this item.")
if id == BACKPACK_CLOSE_ID then
call addItem.create(manipul, 5, this)
elseif id == BACKPACK_PAGE_1 or id == BACKPACK_PAGE_2 then
call addItem.create(manipul, 4, this)
endif
set manipul = null
set dropped = null
return false
endif
endif
if (id == BACKPACK_PAGE_1 or id == BACKPACK_PAGE_2) and idd == BACKPACK_CLOSE_ID and .bopen then
call SimError(GetOwningPlayer(.Owner), "Cannot drop this item.")
call addItem.create(manipul, 4, this)
call addItem.create(dropped, 5, this)
set manipul = null
set dropped = null
return false
elseif id == BACKPACK_CLOSE_ID and (idd == BACKPACK_PAGE_1 or idd == BACKPACK_PAGE_2) and .bopen then
call SimError(GetOwningPlayer(.Owner), "Cannot drop this item.")
call addItem.create(manipul, 5, this)
call addItem.create(dropped, 4, this)
set manipul = null
set dropped = null
return false
endif
set manipul = null
set dropped = null
return true
endmethod
//will be runned whenever an item is picked up
private static method pickupItem takes nothing returns boolean
local thistype this = .table[GetTriggerUnit()]
local item i = GetManipulatedItem()
local Item it = Item.getItemById(GetItemTypeId(i))
if AUTO_EQUIP and it.Equipment and .isSlotEmpty(it.Slot) and .checkHero(it, false) and .allowauto then
call thistype.equipItem(GetTriggerUnit(), GetManipulatedItem(), it)
set i = null
return true
endif
return false
endmethod
//Will be runned whenever an item is dropped
private static method dropItem takes nothing returns boolean
local thistype this = .table[GetTriggerUnit()]
local item ite = GetManipulatedItem()
local integer id = GetItemTypeId(ite)
if this == 0 or ite == null or not .dropped then
return false
elseif this != 0 and ite != null and .dropped then
if id == BACKPACK_OPEN_ID and not .bopen and not .open then
call SimError(GetOwningPlayer(.Owner), "Cannot drop this item.")
call addItem.create(ite, BACKPACK_SLOT, this)
set ite = null
return true
elseif id == BACKPACK_CLOSE_ID or id == BACKPACK_PAGE_1 or id == BACKPACK_PAGE_2 and (.bopen or .open) then
if id == BACKPACK_CLOSE_ID then
call SimError(GetOwningPlayer(.Owner), "Cannot drop this item.")
call addItem.create(ite, 5, this)
set ite = null
return true
elseif id == BACKPACK_PAGE_1 or id == BACKPACK_PAGE_2 then
call SimError(GetOwningPlayer(.Owner), "Cannot drop this item.")
call addItem.create(ite, 4, this)
set ite = null
return true
endif
endif
endif
return false
endmethod
private static trigger Use = CreateTrigger()
private static trigger Pickup = CreateTrigger()
private static trigger Drag = CreateTrigger()
private static trigger Drop = CreateTrigger()
//initialization of the Inventory struct
private static method onInit takes nothing returns nothing
call TriggerAddCondition(.Use, Condition(function thistype.useItem))
call TriggerAddCondition(.Pickup, Condition(function thistype.pickupItem))
call TriggerAddCondition(.Drag, Condition(function thistype.dragItem))
call TriggerAddCondition(.Drop, Condition(function thistype.dropItem))
set .table = HandleTable.create()
call SETUP_DUMMY_ITEMS()
endmethod
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TestPotions initializer init
private function Setup takes nothing returns nothing
local Item it = 0
//Potion of Greater Healing
set it = Item.addNormalItem('pghe', true, 6)
//Potion of Healing
set it = Item.addNormalItem('I029', true, 6)
//Potion of Healing
set it = Item.addNormalItem('phea', true, 6)
//Potion of Greater Mana
set it = Item.addNormalItem('pgma', true, 4)
//Potion of Mana
set it = Item.addNormalItem('I02B', true, 4)
//Potion of Mana
set it = Item.addNormalItem('pman', true, 4)
//Scroll of Apocalypse
set it = Item.addNormalItem('I00C', true, 10)
//Scroll of Sacrifice
set it = Item.addNormalItem('I00E', true, 10)
//Scroll of Firewall
set it = Item.addNormalItem('I00D', true, 10)
//Scroll of Magic Curtain
set it = Item.addNormalItem('IMCu', true, 10)
//Venom Gland
set it = Item.addNormalItem('veno', true, 40)
//Herb
set it = Item.addNormalItem('herb', true, 10)
//Ration
set it = Item.addNormalItem('band', true, 10)
endfunction
private function init takes nothing returns nothing
call Setup()
endfunction
endscope
//TESH.scrollpos=1341
//TESH.alwaysfold=0
scope TestEquipment initializer init
private function Setup takes nothing returns nothing
local Item it = 0
//------------Weapons-----------------
//Swords
//Long Sword 1
set it = Item.addEquipment('WP01', 2, "", "swords")
set it.Agi = 1
set it.Str = 1
set it.Dmg = 5
set it.AltSlot = 1
set it.ATag = "alternate"
set it.Effect = "MithrilSword.mdx"
set it.EffectAttach = "hand right"
//Long Sword 2
set it = Item.addEquipment('WP02', 2, "", "swords")
set it.Agi = 2
set it.Str = 2
set it.Dmg = 10
set it.AltSlot = 1
set it.ATag = "alternate"
set it.Effect = "MithrilSword.mdx"
set it.EffectAttach = "hand right"
//Long Sword 3
set it = Item.addEquipment('WP03', 2, "", "swords")
set it.Agi = 4
set it.Str = 4
set it.Dmg = 15
set it.AltSlot = 1
set it.ATag = "alternate"
set it.Effect = "MithrilSword.mdx"
set it.EffectAttach = "hand right"
//Long Sword 4
set it = Item.addEquipment('WP04', 2, "", "swords")
set it.Agi = 7
set it.Str = 7
set it.Dmg = 20
set it.AltSlot = 1
set it.ATag = "alternate"
set it.Effect = "MithrilSword.mdx"
set it.EffectAttach = "hand right"
//Long Sword 5
set it = Item.addEquipment('WP05', 2, "", "swords")
set it.Agi = 11
set it.Str = 11
set it.Dmg = 25
set it.ATag = "alternate"
set it.Effect = "MithrilSword.mdx"
set it.EffectAttach = "hand right"
//Long Sword 6
set it = Item.addEquipment('WP06', 2, "", "swords")
set it.Agi = 16
set it.Str = 16
set it.Dmg = 30
set it.ATag = "alternate"
set it.Effect = "MithrilSword.mdx"
set it.EffectAttach = "hand right"
//Claws
//Bronze Claws 1
set it = Item.addEquipment('CLW1', 4, "", "claws")
set it.Agi = 1
set it.Str = 1
set it.Int = 1
set it.Dmg = 3
//Iron claws 2
set it = Item.addEquipment('CLW2', 4, "", "claws")
set it.Agi = 2
set it.Str = 2
set it.Int = 2
set it.Dmg = 5
//Steel claws 3
set it = Item.addEquipment('CLW2', 4, "", "claws")
set it.Agi = 3
set it.Str = 3
set it.Int = 3
set it.Dmg = 9
//Mythril claws 4
set it = Item.addEquipment('CLW4', 4, "", "claws")
set it.Agi = 4
set it.Str = 4
set it.Int = 4
set it.Dmg = 15
//Gold claws 5
set it = Item.addEquipment('CLW5', 4, "", "claws")
set it.Agi = 5
set it.Str = 5
set it.Int = 5
set it.Dmg = 23
//Adamantite claws 6
set it = Item.addEquipment('CLW6', 2, "", "claws")
set it.Agi = 6
set it.Str = 6
set it.Int = 6
set it.Dmg = 33
//Axes
//Axe 1
set it = Item.addEquipment('WP07', 2, "", "axes")
set it.Dmg = 10
set it.AltSlot = 1
set it.ATag = "alternate"
set it.Effect = "MithrilAxe.mdx"
set it.EffectAttach = "hand right"
//Axe 2
set it = Item.addEquipment('WP08', 2, "", "axes")
set it.Dmg = 20
set it.AltSlot = 1
set it.ATag = "alternate"
set it.Effect = "MithrilAxe.mdx"
set it.EffectAttach = "hand right"
//Axe 3
set it = Item.addEquipment('WP09', 2, "", "axes")
set it.Dmg = 30
set it.AltSlot = 1
set it.ATag = "alternate"
set it.Effect = "MithrilAxe.mdx"
set it.EffectAttach = "hand right"
//Axe 4
set it = Item.addEquipment('WP10', 2, "", "axes")
set it.Dmg = 40
set it.ATag = "alternate"
set it.Effect = "MithrilAxe.mdx"
set it.EffectAttach = "hand right"
//Axe 5
set it = Item.addEquipment('WP11', 2, "", "axes")
set it.Dmg = 50
set it.ATag = "alternate"
set it.Effect = "MithrilAxe.mdx"
set it.EffectAttach = "hand right"
//Axe 6
set it = Item.addEquipment('WP12', 2, "", "axes")
set it.Dmg = 60
set it.ATag = "alternate"
set it.Effect = "MithrilAxe.mdx"
set it.EffectAttach = "hand right"
//Mauls
//Maul 1
set it = Item.addEquipment('WP13', 2, "", "mauls")
set it.Dmg = 5
set it.Str = 4
set it.ATag = "channel"
set it.Effect = "Maul.mdx"
set it.EffectAttach = "hand right"
//Maul 2
set it = Item.addEquipment('WP14', 2, "", "mauls")
set it.Dmg = 10
set it.Str = 7
set it.ATag = "channel"
set it.Effect = "Maul.mdx"
set it.EffectAttach = "hand right"
//Maul 3
set it = Item.addEquipment('WP15', 2, "", "mauls")
set it.Dmg = 15
set it.Str = 11
set it.ATag = "channel"
set it.Effect = "Maul.mdx"
set it.EffectAttach = "hand right"
//Maul 4
set it = Item.addEquipment('WP16', 2, "", "mauls")
set it.Dmg = 20
set it.Str = 16
set it.ATag = "channel"
set it.Effect = "Maul.mdx"
set it.EffectAttach = "hand right"
//Maul 5
set it = Item.addEquipment('WP17', 2, "", "mauls")
set it.Dmg = 25
set it.Str = 21
set it.ATag = "channel"
set it.Effect = "Maul.mdx"
set it.EffectAttach = "hand right"
//Maul 6
set it = Item.addEquipment('WP18', 2, "", "mauls")
set it.Dmg = 30
set it.Str = 27
set it.ATag = "channel"
set it.Effect = "Maul.mdx"
set it.EffectAttach = "hand right"
//daggers
//Dagger 1
set it = Item.addEquipment('WP19', 2, "", "daggers")
set it.Dmg = 5
set it.Agi = 4
set it.AltSlot = 1
set it.ATag = "gold"
set it.Effect = "MithrilDagger.mdx"
set it.EffectAttach = "hand right"
//Dagger 2
set it = Item.addEquipment('WP20', 2, "", "daggers")
set it.Dmg = 10
set it.Agi = 7
set it.AltSlot = 1
set it.ATag = "gold"
set it.Effect = "MithrilDagger.mdx"
set it.EffectAttach = "hand right"
//Dagger 3
set it = Item.addEquipment('WP21', 2, "", "daggers")
set it.Dmg = 15
set it.Agi = 11
set it.AltSlot = 1
set it.ATag = "gold"
set it.Effect = "MithrilDagger.mdx"
set it.EffectAttach = "hand right"
//Dagger 4
set it = Item.addEquipment('WP22', 2, "", "daggers")
set it.Dmg = 20
set it.Agi = 16
set it.AltSlot = 1
set it.ATag = "gold"
set it.Effect = "MithrilDagger.mdx"
set it.EffectAttach = "hand right"
//Dagger 5
set it = Item.addEquipment('WP23', 2, "", "daggers")
set it.Dmg = 25
set it.Agi = 21
set it.AltSlot = 1
set it.ATag = "gold"
set it.Effect = "MithrilDagger.mdx"
set it.EffectAttach = "hand right"
//Dagger 6
set it = Item.addEquipment('WP24', 2, "", "daggers")
set it.Dmg = 30
set it.Agi = 27
set it.ATag = "gold"
set it.Effect = "MithrilDagger.mdx"
set it.EffectAttach = "hand right"
//Staves
//Staff 1
set it = Item.addEquipment('WP25', 2, "", "staffs")
set it.Int = 2
set it.Dmg = 5
set it.ATag = "alternate"
call it.HasAbility(true)
set it.Effect = "Quarterstaff.mdx"
set it.EffectAttach = "hand right"
//Staff 2
set it = Item.addEquipment('WP26', 2, "", "staffs")
set it.Int = 3
set it.Str = 1
set it.Dmg = 10
set it.ATag = "alternate"
set it.Effect = "Quarterstaff.mdx"
set it.EffectAttach = "hand right"
//Staff 3
set it = Item.addEquipment('WP27', 2, "", "staffs")
set it.Int = 5
set it.Str = 2
set it.Dmg = 15
set it.ATag = "alternate"
set it.Effect = "Quarterstaff.mdx"
set it.EffectAttach = "hand right"
//Staff 4
set it = Item.addEquipment('WP28', 2, "", "staffs")
set it.Int = 8
set it.Str = 4
set it.Dmg = 20
set it.ATag = "alternate"
set it.Effect = "Quarterstaff.mdx"
set it.EffectAttach = "hand right"
//Staff 5
set it = Item.addEquipment('WP29', 2, "", "staffs")
set it.Int = 12
set it.Str = 7
set it.Dmg = 25
set it.ATag = "alternate"
set it.Effect = "Quarterstaff.mdx"
set it.EffectAttach = "hand right"
//Staff 6
set it = Item.addEquipment('WP30', 2, "", "staffs")
set it.Int = 17
set it.Str = 11
set it.Dmg = 30
set it.ATag = "alternate"
set it.Effect = "Quarterstaff.mdx"
set it.EffectAttach = "hand right"
//wands
//Wand 1
set it = Item.addEquipment('WP31', 2, "", "wands")
set it.Dmg = 5
set it.Int = 4
set it.Abil = 'A01A'
call it.HasAbility(true)
set it.ATag = "flesh"
set it.Effect = "MagicWand.mdx"
set it.EffectAttach = "hand right"
//Wand 2
set it = Item.addEquipment('WP32', 2, "", "wands")
set it.Dmg = 10
set it.Int = 7
set it.Abil = 'A01A'
call it.HasAbility(true)
set it.ATag = "flesh"
set it.Effect = "MagicWand.mdx"
set it.EffectAttach = "hand right"
//Wand 3
set it = Item.addEquipment('WP33', 2, "", "wands")
set it.Dmg = 15
set it.Int = 11
set it.Abil = 'A01A'
call it.HasAbility(true)
set it.ATag = "flesh"
set it.Effect = "MagicWand.mdx"
set it.EffectAttach = "hand right"
//Wand 4
set it = Item.addEquipment('WP34', 2, "", "wands")
set it.Dmg = 20
set it.Int = 16
set it.Abil = 'A01A'
call it.HasAbility(true)
set it.ATag = "flesh"
set it.Effect = "MagicWand.mdx"
set it.EffectAttach = "hand right"
//Wand 5
set it = Item.addEquipment('WP35', 2, "", "wands")
set it.Dmg = 25
set it.Int = 21
set it.Abil = 'A01A'
call it.HasAbility(true)
set it.ATag = "flesh"
set it.Effect = "MagicWand.mdx"
set it.EffectAttach = "hand right"
//Wand 6
set it = Item.addEquipment('WP36', 2, "", "wands")
set it.Dmg = 30
set it.Int = 27
set it.Abil = 'A01A'
call it.HasAbility(true)
set it.ATag = "flesh"
set it.Effect = "MagicWand.mdx"
set it.EffectAttach = "hand right"
//bows
//Bow 1
set it = Item.addEquipment('WP37', 2, "", "bows")
set it.Agi = 7
set it.ATag = "lumber"
call it.HasAbility(true)
set it.Ranged = true
set it.Effect = "Woodbow.mdx"
set it.EffectAttach = "hand left"
//Bow 2
set it = Item.addEquipment('WP38', 2, "", "bows")
set it.Int = 1
set it.Agi = 11
set it.Abil = 'A002'
call it.HasAbility(true)
set it.ATag = "lumber"
set it.Effect = "Woodbow.mdx"
set it.EffectAttach = "hand left"
//Bow 3
set it = Item.addEquipment('WP39', 2, "", "bows")
set it.Int = 2
set it.Agi = 16
set it.Abil = 'A002'
call it.HasAbility(true)
set it.ATag = "lumber"
set it.Effect = "Woodbow.mdx"
set it.EffectAttach = "hand left"
//Bow 4
set it = Item.addEquipment('WP40', 2, "", "bows")
set it.Int = 4
set it.Agi = 21
set it.Abil = 'A002'
call it.HasAbility(true)
set it.ATag = "lumber"
set it.Effect = "Woodbow.mdx"
set it.EffectAttach = "hand left"
//Bow 5
set it = Item.addEquipment('WP41', 2, "", "bows")
set it.Int = 7
set it.Agi = 27
set it.Abil = 'A002'
call it.HasAbility(true)
set it.ATag = "lumber"
set it.Effect = "Woodbow.mdx"
set it.EffectAttach = "hand left"
//Bow 6
set it = Item.addEquipment('WP42', 2, "", "bows")
set it.Int = 11
set it.Agi = 34
set it.Abil = 'A002'
call it.HasAbility(true)
set it.ATag = "lumber"
set it.Effect = "Woodbow.mdx"
set it.EffectAttach = "hand left"
//------------Chests------------------
//Heavy
//Heavy Armor 1
set it = Item.addEquipment('WP43', 1, "", "heavy armors")
set it.Life = 70
set it.Armor = 6
//Heavy Armor 2
set it = Item.addEquipment('WP44', 1, "", "heavy armors")
set it.Life = 160
set it.Armor = 10
//Heavy Armor 3
set it = Item.addEquipment('WP45', 1, "", "heavy armors")
set it.Life = 280
set it.Armor = 13
//Heavy Armor 4
set it = Item.addEquipment('WP46', 1, "", "heavy armors")
set it.Life = 390
set it.Armor = 16
//Heavy Armor 5
set it = Item.addEquipment('WP47', 1, "", "heavy armors")
set it.Life = 500
set it.Armor = 19
//Heavy Armor 6
set it = Item.addEquipment('WP48', 1, "", "heavy armors")
set it.Life = 600
set it.Armor = 22
//Leather
//Leather Armor 1
set it = Item.addEquipment('WP49', 1, "", "leather armors")
set it.Life = 20
set it.Mana = 10
set it.Armor = 8
//Leather Armor 2
set it = Item.addEquipment('WP50', 1, "", "leather armors")
set it.Life = 60
set it.Mana = 30
set it.Armor = 13
//Leather Armor 3
set it = Item.addEquipment('WP51', 1, "", "leather armors")
set it.Life = 115
set it.Mana = 50
set it.Armor = 17
//Leather Armor 4
set it = Item.addEquipment('WP52', 1, "", "leather armors")
set it.Life = 190
set it.Mana = 90
set it.Armor = 21
//Leather Armor 5
set it = Item.addEquipment('WP53', 1, "", "leather armors")
set it.Life = 250
set it.Mana = 115
set it.Armor = 25
//Leather Armor 6
set it = Item.addEquipment('WP54', 1, "", "leather armors")
set it.Life = 310
set it.Mana = 190
set it.Armor = 29
//Cloth
//Cloth Armor 1
set it = Item.addEquipment('WP55', 1, "", "cloth armors")
set it.Life = 10
set it.Mana = 30
set it.Armor = 2
//Cloth Armor 2
set it = Item.addEquipment('WP56', 1, "", "cloth armors")
set it.Life = 40
set it.Mana = 70
set it.Armor = 4
//Cloth Armor 3
set it = Item.addEquipment('WP57', 1, "", "cloth armors")
set it.Life = 90
set it.Mana = 130
set it.Armor = 6
//Cloth Armor 4
set it = Item.addEquipment('WP58', 1, "", "cloth armors")
set it.Life = 135
set it.Mana = 180
set it.Armor = 8
//Cloth Armor 5
set it = Item.addEquipment('WP59', 1, "", "cloth armors")
set it.Life = 170
set it.Mana = 215
set it.Armor = 10
//Cloth Armor 6
set it = Item.addEquipment('WP60', 1, "", "cloth armors")
set it.Life = 230
set it.Mana = 250
set it.Armor = 12
//------------Heads-------------------
//Heavy
//Heavy Head 1
set it = Item.addEquipment('WP61', 0, "", "heavy armors")
set it.Life = 15
set it.Armor = 4
//Heavy Head 2
set it = Item.addEquipment('WP62', 0, "", "heavy armors")
set it.Life = 45
set it.Armor = 7
//Heavy Head 3
set it = Item.addEquipment('WP63', 0, "", "heavy armors")
set it.Life = 75
set it.Armor = 9
//Heavy Head 4
set it = Item.addEquipment('WP64', 0, "", "heavy armors")
set it.Life = 105
set it.Armor = 11
//Heavy Head 5
set it = Item.addEquipment('WP65', 0, "", "heavy armors")
set it.Life = 135
set it.Armor = 14
//Heavy Head 6
set it = Item.addEquipment('WP66', 0, "", "heavy armors")
set it.Life = 165
set it.Armor = 17
//Leather
//Leather Head 1
set it = Item.addEquipment('WP67', 0, "", "leather armors")
set it.Life = 10
set it.Armor = 2
//Leather Head 2
set it = Item.addEquipment('WP68', 0, "", "leather armors")
set it.Life = 35
set it.Armor = 4
//Leather Head 3
set it = Item.addEquipment('WP69', 0, "", "leather armors")
set it.Life = 60
set it.Armor = 6
//Leather Head 4
set it = Item.addEquipment('WP70', 0, "", "leather armors")
set it.Life = 85
set it.Armor = 8
//Leather Head 5
set it = Item.addEquipment('WP71', 0, "", "leather armors")
set it.Life = 110
set it.Armor = 10
//Leather Head 6
set it = Item.addEquipment('WP72', 0, "", "leather armors")
set it.Life = 135
set it.Armor = 12
//Cloth
//Cloth Head 1
set it = Item.addEquipment('WP73', 0, "", "cloth armors")
set it.Life = 5
set it.Mana = 20
set it.Armor = 1
set it.MpReg = 10
//Cloth Head 2
set it = Item.addEquipment('WP74', 0, "", "cloth armors")
set it.Life = 25
set it.Mana = 40
set it.Armor = 3
set it.MpReg = 35
//Cloth Head 3
set it = Item.addEquipment('WP75', 0, "", "cloth armors")
set it.Life = 45
set it.Mana = 60
set it.Armor = 4
set it.MpReg = 55
//Cloth Head 4
set it = Item.addEquipment('WP76', 0, "", "cloth armors")
set it.Life = 65
set it.Mana = 80
set it.Armor = 6
set it.MpReg = 70
//Cloth Head 5
set it = Item.addEquipment('WP77', 0, "", "cloth armors")
set it.Life = 85
set it.Mana = 100
set it.Armor = 7
set it.MpReg = 80
//Cloth Head 6
set it = Item.addEquipment('WP78', 0, "", "cloth armors")
set it.Life = 105
set it.Mana = 120
set it.Armor = 9
set it.MpReg = 85
//------------Gloves------------------
//Heavy
//heavy gloves 1
set it = Item.addEquipment('WP79', 4, "", "heavy gloves")
set it.Life = 20
set it.Armor = 4
//heavy gloves 2
set it = Item.addEquipment('WP80', 4, "", "heavy gloves")
set it.Life = 50
set it.Armor = 7
set it.Str = 2
//heavy gloves 3
set it = Item.addEquipment('WP81', 4, "", "heavy gloves")
set it.Life = 80
set it.Armor = 9
set it.Str = 4
//heavy gloves 4
set it = Item.addEquipment('WP82', 4, "", "heavy gloves")
set it.Life = 110
set it.Armor = 11
set it.Str = 7
//heavy gloves 5
set it = Item.addEquipment('WP83', 4, "", "heavy gloves")
set it.Life = 140
set it.Armor = 14
set it.Str = 11
//heavy gloves 6
set it = Item.addEquipment('WP84', 4, "", "heavy gloves")
set it.Life = 170
set it.Armor = 17
set it.Str = 16
//Leather
//Leather Gloves 1
set it = Item.addEquipment('WP85', 4, "", "leather armors")
set it.Life = 15
set it.Armor = 2
set it.Agi = 1
//Leather Gloves 2
set it = Item.addEquipment('WP86', 4, "", "leather armors")
set it.Life = 40
set it.Armor = 4
set it.Agi = 2
//Leather Gloves 3
set it = Item.addEquipment('WP87', 4, "", "leather armors")
set it.Life = 65
set it.Armor = 6
set it.Agi = 4
//Leather Gloves 4
set it = Item.addEquipment('WP88', 4, "", "leather armors")
set it.Life = 90
set it.Armor = 8
set it.Agi = 7
//Leather Gloves 5
set it = Item.addEquipment('WP89', 4, "", "leather armors")
set it.Life = 115
set it.Armor = 10
set it.Agi = 11
//Leather Gloves 6
set it = Item.addEquipment('WP90', 4, "", "leather armors")
set it.Life = 140
set it.Armor = 12
set it.Agi = 16
//Cloth
//Cloth Gloves 1
set it = Item.addEquipment('WP91', 4, "", "cloth armors")
set it.Life = 10
set it.Mana = 15
set it.Armor = 1
set it.Int = 1
//Cloth Gloves 2
set it = Item.addEquipment('WP92', 4, "", "cloth armors")
set it.Life = 30
set it.Mana = 25
set it.Armor = 3
set it.Int = 2
//Cloth Gloves 3
set it = Item.addEquipment('WP93', 4, "", "cloth armors")
set it.Life = 50
set it.Mana = 35
set it.Armor = 4
set it.Int = 4
//Cloth Gloves 4
set it = Item.addEquipment('WP94', 4, "", "cloth armors")
set it.Life = 70
set it.Mana = 45
set it.Armor = 6
set it.Int = 7
//Cloth Gloves 5
set it = Item.addEquipment('WP95', 4, "", "cloth armors")
set it.Life = 90
set it.Mana = 55
set it.Armor = 7
set it.Int = 11
//Cloth Gloves 6
set it = Item.addEquipment('WP96', 4, "", "cloth armors")
set it.Life = 110
set it.Mana = 65
set it.Armor = 9
set it.Int = 16
//------------Feet------------------
//Heavy
//Heavy Feet 1
set it = Item.addEquipment('WP97', 5, "", "heavy armors")
set it.Life = 20
set it.Armor = 5
set it.Str = 1
//Heavy Feet 2
set it = Item.addEquipment('WP98', 5, "", "heavy armors")
set it.Life = 50
set it.Armor = 8
set it.Str = 2
//Heavy Feet 3
set it = Item.addEquipment('WP99', 5, "", "heavy armors")
set it.Life = 80
set it.Armor = 11
set it.Str = 4
//Heavy Feet 4
set it = Item.addEquipment('WQ01', 5, "", "heavy armors")
set it.Life = 110
set it.Armor = 13
set it.Str = 7
//Heavy Feet 5
set it = Item.addEquipment('WQ02', 5, "", "heavy armors")
set it.Life = 140
set it.Armor = 16
set it.Str = 11
//Heavy Feet 6
set it = Item.addEquipment('WQ03', 5, "", "heavy armors")
set it.Life = 170
set it.Armor = 20
set it.Str = 16
//Leather
//Leather Feet 1
set it = Item.addEquipment('WQ04', 5, "", "leather armors")
set it.Life = 15
set it.Armor = 3
set it.Agi = 1
//Leather Feet 2
set it = Item.addEquipment('WQ05', 5, "", "leather armors")
set it.Life = 40
set it.Armor = 5
set it.Agi = 2
//Leather Feet 3
set it = Item.addEquipment('WQ06', 5, "", "leather armors")
set it.Life = 65
set it.Armor = 8
set it.Agi = 4
//Leather Feet 4
set it = Item.addEquipment('WQ07', 5, "", "leather armors")
set it.Life = 90
set it.Armor = 10
set it.Agi = 7
//Leather Feet 5
set it = Item.addEquipment('WQ08', 5, "", "leather armors")
set it.Life = 115
set it.Armor = 12
set it.Agi = 11
//Leather Feet 6
set it = Item.addEquipment('WQ09', 5, "", "leather armors")
set it.Life = 140
set it.Armor = 15
set it.Agi = 16
//Cloth
//Cloth Feet 1
set it = Item.addEquipment('WQ10', 5, "", "cloth armors")
set it.Life = 10
set it.Mana = 15
set it.Armor = 1
set it.Int = 1
//Cloth Feet 2
set it = Item.addEquipment('WQ11', 5, "", "cloth armors")
set it.Life = 30
set it.Mana = 25
set it.Armor = 3
set it.Int = 2
//Cloth Feet 3
set it = Item.addEquipment('WQ12', 5, "", "cloth armors")
set it.Life = 50
set it.Mana = 35
set it.Armor = 5
set it.Int = 4
//Cloth Feet 4
set it = Item.addEquipment('WQ13', 5, "", "cloth armors")
set it.Life = 80
set it.Mana = 45
set it.Armor = 7
set it.Int = 7
//Cloth Feet 5
set it = Item.addEquipment('WQ14', 5, "", "cloth armors")
set it.Life = 100
set it.Mana = 55
set it.Armor = 9
set it.Int = 11
//Cloth Feet 6
set it = Item.addEquipment('WQ15', 5, "", "cloth armors")
set it.Life = 120
set it.Mana = 65
set it.Armor = 11
set it.Int = 16
//-------------shields---------------
//Shield 1
set it = Item.addEquipment('I01M', 3, "", "shields")
set it.Armor = 7
//Shield 2
set it = Item.addEquipment('I01K', 3, "", "shields")
set it.Armor = 10
//Shield 3
set it = Item.addEquipment('AR01', 3, "", "shields")
set it.Armor = 13
//Shield 4
set it = Item.addEquipment('AR02', 3, "", "shields")
set it.Armor = 16
//Shield 5
set it = Item.addEquipment('AR03', 3, "", "shields")
set it.Armor = 19
//Shield 6
set it = Item.addEquipment('AR04', 3, "", "shields")
set it.Armor = 22
//------------------------------END GENERIC
//******************Extra Items for Dismantling****************
//Tin Suit 1
set it = Item.addEquipment('I00E', 1, "", "heavy armors")
set it.Life = 50
//Copper Suit 3
set it = Item.addEquipment('I00Y', 1, "", "heavy armors")
set it.Life = 225
//Plate 4
set it = Item.addEquipment('I00Z', 1, "", "heavy armors")
set it.Life = 350
//Full Plate 5
set it = Item.addEquipment('I010', 1, "", "heavy armors")
set it.Life = 500
//Dynamo Mail 6
set it = Item.addEquipment('I011', 1, "", "heavy armors")
set it.Life = 675
//Rags 1
set it = Item.addEquipment('I00R', 1, "", "leather armors")
set it.Life = 20
set it.Agi = 2
//Quilted Pelt 2
set it = Item.addEquipment('I00S', 1, "", "leather armors")
set it.Agi = 3
set it.Life = 50
//Leather Armor 3
set it = Item.addEquipment('I00T', 1, "", "leather armors")
set it.Agi = 5
set it.Life = 90
//Demon Hide 4
set it = Item.addEquipment('I00U', 1, "", "leather armors")
set it.Agi = 8
set it.Life = 140
//Padded Armor 5
set it = Item.addEquipment('I00V', 1, "", "leather armors")
set it.Agi = 12
set it.Life = 200
//Crested Rind 6
set it = Item.addEquipment('I00Q', 1, "", "leather armors")
set it.Agi = 17
set it.Life = 270
//Cloak
set it = Item.addEquipment('I014', 1, "", "cloth armors")
set it.Agi = 1
set it.Str = 1
set it.Int = 1
set it.MpReg = 50
//Robe
set it = Item.addEquipment('I012', 1, "", "cloth armors")
set it.Agi = 2
set it.Str = 2
set it.Int = 2
set it.MpReg = 100
//Mantle
set it = Item.addEquipment('I018', 1, "", "cloth armors")
set it.Agi = 3
set it.Str = 3
set it.Int = 3
set it.MpReg = 150
//Woven Gown
set it = Item.addEquipment('I018', 1, "", "cloth armors")
set it.Agi = 4
set it.Str = 4
set it.Int = 4
set it.MpReg = 400
//Demon Mantle
set it = Item.addEquipment('I016', 1, "", "cloth armors")
set it.Armor = 1
set it.Agi = 5
set it.Str = 5
set it.Int = 5
set it.MpReg = 250
//Mantle
set it = Item.addEquipment('I01Q', 1, "", "cloth armors")
set it.Agi = 6
set it.Str = 6
set it.Int = 6
set it.MpReg = 300
//Thorium Shield 3
set it = Item.addEquipment('I02E', 3, "", "shields")
set it.Armor = 8
//Kite Shield 4
set it = Item.addEquipment('I02F', 3, "", "shields")
set it.Armor = 12
//Dynamo Shield 5
set it = Item.addEquipment('I02G', 3, "", "shields")
set it.Armor = 17
//Shield of Storms 6
set it = Item.addEquipment('I02H', 3, "", "shields")
set it.Armor = 18
set it.Abil = 'A05G'
call it.HasAbility(true)
//Arrows 1
set it = Item.addEquipment('I024', 3, "", "arrows")
set it.Dmg = 10
//arrows 2
set it = Item.addEquipment('I01O', 3, "", "arrows")
set it.Dmg = 15
//arrows 3
set it = Item.addEquipment('I026', 3, "", "arrows")
set it.Dmg = 20
//arrows 4
set it = Item.addEquipment('I02I', 3, "", "arrows")
set it.Dmg = 25
//arrows 5
set it = Item.addEquipment('I027', 3, "", "arrows")
set it.Dmg = 30
//arrows 6
set it = Item.addEquipment('I01U', 3, "", "arrows")
set it.Dmg = 35
//Long Sword 1
set it = Item.addEquipment('I02J', 2, "", "swords")
set it.Agi = 1
set it.Str = 1
set it.Dmg = 5
set it.ATag = "alternate"
//Broad Sword 2
set it = Item.addEquipment('I01H', 2, "", "swords")
set it.Agi = 2
set it.Str = 2
set it.Dmg = 10
set it.ATag = "alternate"
//Mythril Blade 3
set it = Item.addEquipment('I01J', 2, "", "swords")
set it.Str = 4
set it.Agi = 4
set it.Dmg = 12
set it.Abil = 'A03M'
call it.HasAbility(true)
set it.ATag = "alternate"
//Claymore 4
set it = Item.addEquipment('I01I', 2, "", "swords")
set it.Str = 7
set it.Agi = 7
set it.Dmg = 20
set it.ATag = "alternate"
//Frost Guard 5
set it = Item.addEquipment('I02K', 2, "", "swords")
set it.Str = 11
set it.Agi = 11
set it.Dmg = 15
set it.Armor = 4
set it.Abil = 'A02X'
call it.HasAbility(true)
set it.ATag = "alternate"
//Sharpened Edge 6
set it = Item.addEquipment('I02L', 2, "", "swords")
set it.Str = 10
set it.Agi = 10
set it.Dmg = 35
set it.Abil = 'CrB2'
call it.HasAbility(true)
set it.ATag = "alternate"
//Poison Dagger 1
set it = Item.addEquipment('I01L', 2, "", "daggers")
set it.Dmg = 4
set it.Abil = 'AIpb'
call it.HasAbility(true)
set it.ATag = "gold"
//Oak Dagger 2
set it = Item.addEquipment('I025', 2, "", "daggers")
set it.Agi = 3
set it.Dmg = 10
set it.ATag = "gold"
//Thornium Dagger 3
set it = Item.addEquipment('I01N', 2, "", "daggers")
set it.Agi = 5
set it.Dmg = 15
set it.ATag = "gold"
//Serrated Dagger 4
set it = Item.addEquipment('I01C', 2, "", "daggers")
set it.Agi = 8
set it.Dmg = 20
set it.ATag = "gold"
//Engulfed Crimson 5
set it = Item.addEquipment('I022', 2, "", "daggers")
set it.Agi = 12
set it.Dmg = 18
set it.Abil = 'A030'
call it.HasAbility(true)
set it.ATag = "gold"
//Dagger of the Illusion 6
set it = Item.addEquipment('I02D', 2, "", "daggers")
set it.Agi = 17
set it.Dmg = 22
set it.Abil = 'A019'
call it.HasAbility(true)
set it.ATag = "gold"
//Wind Bow 1
set it = Item.addEquipment('I02R', 2, "", "bows")
set it.Agi = 4
set it.Abil = 'WhBk'
call it.HasAbility(true)
set it.ATag = "lumber"
//Chilling Axe 2
set it = Item.addEquipment('I01E', 2, "", "axes")
set it.Dmg = 11
set it.Abil = 'A02Y'
call it.HasAbility(true)
set it.ATag = "alternate"
//Battle Axe 3
set it = Item.addEquipment('I02M', 2, "", "axes")
set it.Dmg = 21
set it.ATag = "alternate"
//Water Axe 3
set it = Item.addEquipment('I02S', 2, "", "axes")
set it.Dmg = 16
set it.Abil = 'WSBk'
call it.HasAbility(true)
set it.ATag = "alternate"
//Mage Masher 4
set it = Item.addEquipment('I02N', 2, "", "axes")
set it.Dmg = 27
set it.Abil = 'MMBo'
call it.HasAbility(true)
set it.ATag = "alternate"
//Maim 5
set it = Item.addEquipment('I02O', 2, "", "axes")
set it.Dmg = 25
set it.Abil = 'CrB2'
call it.HasAbility(true)
set it.ATag = "alternate"
//Double Edged Battle Axe 6
set it = Item.addEquipment('I02P', 2, "", "axes")
set it.Dmg = 40
set it.ATag = "alternate"
//Stone Maul 1
set it = Item.addEquipment('I020', 2, "", "mauls")
set it.Str = 2
set it.Dmg = 5
set it.ATag = "channel"
//Enchanted Hammer 2
set it = Item.addEquipment('I01Z', 2, "", "mauls")
set it.Str = 3
set it.Dmg = 7
set it.Abil = 'A03L'
call it.HasAbility(true)
set it.ATag = "channel"
//Mithril Maul 3
set it = Item.addEquipment('I01W', 2, "", "mauls")
set it.Str = 5
set it.Dmg = 15
set it.ATag = "channel"
//Hammer of Light 4
set it = Item.addEquipment('I01Y', 2, "", "mauls")
set it.Str = 8
set it.Dmg = 16
set it.Abil = 'ACbh'
call it.HasAbility(true)
set it.ATag = "channel"
//Arcanite Maul 5
set it = Item.addEquipment('I021', 2, "", "mauls")
set it.Str = 12
set it.Dmg = 25
set it.ATag = "channel"
//Hammer of Thunder 6
set it = Item.addEquipment('I01X', 2, "", "mauls")
set it.Str = 17
set it.Dmg = 24
set it.Abil = 'A03K'
call it.HasAbility(true)
set it.ATag = "channel"
//Yew Wand 1
set it = Item.addEquipment('I01U', 2, "", "wands")
set it.Int = 3
set it.Dmg = 3
set it.ATag = "flesh"
//Oak Wand 2
set it = Item.addEquipment('I01G', 2, "", "wands")
set it.Int = 5
set it.Dmg = 6
set it.ATag = "flesh"
//Star Wand 3
set it = Item.addEquipment('I01V', 2, "", "wands")
set it.Int = 8
set it.Dmg = 9
set it.ATag = "flesh"
//Star Wand 4
set it = Item.addEquipment('I01P', 2, "", "wands")
set it.Int = 12
set it.Dmg = 12
set it.ATag = "flesh"
//Candle Wand 5
set it = Item.addEquipment('I02Q', 2, "", "wands")
set it.Int = 13
set it.Dmg = 12
set it.Abil = 'cawa'
call it.HasAbility(true)
set it.ATag = "flesh"
//Divine Wand 6
set it = Item.addEquipment('I01T', 2, "", "wands")
set it.Int = 18
set it.Dmg = 14
set it.Abil = 'diwa'
call it.HasAbility(true)
set it.ATag = "flesh"
//Blue Staff
set it = Item.addEquipment('I01B', 2, "", "staffs")
set it.Int = 18
set it.Dmg = 14
set it.ATag = "alternate"
//Orb Staff
set it = Item.addEquipment('I01C', 2, "", "staffs")
set it.Int = 10
set it.Dmg = 20
set it.ATag = "alternate"
//Archon Staff
set it = Item.addEquipment('I01D', 2, "", "staffs")
set it.Int = 20
set it.Dmg = 40
set it.ATag = "alternate"
//Book of Magic 1
set it = Item.addEquipment('I019', 3, "", "books")
set it.Mana = 50
set it.ATag = "flesh"
//Book of Embers 2
set it = Item.addEquipment('I013', 3, "", "books")
set it.Mana = 75
set it.ATag = "flesh"
//Book of Necromancy 3
set it = Item.addEquipment('I01A', 3, "", "books")
set it.Mana = 125
set it.ATag = "flesh"
//Book of Flames 4
set it = Item.addEquipment('I01S', 3, "", "books")
set it.Mana = 200
set it.ATag = "flesh"
//Book of the Dead 5
set it = Item.addEquipment('I017', 3, "", "books")
set it.Mana = 300
set it.ATag = "flesh"
//Burning Tome 6
set it = Item.addEquipment('I01R', 3, "", "books")
set it.Mana = 425
set it.ATag = "flesh"
endfunction
private function init takes nothing returns nothing
call Setup()
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope InsertName initializer init
globals
private constant integer SPELLID = 'XXXX'
endglobals
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions()
endif
return true
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=59
//TESH.alwaysfold=0
scope Rush initializer InitTrig_Rush_Template
globals
private constant integer SPELLID = 'A0id'
private constant real tick = 0.034
private unit TEMP
endglobals
private struct Data extends xedamage
unit c
unit t
real x
real y
real dur
static unit temp
static group g
static method GroupDamage takes nothing returns boolean
local xedamage d= xedamage.create()
local real a = bj_RADTODEG*Atan2( GetUnitY(GetFilterUnit()) - GetUnitY(thistype.temp), GetUnitX(GetFilterUnit()) - GetUnitX(thistype.temp) )
local integer lvl = GetUnitAbilityLevel(thistype.temp, SPELLID)
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_MELEE
if not IsUnitInGroup(GetFilterUnit(), thistype.g) then
call d.damageTarget(thistype.temp,GetFilterUnit(), SpellStat(thistype.temp,true)*(0.3+0.06*lvl) + 8+8*lvl)
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(thistype.temp)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) and not( IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD ))then
call KnockbackTarget(thistype.temp, GetFilterUnit(), a, 250., 700., false, true, false, GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0))
endif
endif
call d.destroy()
return false
endmethod
static method GroupEm takes nothing returns boolean
local xedamage d= xedamage.create()
local real a = bj_RADTODEG*Atan2( GetUnitY(GetFilterUnit()) - GetUnitY(thistype.temp), GetUnitX(GetFilterUnit()) - GetUnitX(thistype.temp) )
local integer lvl = GetUnitAbilityLevel(thistype.temp, SPELLID)
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(thistype.temp)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) and not( IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD ))then
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_MELEE
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(thistype.temp)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) and not( IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD ))then
call KnockbackTarget(thistype.temp, GetFilterUnit(), a, 250., 700., false, true, false, GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0))
endif
if not IsUnitInGroup(GetFilterUnit(), thistype.g) then
call d.damageTarget(thistype.temp,GetFilterUnit(), SpellStat(thistype.temp,true)*(0.25+0.07*lvl) + 10+10*lvl)
return true
endif
endif
call d.destroy()
return false
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local thistype this = GetTimerData(tim)
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
local real angle = Atan2(.y - GetUnitY(.c), .x - GetUnitX(.c))
local real x = GetUnitX(.c) + 20 * Cos(angle)
local real y = GetUnitY(.c) + 20 * Sin(angle)
local real dist = SquareRoot((GetUnitX(.c)-.x) * (GetUnitX(.c)-.x) + (GetUnitY(.c)-.y) * (GetUnitY(.c)-.y))
if IsTerrainWalkable(x,y) and not(IsUnitType(.c, UNIT_TYPE_DEAD)) then
call SetUnitX(.c, x)
call SetUnitY(.c, y)
call SetUnitFacing(.c, angle * bj_RADTODEG)
call QueueUnitAnimation(.c, "walk")
set thistype.temp = .c
if dist < 19 or .dur > 3 then
call GroupEnumUnitsInArea(thistype.g, x, y, 160, Filter(function thistype.GroupDamage))
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 1), .c, "origin"))
call ReleaseGroup(thistype.g)
call PauseUnit(.c, false)
call .destroy()
call ReleaseTimer(tim)
else
call GroupEnumUnitsInArea(thistype.g, x, y, 60, Filter(function thistype.GroupEm))
endif
else
if not IsUnitType(.c, UNIT_TYPE_DEAD) then
call GroupEnumUnitsInArea(ENUM_GROUP, x, y, 160, Filter(function thistype.GroupDamage))
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 1), .c, "origin"))
endif
call PauseUnit(.c, false)
call ReleaseGroup(thistype.g)
call .destroy()
call ReleaseTimer(tim)
endif
set .dur = .dur + tick
endmethod
static method create takes unit c, real x, real y returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
set .c = c
set .x = x
set .y = y
set .dur = 0
set thistype.g = NewGroup()
call PauseUnit(.c, true)
call SetUnitAnimation(.c, "walk")
call SetTimerData(tim,this)
call TimerStart(tim, tick, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
endif
return true
endmethod
endstruct
//===========================================================================
public function InitTrig_Rush_Template takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=16
//TESH.alwaysfold=0
scope Orb initializer init
globals
private constant integer SPELLID = 'puor'
endglobals
private struct Data extends xecollider
unit caster
real ang
method loopControl takes nothing returns nothing
set .ang = .ang + 0.09 // r = number of radians that should be rotated every XE_ANIMATION_PERIOD. .ang is a struct member that's a real.
set .x = GetUnitX(.caster) + 150*Cos(.ang) // OFFSET would be how far the xecollider should be from the caster. In your case, 200
set .y = GetUnitY(.caster) + 150*Sin(.ang)
endmethod
method onUnitHit takes unit target returns nothing
if IsUnitEnemy(target, GetOwningPlayer(this.caster)) then
call this.terminate()
endif
endmethod
static method Actions takes unit c returns nothing
local real angle = Atan2(GetUnitFacing(c) - GetUnitY(c), GetUnitFacing(c) - GetUnitX(c))
local Data xc = Data.create(GetUnitX(c)+150*Cos(angle), GetUnitY(c)+150*Sin(angle), 0)
set xc.caster = c
set xc.expirationTime = 999999
set xc.fxpath = GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0)
set xc.ang = angle
set xc.z = 60
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.Actions(GetTriggerUnit())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SummonElemental initializer init
globals
private constant integer SPELLID = 'SuEl'
private constant integer SPELLID = 'SuEn'
endglobals
private function Actions takes unit c, real x, real y, unit d returns nothing
if x = 0 and y = 0 then
set x = GetUnitX(c)
set y = GetUnitY(c)
endif
if GetUnitAbilityLevel(GetTriggerUnit(), 'FirS') > 0 then
set d = CreateUnit(GetOwningPlayer(c), 'fiel', x, y, GetUnitFacing(c))
elseif
endif
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), GetUnitX(), GetUnitY(), null)
endif
return true
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Triple_Cast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'TriC'
endfunction
function Trig_Triple_Cast_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local abilitydata dat = unitabilityhistory[ t ].in.entry[ unitabilityhistory[t].in.stored - 1 ]
local unit array d
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local integer i = 1
local integer array abil
local string array id
loop
exitwhen i == 4
set abil[i] = LoadInteger(TripleSpell, i*10, GetHandleId(GetSpellTargetUnit()))
set id[i] = LoadStr(TripleSpell, i, GetHandleId(GetTriggerUnit()))
set d[i] = CreateUnit(GetTriggerPlayer(),'e002',x,GetUnitY(c),GetUnitFacing(c))
call UnitAddAbility(d[i],abil[i])
call UnitApplyTimedLife(d[i],'BTLF',5.)
call IssueTargetOrder(d[i],id[i],t)
set d[i] = null
set id[i] = null
set i = i + 1
endloop
set t = null
set c = null
endfunction
//===========================================================================
function InitTrig_TriCast takes nothing returns nothing
set gg_trg_TriCast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_TriCast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_TriCast, Condition( function Trig_Triple_Cast_Conditions ) )
call TriggerAddAction( gg_trg_TriCast, function Trig_Triple_Cast_Actions )
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=0
scope Rush initializer InitTrig_Rush
globals
private constant integer SPELLID = 'Rush'
private constant real tick = 0.034
private unit TEMP
endglobals
private struct Data extends xedamage
unit c
unit t
real x
real y
real dur
static unit temp
static group g
static method GroupDamage takes nothing returns boolean
local xedamage d= xedamage.create()
local real a = bj_RADTODEG*Atan2( GetUnitY(GetFilterUnit()) - GetUnitY(thistype.temp), GetUnitX(GetFilterUnit()) - GetUnitX(thistype.temp) )
local integer lvl = GetUnitAbilityLevel(thistype.temp, SPELLID)
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_MELEE
if not IsUnitInGroup(GetFilterUnit(), thistype.g) then
call d.damageTarget(thistype.temp,GetFilterUnit(), SpellStat(thistype.temp,true)*(0.3+0.06*lvl) + 8+8*lvl)
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(thistype.temp)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) and not( IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD ))then
call KnockbackTarget(thistype.temp, GetFilterUnit(), a, 250., 700., false, true, false, GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0))
endif
endif
call d.destroy()
return false
endmethod
static method GroupEm takes nothing returns boolean
local xedamage d= xedamage.create()
local real a = bj_RADTODEG*Atan2( GetUnitY(GetFilterUnit()) - GetUnitY(thistype.temp), GetUnitX(GetFilterUnit()) - GetUnitX(thistype.temp) )
local integer lvl = GetUnitAbilityLevel(thistype.temp, SPELLID)
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(thistype.temp)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) and not( IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD ))then
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_MELEE
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(thistype.temp)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) and not( IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD ))then
call KnockbackTarget(thistype.temp, GetFilterUnit(), a, 250., 700., false, true, false, GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0))
endif
if not IsUnitInGroup(GetFilterUnit(), thistype.g) then
call d.damageTarget(thistype.temp,GetFilterUnit(), SpellStat(thistype.temp,true)*(0.25+0.07*lvl) + 10+10*lvl)
return true
endif
endif
call d.destroy()
return false
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local thistype this = GetTimerData(tim)
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
local real angle = Atan2(.y - GetUnitY(.c), .x - GetUnitX(.c))
local real x = GetUnitX(.c) + 20 * Cos(angle)
local real y = GetUnitY(.c) + 20 * Sin(angle)
local real dist = SquareRoot((GetUnitX(.c)-.x) * (GetUnitX(.c)-.x) + (GetUnitY(.c)-.y) * (GetUnitY(.c)-.y))
if IsTerrainWalkable(x,y) and not(IsUnitType(.c, UNIT_TYPE_DEAD)) then
call SetUnitX(.c, x)
call SetUnitY(.c, y)
call SetUnitFacing(.c, angle * bj_RADTODEG)
call QueueUnitAnimation(.c, "walk")
set thistype.temp = .c
if dist < 19 or .dur > 3 then
call GroupEnumUnitsInArea(thistype.g, x, y, 160, Filter(function thistype.GroupDamage))
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 1), .c, "origin"))
call ReleaseGroup(thistype.g)
call PauseUnit(.c, false)
call .destroy()
call ReleaseTimer(tim)
else
call GroupEnumUnitsInArea(thistype.g, x, y, 60, Filter(function thistype.GroupEm))
endif
else
if not IsUnitType(.c, UNIT_TYPE_DEAD) then
call GroupEnumUnitsInArea(ENUM_GROUP, x, y, 160, Filter(function thistype.GroupDamage))
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 1), .c, "origin"))
endif
call PauseUnit(.c, false)
call ReleaseGroup(thistype.g)
call .destroy()
call ReleaseTimer(tim)
endif
set .dur = .dur + tick
endmethod
static method create takes unit c, real x, real y returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
set .c = c
set .x = x
set .y = y
set .dur = 0
set thistype.g = NewGroup()
call PauseUnit(.c, true)
call SetUnitAnimation(.c, "walk")
call SetTimerData(tim,this)
call TimerStart(tim, tick, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
endif
return true
endmethod
endstruct
//===========================================================================
public function InitTrig_Rush takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=35
//TESH.alwaysfold=0
scope ChainPetrify initializer InitTrig_Chain_Petrify
globals
private constant integer SPELLID = 'PeWa'
private constant integer DUMMYSPELL = 'Petr'
private group array GROUP
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
integer jumps
static method GroupEm takes nothing returns boolean
if not(IsUnitInGroup(GetFilterUnit(), GROUP[GetUnitId(TEMP)]) or IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) or IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) or IsUnitAlly(GetFilterUnit(), GetOwningPlayer(TEMP))) then
return true
endif
return false
endmethod
method onDestroy takes nothing returns nothing
call ReleaseGroup(GROUP[GetUnitId(this.caster)])
endmethod
method loopControl takes nothing returns nothing
local unit target
local group g = NewGroup()
if this.targetUnit == null or IsUnitType(this.targetUnit, UNIT_TYPE_DEAD) then
call GroupEnumUnitsInArea(g, this.x, this.y, 500, Filter(function Data.GroupEm))
set target = FirstOfGroup(g)
if target == null then
call this.terminate()
else
set this.targetUnit = target
endif
endif
set target = null
call ReleaseGroup(g)
endmethod
method onUnitHit takes unit target returns nothing
local xecast xc = xecast.createBasicA(DUMMYSPELL, OrderId("steal"), GetOwningPlayer(this.caster))
local group g = NewGroup()
if IsUnitInGroup(target, GROUP[GetUnitId(this.caster)]) != true and IsUnitEnemy(target, GetOwningPlayer(this.caster)) then
call GroupAddUnit(GROUP[GetUnitId(this.caster)], target)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 1), target, "origin"))
set xc.level = GetUnitAbilityLevel(this.caster,SPELLID)
call xc.castOnTarget(target)
set TEMP = this.caster
call GroupEnumUnitsInArea(g, this.x, this.y, 500, Filter(function Data.GroupEm))
set target = FirstOfGroup(g)
if target == null then
call this.terminate()
else
set this.targetUnit = target
endif
endif
call xc.destroy()
call ReleaseGroup(g)
endmethod
endstruct
private function Actions takes unit c, unit t returns nothing
local real ang = Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c))
local Data d
set GROUP[GetUnitId(c)] = NewGroup()
call GroupRefresh(GROUP[GetUnitId(c)])
call GroupAddUnit(GROUP[GetUnitId(c)], c)
set d = Data.create(GetUnitX(c), GetUnitY(c), ang)
set d.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set d.speed = 600.0
set d.expirationTime = 15
set d.z = 75.0
set d.caster = c
set d.collisionSize = 16.0
set d.angleSpeed = 15.0
set d.targetUnit = t
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions( GetTriggerUnit(), GetSpellTargetUnit() )
endif
return false
endfunction
//===========================================================================
public function InitTrig_Chain_Petrify takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=8
//TESH.alwaysfold=0
scope Prayer initializer onInit
globals
private constant integer SPELLID = 'A01C'
private constant real TICK = 1
private unit TEMP
endglobals
private struct Data
unit c
real dur
static method GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local unit t= GetFilterUnit()
if IsUnitAlly(t, GetOwningPlayer(TEMP)) and not(IsUnitType(t, UNIT_TYPE_DEAD) or IsUnitType(t, UNIT_TYPE_STRUCTURE)) then
call SetWidgetLife(t, GetWidgetLife(t)+30+50*lvl)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0), t, "overhead"))
endif
set t= null
return false
endmethod
static method Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
set TEMP = GetTriggerUnit()
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()), 400, Filter(function thistype.GroupEm))
endif
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function thistype.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endmethod
endstruct
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_TempStacking_Actions takes nothing returns nothing
local unit t = GetManipulatingUnit()
local integer i = 0
local integer i2
local item array indexItem
loop
set indexItem[i] = UnitItemInSlot(t, i)
set i2 = i+1
loop
exitwhen i2 >= bj_MAX_INVENTORY
if UnitItemInSlot(t, i2) != null and GetItemTypeId(indexItem[i]) == GetItemTypeId(UnitItemInSlot(t, i2)) and GetItemType(indexItem[i]) == ITEM_TYPE_CHARGED then
call SetItemCharges(indexItem[i], GetItemCharges(indexItem[i])+GetItemCharges(UnitItemInSlot(t, i2)) )
call RemoveItem(UnitItemInSlot(t, i2))
endif
set i2 = i2 + 1
endloop
set i = i + 1
exitwhen i >= bj_MAX_INVENTORY
endloop
endfunction
//===========================================================================
function InitTrig_TempStacking takes nothing returns nothing
set gg_trg_TempStacking = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_TempStacking, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_TempStacking, function Trig_TempStacking_Actions )
endfunction
//TESH.scrollpos=62
//TESH.alwaysfold=0
scope Life initializer InitTrig_Life
globals
private constant integer SPELLID = 'life'
private unit TEMP
private real DMG
endglobals
private function Ally takes unit t returns nothing
call SetWidgetLife(t, GetUnitState(t, UNIT_STATE_MAX_LIFE))
call SetUnitState(t, UNIT_STATE_MANA, GetUnitState(t, UNIT_STATE_MAX_MANA))
call UnitRemoveBuffs(t, false, true)
endfunction
private function Enemy takes unit c, unit t, real dmg returns nothing
local integer lvl = GetUnitAbilityLevel(c,SPELLID)
if dmg < 0 then
set dmg = 250*lvl
else
set dmg = dmg*(0.5+0.5*lvl)*lvl + 250*lvl
endif
if GetRandomReal(1,100) < -2.5+2.5*lvl then
call UnitDamageTarget(c,t,dmg+2000, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, wtype)
else
call UnitDamageTarget(c,t,dmg, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, wtype)
endif
endfunction
private function GroupEm takes nothing returns boolean
local integer id = GetPlayerId(GetOwningPlayer(GetFilterUnit()))
local unit HERO = GetPlayerHero(id+1)
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local real HP = GetUnitState(HERO, UNIT_STATE_MAX_LIFE)*(0.125+0.175*lvl)
local real MP = GetUnitState(HERO, UNIT_STATE_MAX_MANA)*0.5
if IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) or IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
return false
elseif GetUnitTypeId(GetFilterUnit()) == 'grav' then
call RaiseHero(GetFilterUnit(),HP,MP)
elseif IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD) then
call Enemy(TEMP,GetFilterUnit(),DMG)
else
call Ally(GetFilterUnit())
endif
set HERO = null
return false
endfunction
private function Actions takes unit c, unit t returns nothing
local integer id = GetPlayerId(GetOwningPlayer(t))
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local unit un = GetPlayerHero(id+1)
local real hp = GetUnitState(un, UNIT_STATE_MAX_LIFE)
local real mp = GetUnitState(un, UNIT_STATE_MAX_MANA)
local real dmg = (SpellStat(c,true) - SpellStat(t,true))
local group g = NewGroup()
if lvl > 4 then
set TEMP = c
set DMG = dmg
call GroupEnumUnitsInArea(g, GetSpellTargetX(), GetSpellTargetY(), 350, Filter(function GroupEm))
elseif GetUnitTypeId(t) == 'grav' then
call RaiseHero(t,hp*(0.125+0.175*lvl),mp*0.5)
elseif IsUnitEnemy(t, GetOwningPlayer(c)) and IsUnitType(t, UNIT_TYPE_UNDEAD) then
call Enemy(c,t,dmg)
else
call Ally(t)
endif
call ReleaseGroup(g)
set un = null
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Life takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library UnitAbility requires AutoIndex, TimerUtils
globals
public constant integer STORED_ABILITIES = 3
endglobals
struct abilitydata
readonly unit caster = null
readonly unit target = null
readonly real castx
readonly real casty
readonly real targetx
readonly real targety
readonly real castAngle
readonly real castRange
readonly integer abilityid
readonly string orderstring
method copy takes nothing returns thistype
local thistype copy = allocate()
set copy.caster = caster
set copy.castx = castx
set copy.casty = casty
set copy.target = target
set copy.targetx = targetx
set copy.targety = targety
set copy.abilityid = abilityid
set copy.orderstring= orderstring
set copy.castAngle = castAngle
set copy.castRange = castRange
return copy
endmethod
static method create takes nothing returns thistype
local thistype abil=allocate()
set abil.caster=GetTriggerUnit()
set abil.castx=GetUnitX(abil.caster)
set abil.casty=GetUnitY(abil.caster)
set abil.target=GetSpellTargetUnit()
set abil.targetx=GetSpellTargetX()
set abil.targety=GetSpellTargetY()
set abil.abilityid=GetSpellAbilityId()
set abil.orderstring=OrderId2String(GetUnitCurrentOrder(abil.caster))
//misc spell-data
set abil.castAngle=Atan2(abil.targety-abil.casty, abil.targetx-abil.castx) //in radians
set abil.castRange=SquareRoot((abil.targetx-abil.castx)*(abil.targetx-abil.castx) + (abil.targety-abil.casty)*(abil.targety-abil.casty))
return abil
endmethod
endstruct
struct unitabilities
readonly abilitydata array entry [STORED_ABILITIES]
readonly integer stored = 0
method onDestroy takes nothing returns nothing
local integer i=0
loop
exitwhen(i==stored)
if(entry[i]!=0) then
call entry[i].destroy()
endif
set i=i+1
endloop
endmethod
method addAbility takes abilitydata dat returns boolean
local integer i=0
loop
exitwhen(i==stored)
if(entry[i]==dat) then
return false
endif
set i=i+1
endloop
if(stored==STORED_ABILITIES) then
call entry[0].destroy()
set entry[0]=entry[1]
set entry[1]=entry[2]
set entry[2]=dat
else
set entry[stored]=dat
set stored=stored+1
endif
return true
endmethod
endstruct
private struct savedata
public unit source = null
public unit target = null
public abilitydata abilData
static method create takes unit source, unit target, abilitydata data1 returns thistype
local thistype data = allocate()
set data.source = source
set data.target = target
set data.abilData = data1
return data
endmethod
endstruct
struct unitabilityhistory //requires AutoIndex, TimerUtils
public unitabilities out
public unitabilities in
private trigger abilevent = CreateTrigger()
private timer threadDelay = null
private boolean skipFlag = false
method freeze takes boolean flag returns nothing
if flag then
call EnableTrigger(abilevent)
else
call DisableTrigger(abilevent)
endif
endmethod
method skip takes nothing returns nothing
set skipFlag = true
endmethod
method onDestroy takes nothing returns nothing
call out.destroy()
call in.destroy()
call DestroyTrigger(abilevent)
if threadDelay != null then
call ReleaseTimer(threadDelay)
endif
endmethod
static method onAbilEventThreadDelay takes nothing returns nothing
local savedata data = GetTimerData(GetExpiredTimer())
call thistype[data.source].out.addAbility(data.abilData.copy())
call thistype[data.target].in.addAbility(data.abilData.copy())
call data.abilData.destroy()
call ReleaseTimer(GetExpiredTimer())
endmethod
static method onAbilEvent takes nothing returns boolean
local thistype data = thistype[GetTriggerUnit()]
if not data.skipFlag then
set data.threadDelay = NewTimer()
call SetTimerData(data.threadDelay, savedata.create(GetTriggerUnit(), GetSpellTargetUnit(), abilitydata.create()))
call TimerStart(data.threadDelay, 0, false, function thistype.onAbilEventThreadDelay)
endif
set data.skipFlag = false
return false
endmethod
method onCreate takes nothing returns nothing
set out = unitabilities.create()
set in = unitabilities.create()
call TriggerRegisterUnitEvent(abilevent, me, EVENT_UNIT_SPELL_EFFECT)
call TriggerAddCondition(abilevent, Filter(function thistype.onAbilEvent))
endmethod
implement AutoCreate
implement AutoDestroy
endstruct
endlibrary
//TESH.scrollpos=51
//TESH.alwaysfold=0
scope TidalWave initializer I
globals
private constant integer SPELLID = 'IcCo'
private constant real tick = 0.25
endglobals
private struct Data
unit c
timer tim
real dur
static method Cone takes nothing returns boolean
local xedamage d=xedamage.create()
local integer lvl = GetUnitAbilityLevel(udg_TEMP_Unit, SPELLID)
local real dam = (8+lvl*8+SpellStat(udg_TEMP_Unit, true)*(0.2+0.08*lvl))*tick
local real a = 57.29582 * Atan2(GetUnitY(GetFilterUnit()) - GetUnitY(udg_TEMP_Unit), GetUnitX(GetFilterUnit()) - GetUnitX(udg_TEMP_Unit))
call d.factor( UNIT_TYPE_STRUCTURE, 0.2 )
set d.atype= ATTACK_TYPE_NORMAL
set d.dtype= DAMAGE_TYPE_MAGIC
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_TEMP_Unit)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) or IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) then
call d.damageTarget(udg_TEMP_Unit, GetFilterUnit(), dam)
if not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
call KnockbackTarget(udg_TEMP_Unit, GetFilterUnit(), a, 150., 150., false, false, false, GetAbilityEffectById(SPELLID, EFFECT_TYPE_AREA_EFFECT, 0))
endif
endif
call d.destroy()
return false
endmethod
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
local location loc = GetUnitLoc(.c)
local unit u
local real a = GetUnitFacing(.c)
local real x = GetUnitX(.c) + 200 * Cos(a * bj_DEGTORAD)
local real y = GetUnitY(.c) + 200 * Sin(a * bj_DEGTORAD)
if GetUnitCurrentOrder(.c) == OrderId("breathoffrost") and GetUnitState(.c, UNIT_STATE_MANA) > 45 then
call SetUnitState(.c, UNIT_STATE_MANA, GetUnitState(.c, UNIT_STATE_MANA) - tick*(10+2*lvl))
set u = CreateUnit(GetOwningPlayer(.c), 'e002', x, y, a)
call UnitAddAbility(u, 'Aloc')
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0), u, "origin"))
call UnitApplyTimedLife(u, 'B000', 1)
set udg_TEMP_Unit = .c
call GroupEnumUnitsInCone(ENUM_GROUP, loc, 300., GetUnitFacing(.c), 160, 160, Filter(function thistype.Cone))
else
if GetUnitCurrentOrder(.c) == OrderId("breathoffrost") then
call IssuePointOrder(.c, "move", GetUnitX(.c), GetUnitY(.c))
endif
set .c = null
call ReleaseTimer(.tim)
call .destroy()
endif
set u = null
set loc = null
set .dur = .dur + tick
endmethod
static method create takes unit c, real x, real y returns thistype
local thistype this = thistype.allocate()
set .tim = NewTimer()
set .c = c
set .dur = 0
call SetTimerData(.tim,this)
call TimerStart(.tim, tick, true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns nothing
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local real a = Atan2(GetSpellTargetY() - y, GetSpellTargetX() - x)*bj_RADTODEG
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), x, y)
endif
endfunction
//===========================================================================
public function I takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=39
//TESH.alwaysfold=0
scope Electrocute initializer init
globals
private constant integer SPELLID = 'Elec'
private constant real TICK = 0.25
endglobals
private struct Data
unit c
unit t
timer tim
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c,SPELLID)
local real r1
local real r2
local real r3
local real dam = SpellStat(.c,true)*0.5
local xedamage d = xedamage.create()
set d.dtype = DAMAGE_TYPE_UNIVERSAL
set d.atype = ATTACK_TYPE_MAGIC
set r1 = GetRandomReal(lvl, dam)
set r2 = GetRandomReal(lvl, dam)
set r3 = GetRandomReal(lvl, dam)
if r1 < r2 and r1 < r3 then
set dam = r1
elseif r2 < r1 and r2 < r3 then
set dam = r2
else
set dam = r3
endif
if GetUnitCurrentOrder(.c) == OrderId("magicleash") then
call d.useSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0), "origin")
call d.damageTarget(.c,.t,dam)
call SetUnitAnimation(.t, "attack")
else
call SetUnitAnimation(.t, "stand")
call ReleaseTimer(.tim)
call .destroy()
endif
call d.destroy()
endmethod
static method Actions takes unit c, unit t returns thistype
local thistype this = thistype.allocate()
set this.c = c
set this.t = t
set this.tim = NewTimer()
call SetTimerData(.tim,this)
call TimerStart(.tim, TICK, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call thistype.Actions(GetTriggerUnit(),GetSpellTargetUnit())
endif
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SummonThunderElemental initializer init
globals
private constant integer SPELLID = 'SLEl'
private constant integer SUMMONID = 'h00O'
private constant integer SPELLID1 = 'AOcl'
private constant integer SPELLID2 = 'AHtc'
private constant integer ULTID = 'Shoc'
endglobals
private function Actions takes unit s, unit c returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer DamageBonus = R2I(SpellStat(c, false)*(0.3+0.1*lvl))
local integer ArmorBonus = R2I(GetUnitBonus(c, BONUS_ARMOR)/(8.0-0.7*lvl))
local real HPBonus = 95+95*lvl+GetUnitState(c, UNIT_STATE_MAX_LIFE)/9
local real MPBonus = 40*lvl+GetUnitState(c, UNIT_STATE_MAX_LIFE)/8
call AddUnitMaxState(s, UNIT_STATE_MAX_LIFE, HPBonus)
call AddUnitMaxState(s, UNIT_STATE_MAX_MANA, MPBonus)
call AddUnitBonus(s, BONUS_DAMAGE, DamageBonus)
call AddUnitBonus(s, BONUS_ARMOR, ArmorBonus)
set UnitBounty[GetUnitId(s)] = SpellStat(c, true)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0),GetUnitX(Slave[GetUnitId(c)]), GetUnitY(Slave[GetUnitId(c)])))
call RemoveUnit(Slave[GetUnitId(c)])
call Permanence_Data.create( c, s )
call UnitRemoveAbility(c, 'revi')
if GetHeroInt(c,true) > 40 then
set SpellID1[GetUnitId(c)] = SPELLID1
call UnitAddAbility(s, SPELLID1)
call SetUnitAbilityLevel(s, SPELLID1, lvl )
else
set SpellID1[GetUnitId(c)] = 0
endif
if GetHeroAgi(c,true) > 35 then
set SpellID2[GetUnitId(c)] = SPELLID2
call UnitAddAbility(s, SPELLID2)
call SetUnitAbilityLevel(s, SPELLID2, lvl )
else
set SpellID2[GetUnitId(c)] = 0
endif
if SpellStat(c,true) > 60 then
set SpellID3[GetUnitId(c)] = ULTID
call UnitAddAbility(s, ULTID)
call SetUnitAbilityLevel(s, ULTID, lvl )
else
set SpellID3[GetUnitId(c)] = 0
endif
endfunction
private function Conditions takes nothing returns nothing
if GetUnitTypeId(GetSummonedUnit()) == SUMMONID and not IsUnitIllusion(GetSummonedUnit()) then
call Actions(GetSummonedUnit(), GetSummoningUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddAction( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=40
//TESH.alwaysfold=0
scope Storm initializer init
globals
private constant integer SPELLID = 'Strm'
endglobals
private struct Data
unit c
timer tim
real x
real y
method onDestroy takes nothing returns nothing
call SetUnitAnimation(.c, "stand")
call ReleaseTimer(.tim)
endmethod
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local unit cloud
local real ang = GetRandomReal(0,2*bj_PI)
local real x = GetUnitX(.c)+GetRandomReal(150,400)*Cos(ang)
local real y = GetUnitY(.c)+GetRandomReal(150,400)*Sin(ang)
set cloud = CreateUnit(GetOwningPlayer(.c), 'racl', x, y, GetRandomReal(0,360))
call SetUnitBonus(cloud, BONUS_DAMAGE, R2I(5+SpellStat(.c, true)*0.5))
call UnitAddAbility(cloud, 'Aloc')
call UnitApplyTimedLife(cloud, 'B000', 7.5)
call .destroy()
set cloud = null
endmethod
static method create takes unit c, integer i returns thistype
local thistype this = thistype.allocate()
set .c = c
set .tim = NewTimer()
call SetTimerData(.tim,this)
call TimerStart(.tim, 0.7*i, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns nothing
local integer i = 1
local unit t = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(t, SPELLID)
if GetSpellAbilityId() == SPELLID then
loop
call thistype.create(t,i)
set i = i + 1
exitwhen i >= 2+lvl*2
endloop
endif
set t = null
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=29
//TESH.alwaysfold=0
scope StormBolt initializer Init
globals
private constant integer SPELLID = 'StBo'
private constant attacktype atk = ATTACK_TYPE_MAGIC
private constant damagetype dmg = DAMAGE_TYPE_LIGHTNING
private constant real tick = 0.04
private unit TEMP
private real TempDam
private real X
private real Y
private real Z
endglobals
private struct Data
unit t
real x
real y
real z
real dur
lightning l
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
if D.dur < 0.7 then
call MoveLightningEx(D.l, false, D.x, D.y, D.z+100, GetUnitX(D.t), GetUnitY(D.t), GetUnitFlyHeight(D.t)+100)
set D.dur = D.dur + tick
else
call DestroyLightning(D.l)
call ReleaseTimer(tim)
set D.l = null
set D.t = null
call D.destroy()
endif
endmethod
static method create takes unit target, real x, real y, real z returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.t = target
set D.x = x
set D.y = y
set D.z = z
set D.l = AddLightning("CLSB", false, x, y, GetUnitX(D.t), GetUnitY(D.t))
set D.dur = 0
call SetTimerData(tim, D)
call TimerStart(tim, tick, true, function Data.Timer)
return D
endmethod
endstruct
/*
private struct ConMis
unit mis
unit c
real dur
lightning l
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local ConMis M = ConMis(GetTimerData(tim))
if IsUnitType(M.mis, UNIT_TYPE_DEAD) or M.dur > 1.5 then
call DestroyLightning(M.l)
call ReleaseTimer(tim)
set M.l = null
set M.c = null
set M.mis = null
call M.destroy()
else
set M.dur = M.dur + tick
call MoveLightningEx(M.l, false, GetUnitX(M.c), GetUnitY(M.c), GetUnitFlyHeight(M.c)+100, GetUnitX(M.mis), GetUnitY(M.mis), GetUnitFlyHeight(M.mis)+100)
endif
endmethod
static method create takes unit missile, unit caster, lightning lig returns ConMis
local ConMis M = ConMis.allocate()
local timer tim = NewTimer()
set M.dur = 0
set M.mis = missile
set M.c = caster
set M.l = lig
call SetTimerData(tim, M)
call TimerStart(tim, tick, true, function ConMis.Timer)
return M
endmethod
endstruct
*/
private struct stormBolt extends xecollider
unit caster
lightning lig
static method GroupEm takes nothing returns boolean
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) == false and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false and TEMP != GetFilterUnit() then
call UnitDamageTarget(TEMP, GetFilterUnit(), TempDam, true, false, atk, dmg, wtype)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", GetFilterUnit(), "origin"))
call Data.create(GetFilterUnit(), X, Y, Z)
endif
return true
endmethod
method onDestroy takes nothing returns nothing
local group g = NewGroup()
local integer lvl = GetUnitAbilityLevel(this.caster, SPELLID)
set TempDam = lvl*15 + (SpellStat(this.caster, true)*0.6+0.3*lvl)*(0.23+0.075*lvl)
set TEMP = this.caster
set X = this.x
set Y = this.y
set Z = this.z
call DestroyLightning(this.lig)
set this.lig = null
call GroupEnumUnitsInArea(g, this.x, this.y, 300, Filter(function stormBolt.GroupEm))
call ReleaseGroup(g)
endmethod
method loopControl takes nothing returns nothing
call MoveLightningEx(this.lig, false, GetUnitX(this.caster), GetUnitY(this.caster), GetUnitFlyHeight(this.caster)+100, this.x, this.y, this.z+100)
endmethod
method onUnitHit takes unit target returns nothing
local integer lvl = GetUnitAbilityLevel(this.caster, SPELLID)
set TempDam = lvl*40 + (SpellStat(this.caster, true)*0.6+0.3*lvl)
if IsUnitEnemy(this.caster, GetOwningPlayer(target)) then
call UnitDamageTarget(this.caster, target, TempDam, true, false, atk, dmg, wtype)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", target, "origin"))
call this.terminate()
endif
endmethod
endstruct
private function Actions takes unit c returns nothing
local real ang = Atan2(GetSpellTargetY() - GetUnitY(c), GetSpellTargetX() - GetUnitX(c))
local stormBolt xc
set xc = stormBolt.create(GetUnitX(c), GetUnitY(c), ang)
call xc.loopControl()
set xc.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set xc.lig = AddLightning("CLPB", false, GetUnitX(c), GetUnitY(c), xc.x, xc.y)
set xc.speed = 650.0
set xc.expirationTime = 1.65
set xc.z = 50.0
set xc.caster = c
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, function Conditions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=35
//TESH.alwaysfold=0
scope FreezingBlast initializer InitTrig_Freezing_Blast
globals
private constant integer SPELLID = 'FrBl'
private unit TEMP
endglobals
private struct Freeze
unit t
effect fx
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Freeze F = Freeze(GetTimerData(tim))
call PauseUnit(F.t, false)
call DestroyEffect(F.fx)
set F.t = null
call ReleaseTimer(tim)
call F.destroy()
endmethod
static method create takes unit target, unit caster returns Freeze
local timer tim = NewTimer()
local Freeze F = Freeze.allocate()
local real lvl = GetUnitAbilityLevel(caster, SPELLID)
set F.t = target
call PauseUnit(target, true)
set F.fx = AddSpecialEffectTarget("Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl", target, "origin")
call SetTimerData(tim, F)
call TimerStart(tim, 0.8+0.2*lvl, false, function Freeze.Timer)
return F
endmethod
endstruct
private struct Data
unit c
static method GroupEnum takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD))and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) then
call UnitDamageTarget(TEMP, GetFilterUnit(), 180*(lvl*0.4)+SpellStat(TEMP,true)*1.25, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_COLD, wtype)
call Freeze.create(GetFilterUnit(), TEMP)
return true
endif
return false
endmethod
static method create takes unit caster, real x, real y returns Data
local Data D = Data.allocate()
local group g = NewGroup()
local integer lvl = GetUnitAbilityLevel(caster, SPELLID)
set D.c = caster
set TEMP = caster
call GroupEnumUnitsInArea(g, x, y, 225+25*lvl, Filter(function Data.GroupEnum))
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Freezing_Blast takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DoubleCastPassive initializer InitTrig_DoubleCast
globals
private unit TempUnit
private string OrderString
private constant integer SPELLID = 'DblC'
endglobals
private function Enemy takes nothing returns boolean
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempUnit)) and GetWidgetLife(GetFilterUnit()) > 0.405 and bj_groupCountUnits <= 1 then
set bj_groupCountUnits = bj_groupCountUnits + 1
call IssueTargetOrder(TempUnit,OrderString,GetFilterUnit())
return true
endif
return false
endfunction
private function Ally takes nothing returns boolean
if IsUnitAlly(GetFilterUnit(), GetOwningPlayer(TempUnit)) and GetWidgetLife(GetFilterUnit()) > 0.405 and bj_groupCountUnits <= 1 then
set bj_groupCountUnits = bj_groupCountUnits + 1
call IssueTargetOrder(TempUnit,OrderString,GetFilterUnit())
return true
endif
return false
endfunction
private function Actions takes unit c,unit t,unit d returns nothing
local real x = GetUnitX(c)
local real x2 = GetSpellTargetX()
local string id = OrderId2String(GetUnitCurrentOrder(c))
local group g = NewGroup()
local boolexpr boo = Filter(function Enemy)
set d = CreateUnit(GetOwningPlayer(c),XE_DUMMY_UNITID,x,GetUnitY(c),GetUnitFacing(c))
set UnitBounty[GetUnitId(d)] = SpellStat(c, true)
call SetUnitState(d,UNIT_STATE_MANA,9999)
call UnitAddAbility(d,GetSpellAbilityId())
call UnitAddAbility(d,'Aloc')
call SetUnitAbilityLevel(d,GetSpellAbilityId(),GetUnitAbilityLevel(c, SPELLID))
call UnitApplyTimedLife(d,'BTLF',25.*GetUnitAbilityLevel(c, SPELLID))
if IsUnitAlly(t, GetOwningPlayer(c)) then
set boo = Filter(function Ally)
endif
set TempUnit = d
set OrderString = id
set bj_groupCountUnits = 0
if x2 == 0 and x != 0 then
call SetUnitPosition(d, GetUnitX(d)+GetRandomReal(-100,100), GetUnitY(d)+GetRandomReal(-100,100))
call IssueImmediateOrder(d,id)
elseif t != null then
call GroupEnumUnitsInRange(g, GetUnitX(t), GetUnitY(t), 400, boo)
else
call IssuePointOrder(d,id,x2+GetRandomReal(-200,200),GetSpellTargetY()+GetRandomReal(-200,200))
endif
call ReleaseGroup(g)
endfunction
private function Conditions takes nothing returns boolean
if GetUnitAbilityLevel(GetTriggerUnit(),SPELLID) > 0 and GetRandomInt(1,100) < 8+7*GetUnitAbilityLevel(GetTriggerUnit(),SPELLID) then
call Actions(GetTriggerUnit(),GetSpellTargetUnit(),null)
endif
return false
endfunction
//===========================================================================
public function InitTrig_DoubleCast takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(t,Condition(function Conditions))
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=41
//TESH.alwaysfold=0
scope Fireball initializer Init
globals
private constant integer SPELLID = 'FiBa'
private constant attacktype atk = ATTACK_TYPE_MAGIC
private constant damagetype dmg = DAMAGE_TYPE_NORMAL
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
static method GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local real dam = lvl*50 + (SpellStat(TEMP,true)*(1+0.2*lvl))
local real a
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) != true then
set a = 57.29582 * Atan2(GetUnitY(GetFilterUnit()) - GetUnitY(TEMP), GetUnitX(GetFilterUnit()) - GetUnitX(TEMP))
if IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
set dam = dam*0.4
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl", GetUnitX(GetFilterUnit()), GetUnitY(GetFilterUnit())))
else
call KnockbackTarget(TEMP, GetFilterUnit(), a, 250., 700., false, true, false, "Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl")
endif
call UnitDamageTarget(TEMP, GetFilterUnit(), dam, true, false, atk, dmg, wtype)
endif
return false
endmethod
method onUnitHit takes unit target returns nothing
local group g = NewGroup()
set TEMP = this.caster
if IsUnitEnemy(this.caster, GetOwningPlayer(target)) then
call GroupEnumUnitsInArea(g, GetUnitX(target), GetUnitY(target), 175, Filter(function Data.GroupEm))
call this.terminate()
call ReleaseGroup(g)
endif
endmethod
endstruct
private function Actions takes unit c returns nothing
local real ang = Atan2(GetSpellTargetY() - GetUnitY(c), GetSpellTargetX() - GetUnitX(c))
local Data xc
set xc = Data.create(GetUnitX(c), GetUnitY(c), ang)
set xc.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set xc.speed = 900.0
set xc.expirationTime = 1.33
set xc.z = 65.0
set xc.caster = c
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, function Conditions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=10
//TESH.alwaysfold=0
scope Shock initializer init
globals
private constant integer SPELLID = 'Shoc'
private constant integer BUFFID = 'B008'
private constant integer DUMMYSPELL = 'AOcl'
private constant real TICK = 0.3
endglobals
public struct Data
unit c
integer lvl
real dur
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local group g = NewGroup()
local unit t
local xecast xc
set .lvl = GetUnitAbilityLevel(.c, SPELLID)
if .dur >= 0.6-0.1*.lvl then
call GroupEnumUnitsInArea(g, GetUnitX(.c), GetUnitY(.c), 500, BOOLEXPR_TRUE)
set .dur = 0
loop
set t = FirstOfGroup(g)
exitwhen t == null
if IsUnitEnemy(t, GetOwningPlayer(.c)) and GetUnitAbilityLevel(t, BUFFID) > 0 and GetRandomReal(0,155) < SpellStat(.c, false) then
set xc = xecast.createBasicA(DUMMYSPELL, OrderId("chainlightning"), GetOwningPlayer(.c))
call xc.castOnTarget(t)
call UnitRemoveAbility(t, BUFFID)
endif
call GroupRemoveUnit(g, t)
endloop
elseif .lvl == 0 then
call ReleaseTimer(GetExpiredTimer())
call .destroy()
else
set .dur = .dur + 1
endif
call ReleaseGroup(g)
set t = null
endmethod
static method Actions takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
set .c = c
set .dur = 0
call SetTimerData(tim,this)
call TimerStart(tim, TICK, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns boolean
if GetLearnedSkill() == SPELLID then
call thistype.Actions(GetTriggerUnit())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction( t, function Data.Conditions )
set t= null
endfunction
endscope
//TESH.scrollpos=19
//TESH.alwaysfold=0
scope PsionicArrow initializer InitTrig_Psionic_Arrow
globals
private constant integer SPELLID = 'PsiA'
private unit TempUnit
private unit TARGET
endglobals
private function Group takes nothing returns boolean
local real dam = SpellStat(TempUnit, false) * (0.1 + GetUnitAbilityLevel(TempUnit, SPELLID)*0.2)
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempUnit)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) and GetFilterUnit() != TARGET then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\MurgulMagicMissile\\MurgulMagicMissile.mdl", GetFilterUnit(), "origin"))
call UnitDamageTarget(TempUnit, GetFilterUnit(), dam, true, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_NORMAL, wtype)
return true
endif
return false
endfunction
private function Conditions takes nothing returns boolean
local location loc = GetUnitLoc(GetTriggerUnit())
local real a = 57.29582 * Atan2(GetUnitY(GetTriggerUnit()) - GetUnitY(GetAttacker()), GetUnitX(GetTriggerUnit()) - GetUnitX(GetAttacker()))
local group g = NewGroup()
set TARGET = GetTriggerUnit()
if GetUnitAbilityLevel(GetAttacker(), SPELLID) > 0 then
set TempUnit = GetAttacker()
call GroupEnumUnitsInCone(g, loc, 200., a, 100, 100, Filter(function Group))
endif
call RemoveLocation(loc)
set loc = null
call ReleaseGroup(g)
return false
endfunction
//===========================================================================
public function InitTrig_Psionic_Arrow takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=44
//TESH.alwaysfold=0
scope Mimic initializer InitTrig_Mimic
globals
private constant integer SPELLID = 'mimi'
private integer array id
private integer array charges
private integer array lvl
private trigger array tr
endglobals
private function MimicMinus takes unit c, integer i, integer abil returns nothing
set charges[GetUnitId(c)] = i-1 //8
if i-1 == 0 then
call UnitRemoveAbility(c, abil)
call UnitAddAbility(c, SPELLID)
call SetUnitAbilityLevel(c, SPELLID, lvl[GetUnitId(c)])//9
call DestroyTrigger(tr[GetUnitId(c)])
set tr[GetUnitId(c)] = null
endif
endfunction
private function MimicCasted takes nothing returns boolean
local unit c = GetTriggerUnit()
local integer abil = id[GetUnitId(c)] //8
local integer i = charges[GetUnitId(c)] //7
if GetSpellAbilityId() == abil then
call MimicMinus(c, i, abil)
endif
set c = null
return false
endfunction
private function Actions takes unit c, unit t returns nothing
local abilitydata dat = unitabilityhistory[ t ].out.entry[ unitabilityhistory[t].out.stored - 1 ]
local trigger trig
if GetUnitAbilityLevel(c, dat.abilityid) == 0 and dat.abilityid != 0 then
set charges[GetUnitId(c)] = GetUnitAbilityLevel(c, SPELLID) //7
set lvl[GetUnitId(c)] = charges[GetUnitId(c)] //9
call UnitRemoveAbility(c, SPELLID)
call UnitAddAbility(c, dat.abilityid)
call SetUnitAbilityLevel(c, dat.abilityid, GetUnitAbilityLevel(t, dat.abilityid))
set id[GetUnitId(c)] = dat.abilityid //8
set trig = CreateTrigger()
call TriggerRegisterUnitEvent( trig, c, EVENT_UNIT_SPELL_ENDCAST )
call TriggerAddCondition( trig, Condition( function MimicCasted ) )
set tr[GetUnitId(c)] = trig
endif
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Mimic takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ElementalQuiver initializer init
globals
private constant integer SPELLID = 'ElVo'
private constant integer SPELL1 = 'quda'//Darkness
private constant integer SPELL2 = 'qufi'//Fire
private constant integer SPELL3 = 'qufr'//Frost
private constant integer SPELL4 = 'quli'//Lightning
private constant integer SPELL5 = 'qusl'//Slow
private constant integer SPELL6 = 'qupo'//Poison
private constant integer SPELL7 = 'qush'//Sharpened
private constant integer SPELL8 = 'quba'//Lead
private constant real TICK = 5
endglobals
public struct Data
unit c
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
local unit t
if lvl > 0 then
if GetUnitAbilityLevel(.c,SPELL1) > 0 then
call UnitRemoveAbility(.c,SPELL1)
call UnitAddAbility(.c,SPELL2)
elseif GetUnitAbilityLevel(.c,SPELL2) > 0 then
call UnitRemoveAbility(.c,SPELL2)
call UnitAddAbility(.c,SPELL3)
elseif GetUnitAbilityLevel(.c,SPELL3) > 0 then
call UnitRemoveAbility(.c,SPELL3)
call UnitAddAbility(.c,SPELL4)
elseif GetUnitAbilityLevel(.c,SPELL4) > 0 and lvl > 1 then
call UnitRemoveAbility(.c,SPELL4)
call UnitAddAbility(.c,SPELL5)
elseif GetUnitAbilityLevel(.c,SPELL5) > 0 and lvl > 1 then
call UnitRemoveAbility(.c,SPELL5)
call UnitAddAbility(.c,SPELL6)
elseif GetUnitAbilityLevel(.c,SPELL6) > 0 and lvl > 2 then
call UnitRemoveAbility(.c,SPELL6)
call UnitAddAbility(.c,SPELL7)
elseif GetUnitAbilityLevel(.c,SPELL7) > 0 and lvl > 1 then
call UnitRemoveAbility(.c,SPELL7)
call UnitAddAbility(.c,SPELL8)
else
call UnitRemoveAbility(.c, SPELL4)
call UnitRemoveAbility(.c, SPELL6)
call UnitRemoveAbility(.c, SPELL8)
call UnitAddAbility(.c,SPELL1)
endif
else
call UnitRemoveAbility(.c, SPELL1)
call UnitRemoveAbility(.c, SPELL2)
call UnitRemoveAbility(.c, SPELL3)
call UnitRemoveAbility(.c, SPELL4)
call UnitRemoveAbility(.c, SPELL5)
call UnitRemoveAbility(.c, SPELL6)
call UnitRemoveAbility(.c, SPELL7)
call UnitRemoveAbility(.c, SPELL8)
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endif
set t = null
endmethod
static method Actions takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
set .c = c
call SetTimerData(tim,this)
call TimerStart(tim, TICK, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns boolean
if GetLearnedSkill() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction( t, function Data.Conditions )
set t= null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope InnerStrength initializer init
globals
private constant integer SPELLID = 'InSt'
private constant integer BUFFID = 'BISt'
private constant real tick = 0.3
private HandleTable info
endglobals
private struct Data
unit t
integer hp
integer dmg
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
if GetUnitAbilityLevel(D.t, BUFFID) < 1 then
call AddUnitMaxState(D.t, UNIT_STATE_MAX_LIFE, -D.hp)
call AddUnitBonus(D.t, BONUS_DAMAGE, -D.dmg)
call info.flush(D.t)
set D.t = null
call D.destroy()
call ReleaseTimer(tim)
endif
endmethod
static method create takes unit t, real hp, real dmg returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.t = t
set D.hp = R2I(hp)
set D.dmg = R2I(dmg)
call AddUnitMaxState(D.t, UNIT_STATE_MAX_LIFE, D.hp)
call AddUnitBonus(D.t, BONUS_DAMAGE, D.dmg)
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.Timer)
set info[D.t] = D
return D
endmethod
endstruct
private function Conditions takes nothing returns nothing
local integer lvl= GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
local real hp = (1+0.5*lvl)*SpellStat(GetTriggerUnit(),true)
local real dmg = lvl*SpellStat(GetTriggerUnit(),true)*0.15
if GetSpellAbilityId() == SPELLID then
if not info.exists(GetSpellTargetUnit()) then
call Data.create(GetSpellTargetUnit(), hp, dmg)
endif
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction(t, function Conditions )
set info = HandleTable.create()
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Wall initializer InitTrig_Wall
globals
private constant integer SPELLID = 'Wall'
private constant integer BUFFID = 'B00B'
private constant integer DUMMYID = 'duwa'
private constant string mdl = "Abilities\\Spells\\Orc\\SpiritLink\\SpiritLinkZapTarget.mdl"
private real array Wall
private trigger array EventTrigger
private effect array WallFX
endglobals
private struct Data
unit c
unit t
real dur
real wall
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
if GetUnitAbilityLevel(D.t, BUFFID) < 1 then
call DestroyEffect(WallFX[GetUnitId(D.t)])
call UnitRemoveAbility(D.t, BUFFID)
call ReleaseTimer(tim)
set Wall[GetUnitId(D.t)] = 0
call DestroyTrigger(EventTrigger[GetUnitId(D.t)])
set EventTrigger[GetUnitId(D.t)] = null
set D.c = null
set WallFX[GetUnitId(D.t)] = null
set D.t = null
call D.destroy()
endif
endmethod
static method Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetEventDamageSource(), SPELLID)
local texttag tag = CreateTextTag()
if GetRandomInt(1,3) == 3 then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Defend\\DefendCaster.mdl", GetTriggerUnit(), "head"))
endif
call SetWidgetLife(GetTriggerUnit(), GetWidgetLife(GetTriggerUnit()) + GetEventDamage())
set Wall[GetUnitId(GetTriggerUnit())] = Wall[GetUnitId(GetTriggerUnit())] - GetEventDamage()
call SetTextTagText(tag, I2S(R2I(Wall[GetUnitId(GetTriggerUnit())]))+"HP", 0.024)
call SetTextTagPos(tag, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0.00)
call SetTextTagColor(tag, 0, 0, 255, 255)
call SetTextTagVelocity(tag, 0, 0.03)
call SetTextTagVisibility(tag, true)
call SetTextTagFadepoint(tag, 0.75)
call SetTextTagLifespan(tag, 1.5)
call SetTextTagPermanent(tag, false)
if Wall[GetUnitId(GetTriggerUnit())] < 1 or GetUnitAbilityLevel(GetTriggerUnit(), BUFFID) < 1 then
call UnitRemoveAbility(GetTriggerUnit(), BUFFID)
call DestroyEffect(WallFX[GetUnitId(GetTriggerUnit())])
call DestroyTrigger(EventTrigger[GetUnitId(GetTriggerUnit())])
set EventTrigger[GetUnitId(GetTriggerUnit())] = null
set WallFX[GetUnitId(GetTriggerUnit())] = null
call DestroyTextTag(tag)
set tag = null
endif
return false
endmethod
static method create takes unit caster, unit target, integer lvl returns Data
local xecast xc = xecast.createA()
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.c = caster
set D.t = target
set D.dur = 0
set D.wall = 50+(50*lvl)*(0.7+0.05*lvl*lvl)+SpellStat(D.c, true)*(lvl*0.35+0.75)
set xc.abilityid = DUMMYID
set xc.level = GetUnitAbilityLevel(caster, SPELLID)
set xc.orderstring = "bloodlust"
set xc.owningplayer = GetOwningPlayer(caster)
call xc.castOnTarget( target )
if EventTrigger[GetUnitId(D.t)] == null then
set EventTrigger[GetUnitId(D.t)] = CreateTrigger()
call TriggerRegisterUnitEvent(EventTrigger[GetUnitId(D.t)], D.t, EVENT_UNIT_DAMAGED)
call TriggerAddCondition(EventTrigger[GetUnitId(D.t)], function Data.Conditions)
endif
if WallFX[GetUnitId(D.t)] == null then
set WallFX[GetUnitId(D.t)] = AddSpecialEffectTarget(mdl, D.t, "chest")
endif
set Wall[GetUnitId(D.t)] = D.wall
call SetTimerData(tim,D)
call TimerStart(tim, 0.5*lvl, false, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit(), GetUnitAbilityLevel(GetTriggerUnit(), SPELLID))
endif
return false
endfunction
//===========================================================================
public function InitTrig_Wall takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=21
//TESH.alwaysfold=0
scope DivineLight initializer InitTrig_Divine_Light
globals
private constant integer SPELLID = 'DLig'
endglobals
private struct Data
timer tim
unit t
unit c
real h
real dur
integer lvl
static method onLoop takes nothing returns nothing
local Data D = Data(GetTimerData(GetExpiredTimer()))
set D.tim = GetExpiredTimer()
if D.dur <= 5 then
if IsUnitAlly(D.t, GetOwningPlayer(D.c)) then
call SetWidgetLife(D.t, GetWidgetLife(D.t) + D.h)
else
call UnitDamageTarget(D.c, D.t, D.h, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, wtype)
endif
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\VampiricAura\\VampiricAuraTarget.mdl", D.t, "origin"))
set D.dur = D.dur + 1
call SetTimerData(D.tim, D)
else
set D.t = null
set D.c = null
call ReleaseTimer(D.tim)
call D.destroy()
endif
endmethod
static method create takes unit caster, unit target returns Data
local Data D = Data.allocate()
set D.tim = NewTimer()
set D.c = caster
set D.t = target
set D.lvl = GetUnitAbilityLevel(D.c, SPELLID)
set D.dur = 0
set D.h = SpellStat(D.c, true)*(D.lvl*0.4)
call SetTimerData(D.tim, D)
call TimerStart(D.tim, 1, true, function Data.onLoop)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'DLig' then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Divine_Light takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope UltLife initializer InitTrig_LifeUlt
globals
private constant integer SPELLID = 'HCli'
endglobals
private function Ally takes unit t, boolean reset returns nothing
call SetWidgetLife(t, GetUnitState(t, UNIT_STATE_MAX_LIFE))
call SetUnitState(t, UNIT_STATE_MANA, GetUnitState(t, UNIT_STATE_MAX_MANA))
call UnitRemoveBuffs(t, false, true)
if reset then
call UnitResetCooldown(t)
endif
endfunction
private function Enemy takes unit c, unit t, real dmg returns nothing
local integer lvl = GetUnitAbilityLevel(c,SPELLID)
if dmg < 0 then
set dmg = 250*lvl*lvl
else
set dmg = dmg*(1+1*lvl)*lvl + 250*lvl+125*lvl
endif
if GetRandomReal(1,100) < 2.5*lvl then
call UnitDamageTarget(c,t,99999, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, wtype)
else
call UnitDamageTarget(c,t,dmg, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, wtype)
endif
endfunction
private function Actions takes unit c, unit t returns nothing
local integer id = GetPlayerId(GetOwningPlayer(t))
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local unit un = GetPlayerHero(id+1)
local real hp = GetUnitState(un, UNIT_STATE_MAX_LIFE)
local real mp = GetUnitState(un, UNIT_STATE_MAX_MANA)
local real dmg = (SpellStat(c,true) - SpellStat(t,true))
local group g = NewGroup()
if GetUnitTypeId(t) == 'grav' then
call RaiseHero(t,0.335*lvl*hp,(-0.5+0.5*lvl)*mp)
elseif IsUnitEnemy(t, GetOwningPlayer(c)) and IsUnitType(t, UNIT_TYPE_UNDEAD) then
call Enemy(c,t,dmg)
else
call Ally(t, lvl > 2)
endif
call ReleaseGroup(g)
set un = null
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
public function InitTrig_LifeUlt takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=10
//TESH.alwaysfold=0
scope RaiseHero initializer InitTrig_Raise_Hero_PT1
globals
private constant integer SPELLID = 'RaHe'
private constant integer DUMMYSPELL = 'dRaH'
endglobals
private function Ally takes unit t, integer lvl returns nothing
call SetWidgetLife(t, GetWidgetLife(t)*2)
call SetUnitState(t, UNIT_STATE_MANA, GetUnitState(t, UNIT_STATE_MANA)*2)
call UnitAddAbility(t, 'WRem')
call SetUnitAbilityLevel(t, 'WRem', lvl)
endfunction
private function Actions takes unit c, unit t returns nothing
local integer id = GetPlayerId(GetOwningPlayer(t))+1
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local unit un = GetPlayerHero(id)
local real hp = GetUnitState(un, UNIT_STATE_MAX_LIFE)
local real mp = GetUnitState(un, UNIT_STATE_MAX_MANA)
local real dmg = (SpellStat(c,true) - SpellStat(t,true))
local xecast xc
if GetUnitTypeId(t) == 'grav' then
call RaiseHero(t,1,1)
set xc = xecast.createBasicA(DUMMYSPELL, 852274, GetOwningPlayer(t))
set xc.level = lvl
call xc.castOnTarget(GetPlayerHero(id))
else
call Ally(t, lvl)
endif
set un = null
endfunction
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), GetSpellTargetUnit())
endif
endfunction
//===========================================================================
public function InitTrig_Raise_Hero_PT1 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=34
//TESH.alwaysfold=0
scope RaiseHeroGhost initializer onInit
globals
private constant integer REALID = 'dRaH'
private constant real TICK = 0.2
endglobals
private struct Data
unit c
unit h
real dur
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local real x = GetUnitX(.c)
local real y = GetUnitY(.c)
set .dur = .dur + TICK
if .c == null then
call ShowUnit(.h, true)
call PauseUnit(.h, false)
call SetUnitPosition(.h, x, y)
call KillUnit(.h)
call ReleaseTimer(GetExpiredTimer())
call .destroy()
elseif .dur >= 6 then
call SetWidgetLife(.h, GetWidgetLife(.c))
call KillUnit(.c)
call ShowUnit(.h, true)
call PauseUnit(.h, false)
call SetUnitPosition(.h, x, y)
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endif
endmethod
static method create takes unit c returns thistype
local thistype this = thistype.allocate()
local timer tim = NewTimer()
set .c = c
set .h = udg_HERO_Ref2[GetPlayerId(GetOwningPlayer(c))+1]
set .dur = 0
call UnitAddType(.c, UNIT_TYPE_UNDEAD)
call SetTimerData(tim,this)
call TimerStart(tim, TICK, true, function thistype.Timer)
return this
endmethod
endstruct
private function Actions takes nothing returns nothing
local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))+1
if IsUnitIllusion(GetTriggerUnit()) and GetUnitAbilityLevel(GetSummoningUnit(), REALID) > 0 then
call SetUnitVertexColor(GetTriggerUnit(), 40,15,30,110)
call ShowUnit(udg_HERO_Ref2[id], false)
call PauseUnit(udg_HERO_Ref2[id], true)
call SetWidgetLife(GetTriggerUnit(), GetUnitState(GetTriggerUnit(), UNIT_STATE_MAX_LIFE)*.5)
call Data.create(GetTriggerUnit())
endif
endfunction
//===========================================================================
public function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddAction( t, function Actions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_RaiseHero_PT3_Actions takes nothing returns nothing
if GetUnitAbilityLevel( GetTriggerUnit(), 'WRem' ) > 0 then
call UnitRemoveAbility( GetTriggerUnit(), 'WRem' )
endif
endfunction
//===========================================================================
function InitTrig_RaiseHero_PT3 takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( t, function Trig_RaiseHero_PT3_Actions )
set t = null
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=0
scope CallHP initializer InitTrig_Call_Holy_Phoenix
globals
private hashtable Holy
private unit TempUnit
private constant integer SPELLID = 'suhp'
endglobals
private function GroupCheck takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TempUnit, SPELLID)
local real dam = 55*lvl + SpellStat(TempUnit, true)/3*lvl
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempUnit)) and GetWidgetLife(GetFilterUnit()) > 0.405 and bj_groupCountUnits < 5 then
call UnitDamageTarget(TempUnit, GetFilterUnit(), dam, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, wtype)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\LordofFlameMissile\\LordofFlameMissile.mdl", GetFilterUnit(), "origin"))
set bj_groupCountUnits = bj_groupCountUnits + 1
return true
endif
return false
endfunction
private function Actions takes unit c, unit temp returns nothing
local real HP = (GetUnitBounty(c) * 15) / 3
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer phoenixdam = GetUnitBonus(c, BONUS_DAMAGE)
local integer i
local group g = NewGroup()
set TempUnit = c
set temp = LoadUnitHandle(Holy, 0, GetHandleId(c))
if temp == null then
set temp = CreateUnit(GetOwningPlayer(c), 'hoph', GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
call AddUnitMaxState(temp, UNIT_STATE_MAX_LIFE, HP)
call SetUnitBonus(temp, BONUS_DAMAGE, phoenixdam)
set UnitBounty[GetUnitId(temp)] = R2I(SpellStat(c, true) + GetWidgetLife(temp)*0.01)
call UnitAddType(temp, UNIT_TYPE_SUMMONED)
call SaveUnitHandle(Holy, 0, GetHandleId(c), temp)
else
call SetUnitPosition(temp, GetUnitX(c), GetUnitY(c))
endif
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", temp, "origin"))
set bj_groupCountUnits = 0
call GroupEnumUnitsInRangeCounted(g, GetUnitX(temp), GetUnitY(temp), 500, Filter(function GroupCheck), 5)
call ReleaseGroup(g)
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), null)
endif
return false
endfunction
//===========================================================================
public function InitTrig_Call_Holy_Phoenix takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
set Holy = InitHashtable()
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=4
//TESH.alwaysfold=0
scope HPDies initializer InitTrig_Holy_Phoenix_Dies
globals
private unit TempUnit
endglobals
private function GroupCheck takes nothing returns boolean
local real heal = 8*UnitBounty[GetUnitId(TempUnit)]
if IsUnitAlly(GetFilterUnit(), GetOwningPlayer(TempUnit)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD))and bj_groupCountUnits < 5 then
call SetWidgetLife(GetFilterUnit(), GetWidgetLife(GetFilterUnit()) + heal)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\HealingSpray\\HealBottleMissile.mdl", GetFilterUnit(), "origin"))
set bj_groupCountUnits = bj_groupCountUnits + 1
return true
endif
return false
endfunction
private function Actions takes unit c returns nothing
local integer i
local group g = NewGroup()
set bj_groupCountUnits = 0
set TempUnit = c
call GroupEnumUnitsInArea(g, GetUnitX(c), GetUnitY(c), 500, Filter(function GroupCheck))
call ReleaseGroup(g)
endfunction
private function Conditions takes nothing returns boolean
if GetUnitTypeId(GetDyingUnit()) == 'hoph' then
call Actions(GetDyingUnit())
endif
return false
endfunction
//===========================================================================
private function InitTrig_Holy_Phoenix_Dies takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope BlastingZone initializer init
globals
private constant integer SPELLID1 = 'BlZo'
private constant integer SPELLID2 = 'EaBr'
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
unit c
string path
integer i
integer spellid
method loopControl takes nothing returns nothing
local xedamage d= xedamage.create()
local integer lvl = GetUnitAbilityLevel(.caster, .spellid)
if i > 0 then
set d.dtype = DAMAGE_TYPE_MAGIC
set d.atype = ATTACK_TYPE_MELEE
set d.exception = UNIT_TYPE_FLYING
call d.factor( UNIT_TYPE_STRUCTURE, 0.35)
call .flash(.path)
call d.damageAOE(.caster,.x,.y,200,SpellStat(.caster,true)*(0.2*lvl)+5)
set i = 0
else
set i = 1
endif
call d.destroy()
endmethod
static method Actions takes unit c, integer id returns nothing
local integer lvl = GetUnitAbilityLevel(c, id)
local real angle = Atan2( GetSpellTargetY() - GetUnitY(c) , GetSpellTargetX() - GetUnitX(c) )
local Data xc
set xc = Data.create( GetUnitX(c), GetUnitY(c), angle )
set xc.caster = c
set xc.spellid = id
set xc.path = GetAbilityEffectById(id, EFFECT_TYPE_AREA_EFFECT, 0)
set xc.speed = 600+25*lvl
set xc.expirationTime = 0.4+0.2*lvl
set xc.collisionSize = 0
set xc.i = 0
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID2 or GetSpellAbilityId() == SPELLID1 then
call Data.Actions(GetTriggerUnit(), GetSpellAbilityId())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope InspiringShout initializer init
globals
private constant integer SPELLID = 'InsS'
private constant integer BUFFID = 'BInS'
private constant real tick = 0.3
private unit TEMP
endglobals
private struct Data
unit c
real dur
integer hp
integer dmg
integer arm
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
if D.dur > 30 or not(GetUnitAbilityLevel(D.c, BUFFID) > 0) then
call AddUnitMaxState(D.c, UNIT_STATE_MAX_LIFE, -D.hp)
call AddUnitBonus(D.c, BONUS_DAMAGE, -D.dmg)
call AddUnitBonus(D.c, BONUS_ARMOR, -D.arm)
set D.c = null
call D.destroy()
call ReleaseTimer(tim)
else
set D.dur = D.dur + tick
call SetTimerData(tim,D)
endif
endmethod
static method create takes unit c, real hp, real dmg, real arm returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.c = c
set D.hp = R2I(hp)
set D.dmg = R2I(dmg)
set D.arm = R2I(arm)
set D.dur = 0
call AddUnitMaxState(D.c, UNIT_STATE_MAX_LIFE, D.hp)
call AddUnitBonus(D.c, BONUS_DAMAGE, D.dmg)
call AddUnitBonus(D.c, BONUS_ARMOR, D.arm)
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.Timer)
return D
endmethod
endstruct
private function GroupEm takes nothing returns boolean
local real lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local real hp = GetUnitState(TEMP, UNIT_STATE_MAX_LIFE)*(0.125+0.025*lvl)
local real dmg = GetUnitBonus(TEMP, BONUS_DAMAGE)*(0.15+0.03*lvl)+8
local real arm = GetUnitBonus(TEMP, BONUS_ARMOR)*(0.2+0.05*lvl)+2
if IsUnitAlly(GetFilterUnit(), GetOwningPlayer(TEMP)) and IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) then
call Data.create(GetFilterUnit(), hp, dmg, arm)
endif
return false
endfunction
private function Trig_InspiringShout_Conditions takes nothing returns boolean
local group g = NewGroup()
if GetSpellAbilityId() == SPELLID then
set TEMP = GetTriggerUnit()
call GroupEnumUnitsInArea(g, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 650, Filter(function GroupEm))
endif
call ReleaseGroup(g)
return false
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, function Trig_InspiringShout_Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=4
//TESH.alwaysfold=0
scope SwordMastery initializer InitTrig_SwordMastery
globals
private constant integer SPELLID = 'SwMa'
endglobals
private struct Data
unit c
integer lvl
static method onLoop takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data B = Data(GetTimerData(tim))
call AddUnitBonus(B.c, BONUS_DAMAGE, -(2+R2I(0.5*B.lvl)))
call ReleaseTimer(tim)
set B.c = null
call B.destroy()
endmethod
static method create takes unit caster, integer level returns Data
local Data B = Data.allocate()
local real tick = 3+2*level
local integer dmg = 2+R2I(0.5*level)
local timer tim = NewTimer()
set B.c = caster
set B.lvl = level
call AddUnitBonus(B.c, BONUS_DAMAGE, dmg)
call SetTimerData(tim, B)
call TimerStart(tim, tick, false, function Data.onLoop)
return B
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetUnitAbilityLevel(GetAttacker(), SPELLID) > 0 then
call Data.create(GetAttacker(), GetUnitAbilityLevel(GetAttacker(), SPELLID))
endif
return false
endfunction
//===========================================================================
public function InitTrig_SwordMastery takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope FierceSlash initializer InitTrig_Fierce_Slash
globals
private constant integer SPELLID = 'FieS'
private constant attacktype atype = ATTACK_TYPE_NORMAL
private constant damagetype dtype = DAMAGE_TYPE_NORMAL
private constant string FX = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
private unit TEMP
endglobals
private function Group takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local real dam = 55 + GetUnitBonus(TEMP, BONUS_DAMAGE)*(0.55+0.05*lvl) + SpellStat(TEMP, false) * (0.5 + lvl*0.2)
local real a = 57.29582 * Atan2(GetUnitY(GetFilterUnit()) - GetUnitY(TEMP), GetUnitX(GetFilterUnit()) - GetUnitX(TEMP))
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) or IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) then
call KnockbackTarget(TEMP, GetFilterUnit(), a, 150., 150., false, false, false, FX)
call UnitDamageTarget(TEMP, GetFilterUnit(), dam, true, false, atype, dtype, wtype)
endif
return false
endfunction
private function Conditions takes nothing returns boolean
local location loc = GetUnitLoc(GetTriggerUnit())
local real a = GetUnitFacing(GetTriggerUnit())
if GetSpellAbilityId() == SPELLID then
set TEMP = GetTriggerUnit()
call GroupEnumUnitsInCone(ENUM_GROUP, loc, 400., a, 115, 115, Filter(function Group))
endif
call RemoveLocation(loc)
set loc = null
return false
endfunction
//===========================================================================
public function InitTrig_Fierce_Slash takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=27
//TESH.alwaysfold=0
scope AncientHammer initializer init
globals
private constant integer SPELLID = 'AHam'
private constant damagetype dmg = DAMAGE_TYPE_NORMAL
private constant attacktype atk = ATTACK_TYPE_MAGIC
private unit TEMP
private real X
private real Y
endglobals
private struct Data
unit c
real x
real y
real dur
static method GroupEm takes nothing returns boolean
local xecast xc = xecast.createA()
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local real dam = lvl*35+25 + SpellStat(TEMP,true)*(0.25+0.25*lvl)
local unit t = GetFilterUnit()
local unit c = TEMP
call UnitDamageTarget(c, t, dam, true, false, atk, dmg, wtype)
set xc.abilityid = 'A01G'
set xc.orderstring = "firebolt"
set xc.owningplayer = GetOwningPlayer(c)
if IsUnitEnemy(t, GetOwningPlayer(TEMP)) and not(IsUnitType(t, UNIT_TYPE_DEAD)) then
call xc.castOnTarget( t )
endif
return false
endmethod
static method start takes unit c, real x, real y returns nothing
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_AREA_EFFECT,0),x,y))
set TEMP = c
call GroupEnumUnitsInArea(ENUM_GROUP, x, y, 450, Filter(function Data.GroupEm))
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call BJDebugMsg(R2S(GetUnitX(GetSpellTargetUnit())))
call BJDebugMsg(R2S(GetUnitY(GetSpellTargetUnit())))
call Data.start(GetTriggerUnit(), GetUnitX(GetSpellTargetUnit()), GetUnitY(GetSpellTargetUnit()))// GetSpellTargetX(), GetSpellTargetY())
endif
return false
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=21
//TESH.alwaysfold=0
scope Warthreat initializer InitTrig_Warthreat
globals
private constant integer SPELLID = 'WarT'
private unit TempUnit = null
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELLID
endfunction
private function GroupCheck takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempUnit)) and GetWidgetLife(GetFilterUnit()) > 0.405
endfunction
private function Actions takes nothing returns nothing
local unit s
local unit c = GetTriggerUnit()
local group g = NewGroup()
local integer i = 0
local integer i2 = 2+2*GetUnitAbilityLevel(c, SPELLID)
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local real r = 400. + 100. * GetUnitAbilityLevel(c, SPELLID)
local real a
local real dam = (50. * GetUnitAbilityLevel(c,SPELLID)) + (GetHeroStr(c, true) * 0.75)
set TempUnit = c
call GroupEnumUnitsInRange(g, x, y, r, function GroupCheck)
loop
set s = FirstOfGroup(g)
exitwhen s == null or i >= i2
set a = 57.29582 * Atan2(GetUnitY(s) - y, GetUnitX(s) - x)
call UnitDamageTarget(c, s, dam, false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, wtype)
call KnockbackTarget(c, s, a, 300., 800., false, true, false, "MDX\\KnockbackDust.mdx")
call IssueTargetOrder(s, "attack", c)
call GroupRemoveUnit(g, s)
set i = i + 1
endloop
call ReleaseGroup(g)
set g = null
set s = null
set c = null
endfunction
//===========================================================================
public function InitTrig_Warthreat takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function HammerSlam_Actions takes unit c, unit t returns nothing
local real a = 57.29582 * Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c))
local real lvl = GetUnitAbilityLevel(c, GetSpellAbilityId())
call KnockbackTarget(c, t, a, 200., 150, false, true, true, "MDX\\KnockbackDust.mdx")
call UnitDamageTarget(c, t, SpellStat(c, true) * lvl + GetUnitBonus(c, BONUS_DAMAGE), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, wtype)
endfunction
function HammerSlam_Conditions takes nothing returns boolean
if GetUnitAbilityLevel(GetAttacker(), 'crub') > 0 and GetRandomInt(1,100) <= 15 then
call HammerSlam_Actions(GetAttacker(), GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
function InitTrig_Hammer_Slam takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(t, function HammerSlam_Conditions)
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SummonTrainedWolf initializer init
globals
private constant integer SPELLID = 'SuWo'
private constant integer SUMMONID1 = 'dhSW'
private constant integer SUMMONID2 = 'ihSW'
private constant integer SUMMONID3 = 'jhSW'
private constant integer SPELLID1 = 'AOcr'
private constant integer SPELLID2 = 'Apiv'
private constant integer ULTID = 'howl'
endglobals
private function Actions takes unit s, unit c returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer DamageBonus = R2I(SpellStat(c, false)*(0.4+0.2*lvl))
local integer ArmorBonus = R2I(GetUnitBonus(c, BONUS_ARMOR)/(4.0-0.3*lvl))
local real HPBonus = 100+105*lvl+GetUnitState(c, UNIT_STATE_MAX_MANA)/7
local real MPBonus = 8*lvl+GetUnitState(c, UNIT_STATE_MAX_LIFE)/8
call AddUnitMaxState(s, UNIT_STATE_MAX_LIFE, HPBonus)
call AddUnitMaxState(s, UNIT_STATE_MAX_MANA, MPBonus)
call AddUnitBonus(s, BONUS_DAMAGE, DamageBonus)
call AddUnitBonus(s, BONUS_ARMOR, ArmorBonus)
set UnitBounty[GetUnitId(s)] = SpellStat(c, true)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, lvl-1),GetUnitX(Slave[GetUnitId(c)]), GetUnitY(Slave[GetUnitId(c)])))
call RemoveUnit(Slave[GetUnitId(c)])
call Permanence_Data.create( c, s )
call UnitRemoveAbility(c, 'revi')
if GetHeroStr(c,true) > 30 then
set SpellID1[GetUnitId(c)] = SPELLID1
call UnitAddAbility(s, SPELLID1)
call SetUnitAbilityLevel(s, SPELLID1, lvl-1 )
else
set SpellID1[GetUnitId(c)] = 0
endif
if GetHeroAgi(c,true) > 40 then
set SpellID2[GetUnitId(c)] = SPELLID2
call UnitAddAbility(s, SPELLID2)
call SetUnitAbilityLevel(s, SPELLID2, lvl )
else
set SpellID2[GetUnitId(c)] = 0
endif
if SpellStat(c,true) > 60 then
set SpellID3[GetUnitId(c)] = ULTID
call UnitAddAbility(s, ULTID)
call SetUnitAbilityLevel(s, ULTID, lvl-1 )
else
set SpellID3[GetUnitId(c)] = 0
endif
endfunction
private function Conditions takes nothing returns nothing
if(GetUnitTypeId(GetSummonedUnit()) == SUMMONID1 or GetUnitTypeId(GetSummonedUnit()) == SUMMONID2 or GetUnitTypeId(GetSummonedUnit()) == SUMMONID3)and not IsUnitIllusion(GetSummonedUnit()) then
call Actions(GetSummonedUnit(), GetSummoningUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddAction( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CloyingPowder initializer init
globals
private constant integer SPELLID = 'ClPo'
private constant integer DUMMYID = 'duCP'
endglobals
private struct Data extends xecast
static method Conditions takes nothing returns boolean
local xecast xe = xecast.createBasicA(DUMMYID, OrderId("slow"), GetOwningPlayer(GetTriggerUnit()))
if GetSpellAbilityId() == SPELLID then
set xe.level = GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
call xe.castOnAOE(GetSpellTargetX(), GetSpellTargetY(), 200)
else
call xe.destroy()
endif
return true
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=29
//TESH.alwaysfold=0
scope SpreadShot initializer init
globals
private constant integer SPELLID = 'SpSh'
private constant integer BSPELLID = 'duCP'
private constant integer BUFFID = 'ClPo'
private constant attacktype atype = ATTACK_TYPE_PIERCE
private constant damagetype dtype = DAMAGE_TYPE_NORMAL
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
unit target
method onUnitHit takes unit target returns nothing
local integer lvl = GetUnitAbilityLevel(this.caster, SPELLID)
local real dam = 35 + SpellStat(TEMP, false) * (0.6 + lvl*0.15) + GetUnitBonus(TEMP, BONUS_DAMAGE)*0.5
if target == .target then
if GetUnitAbilityLevel(.caster, BUFFID) > 0 then
set dam = dam*(1.15+0.05*GetUnitAbilityLevel(.caster,BSPELLID))
endif
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_AREA_EFFECT,0), target, "origin"))
call UnitDamageTarget(this.caster, target, dam, true, false, atype, dtype, wtype)
call .terminate()
endif
endmethod
static method GroupEm takes nothing returns boolean
local unit un = GetFilterUnit()
local real ang = Atan2(GetUnitY(un) - GetUnitY(TEMP), GetUnitX(un) - GetUnitX(TEMP))
local Data xc
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) then
set xc = Data.create(GetUnitX(TEMP), GetUnitY(TEMP), ang)
set xc.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set xc.speed = 900
set xc.expirationTime = 1.5
set xc.z = 60.0
set xc.collisionSize = 15.0
set xc.caster = TEMP
set xc.target = un
else
call xc.terminate()
endif
set un = null
return false
endmethod
static method Conditions takes nothing returns boolean
local location loc = GetUnitLoc(GetTriggerUnit())
local real a = Atan2(GetSpellTargetY() - GetUnitY(GetTriggerUnit()), GetSpellTargetX() - GetUnitX(GetTriggerUnit()))*bj_RADTODEG
local group g = NewGroup()
if GetSpellAbilityId() == SPELLID then
set TEMP = GetTriggerUnit()
call GroupEnumUnitsInCone(g, loc, 600., a, 125, 125, Filter(function Data.GroupEm))
endif
call RemoveLocation(loc)
set loc = null
call ReleaseGroup(g)
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ExplodingBullet initializer Init
globals
private constant integer SPELLID = 'ExBu'
private constant integer BUFFID = 'BClP'
private constant attacktype atk = ATTACK_TYPE_PIERCE
private constant damagetype dmg = DAMAGE_TYPE_NORMAL
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
real xend
real yend
static method GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local real dam = lvl*50 + (SpellStat(TEMP,true)*(0.8+0.2*lvl))
local integer lvl2 = GetUnitAbilityLevel(TEMP, 'ClPo')
if lvl2 > 0 then
set dam = dam*(1+0.075*lvl2)
endif
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) != true then
if IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
set dam = dam*0.4
endif
if GetUnitAbilityLevel(GetFilterUnit(), BUFFID) > 0 then
set dam = dam*1.15+(0.05*lvl2)
endif
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl", GetUnitX(GetFilterUnit()), GetUnitY(GetFilterUnit())))
call UnitDamageTarget(TEMP, GetFilterUnit(), dam, true, false, atk, dmg, wtype)
endif
return false
endmethod
method onDestroy takes nothing returns nothing
local group g = NewGroup()
local integer lvl = GetUnitAbilityLevel(this.caster, SPELLID)
set TEMP = this.caster
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_TARGET, 0), this.x, this.y))
call GroupEnumUnitsInArea(g, this.x, this.y, 200+25*lvl, Filter(function Data.GroupEm))
call ReleaseGroup(g)
endmethod
method loopControl takes nothing returns nothing
local real dx = this.xend - this.x
local real dy = this.yend - this.y
local real dist = SquareRoot(dx * dx + dy * dy)
if dist <= 25 then
call this.terminate()
endif
endmethod
method onUnitHit takes unit target returns nothing
local integer lvl = GetUnitAbilityLevel(this.caster, SPELLID)
local real dam = -55+lvl*125 + (SpellStat(this.caster,true)*(0.8+0.2*lvl))
if IsUnitEnemy(this.caster, GetOwningPlayer(target)) and not(IsUnitType(target, UNIT_TYPE_STRUCTURE)) then
call UnitDamageTarget(this.caster, target, dam, true, false, atk, dmg, wtype)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_TARGET, 1), target, "origin"))
endif
endmethod
endstruct
private function Actions takes unit c returns nothing
local real ang = Atan2(GetSpellTargetY() - GetUnitY(c), GetSpellTargetX() - GetUnitX(c))
local Data xc
set xc = Data.create(GetUnitX(c), GetUnitY(c), ang)
set xc.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set xc.speed = 900.0
set xc.expirationTime = 3
set xc.z = 60.0
set xc.xend = GetSpellTargetX()
set xc.yend = GetSpellTargetY()
set xc.caster = c
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, function Conditions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope ExplosiveShells initializer InitTrig_Explosive_Shells
globals
private constant integer SPELLID = 'ExSh'
private constant integer BUFFID = 'BClP'
endglobals
private function Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetAttacker(), SPELLID)
local real i = GetRandomInt(0,100)
local real dam = i*lvl + SpellStat(GetAttacker(),true)*(0.4+0.2*lvl)
local xedamage xc = xedamage.create()
local integer lvl2 = GetUnitAbilityLevel(GetAttacker(), 'ClPo')
if GetUnitAbilityLevel(GetTriggerUnit(),BUFFID) > 0 then
set dam = dam*(1.1+0.06*lvl2)
endif
if lvl > 0 and i < 12+3*lvl then
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_TARGET,1), GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit())))
set xc.dtype = DAMAGE_TYPE_DEMOLITION
set xc.atype = ATTACK_TYPE_PIERCE
call xc.factor(UNIT_TYPE_STRUCTURE, 0.4)
call xc.useSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_TARGET,0),"origin")
call xc.damageAOE(GetAttacker(), GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 300, dam)
endif
call xc.destroy()
return false
endfunction
//===========================================================================
public function InitTrig_Explosive_Shells takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=46
//TESH.alwaysfold=0
scope SmokeBomb initializer InitTrig_Smoke_Bomb
globals
private constant integer SPELLID = 'SmBo'
private constant integer DUMMYID = 'A010'
private constant integer SYNERGYID = 'A00Z'
private constant integer CRIT = 'CrBk'
private unit TEMP
endglobals
private struct Data
unit c
unit d
real x
real y
static method GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local real dam = SpellStat(TEMP,true)*(0.4+0.2*lvl)+10*lvl
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) != true then
if IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
set dam = dam*0.4
endif
call IssueImmediateOrder(GetFilterUnit(), "stop")
call UnitDamageTarget(TEMP, GetFilterUnit(), dam, true, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_MAGIC, wtype)
endif
return false
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call RemoveUnit(D.d)
call D.destroy()
call ReleaseTimer(tim)
endmethod
static method create takes unit c, real x, real y returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
local group g = NewGroup()
local real lvl = GetUnitAbilityLevel(c, SPELLID)
set D.c = c
set TEMP = c
set D.x = x
set D.y = y
set D.d = CreateUnit(GetOwningPlayer(D.c), XE_DUMMY_UNITID, D.x, D.y, 0)
if GetUnitAbilityLevel(D.c, CRIT) > 0 then
call UnitAddAbility(D.d, SYNERGYID)
else
call UnitAddAbility(D.d, DUMMYID)
endif
call IssuePointOrder(D.d, "cloudoffog", D.x, D.y)
call GroupEnumUnitsInArea(g, D.x, D.y, 300, Filter(function Data.GroupEm))
call SetTimerData(tim, D)
call TimerStart(tim, 1+2*lvl, false, function Data.Timer)
call ReleaseGroup(g)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Smoke_Bomb takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
set t = null
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Backstab_Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetAttacker(), 'BacS')
local integer i = GetRandomInt(1,100)
if lvl > 0 and BackstabAngleDifference(GetUnitFacing(GetAttacker()), GetUnitFacing(GetTriggerUnit())) <= 60 then
if not IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) and IsUnitEnemy(GetAttacker(), GetOwningPlayer(GetTriggerUnit())) then
call UnitDamageTarget(GetAttacker(), GetTriggerUnit(), -10+15*lvl+SpellStat(GetAttacker(), true)*(0.4+0.1*lvl), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, wtype)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById('BacS',EFFECT_TYPE_TARGET,0),GetTriggerUnit(),"head"))
if i < 70-10*lvl then
call IssueTargetOrder(GetTriggerUnit(), "smart", GetAttacker())
endif
endif
endif
return true
endfunction
//===========================================================================
function InitTrig_Backstab takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, function Trig_Backstab_Conditions )
endfunction
//TESH.scrollpos=52
//TESH.alwaysfold=0
scope SAS initializer InitTrig_SwiftAsShadows
globals
private constant integer SPELLID = 'asas'
private constant integer EVASION = 'insh'
private constant integer PINVIS = 'insh'
private constant integer BOOK = 'CrBk'
private constant string TurnOn = "defend"
private constant string TurnOff = "undefend"
private constant real Tick = 0.1
private HandleTable info
endglobals
private struct Data
unit c
integer lvl
boolean deactivate = false
timer tim
real mspd
real d
real i
integer co
static method onLoop takes nothing returns nothing
local Data D = Data(GetTimerData(GetExpiredTimer()))
if D.d == Tick then
call AddUnitAnimationProperties(D.c, "defend", false)
endif
if not(IsUnitType(D.c,UNIT_TYPE_DEAD)) and not(D.deactivate) and GetUnitState(D.c, UNIT_STATE_MANA) >= 10 then
//Start timer
if D.lvl < GetUnitAbilityLevel(D.c, SPELLID) then
set D.lvl = GetUnitAbilityLevel(D.c, SPELLID)
endif
if D.d == 1 + D.i and D.i <= 3+3*GetUnitAbilityLevel(D.c, SPELLID) then
set D.i = D.i + 1
set D.co = D.co - 21
call SetUnitAbilityLevel(D.c, EVASION, GetUnitAbilityLevel(D.c, EVASION) + 1)
call SetUnitVertexColor(D.c, D.co, D.co, D.co, D.co)
call SetUnitMoveSpeed(D.c, D.mspd + 20*D.i)
call SetUnitState(D.c, UNIT_STATE_MANA, GetUnitState(D.c, UNIT_STATE_MANA) - D.i*2)
elseif D.i > 3+3*GetUnitAbilityLevel(D.c, SPELLID) then
call UnitAddAbility(D.c, 'Apiv')
call SetUnitState(D.c, UNIT_STATE_MANA, GetUnitState(D.c, UNIT_STATE_MANA) - D.i*0.2)
endif
set D.d = D.d + 0.1
else
//Cleanup
call UnitRemoveAbility(D.c, BOOK)
call UnitRemoveAbility(D.c, 'Apiv')
call SetUnitMoveSpeed(D.c, D.mspd)
call SetUnitVertexColor(D.c, 255,255,255,255)
call IssueImmediateOrder(D.c, TurnOff)
call IssueSecondLastOrder(D.c)
call info.flush(D.c)
set D.c = null
call ReleaseTimer(D.tim)
set D.tim = null
call D.destroy()
endif
endmethod
static method create takes unit caster, real movespeed returns Data
local Data D = Data.allocate()
set D.c = caster
set D.co = 255
set D.d = 0
set D.i = 0
set D.lvl = GetUnitAbilityLevel(D.c, SPELLID)
set D.mspd = movespeed
call SetUnitMoveSpeed(D.c, D.mspd + 10)
call UnitAddAbility(D.c, BOOK)
call UnitRemoveAbility(D.c, 'Cr12')
//Timer
set D.tim = NewTimer()
call SetTimerData(D.tim,D)
call TimerStart(D.tim, Tick, true, function Data.onLoop)
set info[D.c] = D
return D
endmethod
endstruct
private function Deactivate takes nothing returns boolean
local Data D
if GetIssuedOrderId() == OrderId(TurnOff) and info.exists(GetTriggerUnit()) then
set D = info[GetTriggerUnit()]
set D.deactivate = true
endif
return false
endfunction
private function Activation takes nothing returns boolean
if GetIssuedOrderId() == OrderId(TurnOn) and GetUnitAbilityLevel(GetTriggerUnit(), SPELLID) > 0 then
call Data.create(GetTriggerUnit(), GetUnitMoveSpeed(GetTriggerUnit()))
endif
return false
endfunction
//===========================================================================
private function InitTrig_SwiftAsShadows takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition(t, function Activation )
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( t, function Deactivate )
set info = HandleTable.create()
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=54
//TESH.alwaysfold=0
scope AssassinInTheNight initializer init
globals
private constant integer SPELLID = 'aitn'
private constant real tick = 0.7
private constant damagetype dmg = DAMAGE_TYPE_NORMAL
private constant weapontype wpn = WEAPON_TYPE_WHOKNOWS
private constant attacktype atk = ATTACK_TYPE_MAGIC
private unit cast
endglobals
private struct Data
unit c
real x
real y
real d = 0
static method GroupConditions takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(cast)) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)
endmethod
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local unit t
local group g = NewGroup()
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
set cast = .c
if .d > 2.1 then
call SetUnitPosition(.c, .x, .y)
call PauseUnit(.c, false)
call SetUnitInvulnerable(.c, false)
call ReleaseTimer(GetExpiredTimer())
call .destroy()
else
call GroupEnumUnitsInArea(g, .x, .y, 500., Filter(function thistype.GroupConditions))
set t = GroupPickRandomUnit(g)
if t == null then
call SetUnitPosition(.c, .x, .y)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\CarrionSwarm\\CarrionSwarmDamage.mdl", GetUnitX(.c),GetUnitY(.c)))
call PauseUnit(.c, false)
call SetUnitInvulnerable(.c, false)
call ReleaseTimer(GetExpiredTimer())
call .destroy()
else
call SetUnitPosition(.c, GetUnitX(t), GetUnitY(t))
call SetUnitAnimation( .c, "attack" )
call UnitDamageTarget(.c, t, 40. + SpellStat(.c, true) * (lvl - 1.), true, false, atk, dmg, wpn)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\HydraliskImpact\\HydraliskImpact.mdl", t, "origin"))
endif
set .d = .d + tick
endif
call ReleaseGroup(g)
set t = null
set g = null
endmethod
static method create takes unit c returns thistype
local thistype this = thistype.allocate()
local timer tim = NewTimer()
set .c = c
set .x = GetUnitX(c)
set .y = GetUnitY(c)
call IssueImmediateOrder(c, "undefend")
call SetUnitAnimation(c, "spell,throw")
call PauseUnit(c, true)
call SetUnitInvulnerable(c, true)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\CarrionSwarm\\CarrionSwarmDamage.mdl", GetUnitX(c),GetUnitY(c)))
call SetTimerData(tim, this)
call TimerStart(tim, tick, true, function thistype.Timer)
return this
endmethod
endstruct
private function Actions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger AITN = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(AITN, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( AITN, function Actions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope Cover initializer InitTrig_Cover
globals
private constant integer SPELLID = 'Cove'
private constant integer BUFFID = 'BCov'
private unit array CASTER
private trigger array EVENT
private effect array CoverFX
endglobals
private struct Data
unit c
unit t
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call DestroyEffect(CoverFX[GetUnitId(D.t)])
call ReleaseTimer(tim)
call DestroyTrigger(EVENT[GetUnitId(D.t)])
set EVENT[GetUnitId(D.t)] = null
set D.c = null
set CoverFX[GetUnitId(D.t)] = null
set D.t = null
call D.destroy()
endmethod
static method Conditions takes nothing returns boolean
local unit caster = CASTER[GetUnitId(GetTriggerUnit())]
local integer lvl = GetUnitAbilityLevel(caster, SPELLID)
local real dist = SquareRoot((GetUnitX(caster)-GetUnitX(GetTriggerUnit())) * (GetUnitX(caster)-GetUnitX(GetTriggerUnit())) + (GetUnitY(caster)-GetUnitY(GetTriggerUnit())) * (GetUnitY(caster)-GetUnitY(GetTriggerUnit())))
if GetUnitAbilityLevel(GetTriggerUnit(), BUFFID) > 0 then
if GetRandomInt(1,3) == 3 then
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,1), GetTriggerUnit(), "origin"))
endif
call SetWidgetLife(GetTriggerUnit(), GetWidgetLife(GetTriggerUnit()) + GetEventDamage())
call SetWidgetLife(caster, GetWidgetLife(caster) - GetEventDamage()*(1.1-0.05*lvl))
if GetWidgetLife(caster)/GetUnitState(caster, UNIT_STATE_MAX_LIFE) < 0.25 or dist > 400+50*lvl then
call UnitRemoveAbility(GetTriggerUnit(), BUFFID)
call DestroyEffect(CoverFX[GetUnitId(GetTriggerUnit())])
call DestroyTrigger(EVENT[GetUnitId(GetTriggerUnit())])
set EVENT[GetUnitId(GetTriggerUnit())] = null
set CoverFX[GetUnitId(GetTriggerUnit())] = null
endif
else
call UnitRemoveAbility(GetTriggerUnit(), BUFFID)
call DestroyEffect(CoverFX[GetUnitId(GetTriggerUnit())])
call DestroyTrigger(EVENT[GetUnitId(GetTriggerUnit())])
set EVENT[GetUnitId(GetTriggerUnit())] = null
set CoverFX[GetUnitId(GetTriggerUnit())] = null
endif
set caster = null
return false
endmethod
static method create takes unit caster, unit target, integer lvl returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.c = caster
set D.t = target
set CASTER[GetUnitId(target)] = D.c
if EVENT[GetUnitId(D.t)] == null then
set EVENT[GetUnitId(D.t)] = CreateTrigger()
call TriggerRegisterUnitEvent(EVENT[GetUnitId(D.t)], D.t, EVENT_UNIT_DAMAGED)
call TriggerAddCondition(EVENT[GetUnitId(D.t)], function Data.Conditions)
endif
if CoverFX[GetUnitId(D.t)] == null then
set CoverFX[GetUnitId(D.t)] = AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,0), D.t, "origin")
endif
call SetTimerData(tim,D)
call TimerStart(tim, 10+5*lvl, false, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit(), GetUnitAbilityLevel(GetTriggerUnit(), SPELLID))
endif
endfunction
//===========================================================================
public function InitTrig_Cover takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=58
//TESH.alwaysfold=0
scope Sanctuary initializer init
globals
private constant integer SPELLID = 'Sanc'
private constant damagetype dmg = DAMAGE_TYPE_NORMAL
private constant attacktype atk = ATTACK_TYPE_MAGIC
private constant real tick = 1.5
private unit TEMP
private real X
private real Y
endglobals
private struct Data
unit c
real x
real y
real dur
static method GroupEm takes nothing returns boolean
local real lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local real h = 15*lvl + SpellStat(TEMP, true)*(0.60+0.15*lvl)
local real a = 57.29582 * Atan2(Y - GetUnitY(TEMP), X - GetUnitX(TEMP))
local real hpp = GetWidgetLife(GetFilterUnit()) / GetUnitState(GetFilterUnit(),UNIT_STATE_MAX_LIFE)
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) then
call UnitRemoveBuffs(GetFilterUnit(), true, false)
if IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD) or IsUnitType(GetFilterUnit(), UNIT_TYPE_SUMMONED) then
call KnockbackTarget(TEMP, GetFilterUnit(), a, 250., 400., false, true, false, GetAbilityEffectById(SPELLID,EFFECT_TYPE_TARGET, 0))
call UnitDamageTarget(TEMP, GetFilterUnit(), h*0.8, true, false, atk, dmg, wtype)
endif
elseif not IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) and hpp < 1 then
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_TARGET, 1), GetFilterUnit(), "origin"))
call SetWidgetLife(GetFilterUnit(), GetWidgetLife(GetFilterUnit())+h)
endif
return false
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local group g = NewGroup()
set TEMP = D.c
set X = D.x
set Y = D.y
if D.dur <= 15 then
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_EFFECT,0),D.x,D.y))
call GroupEnumUnitsInArea(g, D.x, D.y, 250, Filter(function Data.GroupEm))
set D.dur = D.dur + tick
call SetTimerData(tim,D)
else
call ReleaseTimer(tim)
set D.c = null
call D.destroy()
endif
call ReleaseGroup(g)
endmethod
static method create takes unit c, real x, real y returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.c = c
set D.x = x
set D.y = y
set D.dur = 0
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_AREA_EFFECT,0),D.x,D.y))
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
endif
return false
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=35
//TESH.alwaysfold=0
scope RighteousHammer initializer Init
globals
private constant integer SPELLID = 'RiHa'
private constant attacktype atk = ATTACK_TYPE_MAGIC
private constant damagetype dmg = DAMAGE_TYPE_NORMAL
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
method onUnitHit takes unit target returns nothing
local integer lvl = GetUnitAbilityLevel(this.caster, SPELLID)
local real dam = -55+lvl*125 + (SpellStat(this.caster,true)*(0.8+0.2*lvl))
local real a = 57.29582 * Atan2(GetUnitY(target) - this.y, GetUnitX(target) - this.x)
if IsUnitEnemy(this.caster, GetOwningPlayer(target)) and not(IsUnitType(target, UNIT_TYPE_STRUCTURE)) then
call UnitDamageTarget(this.caster, target, dam, true, false, atk, dmg, wtype)
call KnockbackTarget(this.caster, target, a, 325., 650., false, true, false, GetAbilityEffectById(SPELLID,EFFECT_TYPE_TARGET, 0))
else
call SetWidgetLife(target, GetWidgetLife(target) + dam*0.7)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_TARGET, 1), target, "origin"))
endif
endmethod
endstruct
private function Actions takes unit c returns nothing
local real ang = Atan2(GetSpellTargetY() - GetUnitY(c), GetSpellTargetX() - GetUnitX(c))
local Data xc
set xc = Data.create(GetUnitX(c), GetUnitY(c), ang)
set xc.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set xc.speed = 675.0
set xc.expirationTime = 1.5
set xc.z = 80.0
set xc.caster = c
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, function Conditions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=70
//TESH.alwaysfold=0
scope ShieldOfDivinity initializer InitTrig_Shield_of_Divinity
globals
private constant integer SPELLID = 'shod'
private constant integer ALTSPELLID = 'oroc'
private constant real tick = 1.
endglobals
private struct Data
unit c
unit t
effect fx
string str
string art
timer tim
real dur
integer abil
static method onLoop takes nothing returns nothing
local Data D = Data(GetTimerData(GetExpiredTimer()))
local string str1
set D.tim = GetExpiredTimer()
if D.dur <= 2 + GetUnitAbilityLevel(D.c, D.abil) * 2 then
if D.str == "off" then
set D.str = "on"
if D.abil == ALTSPELLID then
set str1 = "overhead"
else
set str1 = "origin"
endif
set D.fx = AddSpecialEffectTarget(D.art, D.t, str1)
call SetUnitInvulnerable(D.t, true)
elseif D.str == "on" then
set D.str = "off"
call DestroyEffect(D.fx)
call SetUnitInvulnerable(D.t, false)
endif
set D.dur = D.dur + tick
call SetTimerData(D.tim,D)
else
call SetUnitInvulnerable(D.t, false)
call DestroyEffect(D.fx)
set D.fx = null
set D.t = null
set D.c = null
set D.str = null
set D.art = null
call ReleaseTimer(D.tim)
call D.destroy()
endif
endmethod
static method create takes unit caster, unit target, integer abilityid, effect sfx, string art returns Data
local Data D = Data.allocate()
set D.tim = NewTimer()
set D.c = caster
set D.t = target
set D.abil = abilityid
set D.dur = 0
set D.art = art
set D.fx = sfx
call SetUnitInvulnerable(D.t, true)
set D.str = "on"
call SetTimerData(D.tim, D)
call TimerStart(D.tim, tick, true, function Data.onLoop)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
local string str
local string str1
if GetSpellAbilityId() == SPELLID or GetSpellAbilityId() == ALTSPELLID then
if GetSpellAbilityId() == ALTSPELLID then
set str = "Abilities\\Spells\\Undead\\AntiMagicShell\\AntiMagicShell.mdl"
set str1 = "overhead"
else
set str = "Abilities\\Spells\\Human\\DivineShield\\DivineShieldTarget.mdl"
set str1 = "origin"
endif
call Data.create(GetTriggerUnit(), GetSpellTargetUnit(), GetSpellAbilityId(), AddSpecialEffectTarget(str, GetSpellTargetUnit(), "overhead"), str)
endif
set str1 = null
set str = null
return false
endfunction
//===========================================================================
public function InitTrig_Shield_of_Divinity takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=31
//TESH.alwaysfold=0
scope Pierce initializer Init
globals
private constant integer SPELLID = 'Pier'
endglobals
private struct Data
unit c
unit t
timer tim
real r
static method onLoop takes nothing returns nothing
local Data D = Data(GetTimerData(GetExpiredTimer()))
set D.tim = GetExpiredTimer()
call AddUnitBonus(D.t, BONUS_ARMOR, R2I((-1)*D.r))
call ReleaseTimer(D.tim)
set D.t = null
set D.c = null
call D.destroy()
endmethod
static method create takes unit caster, unit target returns Data
local Data D = Data.allocate()
local texttag tag = CreateTextTag()
local integer i = GetRandomInt(0,100)
local real lvl = GetUnitAbilityLevel(caster, SPELLID)
local real tick = 2+5*lvl
local real dam = 25+20*lvl+(SpellStat(caster,true)*lvl*0.45)
set D.c = caster
set D.t = target
set D.tim = NewTimer()
if i < 15+10*lvl then
set dam = dam*2.5
call SetTextTagText(tag, I2S(R2I(dam))+"!", 0.024)
call SetTextTagPos(tag, GetUnitX(D.c), GetUnitY(D.c), 0.00)
call SetTextTagColor(tag, 255, 0, 0, 255)
call SetTextTagVelocity(tag, 0, 0.04)
call SetTextTagVisibility(tag, true)
call SetTextTagFadepoint(tag, 1)
call SetTextTagLifespan(tag, 1.5)
call SetTextTagPermanent(tag, false)
call SetUnitAnimation(D.c, "attack slam")
call UnitDamageTarget(D.c, D.t, dam, true, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_METAL_HEAVY_SLICE)
else
call DestroyTextTag(tag)
set tag = null
call UnitDamageTarget(D.c, D.t, dam, true, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WOOD_HEAVY_BASH)
endif
set D.r = 0-SpellStat(D.c, true)*0.4
call AddUnitBonus(D.t, BONUS_ARMOR, R2I(D.r))
call SetTimerData(D.tim,D)
call TimerStart(D.tim,tick,false, function Data.onLoop)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(),GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=11
//TESH.alwaysfold=0
scope SpinActive initializer Init
globals
private unit caster
private real dam
private constant integer SPELLID = 'blsa'
private constant real tick = 0.4
endglobals
private struct Data
unit c
timer tim
real dur
group g
static method GroupEnum takes nothing returns boolean
set dam = SpellStat(caster, true)*0.2*GetUnitAbilityLevel(caster,SPELLID) + GetUnitBonus(caster, BONUS_DAMAGE)
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(caster)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) then
call UnitDamageTarget(caster, GetFilterUnit(), dam, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, wtype)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl", GetFilterUnit(),"origin"))
endif
return false
endmethod
static method onLoop takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
if .dur < 3 and GetWidgetLife(.c) > 0.405 then
set caster = .c
call GroupEnumUnitsInRange(ENUM_GROUP, GetUnitX(.c),GetUnitY(.c), 250., Filter(function thistype.GroupEnum))
else
call IssuePointOrder(.c, "move", GetUnitX(.c), GetUnitY(.c))
call ReleaseTimer(.tim)
call .destroy()
endif
set .dur = .dur + tick
endmethod
static method create takes unit c returns Data
local thistype this = thistype.allocate()
set .tim = NewTimer()
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_AREA_EFFECT, 0), c, "origin"))
set .c = c
set .dur = 0
call SetUnitAnimation(.c, "spin" )
call SetTimerData(.tim,this)
call TimerStart(.tim,tick,true, function thistype.onLoop)
return this
endmethod
endstruct
private function Actions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction(t, function Actions )
set t = null
endfunction
endscope
//TESH.scrollpos=87
//TESH.alwaysfold=0
scope DrowsyCask initializer InitTrig_Chain_Petrify
globals
private constant integer SPELLID = 'DrCa'
private constant integer BUFFID = 'BUsl'
private constant integer DUMMYSPELL = 'AUsl'
private group GROUP
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
unit targ
group g
integer jumps
static method GroupEm takes nothing returns boolean
local unit t = GetFilterUnit()
local integer lvl = GetUnitAbilityLevel(t, BUFFID)
if not(IsUnitInGroup(t, GROUP) or IsUnitType(t,UNIT_TYPE_DEAD) or IsUnitType(t, UNIT_TYPE_STRUCTURE)) and lvl == 0 and IsUnitEnemy(t, GetOwningPlayer(TEMP)) then
return true
endif
set t= null
return false
endmethod
method onDestroy takes nothing returns nothing
call ReleaseGroup(.g)
endmethod
method loopControl takes nothing returns nothing
local unit target
local group g = NewGroup()
if .targetUnit == null or IsUnitType(.targetUnit, UNIT_TYPE_DEAD) then
set GROUP = .g
call GroupEnumUnitsInArea(g, this.x, this.y, 300, Filter(function Data.GroupEm))
set target = FirstOfGroup(g)
set .targ = target
if target == null then
call ReleaseGroup(g)
call .terminate()
else
set .targetUnit = target
endif
endif
set target = null
call ReleaseGroup(g)
endmethod
method onUnitHit takes unit target returns nothing
local group g = NewGroup()
local integer lvl = GetUnitAbilityLevel(.caster,SPELLID)
local real dam = lvl*SpellStat(.caster,true)*(0.3+0.3*lvl)+15*lvl
local xecast xc
local xedamage d= xedamage.create()
set d.dtype= DAMAGE_TYPE_ACID
set d.atype= ATTACK_TYPE_CHAOS
if not(IsUnitInGroup(target, .g) or GetUnitAbilityLevel(target, BUFFID)>0) and IsUnitEnemy(target, GetOwningPlayer(.caster)) then
set xc = xecast.createBasicA(DUMMYSPELL, OrderId("sleep"), GetOwningPlayer(.caster))
call GroupRemoveUnit(.g, .targ)
call GroupAddUnit(.g, target)
set .targ = target
set TEMP = .caster
set GROUP = .g
set xc.level = lvl
call d.useSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 1),"origin")
call d.damageTarget(.caster,target,dam)
call xc.castOnTarget(target)
call GroupEnumUnitsInArea(g, this.x, this.y, 400, Filter(function Data.GroupEm))
set target = FirstOfGroup(g)
set .jumps = .jumps + 1
if target == null or .jumps > 2+2*lvl then
call ReleaseGroup(g)
call .terminate()
else
set .targetUnit = target
endif
endif
call d.destroy()
endmethod
endstruct
private function Actions takes unit c, unit t returns nothing
local real ang = Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c))
local Data d
set d = Data.create(GetUnitX(c), GetUnitY(c), ang)
set d.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set d.speed = 600.0
set d.expirationTime = 15
set d.z = 75.0
set d.caster = c
set d.collisionSize = 16.0
set d.angleSpeed = 15.0
set d.targetUnit = t
set d.targ = c
set d.jumps = 0
set d.g = NewGroup()
call GroupAddUnit(d.g, c)
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions( GetTriggerUnit(), GetSpellTargetUnit() )
endif
return false
endfunction
//===========================================================================
public function InitTrig_Chain_Petrify takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=4
//TESH.alwaysfold=0
scope InsectSwarm initializer init
globals
private constant integer SPELLID = 'InSw'
endglobals
private function Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(),SPELLID)
local integer i = 1
local unit d
local real ang = GetRandomReal(0,2*bj_PI)
local real x = GetUnitX(GetTriggerUnit())+GetRandomReal(0,250)*Cos(ang)
local real y = GetUnitY(GetTriggerUnit())+GetRandomReal(0,250)*Sin(ang)
if GetSpellAbilityId() == SPELLID then
loop
exitwhen i > lvl*4+1
set ang = GetRandomReal(0,2*bj_PI)
set x = GetUnitX(GetTriggerUnit())+GetRandomReal(0,250)*Cos(ang)
set y = GetUnitY(GetTriggerUnit())+GetRandomReal(0,250)*Sin(ang)
set d = CreateUnit(GetTriggerPlayer(), 'floc',x,y,ang-bj_PI)
call UnitApplyTimedLife(d, 'Xbli', 8+2*lvl)
call UnitAddAbility(d, 'anst')
call SetUnitBonus(d, BONUS_DAMAGE, R2I(lvl*5+0.05*SpellStat(GetTriggerUnit(),true)))
call SetUnitMaxState(d, UNIT_STATE_MAX_LIFE, R2I(GetWidgetLife(GetTriggerUnit())*(0.05+0.0145*lvl)))
set i = i + 1
endloop
endif
set d = null
return true
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function StingActions takes nothing returns nothing
if GetUnitAbilityLevel(GetAttacker(),'anst') > 0 and GetRandomInt(1, 3) == 1 then
call IssueTargetOrder( GetTriggerUnit(), "attack", GetAttacker() )
endif
endfunction
//===========================================================================
function InitTrig_Annoying_Sting takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( t, function StingActions )
set t = null
endfunction
//TESH.scrollpos=8
//TESH.alwaysfold=0
scope BlastWard initializer init
globals
private constant integer SPELLID = 'BlWa'
private trigger array EVENT
private unit array UNIT
private unit TEMP
endglobals
private function GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(UNIT[GetUnitId(TEMP)], SPELLID)
local real dam = SpellStat(UNIT[GetUnitId(TEMP)],true)*(1+0.15*lvl)+20+60*lvl
local real ang = 57.29582 * Atan2(GetUnitY(GetFilterUnit()) - GetUnitY(TEMP), GetUnitX(GetFilterUnit()) - GetUnitX(TEMP))
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and not( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) ) then
call UnitDamageTarget(UNIT[GetUnitId(TEMP)], GetFilterUnit(), dam, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, wtype)
call KnockbackTarget(UNIT[GetUnitId(TEMP)], GetFilterUnit(), ang, 300, 175, false, false, false, GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0))
endif
return false
endfunction
private function ConditionsDeath takes nothing returns boolean
local group g = NewGroup()
set TEMP = GetTriggerUnit()
call GroupEnumUnitsInArea(g, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 400, Filter(function GroupEm))
call DestroyTrigger(EVENT[GetUnitId(GetTriggerUnit())])
set EVENT[GetUnitId(GetTriggerUnit())] = null
call ReleaseGroup(g)
return false
endfunction
private function Actions takes unit c, unit u returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
set u = CreateUnit(GetTriggerPlayer(), 'bwrd', GetSpellTargetX(), GetSpellTargetY(), 270)
call SetUnitMaxState(u, UNIT_STATE_MAX_LIFE, GetWidgetLife(c)*0.035*lvl)
call UnitApplyTimedLife(u, 'BOwd', 6.75-0.75*lvl)
set UNIT[GetUnitId(u)] = c
set EVENT[GetUnitId(u)] = CreateTrigger()
call TriggerRegisterUnitEvent(EVENT[GetUnitId(u)], u, EVENT_UNIT_DEATH)
call TriggerAddCondition( EVENT[GetUnitId(u)], function ConditionsDeath )
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), null)
endif
return true
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=38
//TESH.alwaysfold=0
scope VodunSpin initializer Init
globals
private unit caster
private real dam
endglobals
private struct Data
unit c
effect fx
static method create takes unit caster returns Data
local Data D = Data.allocate()
set D.c = caster
set D.fx = AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\Immolation\\ImmolationTarget.mdl", caster, "origin")
return D
endmethod
endstruct
private function GroupEnum takes nothing returns boolean
local xecast xc = xecast.createA()
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(caster)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\Possession\\PossessionMissile.mdl", GetFilterUnit(),"origin"))
call UnitDamageTarget(caster, GetFilterUnit(), dam, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, wtype)
if GetRandomInt(1,100) <= 30+5*GetUnitAbilityLevel(caster, 'blsp') then
set xc.abilityid = 'ACcs'
set xc.orderstring = "curse"
set xc.owningplayer = GetOwningPlayer(caster)
call xc.castOnTarget( GetFilterUnit() )
endif
return true
endif
return false
endfunction
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
set dam = SpellStat(D.c, true)*0.8 * GetUnitAbilityLevel(D.c,'blsp') + GetUnitBonus(D.c, BONUS_DAMAGE)
call PauseUnit(D.c, false)
call DestroyEffect(D.fx)
//call IssueLastOrder(D.c)
call ReleaseTimer(tim)
set D.fx = null
set D.c = null
call D.destroy()
endfunction
private function Actions takes nothing returns nothing
local Data D = Data.create(GetAttacker())
local timer tim = NewTimer()
call PauseUnit(D.c, true)
call SetUnitAnimation(D.c, "spin" )
call SetTimerData(tim,D)
call TimerStart(tim,0.65,false, function Timer)
endfunction
private function Conditions takes nothing returns boolean
local group g = NewGroup()
if GetUnitAbilityLevel(GetAttacker(), 'blsp') > 0 and GetRandomInt(1,6) == 1 then
set caster = GetAttacker()
call GroupEnumUnitsInRange(g, GetUnitX(GetAttacker()),GetUnitY(GetAttacker()), 250., Filter(function GroupEnum))
call Actions()
endif
call ReleaseGroup(g)
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(t, Condition( function Conditions ) )
call TriggerAddAction(t, function Actions )
endfunction
endscope
//TESH.scrollpos=75
//TESH.alwaysfold=0
scope CreateConcoct initializer Init
globals
private constant integer SPELLID = 'crco'
private constant real tick = 1
endglobals
private struct Data
unit c
real d
static method create takes unit caster returns Data
local Data D = Data.allocate()
set D.c = caster
set D.d = 1
return D
endmethod
endstruct
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local integer a = GetUnitAbilityLevel(D.c, SPELLID)
local integer i = GetRandomInt(1, 100)
local real max = GetUnitState(D.c, UNIT_STATE_MAX_MANA)
local real cur = GetUnitState(D.c, UNIT_STATE_MANA)
local real percent = max*0.1
local texttag tag = CreateTextTag()
call SetTextTagPos(tag, GetUnitX(D.c), GetUnitY(D.c), 0.00)
call SetTextTagVelocity(tag, 0, 0.04)
call SetTextTagVisibility(tag, true)
call SetTextTagFadepoint(tag, 1)
call SetTextTagLifespan(tag, 0.8)
call SetTextTagPermanent(tag, false)
//If the spell is not being channeled or the caster runs out of mana, then stop the spell
if GetUnitCurrentOrder(D.c) != OrderId("tranquility") or cur < percent then
if GetUnitCurrentOrder(D.c) == OrderId("tranquility") then
call IssuePointOrder(D.c, "move", GetUnitX(D.c), GetUnitY(D.c))
endif
call D.destroy()
call ReleaseTimer(tim)
//Set chances for Item lvl 1
elseif D.d == 1 then
call SetUnitState(D.c, UNIT_STATE_MANA, cur - percent)
if a >= 1 then
if a >= 2 then
set i = i + 10
endif
if a == 5 then
set i = i - 5
endif
if i <= 60 then
call SetTextTagColor(tag, 0, 175, 0, 255)
call SetTextTagText(tag, "Success!", 0.024)
if GetUnitAbilityLevel(D.c, SPELLID) > 0 and GetRandomInt(1,2) == 1 then
call UnitAddItemById(D.c, 'Ifwp')
else
call UnitAddItemById(D.c, 'IC22')
endif
else
call SetTextTagColor(tag, 255, 0, 0, 255)
call SetTextTagText(tag, "Failure!", 0.024)
endif
endif
//Set chances for Item lvl 2
elseif D.d == 2 then
call SetUnitState(D.c, UNIT_STATE_MANA, cur - percent)
set i = GetRandomInt(1, 100)
if a >= 2 then
if a >= 3 then
set i = i + 5
endif
if a == 5 then
set i = i - 4
endif
if i <= 45 then
call SetTextTagColor(tag, 0, 205, 55, 255)
call SetTextTagText(tag, "Success!", 0.024)
if GetUnitAbilityLevel(D.c, SPELLID) > 1 and GetRandomInt(1,2) == 1 then
call UnitAddItemById(D.c, 'moon')
else
call UnitAddItemById(D.c, 'IC27')
endif
else
call SetTextTagColor(tag, 215, 0, 0, 255)
call SetTextTagText(tag, "Failure!", 0.024)
endif
endif
//Set chances for Item lvl 3
elseif D.d == 3 then
call SetUnitState(D.c, UNIT_STATE_MANA, cur - percent)
set i = GetRandomInt(1, 100)
if a >= 3 then
if a >= 4 then
set i = i + 5
endif
if a == 5 then
set i = i - 3
endif
if i <= 30 then
call SetTextTagColor(tag, 0, 155, 105, 255)
call SetTextTagText(tag, "Success!", 0.024)
if GetUnitAbilityLevel(D.c, SPELLID) > 2 and GetRandomInt(1,2) == 1 then
call UnitAddItemById(D.c, 'IC26')
else
call UnitAddItemById(D.c, 'IC20')
endif
else
call SetTextTagColor(tag, 175, 0, 0, 255)
call SetTextTagText(tag, "Failure!", 0.024)
endif
endif
//Set chances for Item lvl 4
elseif D.d == 4 then
call SetUnitState(D.c, UNIT_STATE_MANA, cur - percent)
set i = GetRandomInt(1, 100)
if a >= 4 then
if a == 5 then
set i = i - 5
endif
if i <= 20 then
call SetTextTagColor(tag, 0, 105, 155, 255)
call SetTextTagText(tag, "Success!", 0.024)
set i = GetRandomInt(1, 4)
if i == 1 then
call UnitAddItemById(D.c, 'IC08')
elseif i == 2 then
call UnitAddItemById(D.c, 'gobm')
elseif i == 3 then
call UnitAddItemById(D.c, 'IC18')
elseif i == 4 then
call UnitAddItemById(D.c, 'Immc')
endif
else
call SetTextTagColor(tag, 135, 0, 0, 255)
call SetTextTagText(tag, "Failure!", 0.024)
endif
endif
endif
set D.d = D.d + tick
endfunction
private function Actions takes nothing returns nothing
local timer tim = NewTimer()
local Data D = Data.create(GetTriggerUnit())
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Timer)
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELLID
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,function Conditions)
call TriggerAddAction(t, function Actions )
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope Inspire initializer init
globals
private constant integer BUFF1 = 'BIn1'
private constant integer BUFF2 = 'BIn2'
private constant integer BUFF3 = 'BIn3'
private constant integer BUFF4 = 'BIn4'
private constant integer BUFF5 = 'BIn5'
private constant integer DUMMYID = 'ACbl'
endglobals
private function BUFF takes unit c returns integer
if GetUnitAbilityLevel(c, BUFF1) > 0 then
return 1
elseif GetUnitAbilityLevel(c, BUFF2) > 0 then
return 2
elseif GetUnitAbilityLevel(c, BUFF3) > 0 then
return 3
elseif GetUnitAbilityLevel(c, BUFF4) > 0 then
return 4
elseif GetUnitAbilityLevel(c, BUFF5) > 0 then
return 5
endif
return 0
endfunction
private function Conditions takes nothing returns nothing
local xecast xe
local integer lvl = BUFF(GetAttacker())
if lvl > 0 and GetRandomInt(1,100) < 8+2*lvl then
set xe = xecast.createBasicA('ACbl', OrderId("bloodlust"), GetOwningPlayer(GetAttacker()))
set xe.level = lvl
call xe.castOnTarget(GetAttacker())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope AncientGhostDummy initializer onInit
globals
private constant integer REALID = 'AnGh'
endglobals
private function Conditions takes nothing returns nothing
if IsUnitIllusion(GetTriggerUnit()) and GetUnitAbilityLevel(GetSummoningUnit(), REALID) > 0 then
call SetUnitVertexColor(GetTriggerUnit(), 50,50,50,110)
call SetUnitVertexColor(GetSummoningUnit(), 50,50,50,110)
call UnitRemoveAbility(GetTriggerUnit(), 'Insp')
endif
endfunction
//===========================================================================
public function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddAction( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope AncientGhost initializer onInit
globals
private constant integer SPELLID = 'AnGh'
private constant integer DUMMYID = 'duAG'
private constant real TICK = 1.5
endglobals
private function Actions takes unit c, unit dummy returns nothing
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
set dummy = CreateUnit(GetOwningPlayer(c), XE_DUMMY_UNITID, x, y, 0)
call UnitAddAbility(dummy, SPELLID)
call UnitAddAbility(dummy, 'Aloc')
call UnitAddAbility(dummy, DUMMYID)
call SetUnitAbilityLevel(dummy, DUMMYID, lvl)
call UnitApplyTimedLife(dummy, 'BIvs',2)
call IssueTargetOrderById(dummy,852274,c)
endfunction
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), null)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=32
//TESH.alwaysfold=0
scope Axerang initializer Init
globals
private constant integer SPELLID = 'AxeT'
private constant attacktype atk = ATTACK_TYPE_NORMAL
private constant damagetype dmg = DAMAGE_TYPE_NORMAL
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
unit Ender
method loopControl takes nothing returns nothing
local real dx = this.x - GetUnitX(this.caster)
local real dy = this.y - GetUnitY(this.caster)
local real dist = SquareRoot(dx * dx + dy * dy)
// if dist > 000 then
set this.acceleration = -1000
set this.Ender = this.caster
//endif
endmethod
method onUnitHit takes unit target returns nothing
local integer lvl = GetUnitAbilityLevel(this.caster, SPELLID)
local real dam = lvl*35 + SpellStat(this.caster,true)*(0.4+0.2*lvl)
if IsUnitEnemy(this.caster, GetOwningPlayer(target)) and not(IsUnitType(target, UNIT_TYPE_STRUCTURE)) then
call UnitDamageTarget(this.caster, target, dam, true, false, atk, dmg, wtype)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_AREA_EFFECT, 0), target, "origin"))
elseif target == this.Ender then
call this.terminate()
endif
endmethod
endstruct
private function Actions takes unit c returns nothing
local real ang = Atan2( GetSpellTargetY() - GetUnitY(c) , GetSpellTargetX() - GetUnitX(c) )
local Data xc
local integer i = 0
local real ang2 = ang + bj_PI/2
set ang2 = ang + bj_PI/2
set ang = bj_RADTODEG*ang+17.5
loop
exitwhen (i==3)
set xc = Data.create( GetUnitX(c)-15+5*i, GetUnitY(c)-15+5*i, bj_DEGTORAD*(ang - 17.5*i) )
set xc.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set xc.speed = 1200
set xc.expirationTime = 3
set xc.z = 50.0
set xc.collisionSize = 30
set xc.minSpeed = -1200
set xc.Ender = udg_GUI_Pointer[10]
set xc.caster = c
set ang2= bj_PI + ang2
set i = i + 1
endloop
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, function Conditions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope Flurry initializer InitTrig_Flurry
globals
private constant integer SPELLID = 'Flur'
private unit array TEMP
private integer array DBONUS
endglobals
private function Conditions takes nothing returns boolean
if GetUnitAbilityLevel(GetAttacker(), SPELLID) > 0 then
if DBONUS[GetUnitId(GetAttacker())] < 5+10*GetUnitAbilityLevel(GetAttacker(), SPELLID) then
call AddUnitBonus(GetAttacker(), BONUS_ATTACK_SPEED, 3+1*GetUnitAbilityLevel(GetAttacker(), SPELLID))
set DBONUS[GetUnitId(GetAttacker())] = DBONUS[GetUnitId(GetAttacker())] + 3+1*GetUnitAbilityLevel(GetAttacker(), SPELLID)
endif
if TEMP[GetUnitId(GetAttacker())] != GetTriggerUnit() then
set TEMP[GetUnitId(GetAttacker())] = GetTriggerUnit()
call AddUnitBonus(GetAttacker(), BONUS_ATTACK_SPEED, -DBONUS[GetUnitId(GetAttacker())])
set DBONUS[GetUnitId(GetAttacker())] = 0
endif
endif
return false
endfunction
//===========================================================================
public function InitTrig_Flurry takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Conditions ) )
set t = null
endfunction
endscope
//TESH.scrollpos=36
//TESH.alwaysfold=0
scope Lacerate initializer Init
globals
integer array Lacerate
private constant integer SPELLID = 'Lace'
private constant integer BUFFBOOK = 'bubo'
endglobals
private struct Data
unit t
static method create takes unit target returns Data
local Data D = Data.allocate()
set D.t = target
return D
endmethod
endstruct
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local integer i = Lacerate[GetUnitId(D.t)]
set Lacerate[GetUnitId(D.t)] = Lacerate[GetUnitId(D.t)] - 1
if Lacerate[GetUnitId(D.t)] < 1 then
call UnitRemoveAbility(D.t, BUFFBOOK)
endif
call ReleaseTimer(tim)
endfunction
private function Actions takes nothing returns nothing
local timer tim = NewTimer()
local Data D = Data.create(GetSpellTargetUnit())
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
local real dam = (6+5*lvl+GetUnitBonus(GetTriggerUnit(), BONUS_DAMAGE))*(0.4+0.2*Lacerate[GetUnitId(D.t)])
call UnitDamageTarget(GetTriggerUnit(), D.t, dam, true, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_NORMAL, wtype)
call UnitAddAbility(D.t, BUFFBOOK)
call SetUnitState(GetTriggerUnit(), UNIT_STATE_MANA, GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) - 2.5*Lacerate[GetUnitId(D.t)])
set Lacerate[GetUnitId(D.t)] = Lacerate[GetUnitId(D.t)] + 1
call SetTimerData(tim, D)
call TimerStart(tim, 2+0.75*lvl, false, function Timer)
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions()
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
local integer i = 0
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions)
call TriggerAddAction( t, function Actions )
loop
exitwhen i == bj_MAX_PLAYER_SLOTS
call SetPlayerAbilityAvailable(Player(i), BUFFBOOK, false)
set i = i + 1
endloop
endfunction
endscope
//TESH.scrollpos=16
//TESH.alwaysfold=0
scope BloodLife initializer InitTrig_BloodLife
globals
private constant integer SPELLID = 'BlLi'
endglobals
private struct Blood
unit c
integer lvl
static method onLoop takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Blood B = Blood(GetTimerData(tim))
if B.c != null then
call AddUnitMaxState(B.c, UNIT_STATE_MAX_LIFE, -B.lvl)
endif
call ReleaseTimer(tim)
set B.c = null
call B.destroy()
endmethod
static method create takes unit caster, integer level returns Blood
local Blood B = Blood.allocate()
local timer tim = NewTimer()
set B.c = caster
set B.lvl = level
call AddUnitMaxState(B.c, UNIT_STATE_MAX_LIFE, B.lvl)
call SetTimerData(tim, B)
call TimerStart(tim, 120, false, function Blood.onLoop)
return B
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetUnitAbilityLevel(GetTriggerUnit(), SPELLID) > 0 then
call Blood.create(GetTriggerUnit(), GetUnitAbilityLevel(GetTriggerUnit(), SPELLID))
endif
return false
endfunction
//===========================================================================
public function InitTrig_BloodLife takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Berserk initializer init
globals
private constant integer SPELLID = 'Bers'
private constant integer BUFFID = 'Bbsk'
private constant real TICK = 0.03
endglobals
public struct Data
unit c
real dur
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
set .dur = .dur + TICK
if IsUnitSelected(.c, GetOwningPlayer(.c)) then
if GetLocalPlayer() == GetOwningPlayer(.c) then
call SelectUnit(.c, false)
endif
endif
if .dur >= 8 or GetUnitAbilityLevel(.c, BUFFID) < 1 then
if GetLocalPlayer() == GetOwningPlayer(.c) then
call SelectUnit(.c, true)
endif
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endif
endmethod
static method Actions takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
call AttachSoundToUnit(gg_snd_BloodlustTarget, c)
call StartSound(gg_snd_BloodlustTarget)
set .c = c
set .dur = 0
call SetTimerData(tim,this)
call TimerStart(tim, TICK, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t= null
endfunction
endscope
//TESH.scrollpos=65
//TESH.alwaysfold=0
struct FirePatch extends xecollider
unit caster
real dam
method loopControl takes nothing returns nothing
local xedamage d= xedamage.create()
set d.dtype = DAMAGE_TYPE_MAGIC
set d.atype = ATTACK_TYPE_MELEE
set d.exception = UNIT_TYPE_FLYING
call d.factor ( UNIT_TYPE_STRUCTURE, 0.4)
call d.damageAOE(.caster,.x,.y,.collisionSize,.dam*XE_ANIMATION_PERIOD)
call d.destroy()
endmethod
static method actions takes unit c, integer id, real x, real y, real dur, real dam returns nothing
local integer lvl = GetUnitAbilityLevel(c, id)
local FirePatch xc = FirePatch.create(x, y, 0)
set xc.caster = c
set xc.speed = 0
set xc.expirationTime = dur
set xc.collisionSize = 50
set xc.fxpath = GetAbilityEffectById(id, EFFECT_TYPE_MISSILE, lvl-1)
set xc.scale = 2
set xc.z = 25
set xc.dam = dam
endmethod
endstruct
scope FireWall initializer InitTrig_FireWall
globals
private constant integer SPELLID = 'A011'
private constant integer BSPELLID = 'Pact'
private constant integer BUFFID = 'BPac'
endglobals
private function Actions takes unit c, real x, real y returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer blvl = GetUnitAbilityLevel(c, BSPELLID)
local integer i = -lvl-1
local real angle = Atan2(y - GetUnitY(c), x - GetUnitX(c))+90*bj_DEGTORAD
local real dam = SpellStat(c,true)*(0.25+0.2*lvl)+5*lvl
local real cost = 100*(1.125-0.125*blvl)
local real dx
local real dy
if GetUnitAbilityLevel(c, BUFFID) > 0 and GetWidgetLife(c) > cost and GetUnitState(c, UNIT_STATE_MANA) > cost then
call SetUnitState(c, UNIT_STATE_MANA, GetUnitState(c, UNIT_STATE_MANA)-cost )
call SetWidgetLife(c, GetWidgetLife(c)-cost )
call UnitRemoveAbility(c, BUFFID)
set dam = dam*2
endif
loop
exitwhen i > lvl+1
set dx = x + i*100 * Cos(angle)
set dy = y + i*100 * Sin(angle)
call FirePatch.actions( c, SPELLID, dx, dy, 6, dam)
set i = i + 1
endloop
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions( GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY() )
endif
return false
endfunction
public function InitTrig_FireWall takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition(t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=4
//TESH.alwaysfold=0
scope Apocalypse initializer InitTrig_Apocalypse
globals
private constant integer SPELLID = 'A00U'
private constant integer BSPELLID = 'Pact'
private constant integer BUFFID = 'BPac'
private unit TEMP
endglobals
private function GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local integer blvl = GetUnitAbilityLevel(TEMP, BSPELLID)
local real dam = 15*lvl + SpellStat(TEMP, true)*(0.5+0.5*lvl)
local real cost = 200*(1.25-0.25*blvl)
if GetUnitAbilityLevel(TEMP, BUFFID) > 0 and GetWidgetLife(TEMP) > cost and GetUnitState(TEMP, UNIT_STATE_MANA) > cost then
call SetUnitState(TEMP, UNIT_STATE_MANA, GetUnitState(TEMP, UNIT_STATE_MANA)-cost )
call SetWidgetLife(TEMP, GetWidgetLife(TEMP)-cost )
call UnitRemoveAbility(TEMP, BUFFID)
set dam = dam*2
endif
if IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(TEMP)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) then
call FirePatch.actions( TEMP, SPELLID, GetUnitX(GetFilterUnit()), GetUnitY(GetFilterUnit()), blvl-2+3*lvl, dam )
endif
return false
endfunction
private function Actions takes unit un returns nothing
local group g = NewGroup()
set TEMP = un
call GroupEnumUnitsInArea(g, GetUnitX(un), GetUnitY(un), 800, Filter(function GroupEm))
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl", GetUnitX(un), GetUnitY(un) ) )
call ReleaseGroup(g)
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endfunction
public function InitTrig_Apocalypse takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=41
//TESH.alwaysfold=0
scope ManaDrain initializer init
globals
private constant integer SPELLID = 'MaDr'
private constant integer BSPELLID = 'Pact'
private constant integer BUFFID = 'BPac'
endglobals
private struct Data
unit c
unit t
real mp
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
if IsUnitEnemy(.t, GetOwningPlayer(.c)) then
call AddUnitMaxState(.c, UNIT_STATE_MAX_MANA, -.mp)
call AddUnitMaxState(.t, UNIT_STATE_MAX_MANA, .mp)
else
call AddUnitMaxState(.c, UNIT_STATE_MAX_MANA, .mp)
call AddUnitMaxState(.t, UNIT_STATE_MAX_MANA, -.mp)
endif
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_CASTER,0), .t, "origin"))
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_TARGET,0), .c, "origin"))
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endmethod
static method Actions takes unit c, unit t, real mp returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
set .c = c
set .t = t
set .mp = mp
call SetTimerData(tim,this)
call TimerStart(tim,15+5*lvl, false, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns nothing
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
local integer blvl = GetUnitAbilityLevel(GetTriggerUnit(), BSPELLID)
local real cost = (125- ( 18.6 * (lvl-1) )) *(1.25-0.25*blvl)
local integer mp = R2I(15*lvl+SpellStat(GetTriggerUnit(),true)*(0.1+0.1*lvl))
if GetSpellAbilityId() == 'MaDr' then
if GetUnitAbilityLevel(GetTriggerUnit(), BUFFID) > 0 and GetWidgetLife(GetTriggerUnit()) > cost and GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) > cost then
call SetUnitState(GetTriggerUnit(), UNIT_STATE_MANA, GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA)-cost )
call SetWidgetLife(GetTriggerUnit(), GetWidgetLife(GetTriggerUnit())-cost )
call UnitRemoveAbility(GetTriggerUnit(), BUFFID)
set mp = mp*2
endif
if IsUnitEnemy(GetSpellTargetUnit(), GetTriggerPlayer()) then
call AddUnitMaxState(GetTriggerUnit(), UNIT_STATE_MAX_MANA, mp)
call AddUnitMaxState(GetSpellTargetUnit(), UNIT_STATE_MAX_MANA, -mp)
else
call AddUnitMaxState(GetTriggerUnit(), UNIT_STATE_MAX_MANA, -mp)
call AddUnitMaxState(GetSpellTargetUnit(), UNIT_STATE_MAX_MANA, mp)
endif
call Actions(GetTriggerUnit(),GetSpellTargetUnit(), mp)
endif
endmethod
endstruct
//===========================================================================
function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Data.Conditions )
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope BloodStar initializer init
globals
private integer SPELLID = 'BlSt'
private integer ECOUNTED
private integer ACOUNTED
private constant real TICK = 0.1
endglobals
private struct Data
xefx xf
static unit c
real dur = 0
static real x
static real y
static method ApplyEffects takes nothing returns nothing
local unit e = GetEnumUnit()
local integer lvl = GetUnitAbilityLevel(thistype.c, SPELLID)
local real dx = GetUnitX(e) - thistype.x
local real dy = GetUnitY(e) - thistype.y
local real dist = 1-(SquareRoot(dx * dx + dy * dy)/((400+100*lvl)*2))
local real dam = dist*TICK*(2+0.2*SpellStat(.c,true)*lvl+(3.5+.75*lvl)*ECOUNTED)
local real heal = dist*TICK*(4.5+0.4*SpellStat(.c,true)*ACOUNTED)
if IsUnitEnemy(e, GetOwningPlayer(thistype.c)) then
call UnitDamageTarget(thistype.c, e, dam, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
elseif IsUnitAlly(e, GetOwningPlayer(thistype.c)) then
call SetWidgetLife(e, GetWidgetLife(e)+heal)
endif
set e = null
endmethod
static method GroupEm takes nothing returns boolean
local unit f = GetFilterUnit()
if not(IsUnitType(f, UNIT_TYPE_STRUCTURE) or IsUnitType(f, UNIT_TYPE_DEAD))then
if IsUnitEnemy(f, GetOwningPlayer(thistype.c)) then
set ECOUNTED = ECOUNTED + 1
elseif IsUnitAlly(f, GetOwningPlayer(thistype.c)) then
set ACOUNTED = ACOUNTED + 1
endif
return true
endif
set f = null
return false
endmethod
static method Timer takes nothing returns nothing
local Data D = Data(GetTimerData(GetExpiredTimer()))
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
set D.dur = D.dur + TICK
set ACOUNTED = 0
set ECOUNTED = 0
set thistype.c = D.c
set thistype.x = D.x
set thistype.y = D.y
call GroupEnumUnitsInArea(ENUM_GROUP, D.xf.x, D.xf.y, 400+100*lvl, Filter(function Data.GroupEm))
call ForGroup(ENUM_GROUP, function Data.ApplyEffects)
if D.dur >= 9+1 or GetUnitCurrentOrder(D.c) != OrderId("barkskin") then
if GetUnitCurrentOrder(D.c) != OrderId("barkskin") then
call IssueImmediateOrder(D.c, "stop")
call SetUnitAnimation(D.c, "stand")
endif
call D.xf.destroy()
call ReleaseTimer(GetExpiredTimer())
call D.destroy()
endif
endmethod
static method create takes unit c, real x, real y returns Data
local Data D = Data.allocate()
local timer tim
set D.x = x
set D.y = y
set D.xf = xefx.create(x,y,GetUnitFacing(c))
set D.xf.z = 320+20*GetUnitAbilityLevel(c, SPELLID)
set D.xf.owner = GetOwningPlayer(c)
set D.xf.abilityid = 'duBS'
set D.xf.fxpath = GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0)
set D.xf.abilityLevel = GetUnitAbilityLevel(c, SPELLID)
set D.c = c
set tim = NewTimer()
call SetTimerData(tim,D)
call TimerStart(tim, TICK, true, function Data.Timer)
return D
endmethod
endstruct
private function Actions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddAction(t, function Actions)
call XE_PreloadAbility(SPELLID)
set t=null
endfunction
endscope
//TESH.scrollpos=67
//TESH.alwaysfold=0
scope Whirlwind initializer init
globals
private constant integer SPELLID = 'WhWi'
private constant attacktype atype = ATTACK_TYPE_MELEE
private constant damagetype dtype = DAMAGE_TYPE_UNIVERSAL
endglobals
private struct Data extends xecollider
static thistype temp
unit caster
group g
integer i
static method EndIt takes nothing returns nothing
local unit u = GetEnumUnit()
local real dam = GetUnitFlyHeight(u)*(SpellStat(temp.caster, true)*0.02)
call SetUnitInvulnerable(u, false)
call UnitDamageTarget(temp.caster, u, dam, true, false, atype, dtype, wtype)
call SetUnitFlyHeight(u, GetUnitDefaultFlyHeight(u), 10*GetUnitFlyHeight(u))
call SetUnitPathing(u,true)
endmethod
static method GroupMove takes nothing returns nothing
local real dx = GetUnitX(GetEnumUnit()) - temp.x
local real dy = GetUnitY(GetEnumUnit()) - temp.y
local real dist = SquareRoot(dx*dx + dy*dy)
local real a = Atan2(dy,dx)+0.07
call SetUnitPosition(GetEnumUnit(), temp.x + dist*Cos(a), temp.y + dist*Sin(a))
call SetUnitFlyHeight(GetEnumUnit(), GetUnitFlyHeight(GetEnumUnit()) + 2.25, 0)
endmethod
method loopControl takes nothing returns nothing
local real lvl = GetUnitAbilityLevel(this.caster, SPELLID)
local real dam
set this.i = this.i + 1
set this.scale = 0.4+0.005*this.i
set this.collisionSize = this.collisionSize+0.9
set temp = this
set temp.i = this.i
call ForGroup(this.g, function Data.GroupMove)
if GetUnitCurrentOrder(this.caster) != OrderId("tornado") then
call ForGroup(.g, function Data.EndIt)
call ReleaseGroup(this.g)
call this.terminate()
endif
endmethod
method onUnitHit takes unit target returns nothing
if IsUnitEnemy(target, GetOwningPlayer(.caster)) and not(IsUnitType(target,UNIT_TYPE_STRUCTURE) or IsUnitType(target,UNIT_TYPE_FLYING) or IsUnitInGroup(target,.g)) then
call GroupAddUnit(.g, target)
call UnitAddAbility(target,XE_HEIGHT_ENABLER)
call UnitRemoveAbility(target,XE_HEIGHT_ENABLER)
call SetUnitPathing(target,false)
call SetUnitInvulnerable(target,true)
endif
endmethod
static method Actions takes unit c, real x, real y returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local Data xc = Data.create(x, y, 0)
set xc.g = NewGroup()
set xc.caster = c
set xc.expirationTime = 999999
set xc.collisionSize = 70
set xc.fxpath = GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0)
set xc.scale = 0.4
set xc.i = 0
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.Actions(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope BlazeShield initializer InitTrig_Blaze_Shield
globals
private constant integer SPELLID = 'BlSh'
private constant integer BUFFID = 'BBlz'
private constant attacktype atype = ATTACK_TYPE_MAGIC
private constant damagetype dtype = DAMAGE_TYPE_MAGIC
endglobals
private struct Data extends xecollider
unit caster
unit target
method onUnitHit takes unit target returns nothing
local real dam = SpellStat(.caster, true)*(0.3)
if target == .target then
call UnitDamageTarget(.caster, target, dam, true, false, atype, dtype, wtype)
call .terminate()
endif
endmethod
static method Actions takes unit c, unit t returns nothing
local real ang = Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c))
local Data xc
set xc = Data.create(GetUnitX(c), GetUnitY(c), ang)
set xc.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set xc.speed = 900
set xc.expirationTime = 1.5
set xc.z = 60.0
set xc.collisionSize = 14
set xc.caster = c
set xc.target = t
endmethod
static method Conditions takes nothing returns boolean
if GetUnitAbilityLevel(GetTriggerUnit(), BUFFID) > 0 then
call Actions(GetTriggerUnit(), GetAttacker())
endif
return false
endmethod
endstruct
//===========================================================================
public function InitTrig_Blaze_Shield takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, function Data.Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=101
//TESH.alwaysfold=0
///////////////////////////////////////////////////
// Fire Storm
// by: Adiktuz
///////////////////////////////////////////////////
scope LandSlide initializer S_Init
//configurables
globals
private constant integer FLY = 'Amrf' //Rawcode of Medivh's raven form
private constant integer DUMMY = 'e002' //Rawcode of the dummy unit(vertical)
private constant integer SPELL = 'RoDr' //Rawcode of the spell
private constant integer MAX = 4 //Base number of meteors created
private constant integer MAX_I = 2 //Increment in the number of meteors created per level
private constant real SPEED = 20 //The rate at which the meteors fall, higher number = faster fall
private constant real SPEEDMAX = 30 //The max rate at which the meteor will fall if RANDOM = true
private constant real SPEEDMIN = 12 //The min rate at which the meteor will fall if RANDOM = true
private constant real MAXHEIGHT = 800 //The max height of each meteor upon creation
private constant real MINHEIGHT = 500 //The min height of each meteor upon creation
private constant real AOE = 50 //The base radius of the spell
private constant real AOE_I = 75 //Bonus radius of the spell per level
private constant real RADIUS = 125 //The radius of the meteor's damage
private constant string EFFECT = "Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl" //The effect when the meteor explodes
private constant string METEOR = "Abilities\\Weapons\\RockBoltMissile\\RockBoltMissile.mdl" //The effect of the meteor
private attacktype ATYPE = ATTACK_TYPE_NORMAL //The attack type of the spell
private damagetype DTYPE = DAMAGE_TYPE_MAGIC //The damage type of the spell
//End of configurables
private integer array Data
private integer Total = 0
private timer t = CreateTimer()
private group Temp = CreateGroup()
endglobals
private struct S
real x
real y
unit u
player owner
real height
effect meteor
real damage
method onDestroy takes nothing returns nothing
local unit a
local rect r = Rect(this.x - RADIUS, this.y - RADIUS, this.x + RADIUS, this.y + RADIUS)
call DestroyEffect(AddSpecialEffect(EFFECT, this.x, this.y))
call GroupEnumUnitsInRange(Temp, this.x, this.y, RADIUS, null)
loop
set a = FirstOfGroup(Temp)
exitwhen a == null
if (IsPlayerEnemy(GetOwningPlayer(a), this.owner) and GetWidgetLife(a) > .405) then
call UnitDamageTarget(this.u, a, this.damage, false, false , ATYPE, DTYPE, WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(Temp, a)
endloop
set a = null
call DestroyEffect(this.meteor)
call UnitApplyTimedLife(this.u, 'BTLF', 1.00)
call RemoveRect(r)
set this.u = null
set this.owner = null
set this.meteor = null
endmethod
static method Screate takes real x, real y, player p, integer level, unit c returns nothing
local S dat = S.create()
set Data[Total] = dat
set dat.owner = p
set dat.x = x + GetRandomReal(-(AOE + AOE_I*level), (AOE + AOE_I*level))
set dat.y = y + GetRandomReal(-(AOE + AOE_I*level), (AOE + AOE_I*level))
set dat.u = CreateUnit(dat.owner, DUMMY, dat.x, dat.y, 0.00)
set dat.height = GetRandomReal(MINHEIGHT, MAXHEIGHT)
set dat.damage = (0.5+0.2*level)*SpellStat(c,true)+25+20*level
call UnitAddAbility(dat.u, FLY)
call UnitRemoveAbility(dat.u, FLY)
call SetUnitFlyHeight(dat.u, dat.height, 0.0)
set dat.meteor = AddSpecialEffectTarget(METEOR, dat.u, "origin")
set Total = Total + 1
if Total == 1 then
call TimerStart(t, .03, true, function S.move)
endif
set p = null
endmethod
static method move takes nothing returns nothing
local S dat
local integer i = 0
loop
exitwhen i == Total
set dat = Data[i]
set dat.height = dat.height - GetRandomReal(SPEEDMIN, SPEEDMAX)
call SetUnitFlyHeight(dat.u, dat.height, 0.00)
if dat.height < 1 then
call dat.destroy()
set Total = Total - 1
set Data[i] = Data[Total]
set i = i - 1
endif
set i = i + 1
endloop
if Total == 0 then
call PauseTimer(t)
endif
endmethod
static method Start takes nothing returns nothing
local integer i = 0
local unit a = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local integer level = GetUnitAbilityLevel(a, GetSpellAbilityId())
loop
exitwhen i > (MAX + MAX_I*level)
call S.Screate(x,y,GetOwningPlayer(a),level,a)
set i = i + 1
endloop
set a = null
endmethod
endstruct
private function SCheck takes nothing returns boolean
return GetSpellAbilityId() == SPELL
endfunction
private function S_Init takes nothing returns nothing
local trigger Meteor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(Meteor, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Meteor, function SCheck)
call TriggerAddAction(Meteor, function S.Start)
set Meteor = null
call XE_PreloadAbility(SPELL)
endfunction
endscope
//TESH.scrollpos=20
//TESH.alwaysfold=0
scope TidalHaven initializer Init
globals
private unit TempUnit
private constant integer SPELLID = 'THav'
endglobals
private struct Data
unit c
real dur
static method create takes unit caster returns Data
local Data D = Data.allocate()
set D.c = caster
set D.dur = 0
return D
endmethod
endstruct
private function GroupEnum takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TempUnit, SPELLID)
local integer INT = SpellStat(TempUnit, true)
if IsUnitAlly(GetFilterUnit(), GetOwningPlayer(TempUnit)) then
call SetWidgetLife(GetFilterUnit(), GetWidgetLife(GetFilterUnit()) + 35*lvl + 0.7*SpellStat(TempUnit,true))
call DestroyEffect( AddSpecialEffectTarget( "HealingWater.mdx", GetFilterUnit(), "origin" ) )
endif
return true
endfunction
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local group g = NewGroup()
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
set TempUnit = D.c
if D.dur >= 5 and not(GetUnitCurrentOrder(D.c) == OrderId("tranquility")) then
call ReleaseTimer(tim)
call D.destroy()
else
call GroupEnumUnitsInArea(g, GetUnitX(D.c), GetUnitY(D.c), 300. + 100*lvl, Filter(function GroupEnum))
set D.dur = D.dur + 1
endif
call ReleaseGroup(g)
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELLID
endfunction
private function Actions takes nothing returns nothing
local timer tim = NewTimer()
local Data D = Data.create(GetTriggerUnit())
call SetTimerData(tim,D)
call TimerStart(tim, 1.0, true, function Timer)
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope VenomGlandItem initializer init
globals
private constant integer ITEMID = 'veno'
endglobals
private function Conditions takes nothing returns boolean
local integer i = 0
local item indexItem
loop
set indexItem = UnitItemInSlot(GetAttacker(), i)
if indexItem != null and GetItemTypeId(indexItem) == ITEMID then
call SetItemCharges(indexItem, GetItemCharges(indexItem)-1)
if GetItemCharges(indexItem) < 1 and not IsUnitIllusion(GetAttacker()) then
call UnitRemoveItem(GetAttacker(), indexItem)
call RemoveItem(indexItem)
endif
return false
endif
set i = i + 1
exitwhen i >= bj_MAX_INVENTORY
endloop
return true
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope StackScavange initializer init
globals
private constant integer ITEMID1 = 'veno'
private constant integer ITEMID2 = 'band'
private constant integer ITEMID3 = 'herb'
endglobals
private function Pickup_Scavange_Conditions takes nothing returns boolean
local integer i = 0
local item indexItem
local item triggerItem = GetManipulatedItem()
if GetItemTypeId(triggerItem) == ITEMID1 or GetItemTypeId(triggerItem) == ITEMID2 or GetItemTypeId(triggerItem) == ITEMID3 then
loop
set indexItem = UnitItemInSlot(GetTriggerUnit(), i)
if indexItem != null and GetItemTypeId(indexItem) == GetItemTypeId(triggerItem) and triggerItem != indexItem then
call SetItemCharges(indexItem, GetItemCharges(indexItem)+GetItemCharges(triggerItem))
call UnitRemoveItem(GetTriggerUnit(), triggerItem)
call RemoveItem(triggerItem)
return false
endif
set i = i + 1
exitwhen i >= bj_MAX_INVENTORY
endloop
endif
return true
endfunction
//===========================================================================
private function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( t, function Pickup_Scavange_Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=18
//TESH.alwaysfold=0
scope Scavange initializer Init
globals
private constant integer SPELLID = 'Scav'
private constant real tick = 1
endglobals
private struct Data
unit c
real d
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
local texttag tag = CreateTextTag()
local integer i = 0
local item indexItem
call SetTextTagPos(tag, GetUnitX(D.c), GetUnitY(D.c), 0.00)
call SetTextTagVelocity(tag, 0, 0.04)
call SetTextTagVisibility(tag, true)
call SetTextTagFadepoint(tag, 1)
call SetTextTagLifespan(tag, 0.8)
call SetTextTagPermanent(tag, false)
//If the spell is not being channeled or the caster runs out of mana, then stop the spell
if GetUnitCurrentOrder(D.c) == OrderId("phaseshift") then
if GetRandomInt(0, 100) < 30+5*lvl then
call SetTextTagColor(tag, 0, 175, 0, 255)
call SetTextTagText(tag, "Success!", 0.024)
call UnitAddItemById(D.c, 'band')
//Set chances for Item lvl 2
elseif GetRandomInt(0, 100) <= 40+5*lvl then
call SetTextTagColor(tag, 0, 205, 55, 255)
call SetTextTagText(tag, "Success!", 0.024)
call UnitAddItemById(D.c, 'herb')
//Set chances for Item lvl 3
elseif GetRandomInt(0, 100) <= 50+5*lvl then
call SetTextTagColor(tag, 0, 155, 105, 255)
call SetTextTagText(tag, "Success!", 0.024)
call UnitAddItemById(D.c, 'veno')
else
call SetTextTagColor(tag, 175, 0, 0, 255)
call SetTextTagText(tag, "Failure!", 0.024)
endif
else
call D.destroy()
call ReleaseTimer(tim)
endif
set D.d = D.d + tick
endmethod
static method create takes unit caster returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.c = caster
set D.d = 1
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(t,function Conditions)
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=14
//TESH.alwaysfold=0
scope ArrowVolley initializer InitTrig_Arrow_Volley
globals
private constant integer SPELLID = 'MuSh'
private constant attacktype atype = ATTACK_TYPE_PIERCE
private constant damagetype dtype = DAMAGE_TYPE_NORMAL
private constant string FX = "Abilities\\Weapons\\Arrow\\ArrowMissile.mdl"
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
unit target
method onUnitHit takes unit target returns nothing
local integer lvl = GetUnitAbilityLevel(this.caster, SPELLID)
local real dam = 45 + GetUnitBonus(TEMP, BONUS_DAMAGE) + SpellStat(TEMP, false) * (0.7 + lvl*0.2)
if target == .target then
call UnitDamageTarget(this.caster, target, dam, true, false, atype, dtype, wtype)
call .terminate()
endif
endmethod
static method GroupEm takes nothing returns boolean
local unit un = GetFilterUnit()
local real ang = Atan2(GetUnitY(un) - GetUnitY(TEMP), GetUnitX(un) - GetUnitX(TEMP))
local Data xc
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) then
set xc = Data.create(GetUnitX(TEMP), GetUnitY(TEMP), ang)
set xc.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set xc.speed = 900
set xc.expirationTime = 3
set xc.z = 60.0
set xc.caster = TEMP
set xc.target = un
else
call xc.terminate()
endif
set un = null
return false
endmethod
static method Conditions takes nothing returns boolean
local location loc = GetUnitLoc(GetTriggerUnit())
local real a = Atan2(GetSpellTargetY() - GetUnitY(GetTriggerUnit()), GetSpellTargetX() - GetUnitX(GetTriggerUnit()))*bj_RADTODEG
local group g = NewGroup()
if GetSpellAbilityId() == SPELLID then
set TEMP = GetTriggerUnit()
call GroupEnumUnitsInCone(g, loc, 600., a, 125, 125, Filter(function Data.GroupEm))
endif
call RemoveLocation(loc)
set loc = null
call ReleaseGroup(g)
return false
endmethod
endstruct
//===========================================================================
public function InitTrig_Arrow_Volley takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SnareShot initializer InitTrig_Snare_Shot
globals
private constant integer SPELLID = 'SnSh'
private constant integer DUMMYID = 'duSS'
private constant attacktype atk = ATTACK_TYPE_PIERCE
private constant damagetype dmg = DAMAGE_TYPE_MAGIC
endglobals
private struct snareShot extends xecollider
unit caster
unit t
lightning l
real dur
method onUnitHit takes unit target returns nothing
local xecast xc = xecast.createBasicA(DUMMYID,OrderId("ensnare"),GetOwningPlayer(.caster))
local real dam = SpellStat(this.caster,true)/2 + GetUnitBonus(this.caster, BONUS_DAMAGE)
if IsUnitType(target, UNIT_TYPE_STRUCTURE) == false and IsUnitEnemy(target, GetOwningPlayer(this.caster)) then
set xc.level= GetUnitAbilityLevel(.caster,SPELLID)
call xc.castOnTarget(target)
call UnitDamageTarget( this.caster, target, dam, true, false, atk, dmg, wtype)
call this.terminate()
call xc.destroy()
else
call ShowUnit(this.caster, true)
endif
endmethod
endstruct
private function Actions takes unit c returns nothing
local real a= Atan2(GetSpellTargetY() - GetUnitY(c), GetSpellTargetX() - GetUnitX(c))
local snareShot xc
set xc = snareShot.create(GetUnitX(c), GetUnitY(c), a )
set xc.expirationTime = 1
set xc.collisionSize = 15.0
set xc.speed = 700
set xc.acceleration = 500
set xc.maxSpeed = 1500
set xc.caster = c
set xc.z = 65
set xc.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
endfunction
//======================Conditions & Events=================================
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endfunction
public function InitTrig_Snare_Shot takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=20
//TESH.alwaysfold=0
function Summon_Owl_Actions takes unit s, unit c returns nothing
local integer lvl = GetUnitAbilityLevel(c, 'A00O')
local integer DamageBonus = R2I(SpellStat(c, false)*(0.3+0.1*lvl))
local integer ArmorBonus = R2I(GetUnitBonus(c, BONUS_ARMOR)/(6.0-0.5*lvl))
local real HPBonus = 175+125*lvl+GetUnitState(c, UNIT_STATE_MAX_MANA)/7
local real MPBonus = 10*lvl+GetUnitState(c, UNIT_STATE_MAX_LIFE)/10
call AddUnitMaxState(s, UNIT_STATE_MAX_LIFE, HPBonus)
call AddUnitMaxState(s, UNIT_STATE_MAX_MANA, MPBonus)
call AddUnitBonus(s, BONUS_DAMAGE, DamageBonus)
call AddUnitBonus(s, BONUS_ARMOR, ArmorBonus)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById('A00O', EFFECT_TYPE_MISSILE, 0),GetUnitX(Slave[GetUnitId(c)]), GetUnitY(Slave[GetUnitId(c)])))
call RemoveUnit(Slave[GetUnitId(c)])
call Permanence_Data.create( c, s )
call UnitRemoveAbility(c, 'revi')
if GetHeroInt(c,true) > 40 then
set SpellID1[GetUnitId(c)] = 'dive'
call UnitAddAbility(s, 'dive')
call SetUnitAbilityLevel(s, 'dive', lvl-2 )
else
set SpellID1[GetUnitId(c)] = 0
endif
if GetHeroAgi(c,true) > 35 then
set SpellID2[GetUnitId(c)] = 'evas'
call UnitAddAbility(s, 'evas')
call SetUnitAbilityLevel(s, 'evas', lvl-1 )
else
set SpellID2[GetUnitId(c)] = 0
endif
if SpellStat(c,true) > 60 then
set SpellID3[GetUnitId(c)] = 'floc'
call UnitAddAbility(s, 'floc')
else
set SpellID3[GetUnitId(c)] = 0
endif
set UnitBounty[GetUnitId(s)] = SpellStat(c, true)
endfunction
function Summon_Owl_Conditions takes nothing returns boolean
if GetUnitTypeId(GetSummonedUnit()) == 'now4' and not IsUnitIllusion(GetSummonedUnit()) then
call Summon_Owl_Actions(GetSummonedUnit(), GetSummoningUnit())
endif
return false
endfunction
//===========================================================================
function InitTrig_Summon_Owl takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( t, function Summon_Owl_Conditions )
endfunction
//TESH.scrollpos=48
//TESH.alwaysfold=0
scope AbsORBtion initializer init
globals
private constant integer SPELLID = 'Aorb'
private constant integer LIFE = 'LCom'
private constant integer MANA = 'MCom'
endglobals
private struct Data extends xecollider
unit caster
integer i
real ang
method loopControl takes nothing returns nothing
set .ang = .ang + 0.095
set .x = GetUnitX(.caster) + 200*Cos(.ang)
set .y = GetUnitY(.caster) + 200*Sin(.ang)
endmethod
method onUnitHit takes unit target returns nothing
local xedamage d=xedamage.create()
local integer lvl = GetUnitAbilityLevel(.caster,SPELLID)
local real dam = SpellStat(.caster,true)*(0.3+0.1*lvl) + 30+40*lvl
local real hp = GetWidgetLife(target)
set d.dtype = DAMAGE_TYPE_MAGIC
set d.atype = ATTACK_TYPE_MAGIC
if IsUnitEnemy(target, GetOwningPlayer(this.caster)) and not(IsUnitType(target, UNIT_TYPE_FLYING)) then
if .i == 1 then
call d.damageTarget(.caster, target, dam)
set hp = hp-GetWidgetLife(target)
call SetWidgetLife(.caster, GetWidgetLife(.caster) + hp*0.25)
else
set dam = dam * 0.65
call SetUnitState(target, UNIT_STATE_MANA, GetUnitState(target, UNIT_STATE_MANA) - dam)
call SetUnitState(.caster, UNIT_STATE_MANA, GetUnitState(.caster, UNIT_STATE_MANA) + dam*0.5)
endif
call .flash(GetAbilityEffectById(SPELLID, EFFECT_TYPE_AREA_EFFECT, 0))
call this.terminate()
endif
call d.destroy()
endmethod
static method Actions takes unit c returns nothing
local real angle = Atan2(GetUnitFacing(c) - GetUnitY(c), GetUnitFacing(c) - GetUnitX(c))
local Data xc = Data.create(GetUnitX(c)+200*Cos(angle), GetUnitY(c)+200*Sin(angle), 0)
if GetUnitAbilityLevel(c, MANA) > 0 then
set xc.i = 2
elseif GetUnitAbilityLevel(c,LIFE) > 0 then
set xc.i = 1
else
set xc.i = GetRandomInt(1,2)
endif
set xc.caster = c
set xc.expirationTime = 7.5
set xc.collisionSize = 30
if xc.i == 1 then
set xc.fxpath = GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0)
else
set xc.scale = 2
set xc.fxpath = GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 1)
endif
set xc.ang = angle
set xc.z = 60
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.Actions(GetTriggerUnit())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
endfunction
endscope
//TESH.scrollpos=18
//TESH.alwaysfold=0
scope CounterPierce initializer init
globals
private constant integer SPELLID = 'CoPi'
private constant real TICK = 1.0
private trigger array EventTrigger
endglobals
public struct Data
unit c
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
set lvl = GetUnitAbilityLevel(.c, SPELLID)
if lvl == 0 then
call DestroyTrigger(EventTrigger[GetUnitId(.c)])
set EventTrigger[GetUnitId(.c)] = null
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endif
endmethod
static method Counter takes nothing returns nothing
local integer i = GetRandomInt(1,100)
local unit c = GetTriggerUnit()
local unit t = GetEventDamageSource()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
if i <= 10 then
call SetWidgetLife(c, GetWidgetLife(c)+GetEventDamage()*(0.4+0.2*lvl))
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_SPECIAL, 0), c, "origin"))
if GetWidgetLife(t) > GetEventDamage()*(0.5+0.1*lvl) then
call SetWidgetLife(t, GetWidgetLife(t)-GetEventDamage()*(0.5+0.1*lvl))
else
call UnitDamageTarget(c, t, GetEventDamage()*(0.5+0.1*lvl), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endif
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_TARGET, 0), t, "origin"))
endif
set c = null
endmethod
static method Actions takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
set .c = c
set EventTrigger[GetUnitId(c)] = CreateTrigger()
call TriggerRegisterUnitEvent(EventTrigger[GetUnitId(c)], c, EVENT_UNIT_DAMAGED)
call TriggerAddAction(EventTrigger[GetUnitId(c)], function thistype.Counter)
call SetTimerData(tim,this)
call TimerStart(tim, TICK, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns nothing
if GetLearnedSkill() == SPELLID then
call thistype.Actions(GetTriggerUnit())
endif
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction( t, function Data.Conditions )
set t= null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Dryad_Strike_Actions takes unit c, unit t returns nothing
local xecast xc = xecast.createA()
local integer lvl = GetUnitAbilityLevel(c, 'DrSt')
local real dam = lvl*35+25 + SpellStat(c,true)*(0.25+0.25*lvl)
call UnitDamageTarget(c, t, dam, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_SLOW_POISON, wtype)
set xc.abilityid = 'A012'
set xc.orderstring = "entanglingroots"
set xc.owningplayer = GetOwningPlayer(c)
call xc.castOnTarget( t )
endfunction
function Trig_Dryad_Strike_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'DrSt' then
call Trig_Dryad_Strike_Actions(GetTriggerUnit(), GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
function InitTrig_Dryad_Strike takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Dryad_Strike_Conditions ) )
set t = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Give_Combustion_Conditions takes nothing returns boolean
if GetLearnedSkill() == 'LMCo' then
call UnitAddAbility(GetTriggerUnit(), 'MCom')
endif
return true
endfunction
//===========================================================================
function InitTrig_Give_Combustion takes nothing returns nothing
set gg_trg_Give_Combustion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Give_Combustion, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_Give_Combustion, Condition( function Trig_Give_Combustion_Conditions ) )
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope ManaCombustion initializer InitTrig_Combustion
globals
private constant integer SPELLID = 'LMCo'
private constant integer LIFE = 'LCom'
private constant integer MANA = 'MCom'
private trigger array EventTrigger
endglobals
private function Conditions2 takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetEventDamageSource(), SPELLID)
if GetUnitAbilityLevel(GetEventDamageSource(), LIFE) > 0 then
call SetUnitState(GetTriggerUnit(), UNIT_STATE_MANA, GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) - (0.025+0.075*lvl)*GetEventDamage())
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl", GetTriggerUnit(), "origin"))
call DestroyTrigger(EventTrigger[GetUnitId(GetTriggerUnit())])
set EventTrigger[GetUnitId(GetTriggerUnit())] = null
elseif GetUnitAbilityLevel(GetEventDamageSource(), MANA) > 0 then
call SetWidgetLife(GetTriggerUnit(), GetWidgetLife(GetTriggerUnit()) + (0.975-0.075*lvl)*GetEventDamage())
call SetUnitState(GetTriggerUnit(), UNIT_STATE_MANA, GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) - GetEventDamage())
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Feedback\\ArcaneTowerAttack.mdl", GetTriggerUnit(), "origin"))
call DestroyTrigger(EventTrigger[GetUnitId(GetTriggerUnit())])
set EventTrigger[GetUnitId(GetTriggerUnit())] = null
endif
return false
endfunction
private function Conditions takes nothing returns boolean
set EventTrigger[GetUnitId(GetTriggerUnit())] = CreateTrigger()
if GetUnitAbilityLevel(GetAttacker(), SPELLID) > 0 then
call TriggerRegisterUnitEvent(EventTrigger[GetUnitId(GetTriggerUnit())], GetTriggerUnit(), EVENT_UNIT_DAMAGED)
call TriggerAddCondition(EventTrigger[GetUnitId(GetTriggerUnit())], function Conditions2)
else
call DestroyTrigger(EventTrigger[GetUnitId(GetTriggerUnit())])
set EventTrigger[GetUnitId(GetTriggerUnit())] = null
endif
return false
endfunction
//===========================================================================
public function InitTrig_Combustion takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Conditions ) )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function L2MCombustion_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'LMCo' then
if GetUnitAbilityLevel(GetTriggerUnit(), 'LCom') > 0 then
call UnitRemoveAbility(GetTriggerUnit(), 'LCom')
call UnitAddAbility(GetTriggerUnit(), 'MCom')
elseif GetUnitAbilityLevel(GetTriggerUnit(), 'MCom') > 0 then
call UnitRemoveAbility(GetTriggerUnit(), 'MCom')
call UnitAddAbility(GetTriggerUnit(), 'LCom')
endif
endif
return false
endfunction
//===========================================================================
function InitTrig_L2MCombustion takes nothing returns nothing
set gg_trg_L2MCombustion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_L2MCombustion, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_L2MCombustion, Condition( function L2MCombustion_Conditions ) )
endfunction
//TESH.scrollpos=26
//TESH.alwaysfold=0
scope Starfall initializer I
globals
private constant integer SPELLID = 'StFa'
endglobals
private struct Data
unit c
timer tim
timer tim1
integer lvl
real dur
real x
real y
real x1
real y1
static method Star takes nothing returns nothing
local xedamage d=xedamage.create()
local thistype this = GetTimerData(GetExpiredTimer())
local real dam = .lvl*20+20+SpellStat(.c, true)*(0.4+0.2*.lvl)
call d.factor( UNIT_TYPE_STRUCTURE, 0.2 )
set d.atype= ATTACK_TYPE_NORMAL
set d.dtype= DAMAGE_TYPE_MAGIC
call d.damageAOE(.c, .x1, .y1, 60, dam)
call ReleaseTimer(.tim1)
call d.destroy()
call .destroy()
endmethod
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local real d = SquareRoot(GetRandomReal(50 * 50, (250+50*.lvl) * (250+50*.lvl)))
local real ang = GetRandomReal(0,2*bj_PI)
set .x1 = .x + d * Cos(ang)
set .y1 = .y + d * Sin(ang)
if GetUnitCurrentOrder(.c) == OrderId("starfall") then
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0), .x1, .y1))
set .tim1 = NewTimer()
call SetTimerData(.tim1, this)
call TimerStart(.tim1, 0.3, false, function thistype.Star)
else
set .c = null
call .destroy()
endif
set .dur = .dur + 0.3
call ReleaseTimer(.tim)
endmethod
static method create takes unit c, real x, real y, integer i returns thistype
local thistype this = thistype.allocate()
set .tim = NewTimer()
set .c = c
set .x = x
set .y = y
set .dur = 0
set .lvl = GetUnitAbilityLevel(.c, SPELLID)
call SetTimerData(.tim,this)
call TimerStart(.tim, 0.3*i+GetRandomReal(0.1,-0.1), true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns nothing
local integer i = 1
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
if GetSpellAbilityId() == SPELLID then
loop
call Data.create(GetTriggerUnit(), x, y, i)
exitwhen i > lvl*10+8
set i = i + 1
endloop
endif
endfunction
//===========================================================================
public function I takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope LunarBlessing initializer init
globals
private constant integer SPELLID = 'LuBl'
private constant integer BUFFID = 'BLuB'
private unit array CASTER
private trigger array EVENT
private effect array LunarFX
endglobals
private struct Data
unit c
unit t
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call DestroyEffect(LunarFX[GetUnitId(D.t)])
call ReleaseTimer(tim)
call DestroyTrigger(EVENT[GetUnitId(D.t)])
set EVENT[GetUnitId(D.t)] = null
set D.c = null
set LunarFX[GetUnitId(D.t)] = null
set D.t = null
call D.destroy()
endmethod
static method Conditions takes nothing returns boolean
local unit caster = CASTER[GetUnitId(GetTriggerUnit())]
local integer lvl = GetUnitAbilityLevel(caster, SPELLID)
if GetUnitAbilityLevel(GetTriggerUnit(), BUFFID) > 0 then
if GetRandomInt(1,3) == 3 then
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,1), GetTriggerUnit(), "origin"))
endif
call SetWidgetLife(GetTriggerUnit(), GetWidgetLife(GetTriggerUnit()) + GetEventDamage()*(0.05+0.03*lvl))
else
call UnitRemoveAbility(GetTriggerUnit(), BUFFID)
call DestroyEffect(LunarFX[GetUnitId(GetTriggerUnit())])
call DestroyTrigger(EVENT[GetUnitId(GetTriggerUnit())])
set EVENT[GetUnitId(GetTriggerUnit())] = null
set LunarFX[GetUnitId(GetTriggerUnit())] = null
endif
set caster = null
return false
endmethod
static method create takes unit caster, unit target, integer lvl returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.c = caster
set D.t = target
set CASTER[GetUnitId(target)] = D.c
if EVENT[GetUnitId(D.t)] == null then
set EVENT[GetUnitId(D.t)] = CreateTrigger()
call TriggerRegisterUnitEvent(EVENT[GetUnitId(D.t)], D.t, EVENT_UNIT_DAMAGED)
call TriggerAddCondition(EVENT[GetUnitId(D.t)], function Data.Conditions)
endif
if LunarFX[GetUnitId(D.t)] == null then
set LunarFX[GetUnitId(D.t)] = AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,0), D.t, "origin")
endif
call SetTimerData(tim,D)
call TimerStart(tim, 7, false, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit(), GetUnitAbilityLevel(GetTriggerUnit(), SPELLID))
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Moonfire initializer init
globals
private constant integer SPELLID = 'MoFi'
private constant real tick = 0.1
endglobals
struct Data
unit c
unit t
real dur = 0
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
local real dam = (GetRandomReal(17+3*lvl,lvl*3+52*(0.03*SpellStat(.c, true))))*tick
local xedamage d
if .dur < 3 then
if IsUnitEnemy(.t, GetOwningPlayer(.c)) then
set d =xedamage.create()
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_MAGIC
call d.damageTarget(.c,.t,dam)
else
call SetWidgetLife(.t, GetWidgetLife(.t)+(dam*(1+0.15*lvl)))
endif
else
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endif
set .dur = .dur + tick
endmethod
static method create takes unit c, unit t returns thistype
local thistype this = thistype.allocate()
local timer tim = NewTimer()
set .c = c
set .t = t
call SetTimerData(tim, this)
call TimerStart(tim, tick, true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(),GetSpellTargetUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=19
//TESH.alwaysfold=0
function Summon_MoonEle_Actions takes unit s, unit c returns nothing
local real lvl = GetUnitAbilityLevel(c, 'SuME')
local real HPBonus = R2I(100+75*lvl+(GetUnitState(c, UNIT_STATE_MAX_MANA)/7))
local real MPBonus = R2I(15*lvl+(GetUnitState(c, UNIT_STATE_MAX_LIFE)/15))
local integer DamageBonus = R2I(SpellStat(c, false)*(0.3+0.05*lvl))
local integer ArmorBonus = R2I(GetUnitBonus(c, BONUS_ARMOR)/(6.0-0.5*lvl))
call AddUnitMaxState(s, UNIT_STATE_MAX_LIFE, HPBonus)
call AddUnitMaxState(s, UNIT_STATE_MAX_MANA, MPBonus)
call AddUnitBonus(s, BONUS_DAMAGE, DamageBonus)
call AddUnitBonus(s, BONUS_ARMOR, ArmorBonus)
set UnitBounty[GetUnitId(s)] = SpellStat(c, true)
call RemoveUnit(Slave[GetUnitId(c)])
call Permanence_Data.create( c, s )
call UnitRemoveAbility(c, 'revi')
if GetHeroInt(c,true) > 30 then
set SpellID1[GetUnitId(c)] = 'Arej'
call UnitAddAbility(s, 'Arej')
else
set SpellID1[GetUnitId(c)] = 0
endif
if GetHeroStr(c,true) > 35 then
set SpellID2[GetUnitId(c)] = 'AEah'
call UnitAddAbility(s, 'AEah')
call SetUnitAbilityLevel(s, 'AEah', GetUnitAbilityLevel(c, 'SuME')-1)
else
set SpellID2[GetUnitId(c)] = 0
endif
if SpellStat(c,true) > 60 then
set SpellID3[GetUnitId(c)] = 'LuBl'
call UnitAddAbility(s, 'LuBl')
call SetUnitAbilityLevel(s, 'LuBl', GetUnitAbilityLevel(c, 'SuME')-2)
else
set SpellID3[GetUnitId(c)] = 0
endif
set s = null
endfunction
function Summon_MoonEle_Conditions takes nothing returns nothing
if GetUnitTypeId(GetSummonedUnit()) == 'mooE' and not IsUnitIllusion(GetSummonedUnit()) then
call Summon_MoonEle_Actions(GetSummonedUnit(), GetSummoningUnit())
endif
endfunction
//===========================================================================
function InitTrig_Summon_MoonEle takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddAction( t, function Summon_MoonEle_Conditions )
endfunction
//TESH.scrollpos=1
//TESH.alwaysfold=0
scope PetalWard initializer init
globals
private constant integer SPELLID = 'PWrd'
private constant integer SUMMONID = 'pWrd'
endglobals
private function Actions takes unit s, unit c returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer DamageBonus = R2I(SpellStat(c, false)*(0.1+0.03*lvl))
local integer ArmorBonus = R2I(GetUnitBonus(c, BONUS_ARMOR)/(1.0-0.5*lvl))
local real HPBonus = 35+15*lvl+GetUnitState(c, UNIT_STATE_MAX_MANA)/12
call AddUnitMaxState(s, UNIT_STATE_MAX_LIFE, HPBonus)
call AddUnitBonus(s, BONUS_DAMAGE, DamageBonus)
call AddUnitBonus(s, BONUS_ARMOR, ArmorBonus)
set UnitBounty[GetUnitId(s)] = SpellStat(c, true)/3
if SpellStat(c, true) > 30 then
call UnitAddAbility(c, 'Afae')
elseif SpellStat(c, true) > 50 then
call UnitAddAbility(c, 'Arej')
elseif SpellStat(c, true) > 70 then
call UnitAddAbility(c, 'Ambt')
endif
endfunction
private function Conditions takes nothing returns nothing
if GetUnitTypeId(GetSummonedUnit()) == SUMMONID and not IsUnitIllusion(GetSummonedUnit()) then
call Actions(GetSummonedUnit(), GetSummoningUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddAction( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=42
//TESH.alwaysfold=0
scope AnimalAspect initializer init
globals
private constant integer SPELLID = 'AnAs'
private constant integer BOOKID = 'boAA'
private constant integer DUMMYID1 = 'tias'
private constant integer DUMMYID2 = 'owas'
private constant integer DUMMYID3 = 'tuas'
private constant integer DUMMYID4 = 'koas'
private constant integer DUMMYID5 = 'eeas'
endglobals
private function Actions takes unit c, unit t returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer i = 0
call SetPlayerAbilityAvailable(GetOwningPlayer(c), BOOKID, false)
if GetUnitAbilityLevel(c, DUMMYID1) > 0 then
set i = 1
elseif GetUnitAbilityLevel(c, DUMMYID2) > 0 then
set i = 2
elseif GetUnitAbilityLevel(c, DUMMYID3) > 0 then
set i = 3
elseif GetUnitAbilityLevel(c, DUMMYID4) > 0 then
set i = 4
elseif GetUnitAbilityLevel(c, DUMMYID5) > 0 then
set i = 5
endif
call UnitRemoveAbility(c, BOOKID)
call UnitAddAbility(c, BOOKID)
if i == 1 and not(i >= lvl)then
call UnitRemoveAbility(c, DUMMYID1)
call UnitRemoveAbility(c, DUMMYID3)
call UnitRemoveAbility(c, DUMMYID4)
call UnitRemoveAbility(c, DUMMYID5)
call SetUnitAbilityLevel(c, DUMMYID2, lvl)
call UnitMakeAbilityPermanent(c, true, DUMMYID2)
elseif i == 2 and not(i >= lvl) then
call UnitRemoveAbility(c, DUMMYID1)
call UnitRemoveAbility(c, DUMMYID2)
call UnitRemoveAbility(c, DUMMYID4)
call UnitRemoveAbility(c, DUMMYID5)
call SetUnitAbilityLevel(c, DUMMYID3, lvl)
call UnitMakeAbilityPermanent(c, true, DUMMYID3)
elseif i == 3 and not(i >= lvl) then
call UnitRemoveAbility(c, DUMMYID1)
call UnitRemoveAbility(c, DUMMYID2)
call UnitRemoveAbility(c, DUMMYID3)
call UnitRemoveAbility(c, DUMMYID5)
call SetUnitAbilityLevel(c, DUMMYID4, lvl)
call UnitMakeAbilityPermanent(c, true, DUMMYID4)
elseif i == 4 and not(i >= lvl) then
call UnitRemoveAbility(c, DUMMYID1)
call UnitRemoveAbility(c, DUMMYID2)
call UnitRemoveAbility(c, DUMMYID3)
call UnitRemoveAbility(c, DUMMYID4)
call SetUnitAbilityLevel(c, DUMMYID5, lvl)
call UnitMakeAbilityPermanent(c, true, DUMMYID5)
elseif i == 5 and not(i >= lvl) then
call UnitRemoveAbility(c, DUMMYID2)
call UnitRemoveAbility(c, DUMMYID3)
call UnitRemoveAbility(c, DUMMYID4)
call UnitRemoveAbility(c, DUMMYID5)
call SetUnitAbilityLevel(c, DUMMYID1, lvl)
call UnitMakeAbilityPermanent(c, true, DUMMYID1)
elseif i >= lvl then
call UnitRemoveAbility(c, DUMMYID2)
call UnitRemoveAbility(c, DUMMYID3)
call UnitRemoveAbility(c, DUMMYID4)
call UnitRemoveAbility(c, DUMMYID5)
call SetUnitAbilityLevel(c, DUMMYID1, lvl)
call UnitMakeAbilityPermanent(c, true, DUMMYID1)
else
call UnitRemoveAbility(c, DUMMYID2)
call UnitRemoveAbility(c, DUMMYID3)
call UnitRemoveAbility(c, DUMMYID4)
call UnitRemoveAbility(c, DUMMYID5)
call SetUnitAbilityLevel(c, DUMMYID1, lvl)
call UnitMakeAbilityPermanent(c, true, DUMMYID1)
endif
endfunction
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(),GetSpellTargetUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ManeaterGrove initializer I
globals
private constant integer SPELLID = 'MaGr'
endglobals
private struct Data
unit c
timer tim
integer lvl
real x
real y
static method Plant takes player pl, integer i, real x, real y, real ang, integer lvl, unit u returns nothing
if i == 1 then
set u = CreateUnit(pl, 'flow', x, y, ang)
call UnitApplyTimedLife(u, 'BEfn', 9+lvl*2)
call UnitAddAbility(u, 'AOcr')
call AddUnitMaxState(u, UNIT_STATE_MAX_LIFE, 50*lvl)
call AddUnitBonus(u, BONUS_DAMAGE, 5*lvl)
elseif i == 2 then
set u = CreateUnit(pl, 'tcre', x, y, ang)
call UnitApplyTimedLife(u, 'BEfn', 9+lvl*2)
call AddUnitMaxState(u, UNIT_STATE_MAX_LIFE, 50*lvl)
call AddUnitBonus(u, BONUS_DAMAGE, 5*lvl)
else
set u = CreateUnit(pl, 'vftr', x, y, ang)
call UnitApplyTimedLife(u, 'BEfn', 9+lvl*2)
call AddUnitBonus(u, BONUS_DAMAGE, 5*lvl)
endif
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0), GetUnitX(u), GetUnitY(u)))
endmethod
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local real d = SquareRoot(GetRandomReal(100 * 100, (300+100*lvl) * (400+100*.lvl)))
local real ang = GetRandomReal(0,2*bj_PI)
local unit u
local real x = .x + d * Cos(ang)
local real y = .y + d * Sin(ang)
if GetUnitCurrentOrder(.c) == OrderId("starfall") then
call thistype.Plant(GetOwningPlayer(.c), GetRandomInt(1,lvl), x, y, ang, .lvl, null)
else
set .c = null
call .destroy()
endif
call ReleaseTimer(.tim)
endmethod
static method create takes unit c, real x, real y, integer i returns thistype
local thistype this = thistype.allocate()
set .tim = NewTimer()
set .c = c
set .x = x
set .y = y
set .lvl = GetUnitAbilityLevel(.c, SPELLID)
call SetTimerData(.tim,this)
call TimerStart(.tim, 0.8*i+GetRandomReal(0.2,-0.2), true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns nothing
local integer i = 1
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
if GetSpellAbilityId() == SPELLID then
loop
call Data.create(GetTriggerUnit(), x, y, i)
exitwhen i > 3*lvl+2
set i = i + 1
endloop
endif
endfunction
//===========================================================================
public function I takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=57
//TESH.alwaysfold=0
scope GiantQuake initializer InitTrig_Giant_Quake
globals
private constant integer SPELLID = 'GiQu'
private constant real tick = 1
private unit TEMP
endglobals
private struct Data
unit c
real x
real y
real d
real r
real dur
static method create takes unit caster, real casterx, real castery, real radius returns Data
local Data D = Data.allocate()
set D.c = caster
set D.x = casterx
set D.y = castery
set D.dur = 0
set D.r = radius
return D
endmethod
endstruct
private function GroupCheck takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
endfunction
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local unit s
local group g = NewGroup()
local boolexpr b = Filter(function GroupCheck)
set TEMP = D.c
if D.dur > 5 or not( GetUnitCurrentOrder(D.c) == OrderId("voodoo") ) then
call IssuePointOrder(D.c, "move", GetUnitX(D.c), GetUnitY(D.c))
set D.c = null
call D.destroy()
call ReleaseTimer(tim)
else
call TerrainDeformRipple(D.x, D.y, D.r, 55, 25, 25, 125, 105, 15, true)
call GroupEnumUnitsInRange(g, D.x, D.y, D.r, b)
loop
set s = FirstOfGroup(g)
exitwhen s == null
if GetUnitAbilityLevel(s, 'BSmD') > 0 then
call UnitDamageTarget(D.c, s, 20.+24*GetUnitAbilityLevel(D.c, SPELLID), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
else
call UnitDamageTarget(D.c, s, 10.+12*GetUnitAbilityLevel(D.c, SPELLID), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
endif
call GroupRemoveUnit(g, s)
endloop
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", D.x, D.y))
set D.dur = D.dur + tick
call SetTimerData(tim, D)
endif
call ReleaseGroup(g)
call DestroyBoolExpr(b)
set s = null
set b = null
endfunction
private function Actions takes unit c returns nothing
local timer tim = NewTimer()
local Data D = Data.create(GetTriggerUnit(), GetUnitX(c), GetUnitY(c), 220 + 40 * GetUnitAbilityLevel(c, SPELLID))
call SetTimerData(tim, D)
call TimerStart(tim, tick, true, function Timer)
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Giant_Quake takes nothing returns nothing
local trigger Thrash = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Thrash, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Thrash, function Conditions)
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=29
//TESH.alwaysfold=0
scope MossArmor initializer InitTrig_Moss_Armor
globals
private constant integer SPELLID = 'A00T'
private constant string TurnOn = "defend"
private constant string TurnOff = "undefend"
private constant real tick = 0.1
private HandleTable info
endglobals
private struct Data
unit c
integer lvl
boolean deactivate = false
timer tim
integer mspd
integer armor
integer regen
effect fx
static method onLoop takes nothing returns nothing
local Data D = Data(GetTimerData(GetExpiredTimer()))
if not(IsUnitType(D.c,UNIT_TYPE_DEAD)) and not(D.deactivate) and GetUnitState(D.c, UNIT_STATE_MANA) >= 10 then
//Start timer
if D.lvl < GetUnitAbilityLevel(D.c, SPELLID) then
set D.armor = D.armor + 6*(GetUnitAbilityLevel(D.c, SPELLID)-D.lvl)
call AddUnitBonus(D.c, BONUS_ARMOR, 6*(GetUnitAbilityLevel(D.c, SPELLID)-D.lvl))
set D.lvl = GetUnitAbilityLevel(D.c, SPELLID)
elseif GetUnitCurrentOrder(D.c) == OrderId("move") then
call IssueImmediateOrder(D.c, "stop")
endif
call SetUnitState(D.c, UNIT_STATE_MANA, GetUnitState(D.c, UNIT_STATE_MANA) - 0.1 * GetHeroInt(D.c, true)*tick)
else
//Cleanup
call UnitRemoveType(D.c, UNIT_TYPE_STRUCTURE)
call SetUnitBonus(D.c, BONUS_MOVEMENT_SPEED, D.mspd)
call AddUnitBonus(D.c, BONUS_ARMOR, -D.armor)
call AddUnitBonus(D.c, BONUS_LIFE_REGEN, -D.regen)
call DestroyEffect(D.fx)
call IssueImmediateOrder(D.c, TurnOff)
call IssueSecondLastOrder(D.c)
call info.flush(D.c)
set D.c = null
call ReleaseTimer(D.tim)
set D.tim = null
call D.destroy()
endif
endmethod
static method create takes unit caster returns Data
local Data D = Data.allocate()
set D.c = caster
set D.lvl = GetUnitAbilityLevel(D.c, SPELLID)
set D.armor = 4+6*D.lvl
set D.regen = R2I(0.10*GetHeroStr(D.c, true))
set D.mspd = GetUnitBonus(D.c, BONUS_MOVEMENT_SPEED)
call UnitAddType(D.c, UNIT_TYPE_STRUCTURE)
call AddUnitBonus(D.c, BONUS_MOVEMENT_SPEED, -522)
call AddUnitBonus(D.c, BONUS_ARMOR, D.armor)
if D.regen == 0 then
set D.regen = R2I(0.10*SpellStat(D.c, true))
endif
call AddUnitBonus(D.c, BONUS_LIFE_REGEN, D.regen)
set D.fx = AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl", D.c, "origin")
//Timer
set D.tim = NewTimer()
call SetTimerData(D.tim,D)
call TimerStart(D.tim, tick, true, function Data.onLoop)
set info[D.c] = D
return D
endmethod
endstruct
private function Deactivate takes nothing returns boolean
local Data D
if GetIssuedOrderId() == OrderId(TurnOff) and info.exists(GetTriggerUnit()) then
set D = info[GetTriggerUnit()]
set D.deactivate = true
endif
return false
endfunction
private function Activation takes nothing returns boolean
if GetIssuedOrderId() == OrderId(TurnOn) and GetUnitAbilityLevel(GetTriggerUnit(), SPELLID) > 0 then
call Data.create(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
private function InitTrig_Moss_Armor takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition(t, function Activation )
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( t, function Deactivate )
set info = HandleTable.create()
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope SmashDown initializer InitTrig_SmashDown
private struct Data
unit c
unit t
static method onLoop takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call TerrainDeformCrater(GetUnitX(D.t), GetUnitY(D.t), 125, -100, 0, true)
call PauseUnit(D.t, false)
call SetUnitFlyHeight(D.t, GetUnitFlyHeight(D.t)+50, 0.4)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl", GetUnitX(D.t), GetUnitY(D.t)))
call ReleaseTimer(tim)
call D.destroy()
endmethod
static method create takes unit caster, unit target returns Data
local timer tim = NewTimer()
local Data D = Data.allocate()
local xecast xc = xecast.createA()
set D.c = caster
set D.t = target
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl", GetUnitX(D.t), GetUnitY(D.t)))
call PauseUnit(D.t, true)
set xc.abilityid = 'SmDB'
set xc.orderstring = "slow"
set xc.owningplayer = GetOwningPlayer(caster)
call xc.castOnTarget( target )
call UnitDamageTarget(D.c, D.t, 55+35*GetUnitAbilityLevel(D.c, 'SmDo')+SpellStat(D.c, true), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, wtype)
call TerrainDeformCrater(GetUnitX(D.t), GetUnitY(D.t), 125, 100, 0, true)
call SetTimerData(tim,D)
call TimerStart(tim, 2.5, false, function Data.onLoop)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'SmDo' then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
public function InitTrig_SmashDown takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope TauntPassive initializer init
globals
private constant integer SPELLID = 'A00P'
private constant real TICK = 1.0
endglobals
public struct Data
unit c
integer lvl
real dur
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer i = 0
local group g = NewGroup()
local unit t
set .lvl = GetUnitAbilityLevel(.c, SPELLID)
if .dur >= 7-.lvl then
call GroupEnumUnitsInRange(g, GetUnitX(.c), GetUnitY(.c), 200, BOOLEXPR_TRUE)
set .dur = 0
loop
set t = FirstOfGroup(g)
exitwhen t == null or i == 1
if IsUnitEnemy(t, GetOwningPlayer(.c)) and not(IsUnitType(t, UNIT_TYPE_DEAD)) then
call IssueTargetOrder(t, "attack", .c)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0), t, "overhead"))
set i = 1
endif
call GroupRemoveUnit(g, t)
endloop
elseif .lvl == 0 then
call ReleaseTimer(GetExpiredTimer())
call .destroy()
else
set .dur = .dur + 1
endif
call ReleaseGroup(g)
set t = null
endmethod
static method Actions takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
set .c = c
set .dur = 0
call SetTimerData(tim,this)
call TimerStart(tim, TICK, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns boolean
if GetLearnedSkill() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction( t, function Data.Conditions )
set t= null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope LivingEmber initializer init
globals
private constant integer SPELLID = 'LiEm'
endglobals
private struct Data
unit c
real x
real y
integer i
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local unit ember
local integer lvl = GetUnitAbilityLevel(.c,SPELLID)
local real ang = GetRandomReal(0,2*bj_PI)
local real x = .x+GetRandomReal(150,900)*Cos(ang)
local real y = .y+GetRandomReal(150,900)*Sin(ang)
if GetUnitCurrentOrder(.c) == OrderId("volcano") then
set ember = CreateUnit(GetOwningPlayer(.c), 'nlv1', .x, .y, GetRandomReal(0,2*bj_PI))
call SetUnitBonus(ember, BONUS_DAMAGE, R2I(lvl*7.5+0.75*SpellStat(GetTriggerUnit(),true)-.i*4))
call UnitAddAbility(ember, 'Aloc')
call UnitApplyTimedLife(ember, 'BPes', 7.5)
call IssuePointOrder(ember, "attack", x, y)
else
call .destroy()
endif
call ReleaseTimer(GetExpiredTimer())
endmethod
static method Actions takes unit c, real x, real y, integer i returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
set .c = c
set .x = x
set .y = y
set .i = i
call SetTimerData(tim,this)
call TimerStart(tim, i*1.5+GetRandomReal(-1,1), false, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(),SPELLID)
local integer i = 1
if GetSpellAbilityId() == SPELLID then
loop
exitwhen i > lvl*4+3
call thistype.Actions(GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY(),i)
set i = i + 1
endloop
endif
return true
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=20
//TESH.alwaysfold=0
scope EarthHarness initializer init
globals
private constant integer SPELLID = 'EaHa'
private constant integer DUMMYID = 'duEH'
private constant integer BUFFID = 'BEHa'
private integer COUNTED
private unit TEMP
endglobals
public struct Data
unit c
static method GroupEm takes nothing returns boolean
local unit t = GetFilterUnit()
local integer lvl = GetUnitAbilityLevel(TEMP,SPELLID)
if GetUnitAbilityLevel(t, BUFFID) > 0 and COUNTED < 3+2*lvl and not IsUnitEnemy(t, GetOwningPlayer(TEMP)) then
set COUNTED = COUNTED + 1
endif
set t = null
return false
endmethod
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
set TEMP = .c
set COUNTED = 0
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(.c), GetUnitY(.c), 1000, Filter(function thistype.GroupEm))
call SetUnitAbilityLevel(.c, DUMMYID, 3+2*lvl-COUNTED)
if lvl == 0 then
call UnitRemoveAbility(.c, DUMMYID)
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endif
endmethod
static method Actions takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
set .c = c
call SetTimerData(tim,this)
call UnitAddAbility(.c, DUMMYID)
call TimerStart(tim, 1.0, true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns nothing
if GetLearnedSkill() == SPELLID then
call Data.Actions(GetTriggerUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope RevelInDead initializer init
globals
private constant integer SPELLID = 'ReID'
private constant integer DUMMYID = 'dRID'
private integer COUNTED
private unit TEMP
endglobals
public struct Data
unit c
static method GroupEm takes nothing returns boolean
local unit t = GetFilterUnit()
local integer lvl = GetUnitAbilityLevel(TEMP,SPELLID)
if IsUnitType(t, UNIT_TYPE_DEAD) and COUNTED < 3+2*lvl then
set COUNTED = COUNTED + 1
endif
set t = null
return false
endmethod
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
set TEMP = .c
set COUNTED = 0
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(.c), GetUnitY(.c), 1000, Filter(function thistype.GroupEm))
call SetUnitAbilityLevel(.c, DUMMYID, COUNTED)
if lvl == 0 then
call UnitRemoveAbility(.c, DUMMYID)
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endif
endmethod
static method Actions takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
set .c = c
call SetTimerData(tim,this)
call UnitAddAbility(.c, DUMMYID)
call TimerStart(tim, 1.0, true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns nothing
if GetLearnedSkill() == SPELLID then
call Data.Actions(GetTriggerUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope CleavingFist initializer init
//ADD GROUP DAMAGE CLEAVE EFFECT
globals
private constant integer SPELLID = 'GuFi'
private unit CASTER
private unit TARGET
endglobals
private function GroupEm takes nothing returns boolean
local unit f = GetFilterUnit()
local integer lvl = GetUnitAbilityLevel(CASTER, SPELLID)
local xedamage d
if IsUnitEnemy(f, GetOwningPlayer(CASTER)) and not(f == TARGET or IsUnitType(f, UNIT_TYPE_DEAD) or IsUnitType(f, UNIT_TYPE_STRUCTURE)) then
set d = xedamage.create()
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_MELEE
call d.damageTarget(CASTER,f, GetWidgetLife(CASTER)*(0.04+0.01*lvl))
endif
set f = null
return false
endfunction
private function Conditions takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local real dam = (1.2+0.1*lvl)*(SpellStat(c,true)*0.5)+GetUnitBonus(c,BONUS_DAMAGE)
local xedamage d
if GetSpellAbilityId() == SPELLID then
set d = xedamage.create()
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_MELEE
call d.useSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0),"head")
call d.damageTarget(c,t,dam)
if GetWidgetLife(c)+1 > GetUnitState(c, UNIT_STATE_MAX_LIFE) then
call DestroyEffect( AddSpecialEffect( GetAbilityEffectById(SPELLID,EFFECT_TYPE_AREA_EFFECT,0), GetUnitX(t), GetUnitY(t) ))
call SetWidgetLife(c, GetWidgetLife(c)*(0.96-0.01*lvl))
set CASTER = c
set TARGET = t
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(t), GetUnitY(t), 250+25*lvl, Condition(function GroupEm) )
endif
endif
set c = null
set t = null
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=10
//TESH.alwaysfold=0
scope Pulverize initializer Pulverize
globals
private constant integer SPELLID = 'Pulv'
private constant real TICK = 0.25
endglobals
private struct Data
unit c
unit t
timer tim
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c,SPELLID)
local real dam = SpellStat(.c,true)*0.5//+GetUnitBonus(.c,BONUS_DAMAGE)
local xedamage d = xedamage.create()
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_MELEE
if GetUnitCurrentOrder(.c) == OrderId("magicleash") then
call d.useSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0), "origin")
call d.damageTarget(.c,.t,dam)
else
call SetUnitTimeScale(.c, 1)
call ReleaseTimer(.tim)
call .destroy()
endif
call d.destroy()
endmethod
static method Actions takes unit c, unit t returns thistype
local thistype this = thistype.allocate()
set this.c = c
set this.t = t
set this.tim = NewTimer()
call SetUnitTimeScale(.c, 2)
call SetTimerData(.tim,this)
call TimerStart(.tim, TICK, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call thistype.Actions(GetTriggerUnit(),GetSpellTargetUnit())
endif
endmethod
endstruct
//===========================================================================
public function Pulverize takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope BlazingPalm initializer init
globals
private constant integer SPELLID = 'BlPa'
private unit TEMP
endglobals
private function GroupEm takes nothing returns boolean
local unit un = GetFilterUnit()
local integer lvl = GetUnitAbilityLevel(TEMP,SPELLID)
local real dam = SpellStat(TEMP,true)*(0.3+0.1*lvl)
local xedamage d= xedamage.create()
set d.dtype = DAMAGE_TYPE_FIRE
set d.atype = ATTACK_TYPE_MAGIC
if IsUnitEnemy(un, GetOwningPlayer(TEMP)) and not(IsUnitType(un, UNIT_TYPE_DEAD) or IsUnitType(un, UNIT_TYPE_STRUCTURE)) then
call d.damageTarget(TEMP,un,dam)
endif
set un = null
return false
endfunction
private function Conditions takes nothing returns nothing
local location loc = GetUnitLoc(GetTriggerUnit())
local real a = Atan2(GetSpellTargetY() - GetUnitY(GetTriggerUnit()), GetSpellTargetX() - GetUnitX(GetTriggerUnit()))*bj_RADTODEG
local group g = NewGroup()
if GetSpellAbilityId() == SPELLID then
set TEMP = GetTriggerUnit()
call GroupEnumUnitsInCone(g, loc, 375., a, 125, 125, Filter(function GroupEm))
endif
call RemoveLocation(loc)
set loc = null
call ReleaseGroup(g)
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Bolt initializer InitTrig_Bolt
globals
private constant integer SPELLID = 'Bolt'
private constant attacktype atype = ATTACK_TYPE_NORMAL
private constant damagetype dtype = DAMAGE_TYPE_MAGIC
endglobals
private struct Caster extends xecast
static method create takes unit target, player pl returns Caster
local Caster xd = xecast.createBasicA('ACpu', OrderId("purge"), pl)
call xd.castOnTarget( target )
return xd
endmethod
endstruct
private struct Data extends xecollider
unit target
unit caster
effect fx
real dam
static thistype temp
static method GroupEm takes nothing returns boolean
local unit un = GetFilterUnit()
if IsUnitEnemy(un, GetOwningPlayer(temp.caster)) and not(IsUnitType(un, UNIT_TYPE_DEAD) and IsUnitType(un, UNIT_TYPE_STRUCTURE)) then
call UnitDamageTarget(temp.caster, un, temp.dam, true, false, atype, dtype, wtype)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl", GetUnitX(un), GetUnitY(un)))
endif
set un = null
return false
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call PauseUnit(D.target, false)
call DestroyEffect(D.fx)
call ReleaseTimer(tim)
call D.destroy()
endmethod
method onUnitHit takes unit target returns nothing
local group g = NewGroup()
local timer tim = NewTimer()
local integer lvl = GetUnitAbilityLevel(.caster, SPELLID)
local real freeze = SpellStat(.caster,false)*0.01+0.25*lvl
local real a = Atan2(GetUnitY(target) - GetUnitY(.caster), GetUnitX(target) - GetUnitX(.caster))*57.29582
local real push = 50*lvl
if target == .target then
if GetUnitAbilityLevel(.caster, 'FirS') > 0 then
set temp = this
call GroupEnumUnitsInArea(g, GetUnitX(target), GetUnitY(target), 350, Filter(function Data.GroupEm))
else
call UnitDamageTarget(.caster,target,.dam, true,false,atype,dtype,wtype)
endif
if GetUnitAbilityLevel(.caster, 'IceS') > 0 then
call PauseUnit(target, true)
set this.fx = AddSpecialEffect("Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl", GetUnitX(target), GetUnitY(target))
call SetTimerData(tim,this)
call TimerStart(tim, 0.75+freeze, false, function Data.Timer)
elseif GetUnitAbilityLevel(.caster, 'LigS') > 0 then
call Caster.create(target, GetOwningPlayer(.caster))
elseif GetUnitAbilityLevel(.caster, 'EarS') > 0 then
call KnockbackTarget(.caster, target, a, 175.+push, 500., false, false, false, "MDX\\KnockbackDust.mdx")
elseif GetUnitAbilityLevel(.caster, 'MooS') > 0 then
call SetUnitState(target, UNIT_STATE_MANA, GetUnitState(target, UNIT_STATE_MANA)-.dam*2)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Feedback\\ArcaneTowerAttack.mdl", target, "origin"))
endif
call .terminate()
endif
call ReleaseGroup(g)
endmethod
static method Actions takes unit c, unit t, integer lvl returns nothing
local real a = Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c))//*57.29582
local Data xc
local string str
local real mpminus = 0.11 - 0.01*lvl
local real dam = GetUnitState(c, UNIT_STATE_MANA)
call SetUnitState(c, UNIT_STATE_MANA, dam - dam*mpminus)
if GetUnitAbilityLevel(c, 'FirS') > 0 then
set dam = dam * 0.05
set str = "Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl"
elseif GetUnitAbilityLevel(c, 'IceS') > 0 then
set dam = dam * 0.07
set str = "Abilities\\Weapons\\LichMissile\\LichMissile.mdl"
elseif GetUnitAbilityLevel(c, 'LigS') > 0 then
set dam = dam * 0.085
set str = "Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl"
elseif GetUnitAbilityLevel(c, 'EarS') > 0 then
set dam = dam * 0.07
set str = "Abilities\\Weapons\\RockBoltMissile\\RockBoltMissile.mdl"
elseif GetUnitAbilityLevel(c, 'MooS') > 0 then
set dam = dam * 0.09
set str = "Abilities\\Weapons\\AvengerMissile\\AvengerMissile.mdl"
else
set dam = dam * 0.15
set str = "Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl"
endif
set xc = Data.create(GetUnitX(c), GetUnitY(c), a)
set xc.fxpath = str
set xc.speed = 900
set xc.expirationTime = 1.5
set xc.z = 75.0
set xc.dam = dam
set xc.caster = c
set xc.target = t
set str = null
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), GetSpellTargetUnit(), GetUnitAbilityLevel(GetTriggerUnit(), GetSpellAbilityId()))
endif
return false
endmethod
endstruct
//===========================================================================
public function InitTrig_Bolt takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
set t= null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Give_Shift_Conditions takes nothing returns boolean
local unit L = GetLearningUnit()
if GetLearnedSkill() == 'EleS' and GetUnitAbilityLevel(L, 'FirS') < 1 and GetUnitAbilityLevel(L, 'IceS') < 1 and GetUnitAbilityLevel(L, 'LigS') < 1 and GetUnitAbilityLevel(L, 'EarS') < 1 and GetUnitAbilityLevel(L, 'MooS') < 1 then
call UnitAddAbility(GetTriggerUnit(), 'Shif')
endif
return true
endfunction
//===========================================================================
function InitTrig_Give_Shift takes nothing returns nothing
set gg_trg_Give_Shift = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Give_Shift, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_Give_Shift, Condition( function Trig_Give_Shift_Conditions ) )
endfunction
//TESH.scrollpos=42
//TESH.alwaysfold=0
globals
effect array WepFX
real array MPMax
real array BountyMax
endglobals
function Trig_Elemental_Shift_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'EleS'
endfunction
function Trig_Elemental_Shift_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevel(c, GetSpellAbilityId())
local integer i = 0
local effect fx = WepFX[GetUnitId(c)]
local real MaxM = MPMax[GetUnitId(c)]
if GetUnitAbilityLevel(c, 'FirS') > 0 then
set i = 1
elseif GetUnitAbilityLevel(c, 'IceS') > 0 then
set i = 2
elseif GetUnitAbilityLevel(c, 'LigS') > 0 then
set i = 3
elseif GetUnitAbilityLevel(c, 'EarS') > 0 then
set i = 4
elseif GetUnitAbilityLevel(c, 'MooS') > 0 then
set i = 5
endif
call DestroyEffect(fx)
if i == 1 and not(i >= lvl)then
set fx = AddSpecialEffectTarget("Abilities\\Weapons\\ZigguratFrostMissile\\ZigguratFrostMissile.mdl", c, "weapon")
call UnitRemoveAbility(c, 'FirS')
call UnitAddAbility(c, 'IceS')
elseif i == 2 and not(i >= lvl) then
set fx = AddSpecialEffectTarget("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", c, "weapon")
call UnitRemoveAbility(c, 'IceS')
call UnitAddAbility(c, 'LigS')
elseif i == 3 and not(i >= lvl) then
set fx = AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl", c, "weapon")
call UnitRemoveAbility(c, 'LigS')
call UnitAddAbility(c, 'EarS')
call AddUnitBonus(c, BONUS_ARMOR, R2I(GetUnitState(c, UNIT_STATE_MAX_MANA)*0.01))
elseif i == 4 and not(i >= lvl) then
set MPMax[GetUnitId(c)] = GetUnitState(c, UNIT_STATE_MAX_MANA)
call AddUnitMaxState(c, UNIT_STATE_MAX_LIFE, R2I(GetUnitState(c, UNIT_STATE_MAX_MANA)))
call AddUnitMaxState(c, UNIT_STATE_MAX_MANA, R2I(0-GetUnitState(c, UNIT_STATE_MAX_MANA)/2))
set fx = AddSpecialEffectTarget("Abilities\\Spells\\Other\\BlackArrow\\BlackArrowMissile.mdl", c, "weapon")
call UnitRemoveAbility(c, 'EarS')
call UnitAddAbility(c, 'MooS')
call AddUnitBonus(c, BONUS_ARMOR, R2I(GetUnitState(c, UNIT_STATE_MAX_MANA)*-0.02))
elseif i == 5 and not(i >= lvl) then
call UnitRemoveAbility(c, 'MooS')
call UnitAddAbility(c, 'Shif')
call AddUnitMaxState(c, UNIT_STATE_MAX_LIFE, R2I(-MaxM))
call AddUnitMaxState(c, UNIT_STATE_MAX_MANA, R2I(MaxM/2))
elseif i >= lvl then
if i == 4 then
call AddUnitBonus(c, BONUS_ARMOR, R2I(GetUnitState(c, UNIT_STATE_MAX_MANA)*-0.02))
elseif i == 5 then
call AddUnitMaxState(c, UNIT_STATE_MAX_LIFE, R2I(-MaxM))
call AddUnitMaxState(c, UNIT_STATE_MAX_MANA, R2I(MaxM/2))
endif
call UnitAddAbility(c, 'Shif')
call UnitRemoveAbility(c, 'FirS')
call UnitRemoveAbility(c, 'IceS')
call UnitRemoveAbility(c, 'LigS')
call UnitRemoveAbility(c, 'EarS')
call UnitRemoveAbility(c, 'MooS')
else
set fx = AddSpecialEffectTarget("Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl", c, "weapon")
call UnitRemoveAbility(c, 'Shif')
call UnitAddAbility(c, 'FirS')
endif
set WepFX[GetUnitId(c)] = fx
set t = null
set c = null
set fx = null
endfunction
//===========================================================================
function InitTrig_Elemental_Shift takes nothing returns nothing
set gg_trg_Elemental_Shift = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Elemental_Shift, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Elemental_Shift, Condition( function Trig_Elemental_Shift_Conditions ) )
call TriggerAddAction( gg_trg_Elemental_Shift, function Trig_Elemental_Shift_Actions )
endfunction
//TESH.scrollpos=30
//TESH.alwaysfold=0
function Trig_Spirit_Element_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'spel'
endfunction
function Trig_Spirit_Element_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local integer lvl = 5
local integer i = 0
local effect fx = WepFX[GetUnitId(c)]
local real BountyM = BountyMax[GetUnitId(c)]
if GetUnitAbilityLevel(c, 'FirS') > 0 then
set i = 1
elseif GetUnitAbilityLevel(c, 'IceS') > 0 then
set i = 2
elseif GetUnitAbilityLevel(c, 'LigS') > 0 then
set i = 3
elseif GetUnitAbilityLevel(c, 'EarS') > 0 then
set i = 4
elseif GetUnitAbilityLevel(c, 'MooS') > 0 then
set i = 5
endif
call DestroyEffect(fx)
if i == 1 and not(i >= lvl)then
call SetUnitVertexColor(c, 0, 102, 255, 102)
set fx = AddSpecialEffectTarget("Abilities\\Weapons\\ZigguratFrostMissile\\ZigguratFrostMissile.mdl", c, "weapon")
call UnitRemoveAbility(c, 'FirS')
call UnitAddAbility(c, 'IceS')
elseif i == 2 and not(i >= lvl) then
call SetUnitVertexColor(c, 179, 77, 255, 102)
set fx = AddSpecialEffectTarget("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", c, "weapon")
call UnitRemoveAbility(c, 'IceS')
call UnitAddAbility(c, 'LigS')
elseif i == 3 and not(i >= lvl) then
call SetUnitVertexColor(c, 204, 102, 0, 102)
set fx = AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl", c, "weapon")
call UnitRemoveAbility(c, 'LigS')
call UnitAddAbility(c, 'EarS')
elseif i == 4 and not(i >= lvl) then
call SetUnitVertexColor(c, 153, 0, 153, 102)
set fx = AddSpecialEffectTarget("Abilities\\Spells\\Other\\BlackArrow\\BlackArrowMissile.mdl", c, "weapon")
call UnitRemoveAbility(c, 'EarS')
call UnitAddAbility(c, 'MooS')
set UnitBounty[GetUnitId(c)] = UnitBounty[GetUnitId(c)] + 10
call AddUnitBonus(c, BONUS_INTELLIGENCE, 10)
elseif i == 5 and not(i >= lvl) then
call SetUnitVertexColor(c, 255, 255, 255, 102)
set UnitBounty[GetUnitId(c)] = UnitBounty[GetUnitId(c)] - 10
call AddUnitBonus(c, BONUS_INTELLIGENCE, -10)
call UnitRemoveAbility(c, 'MooS')
call UnitAddAbility(c, 'Shif')
elseif i >= lvl then
if i == 4 then
set UnitBounty[GetUnitId(c)] = UnitBounty[GetUnitId(c)] - 10
call AddUnitBonus(c, BONUS_INTELLIGENCE, -10)
elseif i == 5 then
set UnitBounty[GetUnitId(c)] = UnitBounty[GetUnitId(c)] - 10
call AddUnitBonus(c, BONUS_INTELLIGENCE, -10)
endif
call SetUnitVertexColor(c, 255, 255, 255, 102)
call UnitAddAbility(c, 'Shif')
call UnitRemoveAbility(c, 'FirS')
call UnitRemoveAbility(c, 'IceS')
call UnitRemoveAbility(c, 'LigS')
call UnitRemoveAbility(c, 'EarS')
call UnitRemoveAbility(c, 'MooS')
else
set fx = AddSpecialEffectTarget("Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl", c, "weapon")
call SetUnitVertexColor(c, 255, 51, 0, 102)
call UnitRemoveAbility(c, 'Shif')
call UnitAddAbility(c, 'FirS')
endif
set WepFX[GetUnitId(c)] = fx
set c = null
set fx = null
endfunction
//===========================================================================
function InitTrig_Spirit_Element takes nothing returns nothing
set gg_trg_Spirit_Element = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Spirit_Element, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Spirit_Element, Condition( function Trig_Spirit_Element_Conditions ) )
call TriggerAddAction( gg_trg_Spirit_Element, function Trig_Spirit_Element_Actions )
endfunction
//TESH.scrollpos=39
//TESH.alwaysfold=0
scope ShiftAttack initializer Init
private struct Data
unit t
static method create takes unit target returns Data
local Data D = Data.allocate()
set D.t = target
return D
endmethod
endstruct
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call SetUnitMoveSpeed(D.t, GetUnitMoveSpeed(D.t)+15)
call AddUnitBonus(D.t, BONUS_ATTACK_SPEED, 5)
call D.destroy()
call ReleaseTimer(tim)
endfunction
private function Actions takes unit t, unit c, unit temp, real dam returns nothing
local timer tim = NewTimer()
local Data D = Data.create(t)
local group g = NewGroup()
local integer i = GetRandomInt(1,10)
set dam = GetUnitState(c, UNIT_STATE_MANA)
if GetUnitAbilityLevel(c, 'FirS') > 0 then
set dam = dam*0.02
call GroupEnumUnitsInRange(g, GetUnitX(t), GetUnitY(t), 300, null)
loop
set temp = FirstOfGroup(g)
exitwhen temp == null
if IsUnitEnemy(temp, GetOwningPlayer(c)) and GetWidgetLife(temp) > 0.405 and GetUnitState(c, UNIT_STATE_MANA) > dam*0.5 then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIfb\\AIfbSpecialArt.mdl", temp, "origin"))
call UnitDamageTarget(c, temp, dam, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_COLD, wtype)
call SetUnitState(c, UNIT_STATE_MANA, GetUnitState(c, UNIT_STATE_MANA) - dam*0.5)
endif
call GroupRemoveUnit(g, temp)
endloop
call ReleaseGroup(g)
elseif GetUnitAbilityLevel(c, 'IceS') > 0 and GetUnitState(c, UNIT_STATE_MANA) > GetUnitState(c, UNIT_STATE_MAX_MANA)*0.4 then
call SetUnitMoveSpeed(t, GetUnitMoveSpeed(t)-10)
call AddUnitBonus(t, BONUS_ATTACK_SPEED, -5)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIob\\AIobSpecialArt.mdl", t, "origin"))
call SetUnitState(c, UNIT_STATE_MANA, GetUnitState(c, UNIT_STATE_MANA) - 5)
call SetTimerData(tim, D)
call TimerStart(tim, 7, false, function Timer)
elseif GetUnitAbilityLevel(c, 'LigS') > 0 and i <= 3 then
set dam = dam*0.05
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIlb\\AIlbSpecialArt.mdl", t, "origin"))
call UnitRemoveBuffs(t, true, false)
call UnitDamageTarget(c, t, dam, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, wtype)
call SetUnitState(c, UNIT_STATE_MANA, GetUnitState(c, UNIT_STATE_MANA) - dam*0.5)
endif
endfunction
private function Conditions takes nothing returns boolean
if GetUnitAbilityLevel(GetAttacker(), 'FirS') > 0 or GetUnitAbilityLevel(GetAttacker(), 'IceS') > 0 or GetUnitAbilityLevel(GetAttacker(), 'LigS') > 0 then
call Actions(GetTriggerUnit(), GetAttacker(), null, 0)
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function GivePhase_Conditions takes nothing returns boolean
if GetLearnedSkill() == 'Phas' and GetUnitAbilityLevel(GetTriggerUnit(), 'Phas') == 1 then
call UnitAddAbility(GetTriggerUnit(), 'PhaD')
endif
return false
endfunction
//===========================================================================
function InitTrig_Give_Phase takes nothing returns nothing
set gg_trg_Give_Phase = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Give_Phase, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_Give_Phase, Condition( function GivePhase_Conditions ) )
endfunction
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope Phase initializer init
globals
private constant integer SPELLID = 'Phas'
private constant real TICK = 0.5
endglobals
private struct Data
unit c
unit d
real dur
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local real respawn = 30-3*GetUnitAbilityLevel(.c, SPELLID)
set .dur = .dur + TICK
if .dur > respawn or IsUnitType(.d, UNIT_TYPE_DEAD) then
if not IsUnitType(.d, UNIT_TYPE_DEAD) then
call SetWidgetLife(.c, GetWidgetLife(.c) + GetWidgetLife(.d)/2)
endif
call ShowUnit(.c, true)
call SetUnitPosition(.c, GetUnitX(.d), GetUnitY(.d))
call RemoveUnit(.d)
if GetLocalPlayer() == GetOwningPlayer(.c) then
call SelectUnit(.c, true)
endif
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endif
endmethod
static method create takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local real CurH = GetWidgetLife(c)/2.1-0.1*lvl
local real CurM = GetUnitState(c, UNIT_STATE_MANA)*0.02
call ShowUnit(c, false)
set .dur = 0
set .c = c
set .d = CreateUnit(GetTriggerPlayer(), 'eleM', GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
set UnitBounty[GetUnitId(.d)] = SpellStat(c, true)
if GetUnitAbilityLevel(c, 'FirS') > 0 then
call SetUnitVertexColor(.d, 255, 125, 0, 100)
call UnitAddAbility(.d, 'ACce')
call UnitAddAbility(.d, 'FiBa')
elseif GetUnitAbilityLevel(c, 'IceS') > 0 then
call UnitAddAbility(.d, 'ACf2')
call UnitAddAbility(.d, 'FrBl')
call SetUnitVertexColor(.d, 0, 75, 255, 100)
elseif GetUnitAbilityLevel(c, 'LigS') > 0 then
call SetUnitVertexColor(.d, 255, 255, 0, 100)
call UnitAddAbility(.d, 'StBo')
call UnitAddAbility(.d, 'A05G')
call AddUnitMaxState(.d, UNIT_STATE_MAX_MANA, R2I(CurH*0.01))
elseif GetUnitAbilityLevel(c, 'EarS') > 0 then
call SetUnitVertexColor(.d, 150, 75, 0, 100)
call UnitAddAbility(.d, 'Atau')
call UnitAddAbility(.d, 'ThSk')
call AddUnitBonus(.d, BONUS_ARMOR, R2I(CurH*0.075))
elseif GetUnitAbilityLevel(c, 'MooS') > 0 then
call SetUnitVertexColor(.d, 80, 0, 150, 100)
call UnitAddAbility(.d, 'Afbt')
call UnitAddAbility(.d, 'Ashm')
else
call SetUnitVertexColor(.d, 75, 75, 75, 100)
call UnitAddAbility(.d, 'ACsi')
set CurH = CurH + CurH/2
set CurM = CurM + CurM/5
endif
call AddUnitMaxState(.d, UNIT_STATE_MAX_LIFE, R2I(CurH))
call AddUnitBonus(.d, BONUS_ARMOR, R2I(CurM))
call AddUnitBonus(.d, BONUS_DAMAGE, R2I(SpellStat(.c, true)*(0.4+0.1*lvl)))
if GetLocalPlayer() == GetOwningPlayer(.c) then
call SelectUnit(.d, true)
endif
call SetTimerData(tim, this)
call TimerStart(tim, TICK, true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Phase_Activate_Conditions takes nothing returns boolean
local real MaxHP = GetWidgetLife(GetTriggerUnit())/GetUnitState(GetTriggerUnit(), UNIT_STATE_MAX_LIFE)
if GetUnitAbilityLevel(GetTriggerUnit(), 'Phas') > 0 and 0.25 > MaxHP then
call IssueImmediateOrder(GetTriggerUnit(), "phaseshift")
endif
return false
endfunction
//===========================================================================
function InitTrig_Phase_Activate takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Trig_Phase_Activate_Conditions ) )
set t = null
endfunction
//TESH.scrollpos=36
//TESH.alwaysfold=0
scope MatraM initializer InitTrig_Matra_M
globals
private constant integer SPELLID = 'Rech'
private constant real tick = 0.1
endglobals
/*
private struct Data
unit c
real d
static method create takes unit caster returns Data
local Data D = Data.allocate()
set D.c = caster
set D.d = 0
return D
endmethod
endstruct
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local real HP = GetUnitState(D.c, UNIT_STATE_LIFE)
local real MP = GetUnitState(D.c, UNIT_STATE_MANA)
if 0.4 > HP/GetUnitState(D.c, UNIT_STATE_MAX_LIFE) or GetUnitCurrentOrder(D.c) != OrderId("tranquility") or MP >= GetUnitState(D.c, UNIT_STATE_MAX_MANA) then
call IssuePointOrder(D.c, "move", GetUnitX(D.c), GetUnitY(D.c))
call D.destroy()
call ReleaseTimer(tim)
else
call SetUnitState(D.c, UNIT_STATE_MANA, MP + 0.05 * SpellStat(D.c, false))
call SetWidgetLife(D.c, HP - 0.05 * SpellStat(D.c, false) * (1.1-0.1*GetUnitAbilityLevel(D.c, SPELLID)) )
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\ReplenishMana\\SpiritTouchTarget.mdl", GetUnitX(D.c), GetUnitY(D.c)))
set D.d = D.d + tick
call SetTimerData(tim, D)
endif
endfunction
private function Actions takes unit c returns nothing
local timer tim = NewTimer()
local Data D = Data.create(c)
call SetTimerData(tim, D)
call TimerStart(tim, tick, true, function Timer)
endfunction
*/
private function Conditions takes nothing returns boolean
local unit c = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local real MP = GetUnitState(c, UNIT_STATE_MANA)+70-20*lvl
local real HP = GetWidgetLife(c)+(GetWidgetLife(c)*lvl*0.35)
if GetSpellAbilityId() == SPELLID then
call SetUnitState(c, UNIT_STATE_MANA, HP)
call SetWidgetLife(c, MP)
endif
return true
endfunction
//===========================================================================
public function InitTrig_Matra_M takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, function Conditions)
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=11
//TESH.alwaysfold=0
scope DoubleCastActive initializer Init
globals
private unit TempUnit
endglobals
private function Enemy takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempUnit))
endfunction
private function Ally takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(), GetOwningPlayer(TempUnit))
endfunction
private function Actions takes unit c,unit d returns nothing
local abilitydata dat = unitabilityhistory[ c ].out.entry[ unitabilityhistory[c].out.stored - 1 ]
local integer i = dat.abilityid
local real x = GetUnitX(c)
local real x2 = dat.targetx
local real y2 = dat.targety
local group g = NewGroup()
local boolexpr boo = Filter(function Enemy)
local string id = dat.orderstring
set d = CreateUnit(GetTriggerPlayer(),XE_DUMMY_UNITID,x,GetUnitY(c),GetUnitFacing(c))
call SetUnitState(d,UNIT_STATE_MANA,9999)
call UnitAddAbility(d,'Aloc')
call UnitAddAbility(d,i)
call UnitApplyTimedLife(d,'BTLF',15.)
if IsUnitAlly(dat.target, GetOwningPlayer(c)) then
set boo = Filter(function Ally)
endif
if x2 == 0 and x != 0 then
call IssueImmediateOrder(d,id)
elseif dat.target != null then
call IssueTargetOrder(d,id,dat.target)
else
call IssuePointOrder(d,id,x2+GetRandomReal(0,100),y2+GetRandomReal(0,100))
endif
call ReleaseGroup(g)
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'DblA' then
call unitabilityhistory[GetTriggerUnit()].skip()
call Actions(GetTriggerUnit(),null)
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition(function Conditions))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HydraWard initializer init
globals
private constant integer SPELLID = 'A007'
private constant integer SUMMONID = 'hwa5'
private constant integer HYDRAID = 'nhyh'
endglobals
private function Actions takes unit s, unit c returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer DamageBonus = R2I(SpellStat(c, false)*(0.1+0.03*lvl))
local integer ArmorBonus = R2I(GetUnitBonus(c, BONUS_ARMOR)/(1.0-0.5*lvl))
local real HPBonus = 35+15*lvl+GetUnitState(c, UNIT_STATE_MAX_MANA)/12
call AddUnitMaxState(s, UNIT_STATE_MAX_LIFE, HPBonus)
call AddUnitBonus(s, BONUS_DAMAGE, DamageBonus)
call AddUnitBonus(s, BONUS_ARMOR, ArmorBonus)
set UnitBounty[GetUnitId(s)] = SpellStat(c, true)/3
if SpellStat(c, true) > 50 then
call UnitAddAbility(c, 'SHHS')
endif
endfunction
private function Hydra takes unit s returns nothing
call UnitApplyTimedLife(s, 'BFig', 8)
endfunction
private function Conditions takes nothing returns nothing
if GetUnitTypeId(GetSummonedUnit()) == SUMMONID and not IsUnitIllusion(GetSummonedUnit()) then
call Actions(GetSummonedUnit(), GetSummoningUnit())
elseif GetUnitTypeId(GetSummonedUnit()) == HYDRAID and not IsUnitIllusion(GetSummonedUnit()) then
call Hydra(GetSummonedUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddAction( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=26
//TESH.alwaysfold=0
scope RitualDance initializer InitTrig_Ritual_Dance
globals
private constant integer SPELLID = 'RiDa'
private constant real tick = 1
private unit TEMP
endglobals
private struct Data
unit c = null
timer tim
real x
real y
real r = 600
real dur = 0
static method GroupCheck takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(), GetOwningPlayer(TEMP)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
endmethod
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(this.c,SPELLID)
local integer id
local unit s
local unit un
local real h = SpellStat(this.c,true)*(0.3+0.2*lvl)+20*lvl
local real hp
local real mp
set TEMP = this.c
if this.dur > 5 then
call IssueImmediateOrder(this.c, "stop")
call SetUnitAnimation(this.c, "stand")
endif
if GetUnitCurrentOrder(this.c) != OrderId("voodoo") then
call this.destroy()
call ReleaseTimer(this.tim)
else
call GroupEnumUnitsInArea(ENUM_GROUP, this.x, this.y, this.r, Filter(function thistype.GroupCheck))
loop
set s = FirstOfGroup(ENUM_GROUP)
exitwhen s == null
if GetUnitTypeId(s) == 'grav' and GetRandomInt(1,100) < 10+5*lvl then
set id = GetPlayerId(GetOwningPlayer(s))
set un = GetPlayerHero(id+1)
set hp = GetUnitState(un, UNIT_STATE_MAX_LIFE)
set mp = GetUnitState(un, UNIT_STATE_MAX_MANA)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0), this.x, this.y))
call RaiseHero(s,0.01*hp,0.01*mp)
else
call SetWidgetLife(s, GetWidgetLife(s) + h)
call UnitRemoveBuffs(s, false, true)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 1), s, "origin"))
endif
call GroupRemoveUnit(ENUM_GROUP, s)
endloop
set this.dur = this.dur + tick
endif
set s = null
set un = null
endmethod
static method create takes unit caster, real casterx, real castery returns thistype
local thistype this = thistype.allocate()
set this.c = caster
set this.x = casterx
set this.y = castery
set this.tim = NewTimer()
if not AltRez then
call SetUnitState(this.c, UNIT_STATE_MANA, GetUnitState(this.c, UNIT_STATE_MANA) + 40)
endif
call SetTimerData(this.tim, this)
call TimerStart(this.tim, tick, true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns boolean
local unit c = GetTriggerUnit()
if GetSpellAbilityId() == SPELLID then
call Data.create(c, GetUnitX(c), GetUnitY(c))
endif
set c = null
return false
endfunction
//===========================================================================
public function InitTrig_Ritual_Dance takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, function Conditions)
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=42
//TESH.alwaysfold=0
scope Malvoodoo initializer InitTrig_Malvoodoo
globals
private constant integer SPELLID = 'MaVo'
private constant integer BUFFID = 'BMaV'
private constant real TICK = 0.5
private trigger array EVENT
private real DAMAGE
endglobals
private struct Data
unit c
unit t
real dur
timer tim
static integer counted
static unit u
static unit me
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
set .dur = .dur + TICK
if IsUnitType(.t, UNIT_TYPE_DEAD) or GetUnitAbilityLevel(.t, BUFFID) < 1 or .dur >= 5+1*lvl then
call DestroyTrigger(EVENT[GetUnitId(.t)])
set EVENT[GetUnitId(.t)] = null
call UnitRemoveAbility(.t, BUFFID)
call ReleaseTimer(.tim)
call .destroy()
endif
endmethod
static method GroupEm takes nothing returns boolean
local unit e = GetFilterUnit()
if not(IsUnitType(e, UNIT_TYPE_STRUCTURE)) and not( IsUnitType(e, UNIT_TYPE_DEAD )) and not(IsUnit(e, thistype.me))and GetWidgetLife(e) > DAMAGE and thistype.counted < 4 then
set thistype.counted = thistype.counted + 1
call SetWidgetLife(e, GetWidgetLife(e) - DAMAGE)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\BlackKeeperMissile\\BlackKeeperMissile.mdl", e, "origin"))
endif
set e = null
return false
endmethod
static method Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(thistype.u, SPELLID)
set DAMAGE = (lvl*0.1+0.05)*GetEventDamage()
set thistype.counted = 0
set thistype.me = GetTriggerUnit()
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 320+30*lvl, Filter(function thistype.GroupEm))
return false
endmethod
static method create takes unit c, unit t returns thistype
local thistype this = thistype.allocate()
set .tim = NewTimer()
set .c = c
set .t = t
set thistype.u = c
set .dur = 0
set EVENT[GetUnitId(.t)] = CreateTrigger()
call TriggerRegisterUnitEvent( EVENT[GetUnitId(.t)], .t, EVENT_UNIT_DAMAGED )
call TriggerAddCondition( EVENT[GetUnitId(.t)], function thistype.Conditions )
call SetTimerData(.tim, this)
call TimerStart(.tim, TICK, true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Malvoodoo takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope Benevoodoo initializer InitTrig_Benevoodoo
globals
private constant integer SPELLID = 'Bene'
private constant string TurnOn = "immolation"
private constant string TurnOff = "unimmolation"
private constant real tick = 0.1
private HandleTable info
private unit TEMP
endglobals
private struct Data
unit c
integer lvl
boolean deactivate = false
timer tim
static method GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
if IsUnitAlly(GetFilterUnit(), GetOwningPlayer(TEMP)) and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) != true and IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) != true then
call SetWidgetLife(GetFilterUnit(), GetWidgetLife(GetFilterUnit())+((SpellStat(TEMP,true)*lvl*0.05+(0.2+0.6*lvl)+1)*tick))
endif
return false
endmethod
static method onLoop takes nothing returns nothing
local group g = NewGroup()
local Data D = Data(GetTimerData(GetExpiredTimer()))
if not(IsUnitType(D.c,UNIT_TYPE_DEAD)) and not(D.deactivate) and GetUnitState(D.c, UNIT_STATE_MANA) >= 10 then
//Start timer
if D.lvl < GetUnitAbilityLevel(D.c, SPELLID) then
set D.lvl = GetUnitAbilityLevel(D.c, SPELLID)
endif
set TEMP = D.c
call GroupEnumUnitsInArea(g, GetUnitX(D.c), GetUnitY(D.c), 250, Filter(function Data.GroupEm))
call SetUnitState(D.c, UNIT_STATE_MANA, GetUnitState(D.c, UNIT_STATE_MANA) - 0.1 * GetHeroInt(D.c, true)*tick)
call ReleaseGroup(g)
else
//Cleanup
call IssueImmediateOrder(D.c, TurnOff)
call info.flush(D.c)
set D.c = null
call ReleaseTimer(D.tim)
set D.tim = null
call D.destroy()
endif
endmethod
static method create takes unit caster returns Data
local Data D = Data.allocate()
set D.c = caster
set D.lvl = GetUnitAbilityLevel(D.c, SPELLID)
//Timer
set D.tim = NewTimer()
call SetTimerData(D.tim,D)
call TimerStart(D.tim, tick, true, function Data.onLoop)
set info[D.c] = D
return D
endmethod
endstruct
private function Deactivate takes nothing returns boolean
local Data D
if GetIssuedOrderId() == OrderId(TurnOff) and info.exists(GetTriggerUnit()) then
set D = info[GetTriggerUnit()]
set D.deactivate = true
endif
return false
endfunction
private function Activation takes nothing returns boolean
if GetIssuedOrderId() == OrderId(TurnOn) and GetUnitAbilityLevel(GetTriggerUnit(), SPELLID) > 0 then
call Data.create(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
private function InitTrig_Benevoodoo takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition(t, function Activation )
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( t, function Deactivate )
set info = HandleTable.create()
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
real array ManaBefore
endglobals
function Trig_ManaBefore_Actions takes nothing returns nothing
set ManaBefore[GetUnitId(GetTriggerUnit())] = GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA)
endfunction
//===========================================================================
function InitTrig_ManaBefore takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddAction( t, function Trig_ManaBefore_Actions )
set t = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Clarity_Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), 'Bcla')
local real i = GetRandomInt(1,100)
local real mana = ManaBefore[GetUnitId(GetTriggerUnit())] - GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA)
if lvl > 0 and i < 11+4*lvl then
call SetUnitState(GetTriggerUnit(), UNIT_STATE_MANA, GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) + mana*0.3)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl",GetTriggerUnit(),"origin"))
endif
return false
endfunction
//===========================================================================
function InitTrig_ClarityAura takes nothing returns nothing
set gg_trg_ClarityAura = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ClarityAura, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_ClarityAura, Condition( function Clarity_Conditions ) )
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=0
scope GrandBlood initializer InitTrig_Grand_Blood
globals
private constant integer SpellID = 'GBlo'
endglobals
private struct Data
unit c
real h
static method create takes unit caster, real heal returns Data
local Data D = Data.allocate()
set D.c = caster
set D.h = heal
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SpellID
endfunction
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
if GetUnitAbilityLevel(D.c, 'BBlo') >= 1 then
call SetWidgetLife(D.c, GetWidgetLife(D.c) + D.h)
else
call ReleaseTimer(tim)
call D.destroy()
endif
endfunction
private function Actions takes nothing returns nothing
local timer tim = NewTimer()
local unit c = GetTriggerUnit()
local real h = (0.05 + 0.05*GetUnitAbilityLevel(c, SpellID))*SpellStat(c, true) - 1.*GetUnitAbilityLevel(c, SpellID)
local Data D = Data.create(c, h )
call SetTimerData(tim,D)
call TimerStart(tim, 1.0, true, function Timer)
set c = null
endfunction
//===========================================================================
public function InitTrig_Grand_Blood takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call TriggerAddAction( t, function Actions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope BloodPower initializer InitTrig_BloodPower
globals
private constant integer SPELLID = 'BlPo'
private integer array DBONUS
endglobals
private function Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetAttacker(), SPELLID)
local integer max = R2I(GetWidgetLife(GetTriggerUnit())/GetUnitState(GetTriggerUnit(), UNIT_STATE_MAX_LIFE)*(SpellStat(GetAttacker(),true)*(0.1+0.3*lvl) ))
if lvl > 0 then
call AddUnitBonus(GetAttacker(), BONUS_DAMAGE, -DBONUS[GetUnitId(GetAttacker())])
call AddUnitBonus(GetAttacker(), BONUS_DAMAGE, max)
set DBONUS[GetUnitId(GetAttacker())] = max
endif
return false
endfunction
//===========================================================================
public function InitTrig_BloodPower takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Conditions ) )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Auspice initializer init
globals
private constant integer SPELLID = 'Ausp'
private constant string TurnOn = "immolation"
private constant string TurnOff = "unimmolation"
private constant real TICK = 0.1
private HandleTable info
endglobals
private struct Data
unit c
boolean deactivate = false
integer lvl
integer bonus
integer co
timer tim
real d
real i
static method onLoop takes nothing returns nothing
local Data D = Data(GetTimerData(GetExpiredTimer()))
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
if not(IsUnitType(D.c,UNIT_TYPE_DEAD)) and not(D.deactivate) and GetUnitState(D.c, UNIT_STATE_MANA) >= 10 then
//Start timer
if D.lvl < lvl then
set D.lvl = lvl
endif
if D.d == 1 + D.i and D.i <= 3+3*lvl then
set D.i = D.i + 1
set D.co = D.co - 21
if D.bonus < 45*lvl then
call AddUnitBonus(D.c, BONUS_ATTACK_SPEED, 1*lvl)
set D.bonus = D.bonus + 1*lvl
endif
call SetUnitVertexColor(D.c, 255, D.co, D.co, 255)
call SetUnitState(D.c, UNIT_STATE_MANA, GetUnitState(D.c, UNIT_STATE_MANA) - D.i*(1*lvl))
elseif D.i > 3+3*lvl then
if D.bonus < 45*lvl then
call AddUnitBonus(D.c, BONUS_ATTACK_SPEED, 1*lvl)
set D.bonus = D.bonus + 1*lvl
endif
call SetUnitState(D.c, UNIT_STATE_MANA, GetUnitState(D.c, UNIT_STATE_MANA) - D.i*(lvl*0.1))
endif
set D.d = D.d + TICK
else
//Cleanup
call SetUnitVertexColor(D.c, 255,255,255,255)
call IssueImmediateOrder(D.c, TurnOff)
call AddUnitBonus(D.c, BONUS_ATTACK_SPEED, -D.bonus)
call IssueSecondLastOrder(D.c)
call info.flush(D.c)
set D.c = null
call ReleaseTimer(D.tim)
set D.tim = null
call D.destroy()
endif
endmethod
static method create takes unit caster, real movespeed returns Data
local Data D = Data.allocate()
set D.c = caster
set D.co = 255
set D.d = 0
set D.i = 0
set D.bonus = 0
set D.lvl = GetUnitAbilityLevel(D.c, SPELLID)
//Timer
set D.tim = NewTimer()
call SetTimerData(D.tim,D)
call TimerStart(D.tim, TICK, true, function Data.onLoop)
set info[D.c] = D
return D
endmethod
endstruct
private function Deactivate takes nothing returns boolean
local Data D
if GetIssuedOrderId() == OrderId(TurnOff) and info.exists(GetTriggerUnit()) then
set D = info[GetTriggerUnit()]
set D.deactivate = true
endif
return false
endfunction
private function Activation takes nothing returns boolean
if GetIssuedOrderId() == OrderId(TurnOn) and GetUnitAbilityLevel(GetTriggerUnit(), SPELLID) > 0 then
call Data.create(GetTriggerUnit(), GetUnitMoveSpeed(GetTriggerUnit()))
endif
return false
endfunction
//===========================================================================
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition(t, function Activation )
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( t, function Deactivate )
set info = HandleTable.create()
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=7
//TESH.alwaysfold=0
scope ConsumeLife initializer InitTrig_ConsumeLife
globals
private constant integer SPELLID = 'CoLi'
endglobals
private struct Blood
unit c
integer lvl
static method onLoop takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Blood B = Blood(GetTimerData(tim))
call AddUnitMaxState(B.c, UNIT_STATE_MAX_LIFE, -B.lvl)
call ReleaseTimer(tim)
set B.c = null
call B.destroy()
endmethod
static method create takes unit caster, integer level returns Blood
local Blood B = Blood.allocate()
local timer tim = NewTimer()
set B.c = caster
set B.lvl = level
call AddUnitMaxState(B.c, UNIT_STATE_MAX_LIFE, B.lvl)
call SetTimerData(tim, B)
call TimerStart(tim, 300, false, function Blood.onLoop)
return B
endmethod
endstruct
private function Group takes nothing returns boolean
if GetUnitAbilityLevel(GetFilterUnit(), SPELLID) > 0 then
call Blood.create(GetFilterUnit(), GetUnitAbilityLevel(GetFilterUnit(), SPELLID))
endif
return false
endfunction
private function Actions takes nothing returns nothing
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 600, Filter(function Group))
endfunction
//===========================================================================
public function InitTrig_ConsumeLife takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( t, function Actions)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope BloodLust initializer Init
private struct Data
unit c
static method create takes unit caster returns Data
local Data D = Data.allocate()
set D.c = caster
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'BLus' and GetUnitAbilityLevel(GetTriggerUnit(), 'B009') > 0
endfunction
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call UnitRemoveAbility(D.c, 'CrBk')
call ReleaseTimer(tim)
call D.destroy()
endfunction
private function Actions takes nothing returns nothing
local timer tim = NewTimer()
local unit c = GetTriggerUnit()
local Data D = Data.create(c)
call SetTimerData(tim,D)
call UnitAddAbility(GetTriggerUnit(), 'CrBk')
call UnitRemoveAbility(GetTriggerUnit(), 'insh')
call UnitRemoveAbility(GetTriggerUnit(), 'Apiv')
call TimerStart(tim, 10.0, false, function Timer)
set c = null
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
local integer i = 0
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
loop
exitwhen i == bj_MAX_PLAYER_SLOTS
call SetPlayerAbilityAvailable(Player(i), 'CrBk', false)
set i = i + 1
endloop
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope WailingEssence initializer init
globals
private constant integer SPELLID = 'SoSh'
private constant integer BSPELLID = 'ToSo'
endglobals
private struct Data extends xecollider
unit caster
real ang
method loopControl takes nothing returns nothing
set .ang = .ang + 0.08
set .x = GetUnitX(.caster) + 100*Cos(.ang)
set .y = GetUnitY(.caster) + 100*Sin(.ang)
set .xyangle = ang
endmethod
method onUnitHit takes unit target returns nothing
local xedamage d= xedamage.create()
local integer lvl = GetUnitAbilityLevel(.caster,SPELLID)
local integer blvl = GetUnitAbilityLevel(.caster,BSPELLID)
local real ang = 57.29582 * Atan2(GetUnitY(target) - GetUnitY(.caster), GetUnitX(target) - GetUnitX(.caster))
local real dam = SpellStat(.caster,true)*(0.5+0.5*lvl)+15*lvl
if IsUnitEnemy(target, GetOwningPlayer(.caster)) then
if blvl > 0 then
set dam = dam*(1+0.1*lvl)
endif
set d.dtype = DAMAGE_TYPE_MAGIC
set d.atype = ATTACK_TYPE_MAGIC
call d.damageTarget(.caster,target, dam)
call d.destroy()
call KnockbackTarget(.caster, target, ang, 400, 425, false, false, false, GetAbilityEffectById(SPELLID, EFFECT_TYPE_AREA_EFFECT, 0))
call .terminate()
endif
endmethod
static method Actions takes unit c returns nothing
local real angle
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer i = 1
local Data xc
loop
exitwhen i > lvl+1
set angle = Atan2(GetUnitFacing(c) - GetUnitY(c), GetUnitFacing(c) - GetUnitX(c)) + 360/(lvl+1)*i * bj_DEGTORAD
set xc = Data.create(GetUnitX(c)+50+50*i*Cos(angle), GetUnitY(c)+50+50*i*Sin(angle), angle)
set xc.caster = c
set xc.expirationTime = 9
set xc.collisionSize = 32
set xc.fxpath = GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0)
set xc.ang = angle
set xc.z = 60
set i = i + 1
endloop
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.Actions(GetTriggerUnit())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t= null
endfunction
endscope
//TESH.scrollpos=77
//TESH.alwaysfold=0
scope Echoes initializer InitTrig_Echoes
globals
private constant integer SPELLID = 'Echo'
private constant integer BSPELLID = 'ToSo'
private group GROUP
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
unit targ
group g
real dam
static method GroupEm takes nothing returns boolean
if not(IsUnitInGroup(GetFilterUnit(), GROUP) or IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) or IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) then
return true
endif
return false
endmethod
method onDestroy takes nothing returns nothing
call ReleaseGroup(.g)
endmethod
method loopControl takes nothing returns nothing
local unit target
local group g = NewGroup()
if OrderId("channel") != GetUnitCurrentOrder(.caster) then
call .terminate()
elseif .targetUnit == null or IsUnitType(.targetUnit, UNIT_TYPE_DEAD) then
set GROUP = .g
call GroupEnumUnitsInArea(g, .x, .y, 500, Filter(function Data.GroupEm))
set target = FirstOfGroup(g)
set .targ = target
if target == null then
call ReleaseGroup(.g)
call .terminate()
else
set .targetUnit = target
endif
endif
set target = null
call ReleaseGroup(g)
endmethod
method onUnitHit takes unit target returns nothing
local group g = NewGroup()
local xedamage xd = xedamage.create()
set xd.dtype = DAMAGE_TYPE_NORMAL
set xd.atype = ATTACK_TYPE_MAGIC
if IsUnitInGroup(target, .g) != true then
call GroupRemoveUnit(.g, .targ)
call GroupAddUnit(.g, target)
set .targ = target
set TEMP = .caster
set GROUP = .g
call xd.useSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0),"origin")
if IsUnitEnemy(target, GetOwningPlayer(.caster)) then
call xd.damageTarget(.caster, target, .dam)
else
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 1), target, "origin"))
call SetWidgetLife(target, GetWidgetLife(target) + .dam*0.75)
endif
set .dam = .dam * 0.9
set TEMP = .caster
call GroupEnumUnitsInArea(g, .x, .y, 500, Filter(function Data.GroupEm))
set target = FirstOfGroup(g)
if target == null then
call .terminate()
else
set .targetUnit = target
endif
endif
call xd.destroy()
call ReleaseGroup(g)
endmethod
endstruct
private function Actions takes unit c, unit t returns nothing
local real ang = Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c))
local Data d
local integer lvl = GetUnitAbilityLevel(c,SPELLID)
local integer blvl = GetUnitAbilityLevel(c,BSPELLID)
set d = Data.create(GetUnitX(c), GetUnitY(c), ang)
set d.g = NewGroup()
call GroupRefresh(d.g)
call GroupAddUnit(d.g, c)
set d.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set d.speed = 300.0
set d.expirationTime = 15
set d.z = 75.0
set d.caster = c
set d.collisionSize = 16.0
set d.angleSpeed = 15.0
set d.targ = c
set d.targetUnit = t
set d.dam = 50+55*lvl+(SpellStat(c,true)*0.5+0.3*lvl)+blvl*SpellStat(c,true)
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions( GetTriggerUnit(), GetSpellTargetUnit() )
endif
return false
endfunction
//===========================================================================
public function InitTrig_Echoes takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Deafening_Scream_Actions takes unit c, unit t returns nothing
local group g = NewGroup()
local xecast xc = xecast.createBasicA('sidu', OrderId("silence"), GetOwningPlayer(c))
//createBasicA takes integer abilityID, integer orderid, player owner returns xecast
local integer lvl = GetUnitAbilityLevel(c, 'DeSc')
local integer blvl = GetUnitAbilityLevel(c, 'ToSo')
local real dam = ( 60+20*lvl+(SpellStat(c, true)*lvl)*(0.2+0.1*lvl) )
local real heal = ( 20+60*lvl+SpellStat(c, true)*(0.4+0.2*lvl) )
call GroupEnumUnitsInArea(g, GetUnitX(c), GetUnitY(c), 300+50*lvl, BOOLEXPR_TRUE)
if blvl > 0 then
set dam = dam*(1+0.1*blvl)
endif
loop
set t = FirstOfGroup(g)
exitwhen t == null
if IsUnitEnemy(t, GetOwningPlayer(c)) then
call UnitDamageTarget(c, t, dam, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, wtype)
//call DestroyEffect(AddSpecialEffectTarget("",t,"origin"))
else
call SetWidgetLife(t, GetWidgetLife(t)+heal)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\shadowstrike\\ShadowStrikeMissile.mdl",t,"origin"))
endif
call GroupRemoveUnit(g, t)
endloop
call xc.castOnPoint(GetUnitX(c), GetUnitY(c))
call ReleaseGroup(g)
endfunction
function Trig_Deafening_Scream_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'DeSc' then
call Deafening_Scream_Actions(GetTriggerUnit(), null)
endif
return false
endfunction
//===========================================================================
function InitTrig_Deafening_Scream takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Deafening_Scream_Conditions ) )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SoulTrap initializer init
globals
private constant integer SPELLID = 'SoTr'
endglobals
private struct Blood
unit c
integer lvl
static method onLoop takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
call AddUnitMaxState(.c, UNIT_STATE_MAX_MANA, -.lvl)
call ReleaseTimer(GetExpiredTimer())
set .c = null
call .destroy()
endmethod
static method create takes unit caster, integer level returns thistype
local thistype this = thistype.allocate()
local timer tim = NewTimer()
set .c = caster
set .lvl = level
call AddUnitMaxState(.c, UNIT_STATE_MAX_MANA, .lvl)
call SetTimerData(tim, this)
call TimerStart(tim, 300, false, function thistype.onLoop)
return this
endmethod
endstruct
private function Group takes nothing returns boolean
if GetUnitAbilityLevel(GetFilterUnit(), SPELLID) > 0 then
call Blood.create(GetFilterUnit(), GetUnitAbilityLevel(GetFilterUnit(), SPELLID))
endif
return false
endfunction
private function Actions takes nothing returns nothing
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 600, Filter(function Group))
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( t, function Actions)
endfunction
endscope
//TESH.scrollpos=27
//TESH.alwaysfold=0
scope BoneBehemoth initializer init
globals
private constant integer SPELLID = 'BoBe'
private integer COUNTED
private unit TEMP
endglobals
private function GroupEm takes nothing returns boolean
if IsUnitType(GetFilterUnit(), UNIT_TYPE_SUMMONED) and GetOwningPlayer(GetFilterUnit()) == GetOwningPlayer(TEMP) then
set COUNTED = COUNTED + 1
call KillUnit(GetFilterUnit())
endif
return false
endfunction
private function Conditions takes nothing returns boolean
local group g = NewGroup()
local unit c = GetTriggerUnit()
local unit d
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local integer lvl = GetUnitAbilityLevel(c,SPELLID)
if GetSpellAbilityId() == SPELLID then
set TEMP = c
set COUNTED = 0
call GroupEnumUnitsInArea(g, x, y, 2000, Filter(function GroupEm))
set d = CreateUnit(GetTriggerPlayer(), 'bMon', x, y, GetUnitFacing(c))
call SetUnitBonus(d, BONUS_DAMAGE, R2I(lvl*lvl*COUNTED+(0.05*COUNTED)*SpellStat(c,true)) )
call SetUnitBonus(d, BONUS_ARMOR, R2I(lvl+(0.3+0.02*COUNTED)*GetUnitBonus(c,BONUS_ARMOR) ))
call SetUnitMaxState(d, UNIT_STATE_MAX_LIFE, R2I(GetWidgetLife(c)*(0.35+0.1*lvl)+(20+45*lvl)*COUNTED))
call SetUnitMaxState(d, UNIT_STATE_MAX_MANA, R2I(GetWidgetLife(d)*0.25))
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_TARGET,0), GetUnitX(d), GetUnitY(d)))
if COUNTED > 2 then
call UnitAddAbility(d, 'SoEa')
endif
if COUNTED > 4 then
call UnitAddAbility(d, 'OvPr')
endif
if COUNTED > 6 then
call UnitAddAbility(d, 'ShSt')
endif
if COUNTED > 9 then
call UnitAddAbility(d, 'Doom')
endif
call SetUnitScale(d, 0.8+0.05*COUNTED, 0.8+0.05*COUNTED, 0.8+0.05*COUNTED)
set UnitBounty[GetUnitId(d)] = R2I(SpellStat(c, true)*0.75)
call UnitApplyTimedLife(d, 'Brai', 60)
endif
set d = null
set c = null
call ReleaseGroup(g)
return true
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=38
//TESH.alwaysfold=0
scope BoneShield initializer InitTrig_BoneShield
globals
private constant integer SPELLID = 'BoSh'
private constant integer BUFFID = 'BBoS'
private real array Shield
private unit array UNIT
private trigger array EVENT
private effect array ShieldFX
endglobals
private struct Data
unit c
unit t
real shield
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call DestroyEffect(ShieldFX[GetUnitId(D.t)])
call ReleaseTimer(tim)
set Shield[GetUnitId(D.t)] = 0
call DestroyTrigger(EVENT[GetUnitId(D.t)])
set EVENT[GetUnitId(D.t)] = null
set D.c = null
set ShieldFX[GetUnitId(D.t)] = null
set D.t = null
call D.destroy()
endmethod
static method Conditions takes nothing returns boolean
local unit d
local unit t= GetTriggerUnit()
local real x= GetUnitX(t)
local real y= GetUnitY(t)
local integer lvl= GetUnitAbilityLevel(UNIT[GetUnitId(t)], SPELLID)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_AREA_EFFECT,0), t, "origin"))
call SetWidgetLife(t, GetWidgetLife(t) + GetEventDamage())
set Shield[GetUnitId(t)] = Shield[GetUnitId(t)] - 1
if Shield[GetUnitId(t)] < 1 or GetUnitAbilityLevel(t, BUFFID) < 1 then
call UnitRemoveAbility(t, BUFFID)
set d= CreateUnit(GetOwningPlayer(UNIT[GetUnitId(t)]), 'boch', x,y, GetUnitFacing(t))
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0), GetUnitX(d), GetUnitY(d)))
call SetUnitBonus( d, BONUS_DAMAGE, R2I(SpellStat(t,true)*0.25+7*lvl) )
call SetUnitBonus( d, BONUS_ARMOR, 2+1*lvl )
call SetUnitMaxState( d, UNIT_STATE_MAX_LIFE, R2I((0.3+0.075*lvl)*GetWidgetLife(t)) )
call SetUnitMaxState( d, UNIT_STATE_MAX_MANA, R2I(50+50*lvl) )
call UnitAddType(d, UNIT_TYPE_SUMMONED)
if SpellStat(t,true) > 30 then
call UnitAddAbility(d, 'ACbn')
call SetUnitAbilityLevel(d, 'ACbn', lvl-1)
elseif SpellStat(t,true) > 60 then
call UnitAddAbility(d, 'Arpm')
call SetUnitAbilityLevel(d, 'Arpm', lvl-2)
elseif SpellStat(t,true) > 90 then
call UnitAddAbility(d, 'Petr')
call SetUnitAbilityLevel(d, 'Petr', lvl-3)
endif
call UnitApplyTimedLife(d, 'Brai', 30)
call DestroyEffect(ShieldFX[GetUnitId(t)])
call DestroyTrigger(EVENT[GetUnitId(t)])
set EVENT[GetUnitId(t)] = null
set ShieldFX[GetUnitId(t)] = null
endif
set t= null
set d= null
return false
endmethod
static method create takes unit caster, unit target, integer lvl returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.c = caster
set D.t = target
set UNIT[GetUnitId(target)] = caster
set D.shield = 3
if EVENT[GetUnitId(D.t)] == null then
set EVENT[GetUnitId(D.t)] = CreateTrigger()
call TriggerRegisterUnitEvent(EVENT[GetUnitId(D.t)], D.t, EVENT_UNIT_DAMAGED)
call TriggerAddCondition(EVENT[GetUnitId(D.t)], function Data.Conditions)
endif
if ShieldFX[GetUnitId(D.t)] == null then
set ShieldFX[GetUnitId(D.t)] = AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,0), D.t, "chest")
endif
set Shield[GetUnitId(D.t)] = D.shield
call SetTimerData(tim,D)
call TimerStart(tim, 7.5+2.5*lvl, false, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit(), GetUnitAbilityLevel(GetTriggerUnit(), SPELLID))
endif
return false
endfunction
//===========================================================================
public function InitTrig_BoneShield takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=75
//TESH.alwaysfold=0
//***************************************************************************
//* *
//* Animate Dead *
//* *
//* By Blade.dk + *
//* *
//* http://www.wc3jass.com/viewforum.php?f=23 *
//* *
//***************************************************************************
//===========================================================================
//Animate Dead Spell Configuration Section.
constant function GetRaiseCorpseRawcode takes nothing returns integer
return 'RCor' // The rawcode of the Animate Dead spell.
endfunction
constant function GetRaiseCorpseDuration takes real level returns real
return 5+10*level // How long time the unit will last.
endfunction
constant function GetRaiseCorpseError takes nothing returns string
return "Must target a non-Hero corpse." // The error message displayed when no valid units are in range.
endfunction
constant function GetRaiseCorpseArea takes nothing returns real
return 100.00 // How close a unit must be to the point to be affected.
endfunction
//===========================================================================
//The spell itself. Don't touch it unless you know exactly what you're doing.
function RaiseCorpseConditions takes nothing returns boolean
return GetSpellAbilityId() == GetRaiseCorpseRawcode()
endfunction
function RaiseCorpseFilterConditions takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO))
endfunction
function RaiseCorpseCheckActions takes nothing returns nothing
local unit c = GetTriggerUnit()
local location l = GetSpellTargetLoc()
local group g = NewGroup()
local force f = GetForceOfPlayer(GetOwningPlayer(c))
call GroupEnumUnitsInRangeOfLoc(g, l, GetRaiseCorpseArea(), Condition(function RaiseCorpseFilterConditions))
if ( CountUnitsInGroup(g) < 1) then
call ClearTextMessagesBJ( f )
call DisplayTimedTextToForce( f, 2.00, " |cffffcc00"+GetRaiseCorpseError()+"|r" )
call IssueImmediateOrder( c, "stop" )
call TriggerSleepAction(0.1) // This is needed for the animation to be stopped as it should.
call SetUnitAnimation(c, "stand")
endif
set c = null
call RemoveLocation(l)
set l = null
call ReleaseGroup(g)
set g = null
call DestroyForce(f)
set f = null
endfunction
function RaiseCorpseActions takes nothing returns nothing
local integer a = 1
local unit old
local unit new
local unit c = GetTriggerUnit()
local location l = GetSpellTargetLoc()
local group g = NewGroup()
loop
exitwhen a > R2I(GetRaiseCorpseArea())
call GroupEnumUnitsInRangeOfLoc(g, l, 1*a, Condition(function RaiseCorpseFilterConditions))
if ( CountUnitsInGroup(g ) > 0) then
set old = GroupPickRandomUnit(g)
set a = R2I(GetRaiseCorpseArea()) // I could not just use an 'exitwhen true'. Then the group wouldn't be destroyed.
endif
call GroupClear(g)
set a = a + 1
endloop
set new = CreateUnitAtLoc( GetOwningPlayer(c), GetUnitTypeId(old), l, GetUnitFacing(old) )
call SetUnitBonus(new, BONUS_DAMAGE, GetUnitBonus(old, BONUS_DAMAGE))
call SetUnitBonus(new, BONUS_ARMOR, GetUnitBonus(old, BONUS_ARMOR))
call SetUnitBonus(new, BONUS_ATTACK_SPEED, GetUnitBonus(old, BONUS_ATTACK_SPEED))
call SetUnitMaxState(new, UNIT_STATE_MAX_LIFE, GetUnitState(old, UNIT_STATE_MAX_LIFE))
call SetUnitMaxState(new, UNIT_STATE_MAX_MANA, GetUnitState(old, UNIT_STATE_MAX_MANA))
//INSERT GROWTH AND STATBOOSTS HERE
call RemoveUnit(old)
call UnitApplyTimedLife(new, 'BUan', GetRaiseCorpseDuration(GetUnitAbilityLevel(c, GetRaiseCorpseRawcode())) )
call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Undead\\RaiseCorpse\\RaiseCorpseTarget.mdl", GetUnitX(new), GetUnitY(new) ) ) // The new unit is probably not at the exact location of the spell, so to make it look as it should I use GetUnitX and Y.
set old = null
set new = null
set c = null
call RemoveLocation(l)
set l = null
call ReleaseGroup(g)
endfunction
//===========================================================================
function InitTrig_Raise_Corpse takes nothing returns nothing
local trigger t = CreateTrigger( )
set gg_trg_Raise_Corpse = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Raise_Corpse, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Raise_Corpse, Condition( function RaiseCorpseConditions ) )
call TriggerAddAction( gg_trg_Raise_Corpse, function RaiseCorpseCheckActions )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function RaiseCorpseConditions ) )
call TriggerAddAction( t, function RaiseCorpseActions )
call Preload("Abilities\\Spells\\Undead\\RaiseCorpse\\RaiseCorpseTarget.mdl")
set t = null
endfunction
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope AnimateBones initializer init
globals
private constant integer SPELLID = 'AnBo'
endglobals
private function GiveBonus takes unit d, integer hp, integer dmg, integer arm returns nothing
call SetUnitMaxState(d, UNIT_STATE_MAX_LIFE, hp)
call SetUnitBonus(d, BONUS_DAMAGE, dmg)
call SetUnitBonus(d, BONUS_ARMOR, arm)
call SetUnitMaxState(d, UNIT_STATE_MAX_MANA, 100+0.15*GetWidgetLife(d))
call SetUnitState(d, UNIT_STATE_MANA, 100+0.15*GetWidgetLife(d))
endfunction
private function Actions takes unit c, unit d returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer i = GetRandomInt(1,lvl)
local integer hp = R2I(GetUnitState(c,UNIT_STATE_MAX_LIFE))
local integer dmg = R2I(8+0.5*SpellStat(c,true)+GetUnitBonus(c, BONUS_DAMAGE))
local integer arm = R2I(2+GetUnitBonus(c, BONUS_ARMOR))
call SetWidgetLife(c, GetWidgetLife(c)-hp*0.1)
if i == 1 then //Warrior
set dmg = R2I(dmg*0.4)
set hp = R2I(hp*0.7)
set arm = R2I(arm*0.8)
set d = CreateUnit(GetOwningPlayer(c), 'uske', GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
if SpellStat(c,true) > 40 then
call UnitAddAbility(d,'ACct')
endif
if SpellStat(c,true) > 100 then
call UnitAddAbility(d,'Lace')
endif
elseif i == 2 then //Arhcer
set hp = R2I(hp*0.55)
set dmg = R2I(dmg*0.5)
set arm = R2I(arm*0.7)
set d = CreateUnit(GetOwningPlayer(c), 'nska', GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
if SpellStat(c,true) > 35 then
call UnitAddAbility(d,'ACsa')
endif
if SpellStat(c,true) > 85 then
call UnitAddAbility(d,'MuSh')
endif
elseif i == 3 then //Mage
set hp = R2I(hp*0.5)
set dmg = R2I(dmg*0.4)
set arm = R2I(arm*0.6)
set d = CreateUnit(GetOwningPlayer(c), 'uskm', GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
if SpellStat(c,true) > 30 then
call UnitAddAbility(d,'Awfb')
endif
if SpellStat(c,true) > 75 then
call UnitAddAbility(d,'RePu')
endif
elseif i == 4 then //Orc Skeleton
set hp = R2I(hp*0.65)
set arm = R2I(arm*0.65)
set dmg = R2I(dmg*0.35)
set d = CreateUnit(GetOwningPlayer(c), 'nsko', GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
if SpellStat(c,true) > 40 then
call UnitAddAbility(d,'BlPa')
endif
if SpellStat(c,true) > 100 then
call UnitAddAbility(d,'Pulv')
endif
elseif i == 5 then
if GetRandomInt(1,3) == 1 then
set dmg = R2I(dmg*0.3)
set hp = R2I(hp*0.6)
set arm = R2I(arm*0.7)
set d = CreateUnit(GetOwningPlayer(c), 'uske', GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
call GiveBonus(d, hp, dmg, arm)
call UnitApplyTimedLife(d, 'Brai', 60)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_TARGET,0), GetUnitX(d), GetUnitY(d)))
if SpellStat(c,true) > 40 then
call UnitAddAbility(d,'ACct')
endif
if SpellStat(c,true) > 100 then
call UnitAddAbility(d,'Lace')
endif
endif
if GetRandomInt(1,3) == 1 then
set hp = R2I(hp*0.45)
set dmg = R2I(dmg*0.4)
set arm = R2I(arm*0.6)
set d = CreateUnit(GetOwningPlayer(c), 'nska', GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
call GiveBonus(d, hp, dmg, arm)
call UnitApplyTimedLife(d, 'Brai', 60)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_TARGET,0), GetUnitX(d), GetUnitY(d)))
if SpellStat(c,true) > 35 then
call UnitAddAbility(d,'ACsa')
endif
if SpellStat(c,true) > 85 then
call UnitAddAbility(d,'MuSh')
endif
endif
if GetRandomInt(1,3) == 1 then
set hp = R2I(hp*0.55)
set dmg = R2I(dmg*0.4)
set arm = R2I(arm*0.55)
set d = CreateUnit(GetOwningPlayer(c), 'uskm', GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
call GiveBonus(d, hp, dmg, arm)
call UnitApplyTimedLife(d, 'Brai', 60)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_TARGET,0), GetUnitX(d), GetUnitY(d)))
if SpellStat(c,true) > 30 then
call UnitAddAbility(d,'Awfb')
endif
if SpellStat(c,true) > 75 then
call UnitAddAbility(d,'RePu')
endif
endif
set d = null
endif
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_TARGET,0), GetUnitX(d), GetUnitY(d)))
call GiveBonus(d, hp, dmg, arm)
set UnitBounty[GetUnitId(d)] = R2I(SpellStat(c, true)*0.5)
call UnitAddType(d, UNIT_TYPE_SUMMONED)
call UnitApplyTimedLife(d, 'Brai', 60)
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), null)
endif
return true
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope UnderworldPull initializer init
globals
private constant integer SPELLID = 'UnPu'
private constant integer UNITID = 'nskg'
endglobals
private struct Data
static method Actions takes unit c, unit t, real x, real y returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer DamageBonus = R2I(SpellStat(c, false)*(0.1+0.03*lvl))
local integer ArmorBonus = R2I(GetUnitBonus(c, BONUS_ARMOR)/(3.0-0.3*lvl))
local integer HPBonus = R2I(110+75*lvl+(GetUnitState(c, UNIT_STATE_MAX_MANA)/4))
call TriggerSleepAction(1)
if GetWidgetLife(t) < 1 then
set bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(c), UNITID, x, y, GetUnitFacing(t))
call UnitApplyTimedLife(bj_lastCreatedUnit, 'Brai', 40+5*lvl)
call AddUnitBonus(bj_lastCreatedUnit, BONUS_LIFE, HPBonus)
call AddUnitBonus(bj_lastCreatedUnit, BONUS_DAMAGE, DamageBonus)
call AddUnitBonus(bj_lastCreatedUnit, BONUS_ARMOR, ArmorBonus)
endif
endmethod
static method Conditions takes nothing returns nothing
local unit t = GetSpellTargetUnit()
local unit c = GetTriggerUnit()
local real x = GetUnitX(t)
local real y = GetUnitY(t)
if GetSpellAbilityId() == SPELLID then
call Data.Actions(c, t, x, y)
endif
set t = null
set c = null
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope Petrify initializer InitTrig_Petrify
globals
private constant integer SPELLID = 'Petr'
private constant real tick = 0.2
endglobals
private struct Data
unit c
unit t
real dur
real ms
real as
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
local integer aspd = R2I(tick*(10+10*lvl))
local integer mspd = R2I(tick*(60+20*lvl))
if D.dur >= 4 then
call SetUnitTimeScale(D.t, 1.0)
call PauseUnit(D.t, false)
call AddUnitBonus(D.t, BONUS_ATTACK_SPEED, R2I(D.as))
call AddUnitBonus(D.t, BONUS_MOVEMENT_SPEED, R2I(D.ms))
call SetUnitVertexColor(D.t, 255,255,255,255)
call UnitRemoveType(D.t, UNIT_TYPE_MECHANICAL)
call ReleaseTimer(tim)
call D.destroy()
elseif GetUnitMoveSpeed(D.t) > 25 then
set D.ms = D.ms + mspd
set D.as = D.as + aspd
call AddUnitBonus(D.t, BONUS_ATTACK_SPEED, -aspd)
call AddUnitBonus(D.t, BONUS_MOVEMENT_SPEED, -mspd)
call SetUnitVertexColor(D.t, 197,197,197,255)
call SetUnitTimeScale(D.t, 0.5)
else
call SetUnitVertexColor(D.t, 123,123,123,255)
call SetUnitTimeScale(D.t, 0)
call PauseUnit(D.t, true)
call UnitAddType(D.t, UNIT_TYPE_MECHANICAL)
endif
set D.dur = D.dur + tick
endmethod
static method create takes unit c, unit t returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.dur = 0
set D.c = c
set D.t = t
set D.ms = 0
set D.as = 0
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(),GetSpellTargetUnit())
endif
return true
endfunction
//===========================================================================
public function InitTrig_Petrify takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=39
//TESH.alwaysfold=0
scope FrostArmorTimer initializer InitTrig_FrostAura_Learn
globals
private constant integer SPELLID = 'FrAA'
private constant integer BUFFID = 'BFAA'
private constant integer DUMMYID = 'DFAA'
private unit TEMP
endglobals
private struct Data extends xecast
unit c
static method GroupEm takes nothing returns boolean
local Data xc
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
if GetUnitAbilityLevel(GetFilterUnit(), BUFFID) > 0 then
set xc = xecast.createBasicA(DUMMYID, OrderId("frostarmor"), GetOwningPlayer(TEMP))
set xc.level = lvl
if GetRandomInt(1,100) < 20+10*lvl and IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD) then
call xc.castOnTarget(GetFilterUnit())
elseif GetRandomInt(1, 100) < 12+3*lvl then
call xc.castOnTarget(GetFilterUnit())
endif
endif
return false
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local group g = NewGroup()
local Data D = Data(GetTimerData(tim))
if D.c == null or GetUnitAbilityLevel(D.c, SPELLID) < 0 then
set D.c = null
call D.destroy()
call ReleaseTimer(tim)
else
set TEMP = D.c
call GroupEnumUnitsInArea(g, GetUnitX(D.c), GetUnitY(D.c), 400, Filter(function Data.GroupEm))
endif
call ReleaseGroup(g)
endmethod
static method create takes unit c returns Data
local timer tim = NewTimer()
local Data D = Data.allocate()
set D.c = c
call SetTimerData(tim,D)
call TimerStart(tim, 1.25, true, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetLearnedSkill() == SPELLID and GetLearnedSkillLevel() == 1 then
call Data.create(GetTriggerUnit())
endif
return true
endfunction
//===========================================================================
public function InitTrig_FrostAura_Learn takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=22
//TESH.alwaysfold=0
scope GrimGift initializer InitTrig_GrimGift
globals
private constant integer SPELLID = 'GrGi'
private constant integer BUFFID = 'BGrG'
private constant real tick = 1
private unit TEMP
endglobals
private struct Data
unit c
unit t
real hp
real dur
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
if D.dur > 10 or GetUnitAbilityLevel(D.t, BUFFID) < 1 then
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_TARGET, 0), D.t, "origin"))
if IsUnitType(D.t, UNIT_TYPE_UNDEAD) then
call UnitRemoveType(D.t, UNIT_TYPE_UNDEAD)
else
call UnitAddType(D.t, UNIT_TYPE_UNDEAD)
endif
if IsUnitAlly(D.t, GetOwningPlayer(D.c)) and not(IsUnitType(D.t, UNIT_TYPE_DEAD)) then
call SetWidgetLife(D.t, GetWidgetLife(D.t)-D.hp)
elseif not IsUnitType(D.t, UNIT_TYPE_DEAD) then
call SetWidgetLife(D.t, GetWidgetLife(D.t)+D.hp)
endif
call D.destroy()
call ReleaseTimer(tim)
endif
set D.dur = D.dur + tick
endmethod
static method create takes unit c, unit t returns Data
local timer tim = NewTimer()
local Data D = Data.allocate()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
set D.c = c
set D.t = t
if IsUnitAlly(D.t, GetOwningPlayer(D.c)) then
set D.hp = GetUnitState(D.t, UNIT_STATE_MAX_LIFE) - GetWidgetLife(D.t)
call SetWidgetLife(D.t, GetUnitState(D.t, UNIT_STATE_MAX_LIFE))
else
set D.hp = GetWidgetLife(D.t)
call SetWidgetLife(D.t, D.hp*0.875 - 0.125*lvl)
set D.hp = D.hp-GetWidgetLife(D.t)
endif
if IsUnitType(D.t, UNIT_TYPE_UNDEAD) then
call UnitRemoveType(D.t, UNIT_TYPE_UNDEAD)
elseif GetSpellAbilityId() == SPELLID then
call UnitAddType(D.t, UNIT_TYPE_UNDEAD)
endif
set D.dur = 0
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit())
endif
return true
endfunction
//===========================================================================
public function InitTrig_GrimGift takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope PresenceOfBL initializer Init
globals
private constant integer DUMMYID = 'DFAA'
private integer lvl
endglobals
private struct Data extends xecast
static method Buff takes unit c returns boolean
if GetUnitAbilityLevel(c, 'BLP1') > 0 then
set lvl = 1
return true
elseif GetUnitAbilityLevel(c, 'BLP2') > 0 then
set lvl = 2
return true
elseif GetUnitAbilityLevel(c, 'BLP3') > 0 then
set lvl = 3
return true
elseif GetUnitAbilityLevel(c, 'BLP4') > 0 then
set lvl = 4
return true
elseif GetUnitAbilityLevel(c, 'BLP5') > 0 then
set lvl = 5
return true
endif
return false
endmethod
static method Actions takes unit c, unit d returns nothing
local Data xc
set xc = xecast.createBasicA(DUMMYID, OrderId("frostarmor"), GetOwningPlayer(c))
set xc.level = lvl
if GetRandomInt(1,100) < 20+10*lvl and IsUnitType(c, UNIT_TYPE_UNDEAD) then
call xc.castOnTarget(c)
elseif GetRandomInt(1, 100) < 12+3*lvl then
call xc.castOnTarget(c)
else
call xc.destroy()
endif
endmethod
static method Conditions takes nothing returns nothing
if Data.Buff(GetTriggerUnit()) then
call Data.Actions(GetTriggerUnit(), null)
endif
endmethod
endstruct
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( t, function Data.Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=49
//TESH.alwaysfold=0
scope ReapersPull initializer InitTrig_ReapersPull
globals
private constant integer SPELLID = 'RePu'
private constant real tick = 0.6
private unit TEMP
private integer COUNTED
endglobals
private struct Data extends xedamage
unit c
group g
real dur
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local xedamage d = xedamage.create()
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
local real dam = SpellStat(D.c,true)*(0.5+0.5*lvl)+100*lvl
local unit u
set D.dur = D.dur + tick
if D.dur >= 3 then
loop
set u = FirstOfGroup(D.g)
exitwhen u == null
call ShowUnit(u, true)
set d.dtype = DAMAGE_TYPE_MAGIC
set d.atype = ATTACK_TYPE_MELEE
call d.useSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,1),"origin")
call d.damageTarget(D.c,u, dam)
call SetUnitPosition(u, GetUnitX(D.c), GetUnitY(D.c))
call IssueTargetOrder(u, "attack", D.c)
call GroupRemoveUnit(D.g, u)
endloop
set D.c = null
call ReleaseTimer(tim)
call D.destroy()
call ReleaseGroup(D.g)
elseif IsUnitType(D.c, UNIT_TYPE_DEAD) then
loop
set u = FirstOfGroup(D.g)
exitwhen u == null
call ShowUnit(u, true)
call GroupRemoveUnit(D.g, u)
endloop
call ReleaseGroup(D.g)
endif
set u = null
endmethod
static method GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and not( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) or IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) or IsUnitHidden(GetFilterUnit()) ) and COUNTED < 3+1*lvl then
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,0), GetUnitX(GetFilterUnit()), GetUnitY(GetFilterUnit())))
call ShowUnit(GetFilterUnit(), false)
set COUNTED = COUNTED + 1
return true
endif
return false
endmethod
static method create takes unit c returns Data
local timer tim = NewTimer()
local Data D = Data.allocate()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
set D.dur = 0
set D.c = c
set D.g = NewGroup()
call GroupRefresh(D.g)
set TEMP = D.c
set COUNTED = 0
call GroupEnumUnitsInArea(D.g, GetUnitX(D.c), GetUnitY(D.c), 400, Filter(function Data.GroupEm))
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.Timer)
return D
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit())
endif
return false
endmethod
endstruct
//===========================================================================
public function InitTrig_ReapersPull takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
endfunction
endscope
//TESH.scrollpos=2
//TESH.alwaysfold=0
scope OverwhelmingPresence initializer init
globals
private constant integer SPELLID = 'OvPr'
private constant real tick = 1
endglobals
public struct Data
unit c
real dur
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer i = 0
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
local group g = NewGroup()
local unit t
local real dam = (0.01 * GetUnitBonus(.c, BONUS_ARMOR) / (0.01*GetUnitBonus(.c, BONUS_ARMOR) + 1)) * (30+15*lvl)
if .dur >= 5-lvl then
call GroupEnumUnitsInRange(g, GetUnitX(.c), GetUnitY(.c), 800, BOOLEXPR_TRUE)
set .dur = 0
loop
set t = FirstOfGroup(g)
exitwhen t == null or i == lvl*1
if IsUnitEnemy(t, GetOwningPlayer(.c)) and not(IsUnitType(t, UNIT_TYPE_DEAD)) and not(IsUnitType(t, UNIT_TYPE_MECHANICAL)) then
call UnitDamageTarget(.c, t, dam, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MIND, wtype)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0), t, "origin"))
set i = i+1
endif
call GroupRemoveUnit(g, t)
endloop
elseif lvl == 0 then
call ReleaseTimer(GetExpiredTimer())
call .destroy()
else
set .dur = .dur + tick
endif
call ReleaseGroup(g)
set t = null
endmethod
static method Actions takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
set .c = c
set .dur = 0
call SetTimerData(tim,this)
call TimerStart(tim, tick, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns nothing
if GetLearnedSkill() == SPELLID then
call thistype.Actions(GetTriggerUnit())
endif
endmethod
endstruct
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction( t, function Data.Conditions )
set t= null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Sanguine_Actions takes unit caster, unit targ returns nothing
local real rad = 150. + 80. * GetUnitAbilityLevel(caster, 'sang')
local real dam = 55. + SpellStat(caster, true) * GetUnitAbilityLevel(caster, 'sang')
local integer maxtargs = 2 + 1 * GetUnitAbilityLevel(caster, 'sang')
local integer i = 0
local group SG = NewGroup()
call GroupEnumUnitsInArea(SG, GetSpellTargetX(), GetSpellTargetY(), rad, BOOLEXPR_TRUE)
loop
set targ = FirstOfGroup(SG)
exitwhen targ == null or i == maxtargs
if IsUnitEnemy(targ, GetOwningPlayer(caster)) and GetUnitState(targ, UNIT_STATE_LIFE) >= 1 then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl", targ, "origin"))
call UnitDamageTarget(caster, targ, dam, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, wtype )
set i = i + 1
endif
call GroupRemoveUnit(SG, targ)
endloop
call SetWidgetLife(caster, GetWidgetLife(caster) + i * SpellStat(caster,true))
call SetUnitState(caster, UNIT_STATE_MANA, GetUnitState(caster, UNIT_STATE_MANA) + i * 5)
call ReleaseGroup(SG)
endfunction
function IsItsang takes nothing returns boolean
if GetSpellAbilityId() == 'sang' then
call Sanguine_Actions(GetTriggerUnit(), null)
endif
return false
endfunction
//===========================================================================
function InitTrig_Siphon takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, function IsItsang)
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Doom initializer init
globals
private constant integer SPELLID = 'Doom'
private constant real tick = 1
endglobals
private struct Data
unit c
unit t
real dur
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local real lvl = GetUnitAbilityLevel(D.c, SPELLID)
local texttag tag = CreateTextTag()
local real chance
local real chance1
local real chance2
local real chance3
local real RR = GetRandomReal(0,1)
set D.dur = D.dur + tick
call SetTextTagText(tag, I2S(R2I(D.dur)), 0.04)
call SetTextTagColor(tag, 75,0,0,255)
call SetTextTagPosUnit(tag, D.t, 0.1)
call SetTextTagPermanent(tag, false)
call SetTextTagLifespan(tag, 0.9)
if D.dur < 10 or IsUnitType(D.c, UNIT_TYPE_DEAD) then
call ReleaseTimer(tim)
set chance1 = SpellStat(D.c,false)/SpellStat(D.t,false)//Change to ARMOR: GetUnitBonus(D.c,BONUS_ARMOR)/GetUnitBonus(D.t,BONUS_ARMOR)
set chance2 = GetUnitBounty(D.c)/GetUnitBounty(D.t)
set chance3 = GetWidgetLife(D.c)/GetWidgetLife(D.t)
set chance = (chance1+chance2+chance3)/3*(0.05+0.1*lvl)
if chance > RR and not( IsUnitType(D.t, UNIT_TYPE_UNDEAD) ) then
call SetTextTagText(tag, "Death", 0.04)
call SetTextTagColor(tag, 0,0,0,255)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,0), D.t, "origin"))
call KillUnit(D.t)
else
call SetTextTagText(tag, "Safe", 0.04)
call SetTextTagColor(tag, 255,255,255,255)
endif
call D.destroy()
endif
call SetTextTagVisibility(tag, true)
endmethod
static method Actions takes unit c, unit t returns Data
local timer tim = NewTimer()
local Data D = Data.allocate()
local real lvl = GetUnitAbilityLevel(c, SPELLID)
set D.c = c
set D.t = t
set D.dur = 0
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.Timer)
return D
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.Actions(GetTriggerUnit(), GetSpellTargetUnit())
endif
return true
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=37
//TESH.alwaysfold=0
scope Pestilence initializer init
globals
private constant integer SPELLID = 'Pest'
private constant real tick = 0.1
private unit TEMP
private real DAM
endglobals
private struct Data
unit c
unit frog
static method GroupEm takes nothing returns boolean
local xedamage d= xedamage.create()
local unit t = GetFilterUnit()
if t != null and IsUnitEnemy(t, GetOwningPlayer(TEMP)) and not(IsUnitType(t, UNIT_TYPE_DEAD) or IsUnitType(t, UNIT_TYPE_STRUCTURE)) then
call KillUnit(TEMP)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,0),GetUnitX(TEMP), GetUnitY(TEMP)))
set d.dtype = DAMAGE_TYPE_POISON
set d.atype = ATTACK_TYPE_MAGIC
call d.damageTarget(TEMP,t,DAM)
endif
call d.destroy()
set t = null
return false
endmethod
static method Loop takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
local group g = NewGroup()
set TEMP = D.frog
set DAM = SpellStat(D.c,true)*(0.1+0.2*lvl) + 15+5*lvl
if not IsUnitType(D.frog, UNIT_TYPE_DEAD) then
call GroupEnumUnitsInArea(g, GetUnitX(D.frog), GetUnitY(D.frog), 100, Filter(function Data.GroupEm))
else
call D.destroy()
call ReleaseTimer(tim)
endif
call ReleaseGroup(g)
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local timer tim2 = NewTimer()
local Data D = Data(GetTimerData(tim))
local real ang = GetRandomReal(0,2*bj_PI)
local real x = GetUnitX(D.c)+GetRandomReal(150,600)*Cos(ang)
local real y = GetUnitY(D.c)+GetRandomReal(150,600)*Sin(ang)
if GetUnitCurrentOrder(D.c) == OrderId("stampede") then
set D.frog = CreateUnit(GetOwningPlayer(D.c), 'nfro', x, y, ang)
call UnitAddAbility(D.frog, 'Atwa')
call UnitAddAbility(D.frog, 'Aap3')
call UnitAddAbility(D.frog, 'Aloc')
call SetUnitPathing(D.frog, false)
call UnitApplyTimedLife(D.frog, 'BNwm', 7.5)
call SetTimerData(tim2,D)
call TimerStart(tim2, tick, true, function Data.Loop)
else
call D.destroy()
endif
call ReleaseTimer(tim)
endmethod
static method Actions takes unit c, integer i returns Data
local timer tim = NewTimer()
local Data D = Data.allocate()
set D.c = c
call SetTimerData(tim,D)
call TimerStart(tim, i*0.35+GetRandomReal(-0.2,0.2), false, function Data.Timer)
return D
endmethod
static method Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(),SPELLID)
local integer i = 1
if GetSpellAbilityId() == SPELLID then
loop
exitwhen i > lvl*4+3
call Actions(GetTriggerUnit(),i)
set i = i + 1
endloop
endif
return true
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=14
//TESH.alwaysfold=0
scope Drain initializer InitTrig_Drain
globals
private constant integer SPELLID = 'drai'
private constant real tick = 0.1
private constant attacktype atk = ATTACK_TYPE_PIERCE
private constant damagetype dmg = DAMAGE_TYPE_MAGIC
endglobals
private struct Data
unit c
unit t
lightning lig
real dur
effect fx
static method onLoop takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local real HDrain = GetWidgetLife(D.c)/GetUnitState(D.c, UNIT_STATE_MAX_LIFE)
local real lvl = GetUnitAbilityLevel(D.c, SPELLID)
local real EHp = GetWidgetLife(D.t)
set HDrain = lvl*SpellStat(D.c, true)*HDrain
call MoveLightning(D.lig, true, GetUnitX(D.c), GetUnitY(D.c), GetUnitX(D.t), GetUnitY(D.t))
if not(IsUnitType(D.t, UNIT_TYPE_DEAD)) and D.dur <= 10 and GetUnitCurrentOrder(D.c) == OrderId("lavamonster") then
if IsUnitEnemy(D.t, GetOwningPlayer(D.c)) then
call UnitDamageTarget(D.c, D.t, HDrain*tick, true,false, atk, dmg,wtype)
set EHp = EHp - GetWidgetLife(D.t)
call SetWidgetLife(D.c, GetWidgetLife(D.c)+EHp)
else
call SetWidgetLife(D.c, GetWidgetLife(D.c) - HDrain*tick)
call SetWidgetLife(D.t, GetWidgetLife(D.t) + HDrain*tick*0.75)
endif
else
call DestroyLightning(D.lig)
call DestroyEffect(D.fx)
call IssuePointOrder(D.c, "move", GetUnitX(D.c), GetUnitY(D.c))
set D.lig = null
set D.c = null
set D.t = null
call ReleaseTimer(tim)
call D.destroy()
endif
set D.dur = D.dur + tick
endmethod
static method create takes unit caster, unit target returns Data
local timer tim = NewTimer()
local Data D = Data.allocate()
set D.c = caster
set D.t = target
set D.lig = AddLightning("DRAB", true, GetUnitX(D.c), GetUnitY(D.c), GetUnitX(D.t), GetUnitY(D.t))
set D.dur = 0
set D.fx = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Drain\\DrainCaster.mdl", D.c, "origin")
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.onLoop)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Drain takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Carrion_Crow_Actions takes unit s, unit c returns nothing
local real HPBonus = 40*GetUnitAbilityLevel(c, 'A00Y')+(GetUnitState(c, UNIT_STATE_MAX_MANA)/10)
local real DamageBonus = SpellStat(c, false)/8 + GetUnitAbilityLevel(c, 'A00Y')*4
local real ArmorBonus = GetUnitBonus(c, BONUS_ARMOR)/6
call AddUnitBonus(s, BONUS_LIFE, R2I(HPBonus))
call AddUnitBonus(s, BONUS_DAMAGE, R2I(DamageBonus))
call AddUnitBonus(s, BONUS_ARMOR, R2I(ArmorBonus))
call UnitAddAbility(s, 'AOcr')
call SetUnitAbilityLevel(s, 'AOcr', GetUnitAbilityLevel(c, 'A00Y'))
set UnitBounty[GetUnitId(s)] = SpellStat(c, true)/2
endfunction
function Carrion_Crow_Conditions takes nothing returns boolean
if GetUnitTypeId(GetSummonedUnit()) == 'crow' then
call Carrion_Crow_Actions(GetSummonedUnit(), GetSummoningUnit())
endif
return false
endfunction
//===========================================================================
function InitTrig_Carrion_Crow takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( t, function Carrion_Crow_Conditions )
endfunction
//TESH.scrollpos=50
//TESH.alwaysfold=0
//******************************************************************************
//* *
//* 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 'CurS'
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 0.0
endfunction
constant function Cursed_Soul_PossessDur takes integer level returns real
// Returns the possession duration for the target unit
return 10.0 + 2.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 600.0
endfunction
constant function Cursed_Soul_Radius takes nothing returns real
// Returns the distace which the soul will have from the caster.
return 300.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 ""
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=26
//TESH.alwaysfold=0
scope MassiveCleave initializer init
globals
private constant integer SPELLID = 'MaCl'
private integer array Strikes
private unit TEMP
endglobals
private function GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local real dam = GetUnitBonus(TEMP, BONUS_DAMAGE)*(1 + 0.6*lvl) + SpellStat(TEMP, true) * (1.5 + lvl*0.5)
local location loc1 = GetUnitLoc(TEMP)
local location loc2 = GetUnitLoc(GetFilterUnit())
local xedamage d = xedamage.create()
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_HERO
call TerrainDeformationWaveBJ(0.2, loc1, loc2, 120, 15, 0.1)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_TARGET, 0), GetFilterUnit(), "head"))
call d.damageTarget(TEMP,GetFilterUnit(), dam)
call d.destroy()
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1 = null
set loc2 = null
return false
endfunction
private function Conditions takes nothing returns boolean
local location loc = GetUnitLoc(GetAttacker())
local integer lvl = GetUnitAbilityLevel(GetAttacker(), SPELLID)
local real a = GetUnitFacing(GetAttacker())
local group g = NewGroup()
set TEMP = GetAttacker()
if lvl > 0 then
set Strikes[GetUnitId(TEMP)] = Strikes[GetUnitId(TEMP)] + 1
if Strikes[GetUnitId(TEMP)] > 11-2*lvl then
call GroupEnumUnitsInCone(g, loc, 400, a, 250, 250, Filter(function GroupEm))
set Strikes[GetUnitId(TEMP)] = 0
endif
endif
call ReleaseGroup(g)
call RemoveLocation(loc)
set loc = null
return false
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=22
//TESH.alwaysfold=0
scope CritAura initializer InitTrig_Crit_Strike_Aura
globals
private constant integer SPELLID = 'CrAu'
private constant integer BUFFID = 'BCri'
private trigger array EventTrigger
endglobals
private function Conditions2 takes nothing returns boolean
local texttag tag = CreateTextTag()
local unit c = GetEventDamageSource()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local unit t = GetTriggerUnit()
if GetUnitAbilityLevel(c, BUFFID) > 0 then
if GetWidgetLife(t) > GetEventDamage()*0.25 then
call SetWidgetLife(t, GetWidgetLife(t)-GetEventDamage()*0.25)
endif
call SetTextTagText(tag, I2S(R2I(GetEventDamage()*1.25))+"!",0.0276)
call SetTextTagColor(tag, 255, 0, 0, 255)
call SetTextTagVelocity(tag, 0, 0.04)
call SetTextTagPermanent(tag,false)
call SetTextTagLifespan(tag,1.25)
call SetTextTagFadepoint(tag,1)
call SetTextTagPos(tag,GetUnitX(c)-20,GetUnitY(c),8.00)
else
call DestroyTextTag(tag)
endif
call DestroyTrigger(EventTrigger[GetUnitId(t)])
set EventTrigger[GetUnitId(t)] = null
set t = null
set c = null
return false
endfunction
private function Conditions takes nothing returns boolean
set EventTrigger[GetUnitId(GetTriggerUnit())] = CreateTrigger()
if GetUnitAbilityLevel(GetAttacker(), BUFFID) > 0 and GetRandomInt(1,100) < 15 then
call TriggerRegisterUnitEvent(EventTrigger[GetUnitId(GetTriggerUnit())], GetTriggerUnit(), EVENT_UNIT_DAMAGED)
call TriggerAddCondition(EventTrigger[GetUnitId(GetTriggerUnit())], function Conditions2)
else
call DestroyTrigger(EventTrigger[GetUnitId(GetTriggerUnit())])
set EventTrigger[GetUnitId(GetTriggerUnit())] = null
endif
return false
endfunction
//===========================================================================
public function InitTrig_Crit_Strike_Aura takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, function Conditions )
set t = null
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope SoulEater initializer InitTrig_SoulEater
globals
private constant integer SPELLID = 'SoEa'
private constant integer BUFFID = 'BSoE'
private trigger array EventTrigger
endglobals
private function Conditions2 takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetEventDamageSource(), SPELLID)
if GetUnitAbilityLevel(GetEventDamageSource(), BUFFID) > 0 then
if GetWidgetLife(GetTriggerUnit()) > GetEventDamage()*(0.2+0.2*lvl) then
call SetWidgetLife(GetEventDamageSource(), GetWidgetLife(GetEventDamageSource()) - (0.12+0.1*lvl)*GetEventDamage())
call SetWidgetLife(GetTriggerUnit(), GetWidgetLife(GetTriggerUnit())-GetEventDamage()*(0.2+0.2*lvl))
endif
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl", GetTriggerUnit(), "origin"))
call DestroyTrigger(EventTrigger[GetUnitId(GetTriggerUnit())])
set EventTrigger[GetUnitId(GetTriggerUnit())] = null
endif
return false
endfunction
private function Conditions takes nothing returns boolean
set EventTrigger[GetUnitId(GetTriggerUnit())] = CreateTrigger()
if GetUnitAbilityLevel(GetAttacker(), BUFFID) > 0 then
call TriggerRegisterUnitEvent(EventTrigger[GetUnitId(GetTriggerUnit())], GetTriggerUnit(), EVENT_UNIT_DAMAGED)
call TriggerAddCondition(EventTrigger[GetUnitId(GetTriggerUnit())], function Conditions2)
else
call DestroyTrigger(EventTrigger[GetUnitId(GetTriggerUnit())])
set EventTrigger[GetUnitId(GetTriggerUnit())] = null
endif
return false
endfunction
//===========================================================================
public function InitTrig_SoulEater takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Conditions ) )
set t = null
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ShadeStrike initializer Init
globals
private constant integer SPELLID = 'ShSt'
endglobals
private function Actions takes unit c, unit t returns nothing
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local real HP = GetWidgetLife(t)
local real dam = (35+35*lvl+GetUnitBonus(c, BONUS_DAMAGE))*(0.6+0.2*lvl)
call UnitDamageTarget(c, t, dam, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, wtype)
set HP = (HP-GetWidgetLife(t))*0.45
call SetWidgetLife(c, GetWidgetLife(c) + HP)
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit(), GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions)
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CripplingBlow initializer init
globals
private constant integer SPELLID = 'Crip'
endglobals
private function Conditions takes nothing returns boolean
local xedamage d = xedamage.create()
local real lvl = GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
if GetSpellAbilityId() == SPELLID then
set d.atype= ATTACK_TYPE_MELEE
set d.dtype= DAMAGE_TYPE_NORMAL
call d.damageTarget(GetTriggerUnit(),GetSpellTargetUnit(),40+30*lvl+(SpellStat(GetTriggerUnit(),true)*(1+0.2*lvl)))
endif
call d.destroy()
return true
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope BlinkSlash initializer init
globals
private constant integer SPELLID = 'BlSl'
endglobals
private function Actions takes unit c, unit t returns nothing
local xedamage d=xedamage.create()
local integer lvl = GetUnitAbilityLevel(c,SPELLID)
local real ang = Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c))
local real x = GetUnitX(t)+32*Cos(ang)
local real y = GetUnitY(t)+32*Sin(ang)
local real dam = SpellStat(c,true)+15+30*lvl
call SetUnitPosition(c, x, y)
call SetUnitFacing(c, Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c)))
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_AREA_EFFECT,1), GetUnitX(c), GetUnitY(c)))
call IssueTargetOrder(c, "smart", t)
call SetUnitAnimation(c, "attack")
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_MELEE
call d.useSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,0), "origin")
call d.damageTarget(c,t,dam)
endfunction
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_AREA_EFFECT,0), GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit())))
call Actions(GetTriggerUnit(),GetSpellTargetUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DoubleAttack initializer init
globals
private constant integer SPELLID = 'DoAt'
private trigger array EventTrigger
endglobals
private struct Data
unit c
unit t
real dmg
static method create takes unit c, unit t, real dmg returns Data
local Data D = Data.allocate()
set D.c = c
set D.t = t
set D.dmg = dmg
return D
endmethod
endstruct
private function Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call UnitDamageTarget(D.c, D.t, D.dmg, true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,wtype)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,0), D.t, "origin"))
call SetUnitAnimation(D.c, "attack")
call D.destroy()
call ReleaseTimer(tim)
endfunction
private function Conditions2 takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetEventDamageSource(), SPELLID)
local timer tim = NewTimer()
local Data D = Data.create(GetEventDamageSource(),GetTriggerUnit(), GetEventDamage())
if lvl > 0 then
call SetTimerData(tim,D)
call TimerStart(tim, 0.3, false, function Timer)
call DestroyTrigger(EventTrigger[GetUnitId(GetTriggerUnit())])
set EventTrigger[GetUnitId(GetTriggerUnit())] = null
else
call D.destroy()
call ReleaseTimer(tim)
endif
return false
endfunction
private function Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetAttacker(),SPELLID)
set EventTrigger[GetUnitId(GetTriggerUnit())] = CreateTrigger()
if lvl > 0 and GetRandomInt(1,100) < 15+5*lvl then
call TriggerRegisterUnitEvent(EventTrigger[GetUnitId(GetTriggerUnit())], GetTriggerUnit(), EVENT_UNIT_DAMAGED)
call TriggerAddCondition(EventTrigger[GetUnitId(GetTriggerUnit())], function Conditions2)
else
call DestroyTrigger(EventTrigger[GetUnitId(GetTriggerUnit())])
set EventTrigger[GetUnitId(GetTriggerUnit())] = null
endif
return false
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Conditions ) )
set t = null
endfunction
endscope
//TESH.scrollpos=13
//TESH.alwaysfold=0
scope PoisonDaggers initializer init
globals
private constant integer SPELLID = 'PoDa'
private constant real tick = 1
endglobals
private struct Data extends xecollider
unit caster
unit c
unit t
real dur
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local xedamage d= xedamage.create()
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
local real dam = SpellStat(D.c,true)*(0.2*lvl)+5*lvl
set D.dur = D.dur + tick
if D.dur <= 5 and not( IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD )) then
call d.useSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_AREA_EFFECT, 1),"origin")
set d.dtype = DAMAGE_TYPE_POISON
set d.atype = ATTACK_TYPE_NORMAL
call d.damageTarget(D.c,D.t, 5)
else
set D.c = null
set D.t = null
call ReleaseTimer(tim)
call D.destroy()
endif
call d.destroy()
endmethod
static method make takes unit c, unit t returns Data
local Data D = Data.allocate(0,0,0)
set D.c = c
set D.t = t
set D.dur = 0
return D
endmethod
method onUnitHit takes unit target returns nothing
local xedamage d= xedamage.create()
local Data D
local timer tim = NewTimer()
local integer lvl = GetUnitAbilityLevel(.caster, SPELLID)
local real dam = SpellStat(.caster,true)*(1+0.2*lvl)+15+10*lvl
if IsUnitEnemy(target, GetOwningPlayer(this.caster)) and IsUnitType(target,UNIT_TYPE_STRUCTURE) == false then
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_AREA_EFFECT, 0), target, "origin"))
set d.dtype = DAMAGE_TYPE_POISON
set d.atype = ATTACK_TYPE_NORMAL
call d.damageTarget(this.caster,target, 25)
call d.destroy()
set D = Data.make(this.caster,target)
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.Timer)
call this.terminate()
endif
endmethod
static method Actions takes unit c returns nothing
local integer i = 0
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local real angle = bj_RADTODEG*Atan2( GetSpellTargetY() - GetUnitY(c) , GetSpellTargetX() - GetUnitX(c) ) + (15+10*lvl)/2
local real cone = (15+10*lvl)/(1+lvl)
local Data xc
loop
exitwhen i == 2+lvl
set xc = Data.create( GetUnitX(c), GetUnitY(c), bj_DEGTORAD*(angle - cone*i) )
set xc.caster = c
set xc.fxpath = GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0)
set xc.speed = 900
set xc.expirationTime = 0.8
set xc.collisionSize = 16
set i = i + 1
endloop
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.Actions(GetTriggerUnit())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Rapido_Actions takes nothing returns nothing
if GetSpellAbilityId() == 'Rapi' then
call UnitResetCooldown( GetTriggerUnit() )
endif
endfunction
function Trig_Rapido_Cast takes nothing returns nothing
if GetSpellAbilityId() == 'Rapi' then
call AttachSoundToUnit(gg_snd_RapidoMusic, GetTriggerUnit())
call SetSoundVolume( gg_snd_RapidoMusic, 75 )
call StartSound(gg_snd_RapidoMusic)
endif
endfunction
//===========================================================================
function InitTrig_Rapido takes nothing returns nothing
local trigger t1 = CreateTrigger( )
local trigger t2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerRegisterAnyUnitEventBJ( t2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t1, function Trig_Rapido_Cast )
call TriggerAddAction( t2, function Trig_Rapido_Actions )
endfunction
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope BladeBolero initializer I
globals
private constant integer SPELLID = 'BlBo'
endglobals
private struct Data
unit c
timer tim
integer lvl
real x
real y
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local real d = SquareRoot(GetRandomReal(100 * 100, (300+100*lvl) * (400+100*.lvl)))
local real ang = GetRandomReal(0,2*bj_PI)
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
local unit u
local real x = .x + d * Cos(ang)
local real y = .y + d * Sin(ang)
if GetUnitCurrentOrder(.c) == OrderId("stoneform") then
set u = CreateUnit(GetOwningPlayer(.c), 'answ', x, y, ang)
call UnitApplyTimedLife(u, 'BEfn', 4+lvl*0.5)
call UnitAddAbility(u, 'AOcr')
call UnitAddAbility(u, 'Aloc')
call SetUnitAnimation(u, "birth")
call AddUnitBonus(u, BONUS_DAMAGE, 5*lvl)
call SetUnitVertexColor(u, 100, 130, 255, 175)
else
call SetUnitPosition(.c, GetUnitX(.c), GetUnitY(.c))
call .destroy()
endif
set u = null
call ReleaseTimer(.tim)
endmethod
static method create takes unit c, real x, real y, integer i returns thistype
local thistype this = thistype.allocate()
set .tim = NewTimer()
set .c = c
set .x = x
set .y = y
set .lvl = GetUnitAbilityLevel(.c, SPELLID)
call AttachSoundToUnit(gg_snd_BladeBolero, c)
call SetSoundVolume( gg_snd_BladeBolero, 75 )
call StartSound(gg_snd_BladeBolero)
call SetTimerData(.tim,this)
call TimerStart(.tim, 0.8*i+GetRandomReal(0.2,-0.2), true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns nothing
local integer i = 1
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
if GetSpellAbilityId() == SPELLID then
loop
call Data.create(GetTriggerUnit(), x, y, i)
exitwhen i > 3*lvl+2
set i = i + 1
endloop
endif
endfunction
//===========================================================================
public function I takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=21
//TESH.alwaysfold=0
scope CoinToss initializer Init
globals
private constant integer SPELLID = 'CoiT'
private constant integer BONUSID = 'ImpO'
private constant attacktype atk = ATTACK_TYPE_NORMAL
private constant damagetype dmg = DAMAGE_TYPE_NORMAL
private unit TEMP
endglobals
private struct Data extends xecollider
unit caster
method onUnitHit takes unit target returns nothing
local integer lvl = GetUnitAbilityLevel(this.caster, SPELLID)
local real dam = lvl*35 + SpellStat(this.caster,true)*(0.4+0.2*lvl)
if IsUnitEnemy(this.caster, GetOwningPlayer(target)) and not(IsUnitType(target, UNIT_TYPE_STRUCTURE)) then
call UnitDamageTarget(this.caster, target, dam, true, false, atk, dmg, wtype)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_AREA_EFFECT, 0), target, "origin"))
call this.terminate()
endif
endmethod
endstruct
private function Actions takes unit c returns nothing
local real ang = Atan2( GetSpellTargetY() - GetUnitY(c) , GetSpellTargetX() - GetUnitX(c) )
local Data xc
local integer bonus = GetUnitAbilityLevel(c, BONUSID)
local integer i = 0
local real ang2 = ang + bj_PI/2
set ang2 = ang + bj_PI/2
set ang = bj_RADTODEG*ang+10
loop
exitwhen (i==5+bonus)
set xc = Data.create( GetUnitX(c)-15+3*i, GetUnitY(c)-15+3*i, bj_DEGTORAD*(ang - 10*i) )
set xc.fxpath = GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0)
set xc.speed = 950
set xc.expirationTime = 1.75
set xc.z = 50.0
set xc.collisionSize = 35
set xc.caster = c
set ang2= bj_PI + ang2
set i = i + 1
endloop
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, function Conditions )
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Wasted initializer InitTrig_Wasted
globals
private constant integer SPELLID = 'Wast'
private constant integer DUMMYID = 'ACsl'
private constant real tick = 1.
endglobals
private struct Data
unit c
integer hp
integer dmg
timer tim
static method onLoop takes nothing returns nothing
local Data D = Data(GetTimerData(GetExpiredTimer()))
local xecast xc
set D.tim = GetExpiredTimer()
if GetUnitAbilityLevel(D.c, 'BWst') <= 0 then
call AddUnitMaxState(D.c, UNIT_STATE_MAX_LIFE, -D.hp)
call AddUnitBonus(D.c, BONUS_DAMAGE, -D.dmg)
set D.c = null
call ReleaseTimer(D.tim)
call D.destroy()
elseif GetRandomInt(1, 12) == 1 then
set xc = xecast.createBasicA(DUMMYID,OrderId("sleep"),GetOwningPlayer(D.c))
call xc.castOnTarget(D.c)
endif
endmethod
static method create takes unit caster returns Data
local Data D = Data.allocate()
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
set D.tim = NewTimer()
set D.c = caster
set D.hp = 350+150*lvl
set D.dmg = 10+5*lvl
call AddUnitMaxState(D.c, UNIT_STATE_MAX_LIFE, D.hp)
call AddUnitBonus(D.c, BONUS_DAMAGE, D.dmg)
call SetTimerData(D.tim, D)
call TimerStart(D.tim, tick, true, function Data.onLoop)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Wasted takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope WastedSpell initializer InitTrig_Wasted_Spell
globals
private constant integer SPELLID = 'dWas'
private constant integer DUMMYID = 'ACsl'
private constant real tick = 1.
endglobals
private struct Data
unit c
integer hp
integer dmg
timer tim
static method onLoop takes nothing returns nothing
local Data D = Data(GetTimerData(GetExpiredTimer()))
local xecast xc
set D.tim = GetExpiredTimer()
if GetUnitAbilityLevel(D.c, 'BWst') <= 0 then
call AddUnitMaxState(D.c, UNIT_STATE_MAX_LIFE, -D.hp)
call AddUnitBonus(D.c, BONUS_DAMAGE, -D.dmg)
set D.c = null
call ReleaseTimer(D.tim)
call D.destroy()
elseif GetRandomInt(1, 12) == 1 then
set xc = xecast.createBasicA(DUMMYID,OrderId("sleep"),GetOwningPlayer(D.c))
call xc.castOnTarget(D.c)
endif
endmethod
static method create takes unit caster returns Data
local Data D = Data.allocate()
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
set D.tim = NewTimer()
set D.c = caster
set D.hp = 300+100*lvl
set D.dmg = 8+4*lvl
call AddUnitMaxState(D.c, UNIT_STATE_MAX_LIFE, D.hp)
call AddUnitBonus(D.c, BONUS_DAMAGE, D.dmg)
call SetTimerData(D.tim, D)
call TimerStart(D.tim, tick, true, function Data.onLoop)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetSpellTargetUnit())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Wasted_Spell takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope Dice initializer init
globals
private constant integer SPELLID = 'Dice'
private constant integer BONUSID = 'ImpO'
private constant real tick = 1.5
endglobals
private struct Data
unit c
unit t
real dur
static method Timer takes nothing returns nothing
local xedamage d=xedamage.create()
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local integer bonus = GetUnitAbilityLevel(D.c, BONUSID)
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
local texttag tag = CreateTextTag()
local integer RI = GetRandomInt(0,10)+bonus
local integer id
local real dam = lvl*25 + 15*RI
set D.dur = D.dur + 1
call SetTextTagText(tag, I2S(RI), 0.03)
call SetTextTagColor(tag, 255,255,255,255)
call SetTextTagPosUnit(tag, D.t, 0.1)
call SetTextTagPermanent(tag, false)
call SetTextTagLifespan(tag, 1)
set d.atype= ATTACK_TYPE_NORMAL
set d.dtype= DAMAGE_TYPE_MAGIC
call d.damageTarget(D.c, D.t, dam)
set id = R2I(RI/3)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_AREA_EFFECT, id), D.t, "origin"))
call d.destroy()
if RI < GetRandomInt(0, 10) or D.dur >= 3 or IsUnitType(D.t, UNIT_TYPE_DEAD) or D.t == null then
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL, 0), D.t, "origin"))
call ReleaseTimer(tim)
call D.destroy()
endif
call SetTextTagVisibility(tag, true)
endmethod
static method Actions takes unit c, unit t returns Data
local timer tim = NewTimer()
local Data D = Data.allocate()
local real lvl = GetUnitAbilityLevel(c, SPELLID)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE, 0), D.t, "origin"))
set D.c = c
set D.t = t
set D.dur = 0
call SetTimerData(tim,D)
call TimerStart(tim, tick, true, function Data.Timer)
return D
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.Actions(GetTriggerUnit(), GetSpellTargetUnit())
endif
return true
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope SpinningBeers initializer init
globals
private constant integer SPELLID = 'Beer'
private constant integer DUMMYID = 'ANdh'
private constant integer BSPELLID = 'Drun'
endglobals
private struct Data extends xecollider
unit caster
real ang
method loopControl takes nothing returns nothing
set .ang = .ang + 0.08
set .x = GetUnitX(.caster) + 100*Cos(.ang)
set .y = GetUnitY(.caster) + 100*Sin(.ang)
set .xyangle = ang
endmethod
method onUnitHit takes unit target returns nothing
local xedamage d= xedamage.create()
local xecast xc
local integer lvl = GetUnitAbilityLevel(.caster,SPELLID)
local integer blvl = GetUnitAbilityLevel(.caster,BSPELLID)
local real ang = 57.29582 * Atan2(GetUnitY(target) - GetUnitY(.caster), GetUnitX(target) - GetUnitX(.caster))
local real dam = SpellStat(.caster,true)*(1+0.1*lvl)+5*lvl
if IsUnitEnemy(target, GetOwningPlayer(.caster)) then
set xc = xecast.createBasicA(DUMMYID,OrderId("drunkenhaze"),GetOwningPlayer(.caster))
call xc.castOnTarget(target)
if blvl > 0 then
set dam = dam*(1+0.1*lvl)
endif
set d.dtype = DAMAGE_TYPE_NORMAL
set d.atype = ATTACK_TYPE_MAGIC
call d.damageTarget(.caster,target, dam)
call d.destroy()
call KnockbackTarget(.caster, target, ang, 400, 425, false, false, false, GetAbilityEffectById(SPELLID, EFFECT_TYPE_AREA_EFFECT, 0))
call .terminate()
endif
endmethod
static method Actions takes unit c returns nothing
local real angle
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer i = 1
local Data xc
loop
exitwhen i > lvl+1
set angle = Atan2(GetUnitFacing(c) - GetUnitY(c), GetUnitFacing(c) - GetUnitX(c)) + 360/(lvl+1)*i * bj_DEGTORAD
set xc = Data.create(GetUnitX(c)+50+50*i*Cos(angle), GetUnitY(c)+50+50*i*Sin(angle), angle)
set xc.caster = c
set xc.expirationTime = 9
set xc.collisionSize = 32
set xc.fxpath = GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0)
set xc.ang = angle
set xc.z = 60
set i = i + 1
endloop
endmethod
static method Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.Actions(GetTriggerUnit())
endif
return false
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Data.Conditions )
call XE_PreloadAbility(SPELLID)
set t= null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope LastCall initializer init
globals
private constant integer SPELLID = 'LstC'
private constant integer DUMMYID = 'ANdh'
private constant integer DUMMYID2 = 'dWas'
private unit TEMP
endglobals
private function GroupEm takes nothing returns boolean
local unit target = GetFilterUnit()
local integer lvl = GetUnitAbilityLevel(TEMP,SPELLID)
local xecast xc
if IsUnitEnemy(target, GetOwningPlayer(TEMP)) then
set xc = xecast.createBasicA(DUMMYID,OrderId("drunkenhaze"),GetOwningPlayer(TEMP))
call xc.castOnTarget(target)
else
set xc = xecast.createBasicA(DUMMYID2,OrderId("drunkenhaze"),GetOwningPlayer(TEMP))
call xc.castOnTarget(target)
endif
set target = null
return false
endfunction
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
set TEMP = GetTriggerUnit()
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(TEMP), GetUnitY(TEMP), 600, Filter(function GroupEm))
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope DragonsBreath initializer init
globals
private constant integer SPELLID = 'A001'
private unit TEMP
endglobals
private function GroupEm takes nothing returns boolean
local unit un = GetFilterUnit()
local integer lvl = GetUnitAbilityLevel(TEMP,SPELLID)
local real dam = SpellStat(TEMP,true)*(0.3+0.1*lvl)
local xedamage d
set d.dtype = DAMAGE_TYPE_FIRE
set d.atype = ATTACK_TYPE_MAGIC
if IsUnitEnemy(un, GetOwningPlayer(TEMP)) and not(IsUnitType(un, UNIT_TYPE_DEAD) or IsUnitType(un, UNIT_TYPE_STRUCTURE)) then
set d = xedamage.create()
call d.damageTarget(TEMP,un,dam)
endif
set un = null
return false
endfunction
private function Conditions takes nothing returns nothing
local location loc = GetUnitLoc(GetTriggerUnit())
local real a = Atan2(GetSpellTargetY() - GetUnitY(GetTriggerUnit()), GetSpellTargetX() - GetUnitX(GetTriggerUnit()))*bj_RADTODEG
if GetSpellAbilityId() == SPELLID then
set TEMP = GetTriggerUnit()
call GroupEnumUnitsInCone(ENUM_GROUP, loc, 375., a, 125, 125, Filter(function GroupEm))
endif
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope PurifyingLight initializer Init
globals
private constant integer SPELLID = 'puli'
private constant integer ALTSPELLID = 'imco'
private unit caster
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELLID or GetSpellAbilityId() == ALTSPELLID
endfunction
private function GroupEnum takes nothing returns boolean
local real d
set d = 50 + 25 * GetUnitAbilityLevel(caster, GetSpellAbilityId())
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(caster)) then
call UnitDamageTarget(caster, GetFilterUnit(), d, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_MAGIC, wtype)
endif
return false
endfunction
private function Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local group g = CreateGroup()
local unit t = GetSpellTargetUnit()
local real X = GetSpellTargetX()
local real Y = GetSpellTargetY()
local real d
local real h
set d = 25 + 25*GetUnitAbilityLevel(c, GetSpellAbilityId())
set h = 25+125*GetUnitAbilityLevel(c,GetSpellAbilityId())
if IsUnitEnemy(t, GetOwningPlayer(c)) then
call UnitDamageTarget(c, t, d, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_MAGIC, wtype)
else
call SetWidgetLife(t, GetWidgetLife(t) + h)
endif
call TriggerSleepAction(0.0)
set caster = c
call GroupEnumUnitsInRange(g, X, Y, 250., function GroupEnum)
if GetSpellAbilityId() == SPELLID then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\StaffOfPurification\\PurificationCaster.mdl", t, "origin"))
else
call DestroyEffect(AddSpecialEffectTarget("Units\\NightElf\\Wisp\\WispExplode.mdl", t, "origin"))
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
call XE_PreloadAbility(SPELLID)
endfunction
private function InitTrig_Purifying_Light takes nothing returns nothing
endfunction
endscope
//TESH.scrollpos=41
//TESH.alwaysfold=0
scope TormentedChains initializer InitTrig_Tormenting_Chains
globals
private constant integer SPELLID = 'ToCh'
private constant integer BUFFID = 'BToC'
private constant integer DUMMYID = 'DToC'
private constant real TICK = 0.5
private trigger array EVENT
private real DAMAGE
endglobals
private struct Data
unit c
real dur
timer tim
static integer counted
static unit u
static group g
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
local unit u
local group g = NewGroup()
set bj_groupAddGroupDest = thistype.g
call ForGroup(g, function GroupAddGroupEnum)
set .dur = .dur + TICK
loop
set u = FirstOfGroup(g)
exitwhen u == null
if IsUnitType(u, UNIT_TYPE_DEAD) or GetUnitAbilityLevel(u, BUFFID) < 1 then
call DestroyTrigger(EVENT[GetUnitId(u)])
set EVENT[GetUnitId(u)] = null
call GroupRemoveUnit(thistype.g, u)
endif
call GroupRemoveUnit(g, u)
endloop
if .dur >= 5+1*lvl then
loop
set u = FirstOfGroup(thistype.g)
exitwhen u == null
call UnitRemoveAbility(u, BUFFID)
call GroupRemoveUnit(thistype.g, u)
call DestroyTrigger(EVENT[GetUnitId(u)])
set EVENT[GetUnitId(u)] = null
endloop
call ReleaseGroup(thistype.g)
call ReleaseTimer(.tim)
call .destroy()
endif
call ReleaseGroup(g)
endmethod
static method GroupDamage takes nothing returns nothing
local unit e = GetEnumUnit()
if GetWidgetLife(e) > DAMAGE then
call SetWidgetLife(e, GetWidgetLife(e) - DAMAGE)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0), e, "origin"))
endif
set e = null
endmethod
static method Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(thistype.u, SPELLID)
set DAMAGE = (lvl*0.05+0.05)*GetEventDamage()
call ForGroup(thistype.g, function thistype.GroupDamage )
return false
endmethod
static method GroupEm takes nothing returns boolean
local xecast d = xecast.createBasicA(DUMMYID, OrderId("slow"), GetOwningPlayer(thistype.u))
local unit f = GetFilterUnit()
if IsUnitEnemy(f, GetOwningPlayer(thistype.u)) and not(IsUnitType(f, UNIT_TYPE_STRUCTURE)) and not( IsUnitType(f, UNIT_TYPE_DEAD )) and thistype.counted < 6 then
call d.castOnTarget(f)
call d.destroy()
set EVENT[GetUnitId(f)] = CreateTrigger()
call TriggerRegisterUnitEvent( EVENT[GetUnitId(f)], f, EVENT_UNIT_DAMAGED )
call TriggerAddCondition( EVENT[GetUnitId(f)], function thistype.Conditions )
set thistype.counted = thistype.counted + 1
return true
endif
set f = null
return false
endmethod
static method create takes unit c, real x, real y returns thistype
local thistype this = thistype.allocate()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
set .tim = NewTimer()
set .c = c
set thistype.u = c
set .dur = 0
set thistype.g = NewGroup()
set thistype.counted = 0
call GroupEnumUnitsInArea(thistype.g, x, y, 280+20*lvl, Filter(function thistype.GroupEm))
call SetTimerData(.tim,this)
call TimerStart(.tim, TICK, true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Tormenting_Chains takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope Sacrement initializer init
globals
private constant integer SPELLID = 'Sacr'
private constant damagetype dtype = DAMAGE_TYPE_MAGIC
private constant attacktype atype = ATTACK_TYPE_NORMAL
private constant weapontype wtype = WEAPON_TYPE_WHOKNOWS
endglobals
private struct Data
static unit c
static unit t
static real dam
static integer counted
static method GroupEmEnemy takes nothing returns boolean
local unit e = GetFilterUnit()
local integer lvl = GetUnitAbilityLevel(thistype.c, SPELLID)
if not(IsUnitType(e, UNIT_TYPE_STRUCTURE)) and not( IsUnitType(e, UNIT_TYPE_DEAD )) and not(IsUnit(e, thistype.t)) and IsUnitEnemy(e, GetOwningPlayer(thistype.c)) and thistype.counted < 2+lvl then
set thistype.counted = thistype.counted + 1
set thistype.dam = thistype.dam + GetWidgetLife(e)
call UnitDamageTarget(thistype.c, e, thistype.dam*0.05, true, false, atype, dtype, wtype)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 1), thistype.c, "origin"))
endif
set e = null
return false
endmethod
static method GroupEmAlly takes nothing returns boolean
local unit e = GetFilterUnit()
local integer lvl = GetUnitAbilityLevel(thistype.c, SPELLID)
if not(IsUnitType(e, UNIT_TYPE_STRUCTURE)) and not( IsUnitType(e, UNIT_TYPE_DEAD )) and not(IsUnit(e, thistype.t)) and IsUnitAlly(e, GetOwningPlayer(thistype.c)) and thistype.counted < 2+lvl then
set thistype.counted = thistype.counted + 1
set thistype.dam = thistype.dam + GetUnitState(e, UNIT_STATE_MAX_LIFE) - GetWidgetLife(e)
call SetWidgetLife(e, GetWidgetLife(e) + thistype.dam*0.15)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0), thistype.c, "origin"))
endif
set e = null
return false
endmethod
static method create takes unit c, unit t returns thistype
local thistype this = thistype.allocate()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
set thistype.c = c
set thistype.t = t
set thistype.dam = 0
set thistype.counted = 0
if IsUnitEnemy(t, GetOwningPlayer(c)) then
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(t), GetUnitY(t), 320+30*lvl, Filter(function thistype.GroupEmEnemy))
set thistype.dam = thistype.dam * 0.25
call UnitDamageTarget(c, t, thistype.dam, true, false, atype, dtype, wtype)
else
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(t), GetUnitY(t), 320+30*lvl, Filter(function thistype.GroupEmAlly))
set thistype.dam = thistype.dam * 0.1
call SetWidgetLife(t, GetWidgetLife(t) + thistype.dam)
endif
return this
endmethod
endstruct
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit())
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MeteorStorm initializer init
globals
private constant integer SPELLID = 'MeSt'
endglobals
private struct Data
unit c
integer lvl
real x
real y
real x1
real y1
static method Meteor takes nothing returns nothing
local xedamage d=xedamage.create()
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
local real dam = lvl*70+25+SpellStat(D.c, true)*(0.8+0.2*lvl)
call d.factor( UNIT_TYPE_STRUCTURE, 0.2 )
set d.atype= ATTACK_TYPE_NORMAL
set d.dtype= DAMAGE_TYPE_MAGIC
call TerrainDeformRipple(D.x1, D.y1, 250, 55, 25, 25, 125, 105, 15, true)
call d.damageAOE(D.c, D.x1, D.y1, 155, dam)
call ReleaseTimer(tim)
call d.destroy()
call D.destroy()
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local timer tim1 = NewTimer()
local Data D = Data(GetTimerData(tim))
local real ang = GetRandomReal(0,2*bj_PI)
set D.x1 = D.x+20*GetRandomReal(0,20)*Cos(ang)
set D.y1 = D.y+20*GetRandomReal(0,20)*Sin(ang)
if GetUnitCurrentOrder(D.c) == OrderId("rainofchaos") then
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID, EFFECT_TYPE_MISSILE, 0), D.x1, D.y1))
call SetTimerData(tim1, D)
call TimerStart(tim1, 1.9, false, function Data.Meteor)
else
set D.c = null
call D.destroy()
call ReleaseTimer(tim)
endif
endmethod
static method create takes unit c, real x, real y, integer i returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.c = c
set D.x = x
set D.y = y
call SetTimerData(tim,D)
call TimerStart(tim, 1*i+GetRandomReal(0.3,-0.3), true, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
local integer i = 1
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
if GetSpellAbilityId() == SPELLID then
loop
call Data.create(GetTriggerUnit(), x, y, i)
exitwhen i > lvl*2+3
set i = i + 1
endloop
endif
return false
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=24
//TESH.alwaysfold=0
scope Comet initializer InitTrig_Comet
globals
private constant integer SPELLID = 'mete'
private unit TEMP
private real dam
endglobals
private struct Data
unit c
real x
real y
real dmg
static method GroupEm takes nothing returns boolean
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TEMP)) and IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) != true then
if IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) then
set dam = dam*0.4
endif
call UnitDamageTarget(TEMP, GetFilterUnit(), dam, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, wtype)
endif
return false
endmethod
static method Timer takes nothing returns nothing
local group g = NewGroup()
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
set dam = D.dmg
set TEMP = D.c
call TerrainDeformRipple(D.x, D.y, 250, 55, 25, 25, 125, 105, 15, true)
call GroupEnumUnitsInArea(g, D.x, D.y, 250, Filter(function Data.GroupEm))
call ReleaseTimer(tim)
set D.c = null
call D.destroy()
call ReleaseGroup(g)
endmethod
static method create takes unit caster, real x, real y returns Data
local Data D = Data.allocate()
local integer lvl = GetUnitAbilityLevel(caster, SPELLID)
local timer tim = NewTimer()
set D.dmg = lvl*95+SpellStat(caster, true)*(0.6+0.2*lvl)
set D.c = caster
set D.x = x
set D.y = y
call SetTimerData(tim, D)
call TimerStart(tim, 1.9, false, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
endif
return false
endfunction
//===========================================================================
public function InitTrig_Comet takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
set t = null
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_IceWall_Actions takes nothing returns nothing
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), 'IcWa')
local integer i
local location p
local unit un
set i = -lvl
loop
exitwhen i > lvl
set p = PolarProjectionBJ(GetSpellTargetLoc(), i*100, AngleBetweenPoints(GetUnitLoc(GetSpellAbilityUnit()), GetSpellTargetLoc()) + 90)
set un = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()), 'icwa', p, 0)
call UnitApplyTimedLife(un, 'B000', 4)
call RemoveLocation(p)
set i = i + 1
endloop
set un = null
set p = null
endfunction
function Trig_IceWall_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'IcWa'
endfunction
function InitTrig_IceWall takes nothing returns nothing
set gg_trg_IceWall = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_IceWall, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_IceWall, Condition( function Trig_IceWall_Conditions ) )
call TriggerAddAction( gg_trg_IceWall, function Trig_IceWall_Actions )
endfunction
//TESH.scrollpos=14
//TESH.alwaysfold=0
scope GaleWall initializer init
globals
private constant integer SPELLID = 'GaWa'
endglobals
private function Make takes unit c, real x, real y, unit un returns nothing
local real angle = Atan2(y+90 - GetUnitY(c), x+90 - GetUnitX(c))
local real dx
local real dy
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local integer i = -1
loop
exitwhen i > 1
set dx = x + i*100 * Cos(angle)
set dy = y + i*100 * Sin(angle)
set un = CreateUnit(GetOwningPlayer(c), 'gawa', dx, dy, 0)
call SetUnitAbilityLevel(un, 'A01F', lvl)
call UnitAddAbility(un, 'Aloc')
call UnitApplyTimedLife(un, 'B000', 4)
set i = i + 1
endloop
endfunction
private function Actions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Make( GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY(),null )
endif
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddAction(t, function Actions )
set t = null
endfunction
endscope
//TESH.scrollpos=17
//TESH.alwaysfold=0
scope PsionicArrowItem initializer InitTrig_Psionic_Arrow_Item
globals
private constant integer SPELLID = 'psia'
private unit TempUnit
private unit TARGET
endglobals
private function Group takes nothing returns boolean
local real dam = SpellStat(TempUnit, false) * 0.75
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempUnit)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) and GetFilterUnit() != TARGET then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\SorceressMissile\\SorceressMissile.mdl", GetFilterUnit(), "origin"))
call UnitDamageTarget(TempUnit, GetFilterUnit(), dam, true, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_NORMAL, wtype)
return true
endif
return false
endfunction
private function Conditions takes nothing returns boolean
local location loc = GetUnitLoc(GetTriggerUnit())
local real a = 57.29582 * Atan2(GetUnitY(GetTriggerUnit()) - GetUnitY(GetAttacker()), GetUnitX(GetTriggerUnit()) - GetUnitX(GetAttacker()))
local group g = NewGroup()
local real dx = GetUnitX(GetAttacker()) - GetUnitX(GetTriggerUnit())
local real dy = GetUnitY(GetAttacker()) - GetUnitY(GetTriggerUnit())
local real time = SquareRoot(dx * dx + dy * dy)/900
set TARGET = GetTriggerUnit()
call TriggerSleepAction(time)
if GetUnitAbilityLevel(GetAttacker(), SPELLID) > 0 then
set TempUnit = GetAttacker()
call GroupEnumUnitsInCone(g, loc, 200., a, 100, 100, Filter(function Group))
endif
call RemoveLocation(loc)
set loc = null
call ReleaseGroup(g)
return false
endfunction
//===========================================================================
public function InitTrig_Psionic_Arrow_Item takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Set_Waygate_Point_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A080' ) ) then
return false
endif
return true
endfunction
function Trig_Set_Waygate_Point_Actions takes nothing returns nothing
local location loc = GetUnitLoc(GetSpellAbilityUnit())
call WaygateSetDestinationLocBJ( GetSpellAbilityUnit(), GetSpellTargetLoc() )
call WaygateActivateBJ( true, GetSpellAbilityUnit() )
call AddSpecialEffectLocBJ( GetSpellTargetLoc(), "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl" )
call DestroyEffect( GetLastCreatedEffectBJ() )
call UnitAddTypeBJ( UNIT_TYPE_FLYING, GetSpellAbilityUnit() )
call UnitAddAbilityBJ( 'Awrp', GetSpellAbilityUnit() )
call SetTerrainPathableBJ( loc, PATHING_TYPE_WALKABILITY, true )
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Set_Waygate_Point takes nothing returns nothing
set gg_trg_Set_Waygate_Point = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Set_Waygate_Point, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Set_Waygate_Point, Condition( function Trig_Set_Waygate_Point_Conditions ) )
call TriggerAddAction( gg_trg_Set_Waygate_Point, function Trig_Set_Waygate_Point_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope VialEmpty initializer init
globals
private constant integer ITEMID1 = 'I000'
private constant integer ITEMID2 = 'I02T'
private constant integer ITEMID3 = 'I00X'
private constant integer ITEMID4 = 'I02U'
endglobals
private function Conditions takes nothing returns boolean
local integer i = 0
local item indexItem
loop
set indexItem = UnitItemInSlot(GetTriggerUnit(), i)
if indexItem != null and(GetItemTypeId(indexItem) == ITEMID1 or GetItemTypeId(indexItem) == ITEMID2 or GetItemTypeId(indexItem) == ITEMID3 or GetItemTypeId(indexItem) == ITEMID4 )then
if GetItemCharges(indexItem) < 1 then
call RemoveItem(indexItem)
call UnitAddItemById(GetTriggerUnit(), 'I001')
endif
return false
endif
set i = i + 1
exitwhen i >= bj_MAX_INVENTORY
endloop
return true
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=7
//TESH.alwaysfold=0
scope FireWallItem initializer init
globals
private constant integer SPELLID = 'A03B'
endglobals
private function Actions takes unit c, real x, real y returns nothing
local real angle = Atan2(y+90 - GetUnitY(c), x+90 - GetUnitX(c))
local real dx
local real dy
local integer lvl = 2
local integer i = -lvl-1
local real dam = SpellStat(c,true)*(0.35+0.2*lvl)+10*lvl
loop
exitwhen i > lvl+1
set dx = x + i*100 * Cos(angle)
set dy = y + i*100 * Sin(angle)
call FirePatch.actions( c, SPELLID, dx, dy, 6, dam)
set i = i + 1
endloop
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions( GetTriggerUnit(),GetSpellTargetX(),GetSpellTargetY() )
endif
return false
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, function Conditions )
set t= null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ApocalypseItem initializer init
globals
private constant integer SPELLID = 'A00W'
private unit TEMP
endglobals
private function GroupEm takes nothing returns boolean
local real dam = 10 + SpellStat(TEMP, true)
if IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(TEMP)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)) then
call FirePatch.actions( TEMP, SPELLID, GetUnitX(GetFilterUnit()), GetUnitY(GetFilterUnit()), 3, dam )
endif
return false
endfunction
private function Actions takes unit un returns nothing
local group g = NewGroup()
set TEMP = un
call GroupEnumUnitsInArea(g, GetUnitX(un), GetUnitY(un), 800, Filter(function GroupEm))
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl", GetUnitX(un), GetUnitY(un) ) )
call ReleaseGroup(g)
endfunction
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Actions(GetTriggerUnit())
endif
return false
endfunction
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, function Conditions )
set t= null
endfunction
endscope
//TESH.scrollpos=30
//TESH.alwaysfold=0
scope Rebirth initializer init
globals
private constant integer SPELLID = 'rebi'
private constant integer BUFFID = 'BReb'
private constant integer BOOK = 'duRe'
private constant real TICK = 0.3
endglobals
private struct Data
unit t
real dur
integer stat
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
set .dur = .dur + TICK
if .dur > 15 or not(GetUnitAbilityLevel(.t, BUFFID) > 0) then
call AddUnitBonus(.t, BONUS_INTELLIGENCE, -.stat)
call AddUnitBonus(.t, BONUS_STRENGTH, -.stat)
call AddUnitBonus(.t, BONUS_AGILITY, -.stat)
call UnitRemoveAbility(.t, BOOK)
set .t = null
call .destroy()
call ReleaseTimer(GetExpiredTimer())
endif
endmethod
static method create takes unit t, real stat returns thistype
local thistype this = thistype.allocate()
local timer tim = NewTimer()
set .t = t
set .stat = R2I(stat)
set .dur = 0
call AddUnitBonus(.t, BONUS_INTELLIGENCE, .stat)
call AddUnitBonus(.t, BONUS_STRENGTH, .stat)
call AddUnitBonus(.t, BONUS_AGILITY, .stat)
call UnitAddAbility(.t, BOOK)
call SetTimerData(tim,this)
call TimerStart(tim, TICK, true, function thistype.Timer)
return this
endmethod
endstruct
private function Conditions takes nothing returns nothing
local integer lvl= GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
local real STAT= 0
if AltRez == false then
set STAT= (0.05+0.05*lvl)*SpellStat(GetTriggerUnit(),true)
endif
if GetSpellAbilityId() == SPELLID then
call Data.create(GetSpellTargetUnit(), STAT)
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local integer i = 0
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction(t, function Conditions )
loop
exitwhen i > 11
call SetPlayerAbilityAvailable(Player(i), BOOK, false)
set i = i + 1
endloop
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function RebirthGroupEm takes nothing returns boolean
local xecast xe = xecast.createBasicA('life',OrderId("blink"),GetOwningPlayer(GetFilterUnit()))
if GetUnitTypeId(GetFilterUnit()) == 'grav' then
call xe.castOnTarget(GetFilterUnit())
endif
return false
endfunction
function Trig_Rebirth_Actions takes nothing returns nothing
local real x= GetUnitX(GetTriggerUnit())
local real y= GetUnitY(GetTriggerUnit())
if GetUnitAbilityLevel(GetTriggerUnit(), 'reDB') > 0 then
call TriggerSleepAction(3)
call GroupEnumUnitsInArea(ENUM_GROUP, x, y, 100., Filter(function RebirthGroupEm))
endif
endfunction
//===========================================================================
function InitTrig_Rebirth takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction( t, function Trig_Rebirth_Actions )
set t= null
endfunction
//TESH.scrollpos=10
//TESH.alwaysfold=0
scope Flock initializer onInit
globals
private constant integer SPELLID = 'floc'
private constant integer DUMMYID = 'dufl'
private constant real TICK = 1.5
endglobals
private struct Data
unit c
real dur
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local thistype this = GetTimerData(tim)
local unit dummy
local integer lvl = GetUnitAbilityLevel(.c, SPELLID)
local real ang = (GetUnitFacing(.c)+GetRandomReal(-45,45))*bj_DEGTORAD
local real x = GetUnitX(.c)+GetRandomReal(400,900)*Cos(ang)
local real y = GetUnitY(.c)+GetRandomReal(400,900)*Sin(ang)
if GetUnitCurrentOrder(.c) == OrderId("channel") then
set dummy = CreateUnit(GetOwningPlayer(.c), XE_DUMMY_UNITID, x, y, 0)
call UnitAddAbility(dummy, SPELLID)
call UnitAddAbility(dummy, 'Aloc')
call UnitAddAbility(dummy, DUMMYID)
call SetUnitAbilityLevel(dummy, DUMMYID, lvl)
call UnitApplyTimedLife(dummy, 'BIvs',2)
call IssueTargetOrderById(dummy,852274,.c)
else
call ReleaseTimer(tim)
call .destroy()
endif
set dummy= null
endmethod
static method create takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
set .c = c
set .dur = 0
call SetTimerData(tim,this)
call TimerStart(tim, TICK, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call thistype.create(GetTriggerUnit())
endif
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function thistype.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endmethod
endstruct
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope FlockDummy initializer onInit
globals
private constant integer REALID = 'floc'
endglobals
private function Conditions takes nothing returns nothing
if IsUnitIllusion(GetTriggerUnit()) and GetUnitAbilityLevel(GetSummoningUnit(), REALID) > 0 then
call IssuePointOrder(GetTriggerUnit(), "attack", GetUnitX(GetSummoningUnit()), GetUnitY(GetSummoningUnit()))
endif
endfunction
//===========================================================================
public function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddAction( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=33
//TESH.alwaysfold=0
scope Tailwhip
globals
private constant integer SPELLID = 'tail'
private unit TEMP
endglobals
public struct Data
unit c
static method GroupEm takes nothing returns boolean
local unit t = GetFilterUnit()
local integer lvl = GetUnitAbilityLevel(TEMP,SPELLID)
if IsUnitEnemy(t, GetOwningPlayer(TEMP)) and not(IsUnitType(t,UNIT_TYPE_DEAD) or IsUnitType(t, UNIT_TYPE_STRUCTURE)) then
call UnitDamageTarget(TEMP,t,25+75*lvl, true,false, ATTACK_TYPE_MELEE, DAMAGE_TYPE_POISON, wtype)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,0), t, "origin"))
endif
set t = null
return false
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local group g = NewGroup()
local thistype this = GetTimerData(tim)
local location loc = GetUnitLoc(.c)
local real a = (GetUnitFacing(.c)-180)*bj_RADTODEG
local integer lvl= GetUnitAbilityLevel(.c, SPELLID)
set TEMP = .c
call GroupEnumUnitsInCone(g, loc, 300., a, 100, 100, Filter(function thistype.GroupEm))
if lvl == 0 then
call ReleaseTimer(tim)
call this.destroy()
endif
call ReleaseGroup(g)
call RemoveLocation(loc)
set loc = null
endmethod
static method Actions takes unit caster returns thistype
local thistype this = thistype.allocate()
local timer tim = NewTimer()
set .c = caster
call SetTimerData(tim,this)
call TimerStart(tim, 5.0, true, function thistype.Timer)
return this
endmethod
endstruct
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Dive initializer onInit
globals
private constant integer SPELLID = 'dive'
endglobals
private function Conditions takes nothing returns nothing
local unit c= GetTriggerUnit()
local unit t= GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevel(c, SPELLID)
local real angle = Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c))
local real x = GetUnitX(t) + 100 * Cos(angle)
local real y = GetUnitY(t) + 100 * Sin(angle)
if GetSpellAbilityId() == SPELLID then
call TriggerSleepAction(0.0)
call SetUnitPosition(c,x,y)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0), x, y))
call IssueTargetOrder(t,"attack",c)
endif
set t= null
set c= null
endfunction
//===========================================================================
public function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Snap initializer onInit
globals
private constant integer SPELLID = 'snap'
endglobals
private function Conditions takes nothing returns nothing
local unit c= GetTriggerUnit()
local unit t= GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevel(t, SPELLID)
local real angle = Atan2(GetUnitY(t) - GetUnitY(c), GetUnitX(t) - GetUnitX(c))
local real x = GetUnitX(t) + GetRandomReal(250,500) * Cos(GetRandomReal(0,bj_PI*2))
local real y = GetUnitY(t) + GetRandomReal(250,500) * Sin(GetRandomReal(0,bj_PI*2))
if GetSpellAbilityId() == SPELLID and GetRandomInt(1,4)==4 then
call IssuePointOrder(t,"move",x,y)
endif
set t= null
set c= null
endfunction
//===========================================================================
public function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t= null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope Bloom initializer onInit
globals
private constant integer SPELLID = 'bloo'
private constant integer BUFFID = 'Bloo'
private constant real TICK = 1
private unit TEMP
endglobals
private struct Data
unit c
real dur
static method GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
local unit t= GetFilterUnit()
if IsUnitAlly(t, GetOwningPlayer(TEMP)) and not(IsUnitType(t, UNIT_TYPE_DEAD) or IsUnitType(t, UNIT_TYPE_STRUCTURE)) then
call SetWidgetLife(t, GetWidgetLife(t)+30+50*lvl)
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_SPECIAL,0), t, "origin"))
endif
set t= null
return false
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local thistype this = GetTimerData(tim)
local group g= NewGroup()
set .dur = .dur+TICK
if .dur >= 5 then
set TEMP = .c
call GroupEnumUnitsInRange(g, GetUnitX(.c),GetUnitY(.c), 400, Filter(function thistype.GroupEm))
call ReleaseTimer(tim)
call .destroy()
endif
if GetUnitAbilityLevel(.c, BUFFID) < 1 then
call ReleaseTimer(tim)
call .destroy()
endif
call ReleaseGroup(g)
endmethod
static method create takes unit c returns thistype
local timer tim = NewTimer()
local thistype this = thistype.allocate()
set .c = c
set .dur = 0
call SetTimerData(tim,this)
call TimerStart(tim, TICK, true, function thistype.Timer)
return this
endmethod
static method Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call thistype.create(GetTriggerUnit())
endif
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function thistype.Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endmethod
endstruct
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Howl initializer init
globals
private constant integer SPELLID = 'howl'
endglobals
private function Conditions takes nothing returns nothing
local xecast xe = xecast.createBasicA('ANht', OrderId("howlofterror"), GetOwningPlayer(GetTriggerUnit()))
if GetSpellAbilityId() == SPELLID then
set xe.level = GetUnitAbilityLevel(GetTriggerUnit(),SPELLID)
call xe.castInPoint(GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()))
else
call xe.destroy()
endif
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Protect initializer InitTrig_Protect
globals
private constant integer SPELLID = 'prot'
private constant integer BUFFID = 'Bpro'
private unit array CASTER
private trigger array EVENT
private effect array ProtectFX
endglobals
private struct Data
unit c
unit t
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call DestroyEffect(ProtectFX[GetUnitId(D.t)])
call ReleaseTimer(tim)
call DestroyTrigger(EVENT[GetUnitId(D.t)])
set EVENT[GetUnitId(D.t)] = null
set D.c = null
set ProtectFX[GetUnitId(D.t)] = null
set D.t = null
call D.destroy()
endmethod
static method Conditions takes nothing returns boolean
local unit caster = CASTER[GetUnitId(GetTriggerUnit())]
local integer lvl = GetUnitAbilityLevel(caster, SPELLID)
local real dist = SquareRoot((GetUnitX(caster)-GetUnitX(GetTriggerUnit())) * (GetUnitX(caster)-GetUnitX(GetTriggerUnit())) + (GetUnitY(caster)-GetUnitY(GetTriggerUnit())) * (GetUnitY(caster)-GetUnitY(GetTriggerUnit())))
if GetUnitAbilityLevel(GetTriggerUnit(), BUFFID) > 0 then
if GetRandomInt(1,3) == 3 then
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,1), GetTriggerUnit(), "origin"))
endif
call SetWidgetLife(GetTriggerUnit(), GetWidgetLife(GetTriggerUnit()) + GetEventDamage())
call SetWidgetLife(caster, GetWidgetLife(caster) - GetEventDamage()*(1.15-0.05*lvl))
if GetWidgetLife(caster)/GetUnitState(caster, UNIT_STATE_MAX_LIFE) < 0.25 or dist > 300+50*lvl then
call UnitRemoveAbility(GetTriggerUnit(), BUFFID)
call DestroyEffect(ProtectFX[GetUnitId(GetTriggerUnit())])
call DestroyTrigger(EVENT[GetUnitId(GetTriggerUnit())])
set EVENT[GetUnitId(GetTriggerUnit())] = null
set ProtectFX[GetUnitId(GetTriggerUnit())] = null
endif
else
call UnitRemoveAbility(GetTriggerUnit(), BUFFID)
call DestroyEffect(ProtectFX[GetUnitId(GetTriggerUnit())])
call DestroyTrigger(EVENT[GetUnitId(GetTriggerUnit())])
set EVENT[GetUnitId(GetTriggerUnit())] = null
set ProtectFX[GetUnitId(GetTriggerUnit())] = null
endif
set caster = null
return false
endmethod
static method create takes unit caster, unit target, integer lvl returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.c = caster
set D.t = target
set CASTER[GetUnitId(target)] = D.c
if EVENT[GetUnitId(D.t)] == null then
set EVENT[GetUnitId(D.t)] = CreateTrigger()
call TriggerRegisterUnitEvent(EVENT[GetUnitId(D.t)], D.t, EVENT_UNIT_DAMAGED)
call TriggerAddCondition(EVENT[GetUnitId(D.t)], function Data.Conditions)
endif
if ProtectFX[GetUnitId(D.t)] == null then
set ProtectFX[GetUnitId(D.t)] = AddSpecialEffectTarget(GetAbilityEffectById(SPELLID,EFFECT_TYPE_MISSILE,0), D.t, "origin")
endif
call SetTimerData(tim,D)
call TimerStart(tim, 10+5*lvl, false, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns nothing
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetUnit(), GetUnitAbilityLevel(GetTriggerUnit(), SPELLID))
endif
endfunction
//===========================================================================
public function InitTrig_Protect takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Claw initializer init
globals
private constant integer SPELLID = 'claw'
endglobals
private function Conditions takes nothing returns boolean
local xedamage d = xedamage.create()
local real lvl = GetUnitAbilityLevel(GetTriggerUnit(), SPELLID)
if GetSpellAbilityId() == SPELLID then
set d.atype= ATTACK_TYPE_MELEE
set d.dtype= DAMAGE_TYPE_NORMAL
call d.damageTarget(GetTriggerUnit(),GetSpellTargetUnit(),20+40*lvl)
endif
call d.destroy()
return true
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
call XE_PreloadAbility(SPELLID)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Druidism
globals
boolean array Offensive
constant integer DRUID = 'E006'
endglobals
//This is the function used by all "un"form orders for the Morph system.
function DruidForm takes unit c returns nothing
local integer i = 0
//Pause so Transformation finishes before applying effects
call TriggerSleepAction(0.5)
//Add Transformation Spells
if GetUnitAbilityLevel(c,'Phys') > 0 then //Does the here have Physical Forms?
if Offensive[GetUnitId(c)] then //Is her current in Offensive Forms?
call UnitRemoveAbility(c, 'bear')
call UnitAddAbility(c, 'wolf')
call UnitMakeAbilityPermanent(c, true, 'wolf')
else //If not in offensive forms, then in defensive forms
call UnitRemoveAbility(c, 'wolf')
call UnitAddAbility(c, 'bear')
call UnitMakeAbilityPermanent(c, true, 'bear')
endif
endif
if GetUnitAbilityLevel(c,'Cast') > 0 then //etc.
if Offensive[GetUnitId(c)] then
call UnitRemoveAbility(c, 'tree')
call UnitAddAbility(c, 'stag')
call UnitMakeAbilityPermanent(c, true, 'stag')
else
call UnitRemoveAbility(c, 'stag')
call UnitAddAbility(c, 'tree')
call UnitMakeAbilityPermanent(c, true, 'tree')
endif
endif
if GetUnitAbilityLevel(c,'Tact') > 0 then
if Offensive[GetUnitId(c)] then
call UnitRemoveAbility(c, 'crow')
call UnitAddAbility(c, 'liza')
call UnitMakeAbilityPermanent(c, true, 'liza')
else
call UnitRemoveAbility(c, 'liza')
call UnitAddAbility(c, 'crow')
call UnitMakeAbilityPermanent(c, true, 'crow')
endif
endif
call SetUnitAnimation(c, "stand")
endfunction
//This is the function used when a unit clicks Form Change
function FormChange takes nothing returns nothing
if GetSpellAbilityId() == 'form' and Offensive[GetUnitId(GetTriggerUnit())] then //Is it in offensive?
if GetUnitAbilityLevel(GetTriggerUnit(),'Phys') > 0 then//Has it learned Physical forms?
call UnitRemoveAbility(GetTriggerUnit(), 'wolf')//If so, give toggle it's forms
call UnitAddAbility(GetTriggerUnit(), 'bear')
endif
if GetUnitAbilityLevel(GetTriggerUnit(),'Cast') > 0 then//etc.
call UnitRemoveAbility(GetTriggerUnit(), 'stag')
call UnitAddAbility(GetTriggerUnit(), 'tree')
endif
if GetUnitAbilityLevel(GetTriggerUnit(),'Tact') > 0 then
call UnitRemoveAbility(GetTriggerUnit(), 'liza')
call UnitAddAbility(GetTriggerUnit(), 'crow')
endif
set Offensive[GetUnitId(GetTriggerUnit())] = false//Make sure it change so it can toggle properly
elseif GetSpellAbilityId() == 'form' then //Used form and it's not in Offensive mode
if GetUnitAbilityLevel(GetTriggerUnit(),'Phys') > 0 then
call UnitRemoveAbility(GetTriggerUnit(), 'bear')
call UnitAddAbility(GetTriggerUnit(), 'wolf')
endif
if GetUnitAbilityLevel(GetTriggerUnit(),'Cast') > 0 then
call UnitRemoveAbility(GetTriggerUnit(), 'tree')
call UnitAddAbility(GetTriggerUnit(), 'stag')
endif
if GetUnitAbilityLevel(GetTriggerUnit(),'Tact') > 0 then
call UnitRemoveAbility(GetTriggerUnit(), 'crow')
call UnitAddAbility(GetTriggerUnit(), 'liza')
endif
set Offensive[GetUnitId(GetTriggerUnit())] = true
endif
endfunction
//===========================================================================
function InitTrig_Form_Change takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction(t, function FormChange )
set t = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope PhysicalForm initializer Init
globals //The globals for easy reference
private constant integer PhysicalForm = 'Phys'
private constant integer BearForm = 'bear'
private constant integer WolfForm = 'wolf'
private constant integer Toughness = 'toug'
private constant integer Growl = 'grow'
private constant integer Bite = 'bite'
private constant integer Claw = 'claw'
endglobals
private function Actions takes unit c returns nothing
local integer PhysicalFormlvl = GetUnitAbilityLevel(c, PhysicalForm)//Set the level of physical form
if GetUnitTypeId(c) == 'BrFm' then //If it's in Bear Form, level up it's bear skills
call SetUnitAbilityLevel(c, Toughness, PhysicalFormlvl)
call SetUnitAbilityLevel(c, Growl, PhysicalFormlvl)
elseif GetUnitTypeId(c) == 'WoFm' then//etc.
call SetUnitAbilityLevel(c, Bite, PhysicalFormlvl)
call SetUnitAbilityLevel(c, Claw, PhysicalFormlvl)
elseif GetUnitTypeId(c) == DRUID then//Finally, if it's currently in DRUID form do this:
if Offensive[GetUnitId(c)] then//Offensive on? Add wolf
call UnitAddAbility(c, WolfForm)
call UnitMakeAbilityPermanent(c, false, WolfForm)
else//Else add bear
call UnitAddAbility(c, BearForm)
call UnitMakeAbilityPermanent(c, false, BearForm)
endif
endif
endfunction
//The Unit is learning Physical Form
private function Conditions takes nothing returns nothing
if GetLearnedSkill() == PhysicalForm then
call Actions(GetLearningUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction(t, function Conditions )
set t = null
endfunction
function InitTrig_PhysForm takes nothing returns nothing
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CasterForm initializer Init
globals
private constant integer CasterForm = 'Cast'
private constant integer StagForm = 'stag'
private constant integer TreeForm = 'tree'
private constant integer Root = 'root'
private constant integer Manaburn = 'mana'
private constant integer Bloom = 'bloo'
private constant integer Barkskin = 'bark'
endglobals
private function Actions takes unit c returns nothing
local integer CasterFormlvl = GetUnitAbilityLevel(c, CasterForm)
if GetUnitTypeId(c) == 'StFm' then //Stag Form?
call SetUnitAbilityLevel(c, Root, CasterFormlvl)
call SetUnitAbilityLevel(c, Manaburn, CasterFormlvl)
elseif GetUnitTypeId(c) == 'TrFm' then //Tree Form?
call SetUnitAbilityLevel(c, Bloom, CasterFormlvl)
call SetUnitAbilityLevel(c, Barkskin, CasterFormlvl)
elseif GetUnitTypeId(c) == DRUID then
if Offensive[GetUnitId(c)] then
call UnitAddAbility(c, StagForm)
call UnitMakeAbilityPermanent(c, false, StagForm)
else
call UnitAddAbility(c, TreeForm)
call UnitMakeAbilityPermanent(c, false, TreeForm)
endif
endif
endfunction
private function Conditions takes nothing returns nothing
if GetLearnedSkill() == CasterForm then
call Actions(GetLearningUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction(t, function Conditions )
set t = null
endfunction
function InitTrig_CastForm takes nothing returns nothing
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope TacticalForm initializer Init
globals
private constant integer TacticalForm = 'Tact'
private constant integer LizardForm = 'liza'
private constant integer CrowForm = 'crow'
private constant integer Poison = 'pois' //Slow Poison
private constant integer Snap = 'snap'
private constant integer Evasion = 'evas'
private constant integer Dive = 'dive'
endglobals
private function Actions takes unit c returns nothing
local integer TacticalFormlvl = GetUnitAbilityLevel(c, TacticalForm)
if GetUnitTypeId(c) == 'LiFm' then//Lizard Form?
call SetUnitAbilityLevel(c, Poison, TacticalFormlvl)
call SetUnitAbilityLevel(c, Snap, TacticalFormlvl)
elseif GetUnitTypeId(c) == 'CrFm' then//Crow Form?
call SetUnitAbilityLevel(c, Evasion, TacticalFormlvl)
call SetUnitAbilityLevel(c, Dive, TacticalFormlvl)
elseif GetUnitTypeId(c) == DRUID then
if Offensive[GetUnitId(c)] then
call UnitAddAbility(c, LizardForm)
call UnitMakeAbilityPermanent(c, false, LizardForm)
else
call UnitAddAbility(c, CrowForm)
call UnitMakeAbilityPermanent(c, false, CrowForm)
endif
endif
endfunction
private function Conditions takes nothing returns nothing
if GetLearnedSkill() == TacticalForm then
call Actions(GetLearningUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction(t, function Conditions )
set t = null
endfunction
function InitTrig_TactForm takes nothing returns nothing
endfunction
endscope
//TESH.scrollpos=20
//TESH.alwaysfold=0
scope Ultimate initializer Init
globals
private constant integer Ultimate = 'Ulti'
private constant integer Protect = 'prot'
private constant integer Howl = 'howl'
private constant integer Moon = 'MoFi'
private constant integer Rebirth = 'rebi'
private constant integer Tailwhip = 'tail'
private constant integer Flock = 'floc'
endglobals
private function actions takes unit c returns nothing
local integer Ultimatelvl = GetUnitAbilityLevel(c, Ultimate)
if GetUnitTypeId(c) == 'BrFm' then
call UnitAddAbility(c, Protect)
call SetUnitAbilityLevel(c, Protect, Ultimatelvl)
elseif GetUnitTypeId(c) == 'WoFm' then
call UnitAddAbility(c, Howl)
call SetUnitAbilityLevel(c, Howl, Ultimatelvl)
elseif GetUnitTypeId(c) == 'StFm' then
call UnitAddAbility(c, Moon)
call SetUnitAbilityLevel(c, Moon, Ultimatelvl)
elseif GetUnitTypeId(c) == 'TrFm' then
call UnitAddAbility(c, Rebirth)
call SetUnitAbilityLevel(c, Rebirth, Ultimatelvl)
elseif GetUnitTypeId(c) == 'LiFm' then
call UnitAddAbility(c, Tailwhip)
call Tailwhip_Data.Actions(c)
call SetUnitAbilityLevel(c, Tailwhip, Ultimatelvl)
elseif GetUnitTypeId(c) == 'CrFm' then
call UnitAddAbility(c, Flock)
call SetUnitAbilityLevel(c, Flock, Ultimatelvl)
endif
endfunction
private function Conditions takes nothing returns nothing
if GetLearnedSkill() == Ultimate then
call actions(GetLearningUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL )
call TriggerAddAction(t, function Conditions )
set t = null
endfunction
function InitTrig_Ultimate takes nothing returns nothing
endfunction
endscope
//TESH.scrollpos=15
//TESH.alwaysfold=0
scope BearForm initializer Init
globals
private constant integer BearForm = 'bear'
private constant integer WolfForm = 'wolf'
private constant integer CrowForm = 'crow'
private constant integer LizardForm = 'liza'
private constant integer StagForm = 'stag'
private constant integer TreeForm = 'tree'
private constant integer Ultimate = 'Ulti'
private constant integer PhysForm = 'Phys'
private constant integer Toughness = 'toug'
private constant integer Growl = 'grow'
private constant integer Protect = 'prot'
private constant string FORM = "bearform"
private constant string UNFORM = "unbearform"
endglobals
private function Form takes unit c returns nothing
local integer PhysFormlvl = GetUnitAbilityLevel(c, PhysForm)
local integer Ultimatelvl = GetUnitAbilityLevel(c, Ultimate)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(BearForm, EFFECT_TYPE_TARGET, 0), GetUnitX(c), GetUnitY(c)))
call TriggerSleepAction(1.46)
//Remove Forms
call UnitRemoveAbility(c, WolfForm)
call UnitRemoveAbility(c, StagForm)
call UnitRemoveAbility(c, TreeForm)
call UnitRemoveAbility(c, CrowForm)
call UnitRemoveAbility(c, LizardForm)
//Set up new abilities
call UnitAddAbility(c, Toughness)
call SetUnitAbilityLevel(c, Toughness, PhysFormlvl)
call UnitAddAbility(c, Growl)
call SetUnitAbilityLevel(c, Growl, PhysFormlvl)
if Ultimatelvl > 0 then
call UnitAddAbility(c, Protect)
call SetUnitAbilityLevel(c, Protect, Ultimatelvl)
endif
endfunction
private function Actions takes nothing returns nothing
if GetUnitAbilityLevel(GetTriggerUnit(), BearForm) > 0 and GetIssuedOrderId() == OrderId(FORM) then//Does it have BEAR form and is it turning into a bear?
call Form(GetTriggerUnit())
elseif GetUnitAbilityLevel(GetTriggerUnit(), BearForm) > 0 and GetIssuedOrderId() == OrderId(UNFORM) then//Is it turning into a DRUID?
call DruidForm(GetTriggerUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddAction( t, function Actions )
call XE_PreloadAbility(BearForm)
set t = null
endfunction
private function InitTrig_BearForm takes nothing returns nothing
endfunction
endscope
//TESH.scrollpos=2
//TESH.alwaysfold=0
scope WolfForm initializer Init
globals
private constant integer BearForm = 'bear'
private constant integer WolfForm = 'wolf'
private constant integer CrowForm = 'crow'
private constant integer LizardForm = 'liza'
private constant integer StagForm = 'stag'
private constant integer TreeForm = 'tree'
private constant integer Ultimate = 'Ulti'
private constant integer PhysForm = 'Phys'
private constant integer Claw = 'claw'
private constant integer Bite = 'bite'
private constant integer Howl = 'howl' //Roar + Howl of Terror
private constant string FORM = "bearform"
private constant string UNFORM = "unbearform"
endglobals
private function Form takes unit c returns nothing
local integer PhysFormlvl = GetUnitAbilityLevel(c, PhysForm)
local integer Ultimatelvl = GetUnitAbilityLevel(c, Ultimate)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(WolfForm, EFFECT_TYPE_TARGET, 0), GetUnitX(c), GetUnitY(c)))
call TriggerSleepAction(1.46)
//Remove Forms
call UnitRemoveAbility(c, BearForm)
call UnitRemoveAbility(c, StagForm)
call UnitRemoveAbility(c, TreeForm)
call UnitRemoveAbility(c, CrowForm)
call UnitRemoveAbility(c, LizardForm)
//Set up new abilities
call UnitAddAbility(c, Bite)
call SetUnitAbilityLevel(c, Bite, PhysFormlvl)
call UnitAddAbility(c, Claw)
call SetUnitAbilityLevel(c, Claw, PhysFormlvl)
if Ultimatelvl > 0 then
call UnitAddAbility(c, Howl)
call SetUnitAbilityLevel(c, Howl, Ultimatelvl)
endif
endfunction
private function Conditions takes nothing returns nothing
if GetUnitAbilityLevel(GetTriggerUnit(), WolfForm) > 0 and GetIssuedOrderId() == OrderId(FORM) then
call Form(GetTriggerUnit())
elseif GetUnitAbilityLevel(GetTriggerUnit(), WolfForm) > 0 and GetIssuedOrderId() == OrderId(UNFORM) then
call DruidForm(GetTriggerUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(WolfForm)
set t = null
endfunction
endscope
//TESH.scrollpos=11
//TESH.alwaysfold=0
scope StagForm initializer Init
globals
private constant integer BearForm = 'bear'
private constant integer WolfForm = 'wolf'
private constant integer CrowForm = 'crow'
private constant integer LizardForm = 'liza'
private constant integer StagForm = 'stag'
private constant integer TreeForm = 'tree'
private constant integer Ultimate = 'Ulti'
private constant integer CastForm = 'Cast'
private constant integer Root = 'root'
private constant integer Manaburn = 'mana'
private constant integer Moon = 'MoFi' //Moonfire
private constant string FORM = "ravenform"
private constant string UNFORM = "unravenform"
endglobals
private function Form takes unit c returns nothing
local integer CastFormlvl = GetUnitAbilityLevel(c, CastForm)
local integer Ultimatelvl = GetUnitAbilityLevel(c, Ultimate)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(StagForm, EFFECT_TYPE_TARGET, 0), GetUnitX(c), GetUnitY(c)))
call TriggerSleepAction(1.46)
//Remove Forms
call UnitRemoveAbility(c, BearForm)
call UnitRemoveAbility(c, WolfForm)
call UnitRemoveAbility(c, TreeForm)
call UnitRemoveAbility(c, CrowForm)
call UnitRemoveAbility(c, LizardForm)
//Set up new abilities
call UnitAddAbility(c, Root)
call SetUnitAbilityLevel(c, Root, CastFormlvl)
call UnitAddAbility(c, Manaburn)
call SetUnitAbilityLevel(c, Manaburn, CastFormlvl)
if Ultimatelvl > 0 then
call UnitAddAbility(c, Moon)
call SetUnitAbilityLevel(c, Moon, Ultimatelvl)
endif
endfunction
private function Conditions takes nothing returns nothing
if GetUnitAbilityLevel(GetTriggerUnit(), StagForm) > 0 and GetIssuedOrderId() == OrderId(FORM) then
call Form(GetTriggerUnit())
elseif GetUnitAbilityLevel(GetTriggerUnit(), StagForm) > 0 and GetIssuedOrderId() == OrderId(UNFORM) then
call DruidForm(GetTriggerUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(StagForm)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope TreeForm initializer Init
globals
private constant integer BearForm = 'bear'
private constant integer WolfForm = 'wolf'
private constant integer CrowForm = 'crow'
private constant integer LizardForm = 'liza'
private constant integer StagForm = 'stag'
private constant integer TreeForm = 'tree'
private constant integer Ultimate = 'Ulti'
private constant integer CastForm = 'Cast'
private constant integer Bloom = 'bloo' //Spammable AoE Heal
private constant integer Barkskin = 'bark' //Armor Buff
private constant integer Rebirth = 'rebi' //Auto-Life
private constant string FORM = "ravenform"
private constant string UNFORM = "unravenform"
endglobals
private function Form takes unit c returns nothing
local integer CastFormlvl = GetUnitAbilityLevel(c, CastForm)
local integer Ultimatelvl = GetUnitAbilityLevel(c, Ultimate)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(TreeForm, EFFECT_TYPE_TARGET, 0), GetUnitX(c), GetUnitY(c)))
call TriggerSleepAction(1.46)
//Remove Forms
call UnitRemoveAbility(c, BearForm)
call UnitRemoveAbility(c, WolfForm)
call UnitRemoveAbility(c, StagForm)
call UnitRemoveAbility(c, CrowForm)
call UnitRemoveAbility(c, LizardForm)
//Set up new abilities
call UnitAddAbility(c, Bloom)
call SetUnitAbilityLevel(c, Bloom, CastFormlvl)
call UnitAddAbility(c, Barkskin)
call SetUnitAbilityLevel(c, Barkskin, CastFormlvl)
if Ultimatelvl > 0 then
call UnitAddAbility(c, Rebirth)
call SetUnitAbilityLevel(c, Rebirth, Ultimatelvl)
endif
endfunction
private function Conditions takes nothing returns nothing
if GetUnitAbilityLevel(GetTriggerUnit(), TreeForm) > 0 and GetIssuedOrderId() == OrderId(FORM) then
call Form(GetTriggerUnit())
elseif GetUnitAbilityLevel(GetTriggerUnit(), TreeForm) > 0 and GetIssuedOrderId() == OrderId(UNFORM) then
call DruidForm(GetTriggerUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(StagForm)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope LizardForm initializer Init
globals
private constant integer BearForm = 'bear'
private constant integer WolfForm = 'wolf'
private constant integer CrowForm = 'crow'
private constant integer LizardForm = 'liza'
private constant integer StagForm = 'stag'
private constant integer TreeForm = 'tree'
private constant integer Ultimate = 'Ulti'
private constant integer TactForm = 'Tact'
private constant integer Poison = 'pois'
private constant integer Snap = 'snap'
private constant integer Tailwhip = 'tail'//Any unit behind you recieves periodic damage
private constant string FORM = "robogoblin"
private constant string UNFORM = "unrobogoblin"
endglobals
private function Form takes unit c returns nothing
local integer TactFormlvl = GetUnitAbilityLevel(c, TactForm)
local integer Ultimatelvl = GetUnitAbilityLevel(c, Ultimate)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(LizardForm, EFFECT_TYPE_TARGET, 0), GetUnitX(c), GetUnitY(c)))
call TriggerSleepAction(1.46)
//Remove Forms
call UnitRemoveAbility(c, BearForm)
call UnitRemoveAbility(c, WolfForm)
call UnitRemoveAbility(c, StagForm)
call UnitRemoveAbility(c, TreeForm)
call UnitRemoveAbility(c, CrowForm)
//Set up new abilities
call UnitAddAbility(c, Poison)
call UnitAddAbility(c, Snap)
if Ultimatelvl > 0 then
//Pause so Transformation finishes
call UnitAddAbility(c, Tailwhip)
call Tailwhip_Data.Actions(c)
endif
call SetUnitAbilityLevel(c, Poison, TactFormlvl)
call SetUnitAbilityLevel(c, Snap, TactFormlvl)
call SetUnitAbilityLevel(c, Tailwhip, Ultimatelvl)
endfunction
private function Conditions takes nothing returns nothing
if GetUnitAbilityLevel(GetTriggerUnit(), LizardForm) > 0 and GetIssuedOrderId() == OrderId(FORM) then
call Form(GetTriggerUnit())
elseif GetUnitAbilityLevel(GetTriggerUnit(), LizardForm) > 0 and GetIssuedOrderId() == OrderId(UNFORM) then
call DruidForm(GetTriggerUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(LizardForm)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CrowForm initializer Init
globals
private constant integer BearForm = 'bear'
private constant integer WolfForm = 'wolf'
private constant integer CrowForm = 'crow'
private constant integer LizardForm = 'liza'
private constant integer StagForm = 'stag'
private constant integer TreeForm = 'tree'
private constant integer Ultimate = 'Ulti'
private constant integer TactForm = 'Tact'
private constant integer Evasion = 'evas'
private constant integer Dive = 'dive' //Attack and disorient
private constant integer Flock = 'floc' //Channeled spell that creates illusions
private constant string FORM = "robogoblin"
private constant string UNFORM = "unrobogoblin"
endglobals
private function Form takes unit c returns nothing
local integer TactFormlvl = GetUnitAbilityLevel(c, TactForm)
local integer Ultimatelvl = GetUnitAbilityLevel(c, Ultimate)
call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(CrowForm, EFFECT_TYPE_TARGET, 0), GetUnitX(c), GetUnitY(c)))
call TriggerSleepAction(1.66)
//Remove Forms
call UnitRemoveAbility(c, BearForm)
call UnitRemoveAbility(c, WolfForm)
call UnitRemoveAbility(c, StagForm)
call UnitRemoveAbility(c, TreeForm)
call UnitRemoveAbility(c, LizardForm)
//Set up new abilities
call UnitAddAbility(c, Evasion)
call SetUnitAbilityLevel(c, Evasion, TactFormlvl)
call UnitAddAbility(c, Dive)
call SetUnitAbilityLevel(c, Dive, TactFormlvl)
if Ultimatelvl > 0 then
//Pause so Transformation finishes
call UnitAddAbility(c, Flock)
call SetUnitAbilityLevel(c, Flock, Ultimatelvl)
endif
endfunction
private function Conditions takes nothing returns nothing
if GetUnitAbilityLevel(GetTriggerUnit(), CrowForm) > 0 and GetIssuedOrderId() == OrderId(FORM) then
call Form(GetTriggerUnit())
elseif GetUnitAbilityLevel(GetTriggerUnit(), CrowForm) > 0 and GetIssuedOrderId() == OrderId(UNFORM) then
call DruidForm(GetTriggerUnit())
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddAction( t, function Conditions )
call XE_PreloadAbility(LizardForm)
set t = null
endfunction
endscope
//TESH.scrollpos=1154
//TESH.alwaysfold=0
library ClassSystem requires MapScript
globals
string array HeroClass
string array SubClass
integer SubLVL
boolean ClassON
boolean array LearnedUlt
string array CustomClass
string array CustomSkill
string array CustomGear
quest array CustomQuest
endglobals
function PetSpellKnown takes integer id, integer lvl returns boolean
if lvl < 1 and (GetUnitAbilityLevel(GetPlayerHero(id), skillhash["summonthunderelemental"]) > 0 or GetUnitAbilityLevel(GetPlayerHero(id), skillhash["summontrainedwolf"]) > 0 or GetUnitAbilityLevel(GetPlayerHero(id), skillhash["summonentling"]) > 0 or GetUnitAbilityLevel(GetPlayerHero(id), skillhash["summonowl"]) > 0) then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have a pet companion." )
return true
endif
return false
endfunction
//lvl = Hero's LVL, i = AbilityLevel, id = Player Id
function BaseSpellReq takes integer lvl, integer i, unit u returns boolean
if lvl < 3 and i > 0 then //if The Player's LVL is less than 3 AND his ability lvl is greater than 0, he cannot learn this skill
call DisplayTextToPlayer(GetOwningPlayer(u), 0, 0, "|cfff4a460You need a higher level to learn that any further.|r")
return true
elseif lvl < 5 and i > 1 then //if The Player's LVL is less than 5 AND his ability lvl is greater than 1, he cannot learn this skill
call DisplayTextToPlayer(GetOwningPlayer(u), 0, 0, "|cfff4a460You need a higher level to learn that any further.|r")
return true
elseif lvl < 7 and i > 2 then
call DisplayTextToPlayer(GetOwningPlayer(u), 0, 0, "|cfff4a460You need a higher level to learn that any further.|r")
return true
elseif lvl < 10 and i > 3 then
call DisplayTextToPlayer(GetOwningPlayer(u), 0, 0, "|cfff4a460You need a higher level to learn that any further.|r")
return true
endif
return false
endfunction
function BaseUltReq takes integer lvl, integer i, integer id returns boolean
if LearnedUlt[GetUnitId(GetPlayerHero(id))] and i < 1 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "|cfff4a460You already have an ultimate learned.|r")
return true
elseif lvl < 6 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "|cfff4a460You need a higher level to learn that skill.|r")
return true
elseif lvl < 11 and i > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "|cfff4a460You need a higher level to learn that any further.|r")
return true
elseif lvl < 16 and i > 1 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "|cfff4a460You need a higher level to learn that any further.|r")
return true
endif
set LearnedUlt[GetUnitId(GetPlayerHero(id))] = true
return false
endfunction
function EarlyUltReq takes integer lvl, integer i, integer id returns boolean
if LearnedUlt[GetUnitId(GetPlayerHero(id))] then
call DisplayTextToPlayer(Player(id-1), 0, 0, "|cfff4a460You already have an ultimate learned.|r")
return true
elseif lvl < 3 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "|cfff4a460You need a higher level to learn that skill.|r")
return true
elseif lvl < 9 and i > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "|cfff4a460You need a higher level to learn that any further.|r")
return true
elseif lvl < 14 and i > 1 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "|cfff4a460You need a higher level to learn that any further.|r")
return true
endif
set LearnedUlt[GetUnitId(GetPlayerHero(id))] = true
return false
endfunction
function GamblerSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "wasted" then
//berserk
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "dice" then
//forkedlightning
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "spinningbeerbottles" then
//starfall
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "cointoss" then
//stampede
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "hbreathoffire" then
//breathoffire
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "lastcall" then
//tranquility
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "improvedodds" then
//x
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false // this classes skill
endif
return true
endfunction
function BlueMageSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "mimic" then
//faeriefire
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "wall" then
//sanctuary
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "phase" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "bolt" then
//forkedlightning
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "elementalshift" then
//howlofterror
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "matram" then
//tranquility
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "doublecast" then
//x
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false // this classes skill
endif
return true
endfunction
function DruidSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "animalaspect" then
//impale
if PetSpellKnown(id, i) then
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "dryadstrike" then
//entanglingroots
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "petalward" then
//serpentward
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "thornsaura" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "insectswarm" then
//healingwave
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "mossarmor" then
//defend
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "maneatergrove" then
//???
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false // this classes skill
endif
return true
endfunction
function WarlockSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "manadisplacement" then
//absorb
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "pact" then
//frenzy
if GetUnitAbilityLevel(GetPlayerHero(id), skillhash["berserk"]) > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have 'Berserk', which doesn't work with 'Pact'.")
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "combustion" then
//fanofknives
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "orb" then
//taunt
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "siphon" then
//darkportal
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "bloodstar" then
//???
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "doom" then
//doom
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false // this classes skill
endif
return true
endfunction
function DarkPriestSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "drain" then
//lavamonster
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "grimgift" then
//bloodlust
if GetUnitAbilityLevel(GetPlayerHero(id), skillhash["boneshield"]) > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have 'Bone Shield', which doesn't work with 'Grim Gift'.")
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "underworldpull" then
//deathcoil
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "soultrap" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "unholyintervention" then
//banish
if GetUnitAbilityLevel(GetPlayerHero(id), skillhash["divineshield"]) > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have 'Divine Shield', which doesn't work with 'Unholy Intervention'.")
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "pestilence" then
//stampede
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "raisehero" then
//???
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false // this classes skill
endif
return true
endfunction
function WitchDoctorSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "benevoodoo" then
//immolation
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "malvoodoo" then
//rejuvination
if GetUnitAbilityLevel(GetPlayerHero(id), skillhash["cover"]) > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have 'Cover', which doesn't work with 'Malovoodo'.")
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "drowsycask" then
//channel
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "hydraward" then
//ward
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "moonfire" then
//heal
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "ritualdance" then
//voodoo
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "insectswarm" then
//windwalk
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false // this classes skill
endif
return true
endfunction
function NecromancerSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "revelindead" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "animatebones" then
//raisedead
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "raisecorpse" then
//animatedead
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "boneshield" then
//bloodlust
if GetUnitAbilityLevel(GetPlayerHero(id), skillhash["grimgift"]) > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have 'Grim Gift', which doesn't work with 'Bone Shield'.")
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "cursedsoul" then
//cursedsoul
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "summonshadowbane" then
//spiritwolf
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "boneprison" then
//???
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false // this classes skill
endif
return true
endfunction
function ShamanSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "earthharness" then
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "blastward" then
//stasistrap
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "ancestralblessing" then
//innerfire
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "landslide" then
//rainoffire
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "sandblast" then
//thunderclap
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "geode" then
//parasite
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "whirlwind" then
//tornado
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false // this classes skill
endif
return true
endfunction
function WarriorSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "crushingblow" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "inspiringshout" then
//battleroar
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "stomp" then
//warstomp
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "warthreat" then
//taunt
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "resolve" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "blastingzone" then
//stampede
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "counterpierce" then
//x
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function MonkSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "zen" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "blazingpalm" then
//breathoffire
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "cleavingfist" then
//evileye
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "pummel" then
//magicleash
if GetUnitAbilityLevel(GetPlayerHero(id), skillhash["electrocute"]) > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have 'Electrocute', which doesn't work with 'Pummel'.")
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "chakra" then
//replenishlife
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "combomastery" then
//x
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "earthbreaker" then
//volcano
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function ClericSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "divinelight" then
//holybolt
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "???" then
//???
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "magiccurtain" then
//antimagicshell
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "innerstrength" then
//innerfire
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "clarityaura" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "life" then
//sleep
if EarlyUltReq(lvl, i, id) then
return false
endif
elseif text == "callholyphoenix" then
//summonphoenix
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function PyromancerSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "fireball" then
//shockwave
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "firewall" then
//flamestrike
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "blazeshield" then
//manashield
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "livingembers" then
//breathoffire
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "warmth" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "inferno" then
//starfall
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "doublecast" then
//x
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function CryomancerSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "icewall" then
//flamestrike
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "tidalhaven" then
//tranquility
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "freezingblast" then
//blizzard
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "chillingaura" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "tidalwave" then
//breathoffrost
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "???" then
//???
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "doublecast" then
//x
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function ElectromancerSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "summonthunderelemental" then
if PetSpellKnown(id, i) then
return false
//waterelemental
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "stormbolt" then
//transmute
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "shock" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "storm" then
//wateryminion
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "hthunderclap" then
//thunderclap
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "electrocute" then
//magicleash
if GetUnitAbilityLevel(GetPlayerHero(id), skillhash["pummel"]) > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have 'Pummel', which doesn't work with 'Electrocute'.")
return false
elseif BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "doublecast" then
//doublecast
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function AssassinSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "assassinate" then
//stomp
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "backstab" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "smokebomb" then
//controlmagic
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "poisondaggers" then
//monsoon
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "blinkslash" then
//chainlightning
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "swiftasshadows" then
//defend
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "cripplingblow" then
//cripple
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function SamuraiSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "thirdeye" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "whirringblade" then
//whirlwind
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "swordtoss" then
//clusterrockets
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "swordmastery" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "zen" then
//phaseshift
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "pierce" then
//hex
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "cripplingblow" then
//cripple
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function BerserkerSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "flurry" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "lacerate" then
//acidbomb
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "berserk" then
//frenzy
if GetUnitAbilityLevel(GetPlayerHero(id), skillhash["pummel"]) > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have 'Pact', which doesn't work with 'Berserk'.")
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "inspire" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "criticalaura" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "axetoss" then
//stampede
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "massivecleave" then
//x
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function DeathKnightSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "soundblast" then
//unavatar
if PetSpellKnown(id, i) then
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "bookofsongs" then
//spellbook
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "healingrift" then
//healingwave
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "bladebolero" then
//stoneform
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "x" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "rapido" then
//raisedeadoff
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "echoes" then
//charm
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function PaladinSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "shieldblock" then
//defend
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "righteoushammer" then
//dispel
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "divineshield" then
//banish
if GetUnitAbilityLevel(GetPlayerHero(id), skillhash["unholyintervention"]) > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have 'Unholy Intervention', which doesn't work with 'Divine Shield'.")
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "cover" then
//rejuvination
if GetUnitAbilityLevel(GetPlayerHero(id), skillhash["malvoodoo"]) > 0 then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You already have 'Malvoodoo', which doesn't work with 'Cover'.")
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "???" then
//???
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "sanctuary" then
//cloudoffog
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "ancienthammer" then
//firebolt
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function RangerSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "poisonarrows" then
//poisonarrows
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "trueshotaura" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "summonowl" then
//scout
if PetSpellKnown(id, i) then
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "arrowvolley" then
//flare
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "psionicarrow" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "scavange" then
//phoenixmorph
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "elementalquiver" then
//x
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function HunterSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "summontrainedwolf" then
//feralspirit
if PetSpellKnown(id, i) then
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "explodingbullet" then
//creepthunderbolt
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "explodingshells" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "spreadshot" then
//breathoffire
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "readyaimfire" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "cloyingpowder" then
//cloudoffog
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "heavyshot" then
//???
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function BardSkills takes integer id, string text returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer i = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
if text == "soundblast" then
//unavatar
if PetSpellKnown(id, i) then
return false
elseif BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "bookofsongs" then
//spellbook
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "healingrift" then
//healingwave
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "bladebolero" then
//stoneform
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "x" then
//x
if BaseSpellReq(lvl, i, GetPlayerHero(id)) then
return false
endif
elseif text == "rapido" then
//raisedeadoff
if BaseUltReq(lvl, i, id) then
return false
endif
elseif text == "echoes" then
//charm
if BaseUltReq(lvl, i, id) then
return false
endif
else
return false
endif
return true
endfunction
function CustomSpell takes integer id, string text, integer i1 returns boolean
local integer lvl = GetHeroLevel(GetPlayerHero(id))
local integer skill = GetUnitAbilityLevel(GetPlayerHero(id), skillhash[text])
local integer i2 = 1
loop
exitwhen i2 > 7 or text == CustomSkill[i2+i1*7]
if text == CustomSkill[i2+i1*7] then
if i2 < 6 then
if BaseSpellReq(lvl, skill, GetPlayerHero(id)) then
return false
endif
else
if BaseUltReq(lvl, skill, id) then
return false
endif
endif
endif
set i2 = i2 + 1
endloop
if i2 > 7 then
return false
endif
return true
endfunction
function SkillUp takes unit hero, string text returns boolean
local integer id = GetPlayerId(GetOwningPlayer(hero))+1
local integer lvl = GetHeroLevel(hero)
local integer skill = GetUnitAbilityLevel(hero, skillhash[text])
local integer i = 0
local integer learned = 0
local string HC = HeroClass[GetUnitId(hero)]
local string SC = SubClass[GetUnitId(hero)]
if(HC == "Shaman" or SC == "Shaman")and ShamanSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Warrior" or SC == "Warrior")and WarriorSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Cleric" or SC == "Cleric")and ClericSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Monk" or SC == "Monk")and MonkSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Pyromancer" or SC == "Pyromancer")and PyromancerSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Cryomancer" or SC == "Cryomancer")and CryomancerSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Electromancer" or SC == "Electromancer")and ElectromancerSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Assassin" or SC == "Assassin")and AssassinSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Samurai" or SC == "Samurai")and SamuraiSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Berserker" or SC == "Berserker")and BerserkerSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Paladin" or SC == "Paladin")and PaladinSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Darkpriest" or SC == "Darkpriest")and DarkPriestSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Witchdoctor" or SC == "Witchdoctor")and WitchDoctorSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Warlock" or SC == "Warlock")and WarlockSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Necromancer" or SC == "Necromancer")and NecromancerSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Ranger" or SC == "Ranger")and RangerSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Hunter" or SC == "Hunter")and HunterSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Bluemage" or SC == "Bluemage")and BlueMageSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Druid" or SC == "Druid")and DruidSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Bard" or SC == "Bard")and BardSkills(id, text) then
set learned = learned + 1
endif
if(HC == "Gambler" or SC == "Gambler")and GamblerSkills(id, text) then
set learned = learned + 1
endif
//CUSTOM CLASS LOOP
loop
exitwhen i > 9
if(HC == CustomClass[i] or SC == CustomClass[i])and CustomSpell(id, text, i) then
set learned = learned + 1
endif
set i = i + 1
endloop
if learned > 0 then
if skill > 0 then
call SetUnitAbilityLevel(hero, skillhash[text], skill + 1)
if skill == GetUnitAbilityLevel(hero, skillhash[text]) then
call DisplayTextToPlayer(Player(id-1), 0, 0, "|cff7cfc00'" + GetObjectName(skillhash[text]) + "'|r is already at max level.")
return false
endif
if text == "zen" then
call AddUnitBonus(hero, BONUS_LIFE, 85)
elseif text == "warmth" then
call AddUnitBonus(hero, BONUS_LIFE, 20)
call AddUnitBonus(hero, BONUS_MANA, 10)
endif
else
call UnitAddAbility(hero, skillhash[text])
call UnitMakeAbilityPermanent(hero, true, skillhash[text])
if text == "earthharness" then
call EarthHarness_Data.Actions(hero)
elseif text == "tauntpassive" then
call TauntPassive_Data.Actions(hero)
elseif text == "shock" then
call Shock_Data.Actions(hero)
elseif text == "overwhelmingpressence" then
call OverwhelmingPresence_Data.Actions(hero)
elseif text == "tailwhip" then
call Tailwhip_Data.Actions(hero)
elseif text == "elementalquiver" then
call ElementalQuiver_Data.Actions(hero)
elseif text == "revelindead" then
call RevelInDead_Data.Actions(hero)
elseif text == "devour" then
call UnitAddAbility(hero, 'Advc')
call UnitMakeAbilityPermanent(hero, true, 'Adev')
elseif text == "load" then
call UnitAddAbility(hero, 'Sch3')
call UnitAddAbility(hero, 'Achd')
call UnitAddAbility(hero, 'Adro')
call UnitMakeAbilityPermanent(hero, true, 'Sch3')
call UnitMakeAbilityPermanent(hero, true, 'Achd')
call UnitMakeAbilityPermanent(hero, true, 'Adro')
elseif text == "phase" then
call UnitAddAbility(hero, 'PhaD')
call UnitMakeAbilityPermanent(hero, true, 'PhaD')
elseif text == "elementalshift" then
call UnitAddAbility(hero, 'Shif')
call UnitMakeAbilityPermanent(hero, true, 'Shif')
elseif text == "combustion" or text == "lifeandmanacombustion" then
call UnitAddAbility(hero, 'LMCo')
call UnitAddAbility(hero, 'MCom')
call UnitMakeAbilityPermanent(hero, true, 'LMCo')
call UnitMakeAbilityPermanent(hero, true, 'MCom')
elseif text == "zen" then
call AddUnitBonus(hero, BONUS_LIFE, 115)
elseif text == "warmth" then
call AddUnitBonus(hero, BONUS_LIFE, 30)
call AddUnitBonus(hero, BONUS_MANA, 20)
endif
endif
set SKILL_PTS[GetUnitId(hero)] = SKILL_PTS[GetUnitId(hero)] - 1
call LeaderboardAddItemBJ( Player(14), udg_Board[id], "|cff7cfc00Skill Points: |r|c00FFFFFF" + I2S(SKILL_PTS[GetUnitId(hero)]) + "|r|n|cffffff00Stat Points: |r|c00FFFFFF" + I2S(STAT_PTS[GetUnitId(hero)])+"|r", 0 )
else
call DisplayTextToPlayer(Player(id-1), 0, 0, "|cfff4a460The skill you tried to learn is not part of your class or subclass.|r" )
endif
set HC = null
set SC = null
return true
endfunction
function DetermineClass takes unit hero, string text, string gear returns boolean
local integer equip
local integer id = GetPlayerId(GetOwningPlayer(hero))+1
local integer i = 0
set text = StringCase(text, false)
if text == "shaman" then
set equip = 'WP49' //Leather Armor
set gear = Shamans
elseif text == "warrior" then
set equip = 'WP43' //Heavy Armor
set gear = Warriors
elseif text == "cleric" then
set equip = 'WP56' //Cloth Armor
set gear = Mages
elseif text == "monk" then
set equip = 'CLW1' //Bronze Claws
set gear = Monks
elseif text == "pyromancer" then
set equip = 'WP31' //Pine Wand
set gear = Mages
elseif text == "cryomancer" then
set equip = 'WP31' //Pine Wand
set gear = Mages
elseif text == "electromancer" then
set equip = 'WP31' //Pine Wand
set gear = Mages
elseif text == "assassin" then
set equip = 'WP19' //Bronze Dagger
set gear = Rogues
elseif text == "samurai" then
set equip = 'WP01' //Bronze Sword
set gear = Samurais
elseif text == "berserker" then
set equip = 'WP07' //Bronze Axe
set gear = Barbarians
elseif text == "paladin" then
set equip = 'I01M' //Bronze Shield
set gear = Paladins
elseif text == "darkpriest" then
set equip = 'WP55' //Linnen Robes
set gear = Mages
elseif text == "witchdoctor" then
set equip = 'WP25' //Pine Staff
set gear = Mages
elseif text == "warlock" then
set equip = 'WP31' //Pine Wand
set gear = Mages
elseif text == "necromancer" then
set equip = 'WP55' //Linnen Robes
set gear = Mages
elseif text == "ranger" then
set equip = 'WP37' //Pine Bow
set gear = Rangers
elseif text == "hunter" then
set equip = 'WP37' //Pine Bow
set gear = Rangers
elseif text == "bluemage" then
set equip = 'WP01' //Bronze Sword
set gear = Spellswords
elseif text == "druid" then
set equip = 'WP49' //Leather Armor
set gear = Shamans
elseif text == "bard" then
set equip = 'WP49' //Leather Armor
set gear = Rangers
elseif text == "gambler" then
set equip = 'WP49' //Leather Armor
set gear = Rangers
else
loop
if text == StringCase(CustomClass[i], false) then
set equip = 'I00B' //50 Gold
set gear = CustomGear[i]
endif
exitwhen i > 9 or text == StringCase(CustomClass[i], false)
set i = i + 1
endloop
if i > 9 then
return false
endif
endif
if HeroClass[GetUnitId(hero)] == "" then
if UnitInventoryCount(hero) > 4 then
call DisplayTextToPlayer(GetOwningPlayer(hero), 0, 0, "You need 2 spots in your inventory to declare a class!")
return false
endif
call UnitAddItemById(hero, 'I000')
call UnitUseItem( hero, UnitAddItemById( hero, equip ))
set HeroClass[GetUnitId(hero)] = StringCase(SubString(text, 0, 1), true) + SubString(text, 1, StringLength(text))
call Inventory.create(hero, GetHeroProperName(hero), gear)
call DisplayTextToPlayer(Player(id-1), 0, 0, "You've taken on the |cffffff00'" + HeroClass[GetUnitId(hero)] + "'|r class and can wear |cff00bfff" + gear + "|r.")
else
if StringCase(SubString(text, 0, 1), true) + SubString(text, 1, StringLength(text)) == HeroClass[GetUnitId(hero)] then
call DisplayTextToPlayer(Player(id-1), 0, 0, "You're already that class!")
return false
endif
set SubClass[GetUnitId(hero)] = StringCase(SubString(text, 0, 1), true) + SubString(text, 1, StringLength(text))
call DisplayTextToPlayer(Player(id-1), 0, 0, "You've acquired the |cffffff00'" + SubClass[GetUnitId(hero)] + "'|r subclass and can learn it's skills.")
endif
call LeaderboardSetLabel(udg_Board[id], HeroClass[GetUnitId(hero)] + " " + SubClass[GetUnitId(hero)])
return true
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Stop_Attacking_Friends_Conditions takes nothing returns boolean
if GetIssuedOrderId() == OrderId("attack") and IsUnitAlly(GetOrderTargetUnit(), GetOwningPlayer(GetTriggerUnit())) and not(GetOwningPlayer(GetOrderTargetUnit()) == Player(15)) and IsPlayerInForce(GetOwningPlayer(GetTriggerUnit()), udg_Force[1]) then
if AllyAttack == false then
call IssueTargetOrder( GetTriggerUnit(), "move", GetOrderTargetUnit() )
endif
endif
return false
endfunction
//===========================================================================
function InitTrig_Stop_Attacking_Friends takes nothing returns nothing
set gg_trg_Stop_Attacking_Friends = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Stop_Attacking_Friends, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( gg_trg_Stop_Attacking_Friends, Condition( function Trig_Stop_Attacking_Friends_Conditions ) )
endfunction
//TESH.scrollpos=168
//TESH.alwaysfold=0
//*************************
// checked for leaks
//*************************
function DoTrainingRoomEnumUnits takes nothing returns nothing
local location loc
local location loc2
local real distance
set loc = GetUnitLoc(GetEnumUnit())
set loc2 = GetUnitLoc(udg_TRAIN_CurRoom)
set distance = DistanceBetweenPoints(loc, loc2)
call RemoveLocation(loc)
call RemoveLocation(loc2)
if GetOwningPlayer(GetEnumUnit()) == Player(12) then
if distance > 700 and distance < 1200 then
if IsKillableTrainUnit(GetEnumUnit()) then
call KillUnit(GetEnumUnit())
endif
elseif distance < 700 then
if IsCountableTrainUnit(GetEnumUnit()) then
set udg_TRAIN_CountBad = udg_TRAIN_CountBad + GetUnitLevel(GetEnumUnit())
endif
endif
else
if IsCountableTrainUnit(GetEnumUnit()) then
if (distance < 700) then
set udg_TRAIN_CountGood = udg_TRAIN_CountGood + GetUnitLevel(GetEnumUnit())
set udg_TRAIN_CountGoodTotal = udg_TRAIN_CountGoodTotal + 1
endif
endif
endif
endfunction
function GetTrainingUnitType takes nothing returns integer
local integer level
set level = R2I(I2R(udg_TRAIN_CountGood) / I2R(udg_TRAIN_CountGoodTotal))
if level < 6 then
return udg_TRAIN_Type[GetRandomInt(1, 9) + level * 10]
else
return udg_TRAIN_Type[GetRandomInt(1, 9) + IMaxBJ(IMinBJ(IShuffle((level - 5)/2 + 5),9),0) * 10]
endif
endfunction
function DoEnumTrainingRoom takes nothing returns nothing
local integer utype
local integer lvl
local location trainloc
local location loc
local group grp
set udg_TRAIN_CurRoom = GetEnumUnit()
if not IsUnitType(udg_TRAIN_CurRoom, UNIT_TYPE_DEAD) then
set trainloc = GetUnitLoc(udg_TRAIN_CurRoom)
set udg_TRAIN_CountGood = 0
set udg_TRAIN_CountGoodTotal = 0
set udg_TRAIN_CountBad = 0
call MoveRectToLoc( gg_rct_TrainingRoom, trainloc )
set grp = GetUnitsInRectAll(gg_rct_TrainingRoom)
call ForGroup( grp, function DoTrainingRoomEnumUnits )
call DestroyGroup(grp)
if udg_TRAIN_CountGood > udg_TRAIN_CountBad then
set loc = PolarProjectionBJ(trainloc, GetRandomReal(0, 600.00), GetRandomReal(0, 360.00))
call CreateNUnitsAtLoc( 1, GetTrainingUnitType(), Player(12), loc, GetRandomDirectionDeg() )
call RemoveLocation(loc)
call SetUnitTrain( GetLastCreatedUnit(), true )
endif
call RemoveLocation(trainloc)
else
call GroupRemoveUnit( udg_TRAIN_Rooms, GetEnumUnit() )
endif
endfunction
function TrainingRoomPoll takes nothing returns nothing
call ForGroup( udg_TRAIN_Rooms, function DoEnumTrainingRoom )
endfunction
function InitTrig_Training_Room takes nothing returns nothing
set udg_TRAIN_Type[11] = 'nspb'
set udg_TRAIN_Type[12] = 'nspg'
set udg_TRAIN_Type[13] = 'ngna'
set udg_TRAIN_Type[14] = 'ngno'
set udg_TRAIN_Type[15] = 'nmrl'
set udg_TRAIN_Type[16] = 'yfae'
set udg_TRAIN_Type[17] = 'nsat'
set udg_TRAIN_Type[18] = 'nban'
set udg_TRAIN_Type[19] = 'nwiz'
set udg_TRAIN_Type[21] = 'nftr'
set udg_TRAIN_Type[22] = 'nfsp'
set udg_TRAIN_Type[23] = 'ngrk'
set udg_TRAIN_Type[24] = 'nmrr'
set udg_TRAIN_Type[25] = 'nltl'
set udg_TRAIN_Type[26] = 'nwlt'
set udg_TRAIN_Type[27] = 'nbrg'
set udg_TRAIN_Type[28] = 'nfgu'
set udg_TRAIN_Type[29] = 'ndmu'
set udg_TRAIN_Type[31] = 'nbdr'
set udg_TRAIN_Type[32] = 'nftt'
set udg_TRAIN_Type[33] = 'ngns'
set udg_TRAIN_Type[34] = 'ngnb'
set udg_TRAIN_Type[35] = 'ngnw'
set udg_TRAIN_Type[36] = 'vftr'
set udg_TRAIN_Type[37] = 'hoph'
set udg_TRAIN_Type[38] = 'nrog'
set udg_TRAIN_Type[39] = 'nsc2'
set udg_TRAIN_Type[41] = 'nftb'
set udg_TRAIN_Type[42] = 'nfsh'
set udg_TRAIN_Type[43] = 'nfrl'
set udg_TRAIN_Type[44] = 'nfrs'
set udg_TRAIN_Type[45] = 'nsgt'
set udg_TRAIN_Type[46] = 'nwlg'
set udg_TRAIN_Type[47] = 'nowb'
set udg_TRAIN_Type[48] = 'nass'
set udg_TRAIN_Type[49] = 'nfgb'
set udg_TRAIN_Type[51] = 'ngnv'
set udg_TRAIN_Type[52] = 'nomg'
set udg_TRAIN_Type[53] = 'nogm'
set udg_TRAIN_Type[54] = 'now5'
set udg_TRAIN_Type[55] = 'nkol'
set udg_TRAIN_Type[56] = 'nsln'
set udg_TRAIN_Type[57] = 'nslr'
set udg_TRAIN_Type[58] = 'nenf'
set udg_TRAIN_Type[59] = 'h00H'
set udg_TRAIN_Type[61] = 'nrdr'
set udg_TRAIN_Type[62] = 'nftk'
set udg_TRAIN_Type[63] = 'ngst'
set udg_TRAIN_Type[64] = 'nsqe'
set udg_TRAIN_Type[65] = 'nthl'
set udg_TRAIN_Type[66] = 'nowe'
set udg_TRAIN_Type[67] = 'nfrb'
set udg_TRAIN_Type[68] = 'nsbm'
set udg_TRAIN_Type[69] = 'nmmu'
set udg_TRAIN_Type[71] = 'nogl'
set udg_TRAIN_Type[72] = 'nfrg'
set udg_TRAIN_Type[73] = 'nfre'
set udg_TRAIN_Type[74] = 'nhrq'
set udg_TRAIN_Type[75] = 'nrzg'
set udg_TRAIN_Type[76] = 'nslv'
set udg_TRAIN_Type[77] = 'nbld'
set udg_TRAIN_Type[78] = 'npfm'
set udg_TRAIN_Type[79] = 'nehy'
set udg_TRAIN_Type[81] = 'nfra'
set udg_TRAIN_Type[82] = 'ncnk'
set udg_TRAIN_Type[83] = 'nowk'
set udg_TRAIN_Type[84] = 'ninm'
set udg_TRAIN_Type[85] = 'ndqp'
set udg_TRAIN_Type[86] = 'nbal'
set udg_TRAIN_Type[87] = 'ninf'
set udg_TRAIN_Type[88] = 'nwzd'
set udg_TRAIN_Type[89] = 'nelb'
set udg_TRAIN_Type[91] = 'nggr'
set udg_TRAIN_Type[92] = 'nrwm'
set udg_TRAIN_Type[93] = 'nstw'
set udg_TRAIN_Type[94] = 'nsth'
set udg_TRAIN_Type[95] = 'nsgg'
set udg_TRAIN_Type[96] = 'tome'
set udg_TRAIN_Type[97] = 'nerw'
set udg_TRAIN_Type[98] = 'h00F'
set udg_TRAIN_Type[99] = 'nahy'
call GroupAddUnit( udg_TRAIN_Rooms, CreateUnit( Player(12), 'h00B', GetRectCenterX(gg_rct_TrainingRoomMake), GetRectCenterY(gg_rct_TrainingRoomMake), 270.00 ) )
set gg_trg_Training_Room = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Training_Room, 1.00 )
call TriggerAddAction( gg_trg_Training_Room, function TrainingRoomPoll )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
integer array SKILL_PTS
integer array STAT_PTS
string array HERO_CLASS
trigger array TRIGGER_Hero_Levels
endglobals
function IsHighDruid takes unit u returns boolean
if GetUnitTypeId(u) == 'EHiD' or GetUnitTypeId(u) == 'BrFm' or GetUnitTypeId(u) == 'CrFm' or GetUnitTypeId(u) == 'LiFm' or GetUnitTypeId(u) == 'StFm' or GetUnitTypeId(u) == 'WoFm' or GetUnitTypeId(u) == 'TrFm' then
return true
endif
return false
endfunction
function Trig_Hero_Levels_Actions takes nothing returns nothing
local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit())) + 1
if not(IsHighDruid(GetTriggerUnit()) and GetHeroLevel(GetTriggerUnit()) < SubLVL)then
set SKILL_PTS[GetUnitId(udg_HERO_Ref2[id])] = SKILL_PTS[GetUnitId(udg_HERO_Ref2[id])] + 1
endif
set STAT_PTS[GetUnitId(udg_HERO_Ref2[id])] = STAT_PTS[GetUnitId(udg_HERO_Ref2[id])] + 3
if IsPlayerInForce(Player(id-1), udg_Force[1]) then
call LeaderboardAddItemBJ( Player(14), udg_Board[id], "|cff7cfc00Skill Points: |r|c00FFFFFF" + I2S(SKILL_PTS[GetUnitId(udg_HERO_Ref2[id])]) + "|r|n|cffffff00Stat Points: |r|c00FFFFFF" + I2S(STAT_PTS[GetUnitId(udg_HERO_Ref2[id])])+"|r", 0 )
endif
endfunction
//TESH.scrollpos=90
//TESH.alwaysfold=0
globals
//STR Classes
constant string Paladins = "heavy armors, heavy gloves, cloth armors, shields, mauls, swords, staffs"
constant string Warriors = "heavy armors, heavy gloves, leather armors, shields, offhands, daggers, swords, mauls, axes"
constant string Barbarians = "heavy armors, heavy gloves, leather armors, offhands, daggers, swords, mauls, axes"
constant string Samurais = "leather armors, offhands, swords"
//AGI Classes
constant string Rangers = "leather armors, cloth armors, bows, arrows"
constant string Rogues = "heavy armors, heavy gloves, leather armors, axes, daggers, swords, offhands"
constant string Spellswords = "leather armors, cloth armors, daggers, swords, staffs"
constant string Monks = "heavy gloves, cloth armors, staffs, claws"
//INT Classes
constant string Mages = "cloth armors, staffs, wands, books"
constant string Shamans = "cloth armors, leather armors, claws, staffs, books"
//Special
constant string EquipAll = "cloth armors, leather armors, heavy armors, shields, mauls, swords, daggers, offhands, bows, arrows, axes, wands, staffs, claws"
trigger array TRIG_HERO_Selection
endglobals
function HeroSpawn takes nothing returns nothing
local integer id = 0
local player pl
local force fp
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set udg_HERO_Ref2[id] = CreateUnit( pl, GetUnitTypeId(GetTriggerUnit()), GetUnitX(gg_unit_h006_0197), GetUnitY(gg_unit_h006_0197), GetUnitFacing(gg_unit_h006_0197) )
set HeroPickX[GetUnitId(GetPlayerHero(id))] = GetUnitX(GetTriggerUnit())
set HeroPickY[GetUnitId(GetPlayerHero(id))] = GetUnitY(GetTriggerUnit())
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl", HeroPickX[GetUnitId(GetPlayerHero(id))], HeroPickY[GetUnitId(GetPlayerHero(id))]))
if IsHighDruid(GetPlayerHero(id)) then
call UnitAddItemById(GetPlayerHero(id), 'I000')
call UnitAddItemById( GetPlayerHero(id), 'CLW1' )
set HeroClass[GetUnitId(GetPlayerHero(id))] = "High Druid"
call Inventory.create(GetPlayerHero(id), GetHeroProperName(GetPlayerHero(id)), Shamans)
call DisplayTextToPlayer(Player(id-1), 0, 0, "You've taken on the |cffffff00'High Druid'|r class and can wear |cff00bfff" + Shamans + "|r.")
set SKILL_PTS[GetUnitId(GetPlayerHero(id))] = 0
else
set SKILL_PTS[GetUnitId(GetPlayerHero(id))] = 1
set HeroClass[GetUnitId(GetPlayerHero(id))] = ""
endif
set SubClass[GetUnitId(GetPlayerHero(id))] = ""
call ResetToGameCameraForPlayer( pl, 0 )
call PanCameraToTimedLocForPlayer( pl, GetUnitLoc(gg_unit_h006_0197), 0 )
if not(udg_HERO_AllowDuplicates) then
call RemoveUnit(GetTriggerUnit())
endif
set STAT_PTS[GetUnitId(GetPlayerHero(id))] = 3
if GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER) > 0 then
call AddHeroXP( GetPlayerHero(id), GetPlayerState(pl, PLAYER_STATE_RESOURCE_LUMBER), true )
call SetPlayerState( pl, PLAYER_STATE_RESOURCE_LUMBER, 0 )
endif
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", GetUnitX(GetPlayerHero(id)), GetUnitY(GetPlayerHero(id))))
call DestroyTrigger( TRIGGER_Hero_Levels[id] )
set TRIGGER_Hero_Levels[id] = CreateTrigger( )
call TriggerRegisterUnitEvent( TRIGGER_Hero_Levels[id], GetPlayerHero(id), EVENT_UNIT_HERO_LEVEL )
call TriggerAddAction( TRIGGER_Hero_Levels[id], function Trig_Hero_Levels_Actions )
call LeaderboardRemovePlayerItem(udg_Board[id], Player(14))
call LeaderboardAddItem(udg_Board[id], "|n|cff7cfc00Skill Points: |r|c00FFFFFF" + I2S(SKILL_PTS[GetUnitId(GetPlayerHero(id))]) + "|r|n|cffffff00Stat Points: |r|c00FFFFFF" + I2S(STAT_PTS[GetUnitId(GetPlayerHero(id))])+"|r", 0, Player(14))
call LeaderboardDisplay( udg_Board[id], true )
endfunction
function HeroSelection takes nothing returns nothing
local integer id = 0
local player pl
local force fp
local real time = 15.00
set id = GetPlayerId(GetTriggerPlayer()) + 1
set pl = Player(id-1)
set fp = bj_FORCE_PLAYER[id-1]
if GetPlayerHero(id) == null and GetOwningPlayer(GetTriggerUnit()) == Player(15) and RectContainsUnit(gg_rct_HeroSelector, GetTriggerUnit()) then
if udg_HERO_LastSel[id] == GetTriggerUnit() and GetHeroLevel(udg_HERO_LastSel[id]) > 0 then
call HeroSpawn()
else
set udg_HERO_LastSel[id] = GetTriggerUnit()
call DisplayTimedTextToForce( fp, time, " ")
call DisplayTimedTextToForce( fp, time, "|cffffd700" + GetHeroProperName(GetTriggerUnit()) + "|r" )
if (GetUnitTypeId(GetTriggerUnit()) == 'EHiD' ) then
call DisplayTimedTextToForce( fp, time, "|cffffd700NOTE|r: The High Druid has forms and a set class. He cannot get skill points until he's at the Subclass level." )
endif
call DisplayTimedTextToForce( fp, time, "|cff008000Agility: |r" + I2S(GetHeroAgi(GetTriggerUnit(), false)) )
call DisplayTimedTextToForce( fp, time, "|cff0000ffIntelligence: |r" + I2S(GetHeroInt(GetTriggerUnit(), false)) )
call DisplayTimedTextToForce( fp, time, "|cffff0000Strength: |r" + I2S(GetHeroStr(GetTriggerUnit(), false)))
endif
endif
endfunction
function InitPlayerHeroSelector takes nothing returns nothing
local player pl = GetEnumPlayer()
call FogModifierStart( CreateFogModifierRect( pl, FOG_OF_WAR_VISIBLE, gg_rct_HeroSelector, true, false ) )
call CameraSetupApplyForPlayer( true, gg_cam_HeroSelector, pl, 0 )
if GetPlayerSlotState(pl) == PLAYER_SLOT_STATE_PLAYING then
set udg_TEMP_Integer = udg_TEMP_Integer + 1
endif
endfunction
function HeroSelectorInit takes nothing returns nothing
local integer i = 1
local integer numplayers
set udg_TEMP_Integer = 0
call ForForce( udg_Force[1], function InitPlayerHeroSelector )
loop
exitwhen i > 12
set TRIG_HERO_Selection[i] = CreateTrigger( )
call DisableTrigger( TRIG_HERO_Selection[i] )
call TriggerRegisterPlayerUnitEvent( TRIG_HERO_Selection[i], Player(i-1), EVENT_PLAYER_UNIT_SELECTED, null )
call TriggerAddAction( TRIG_HERO_Selection[i], function HeroSelection )
set i = i + 1
endloop
set numplayers = udg_TEMP_Integer
set udg_TEMP_Integer = 0
call ForGroupBJ( GetUnitsInRectAll(gg_rct_HeroSelector), function CountEnum )
if numplayers > udg_TEMP_Integer then
set udg_HERO_AllowDuplicates = true
else
set udg_HERO_AllowDuplicates = false
endif
call DisplayTextToForce( udg_Force[1], "Click a Hero to view its description." )
call DisplayTextToForce( udg_Force[1], "Click it again to select it." )
call PolledWait( 1 )
set i = 0
loop
exitwhen i > 11
if IsPlayerInForce(Player(i), udg_Force[1]) then
call EnableTrigger( TRIG_HERO_Selection[i+1] )
endif
set i = i + 1
endloop
endfunction
function InitTrig_Hero_Selector takes nothing returns nothing
set gg_trg_Hero_Selector = CreateTrigger()
call TriggerAddAction( gg_trg_Hero_Selector, function HeroSelectorInit )
endfunction
//TESH.scrollpos=165
//TESH.alwaysfold=0
globals
trigger array TRIGGER_HERO_Restrictor
endglobals
function HeroRestrictorDoneEnum takes nothing returns boolean
if HeroRestrictor[GetUnitId(GetFilterUnit())] == true then
call SetUnitVertexColor( GetFilterUnit(), 255, 255, 255, 255 )
else
call RemoveUnit( GetFilterUnit() )
endif
return false
endfunction
function HeroAllowEnum takes nothing returns boolean
set HeroRestrictor[GetUnitId(GetFilterUnit())] = true
call SetUnitVertexColor( GetFilterUnit(), 0, 255, 0, 255 )
return false
endfunction
function HeroRestrictEnum takes nothing returns boolean
set HeroRestrictor[GetUnitId(GetFilterUnit())] = false
call SetUnitVertexColor( GetFilterUnit(), 255, 0, 0, 255 )
return false
endfunction
function DMRestrictHeroSelect takes nothing returns nothing
local integer i = 1
if RectContainsLoc(gg_rct_HeroSelector, GetUnitLoc(GetTriggerUnit())) and IsPlayerInForce( GetTriggerPlayer(), udg_Force[2] ) then
if GetTriggerUnit() == bDone then
call DestroyTextTagBJ( udg_HERO_ButtonText[1] )
call DestroyTextTagBJ( udg_HERO_ButtonText[2] )
call DestroyTextTagBJ( udg_HERO_ButtonText[3] )
call DestroyTextTagBJ( udg_HERO_ButtonText[4] )
call DestroyTextTagBJ( udg_HERO_ButtonText[5] )
call RemoveUnit(bHuman)
call RemoveUnit(bOrc)
call RemoveUnit(bUndead)
call RemoveUnit(bNightElf)
call RemoveUnit(bDone)
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_HeroSelector, function HeroRestrictorDoneEnum )
loop
exitwhen i > 12
call DestroyTrigger( TRIGGER_HERO_Restrictor[i] )
set i = i + 1
endloop
call DisableTrigger( gg_trg_Hero_Restrictor_Lock )
call TriggerExecute( gg_trg_Hero_Selector )
elseif GetTriggerUnit() == bHuman then
if HeroRestrictor[GetUnitId(GetTriggerUnit())] == true then
set HeroRestrictor[GetUnitId(GetTriggerUnit())] = false
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_HeroSelectorHuman, function HeroRestrictEnum )
else
set HeroRestrictor[GetUnitId(GetTriggerUnit())] = true
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_HeroSelectorHuman, function HeroAllowEnum )
endif
elseif GetTriggerUnit() == bOrc then
if HeroRestrictor[GetUnitId(GetTriggerUnit())] == true then
set HeroRestrictor[GetUnitId(GetTriggerUnit())] = false
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_HeroSelectorOrc, function HeroRestrictEnum )
else
set HeroRestrictor[GetUnitId(GetTriggerUnit())] = true
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_HeroSelectorOrc, function HeroAllowEnum )
endif
elseif GetTriggerUnit() == bUndead then
if HeroRestrictor[GetUnitId(GetTriggerUnit())] == true then
set HeroRestrictor[GetUnitId(GetTriggerUnit())] = false
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_HeroSelectorUndead, function HeroRestrictEnum )
else
set HeroRestrictor[GetUnitId(GetTriggerUnit())] = true
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_HeroSelectorUndead, function HeroAllowEnum )
endif
elseif GetTriggerUnit() == bNightElf then
if HeroRestrictor[GetUnitId(GetTriggerUnit())] == true then
set HeroRestrictor[GetUnitId(GetTriggerUnit())] = false
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_HeroSelectorNightElf, function HeroRestrictEnum )
else
set HeroRestrictor[GetUnitId(GetTriggerUnit())] = true
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_HeroSelectorNightElf, function HeroAllowEnum )
endif
else
if HeroRestrictor[GetUnitId(GetTriggerUnit())] == true then
set HeroRestrictor[GetUnitId(GetTriggerUnit())] = false
call SetUnitVertexColor( GetTriggerUnit(), 255, 0, 0, 255 )
else
set HeroRestrictor[GetUnitId(GetTriggerUnit())] = true
call SetUnitVertexColor( GetTriggerUnit(), 0, 255, 0, 255 )
endif
endif
endif
endfunction
function InitHeroRestrictorEnum takes nothing returns boolean
call SetUnitOwner( GetFilterUnit(), Player(15), false )
set HeroRestrictor[GetUnitId(GetFilterUnit())] = true
if GetUnitTypeId(GetFilterUnit()) != 'n000' then
call SetUnitVertexColor( GetFilterUnit(), 0, 255, 0, 255 )
endif
return false
endfunction
function InitHeroRestrictor takes nothing returns nothing
local unit bHuman = gg_unit_n000_0283
local unit bOrc = gg_unit_n000_0282
local unit bUndead = gg_unit_n000_0285
local unit bNightElf = gg_unit_n000_0284
local unit bDone = gg_unit_n000_0286
local integer i = 1
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_HeroSelector, function InitHeroRestrictorEnum )
loop
exitwhen i > 12
set TRIGGER_HERO_Restrictor[i] = CreateTrigger( )
call TriggerAddAction( TRIGGER_HERO_Restrictor[i], function DMRestrictHeroSelect )
call TriggerRegisterPlayerUnitEvent( TRIGGER_HERO_Restrictor[i], Player(i-1), EVENT_PLAYER_UNIT_SELECTED, null)
set i = i + 1
endloop
call CreateTextTagLocBJ( "Human", GetUnitLoc(bHuman), 0, 20.00, 100, 100, 100, 0 )
set udg_HERO_ButtonText[1] = GetLastCreatedTextTag()
call CreateTextTagLocBJ( "Orc", GetUnitLoc(bOrc), 0, 20.00, 100, 100, 100, 0 )
set udg_HERO_ButtonText[2] = GetLastCreatedTextTag()
call CreateTextTagLocBJ( "Undead", GetUnitLoc(bUndead), 0, 20.00, 100, 100, 100, 0 )
set udg_HERO_ButtonText[3] = GetLastCreatedTextTag()
call CreateTextTagLocBJ( "Night Elf", GetUnitLoc(bNightElf), 0, 20.00, 100, 100, 100, 0 )
set udg_HERO_ButtonText[4] = GetLastCreatedTextTag()
call CreateTextTagLocBJ( "Done", GetUnitLoc(bDone), 0, 20.00, 100, 100, 100, 0 )
set udg_HERO_ButtonText[5] = GetLastCreatedTextTag()
call SetUnitScalePercent( bHuman, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( bOrc, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( bUndead, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( bNightElf, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( bDone, 50.00, 50.00, 50.00 )
call SetUnitVertexColor( bHuman, 255, 255, 255, 0 )
call SetUnitVertexColor( bOrc, 255, 255, 255, 0 )
call SetUnitVertexColor( bUndead, 255, 255, 255, 0 )
call SetUnitVertexColor( bNightElf, 255, 255, 255, 0 )
call SetUnitVertexColor( bDone, 255, 255, 255, 0 )
set bHuman = null
set bOrc = null
set bUndead = null
set bNightElf = null
set bDone = null
endfunction
function InitTrig_Hero_Restrictor takes nothing returns nothing
set gg_trg_Hero_Restrictor = CreateTrigger( )
call TriggerAddAction( gg_trg_Hero_Restrictor, function InitHeroRestrictor )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Reviver requires MapScript
globals
trigger array TRIGGER_Hero_Reviver
endglobals
function RezKill takes nothing returns boolean
call RemoveUnit(GetFilterUnit())
return false
endfunction
function RezMarker takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit()) == 'grav' then
call RaiseHero(GetFilterUnit(), 9999,9999)
endif
return false
endfunction
function IndvFlag takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit()) == 'h006' then
set udg_TEMP_Unit = GetFilterUnit()
endif
return false
endfunction
function Trig_Hero_Reviver_Actions takes nothing returns nothing
local integer i = 0
local integer id = GetPlayerId(GetTriggerPlayer()) + 1
local player pl = Player(id-1)
local force fp = bj_FORCE_PLAYER[id-1]
local unit un
local unit flag = gg_unit_h006_0197
local integer exp = 0
set un = GetPlayerHero(id)
if not(un == null) and (udg_HERO_IsDead[id] or IsUnitType(un, UNIT_TYPE_DEAD)) then
if udg_DebugBoardCreated then
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, ColorName("ESC (rev)",id) )
endif
if flag == null then
call DisplayTextToForce( GetPlayersAll(), "ERROR: Hero Flag Null!!" )
endif
if RezOff then
call DisplayTextToForce( fp, "Reviving is off. You must be brought back to life by an ally or DM." )
else
//check for individual flag
set udg_TEMP_Unit = null
call GroupEnumUnitsOfPlayer(ENUM_GROUP, pl, function IndvFlag)
if udg_TEMP_Unit != null then
set flag = udg_TEMP_Unit
endif
call ReviveHero( un, GetUnitX(flag), GetUnitY(flag), true )
call RemoveUnit( GraveMarker[GetUnitId(un)] )
call DisplayTextToForce( fp, "You have been revived." )
call ResetToGameCameraForPlayer( pl, 0 )
call PanCameraToTimedLocForPlayer( pl, GetUnitLoc(flag), 0 )
set udg_HERO_IsDead[id] = false
if GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER) > 0 then
call AddHeroXPSwapped( GetPlayerState(pl, PLAYER_STATE_RESOURCE_LUMBER), un, false )
call SetPlayerStateBJ( pl, PLAYER_STATE_RESOURCE_LUMBER, 0 )
endif
endif
else
if udg_DebugBoardCreated then
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, ColorName("ESC (cam)",id) )
endif
//change camera
if udg_HERO_FloatCam[id] == false then
set udg_HERO_FloatCam[id] = true
call DisplayTextToForce( fp, "|c0000FF00Camera unlocked.|r")
set Rotation[id] = 0
set Angle[id] = 0
set Distance[id] = 0
else
set Distance[id] = 0
if GetLocalPlayer() == GetTriggerPlayer() then
call SetCameraField(CAMERA_FIELD_FARZ, 10000.00, 0)
call CameraSetSmoothingFactor(100)
endif
set udg_HERO_FloatCam[id] = false
call DisplayTextToForce( fp, "|c0000FF00Camera locked.|r")
endif
endif
if udg_DebugBoardCreated then
call PolledWait( 4.00 )
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, "" )
endif
endfunction
function InitTrig_Hero_Reviver takes nothing returns nothing
local integer i = 1
loop
if i < 9 or i == 12 then
set TRIGGER_Hero_Reviver[i] = CreateTrigger()
call TriggerRegisterPlayerEvent( TRIGGER_Hero_Reviver[i], Player(i-1), EVENT_PLAYER_END_CINEMATIC )
call TriggerAddAction( TRIGGER_Hero_Reviver[i], function Trig_Hero_Reviver_Actions )
endif
set i = i + 1
exitwhen i > 12
endloop
endfunction
endlibrary
//TESH.scrollpos=23
//TESH.alwaysfold=0
globals
trigger array TRIGGER_Hero_Dies
endglobals
function Trig_Hero_Dies_Actions takes nothing returns nothing
local integer id = GetPlayerId(GetTriggerPlayer())+1
local player pl = Player(id-1)
local force fp = bj_FORCE_PLAYER[id-1]
local unit un = udg_HERO_Ref2[id]
local group grp = NewGroup()
//note: the reviver does not depend on this;
//this is a hack to try to stop the revive bug.
set udg_HERO_IsDead[id] = true
call RemoveKeepAliveUnit(GetTriggerUnit())
call DisplayTextToForce( fp, "You have died! Press |cFFFFFF00ESC|r to revive." )
if AltRez then
call GroupEnumUnitsOfType(grp, "gravestonemarker", function RezKill)
set GraveMarker[GetUnitId(un)] = CreateUnit(pl, 'grav', GetUnitX(GetDyingUnit()), GetUnitY(GetDyingUnit()), GetUnitFacing(GetDyingUnit()))
call SetUnitVertexColor( GraveMarker[GetUnitId(un)], GetPlayerTagColor(pl,"red"), GetPlayerTagColor(pl,"green"), GetPlayerTagColor(pl,"blue"), 255)
endif
set fp = null
set pl = null
set un = null
call ReleaseGroup(grp)
endfunction
function Trig_Hero_Dies_Conditions takes nothing returns boolean
if GetDyingUnit() == udg_HERO_Ref2[GetPlayerId(GetOwningPlayer(GetDyingUnit()))+1] then
call Trig_Hero_Dies_Actions()
endif
return false
endfunction
//===========================================================================
function InitTrig_Hero_Dies takes nothing returns nothing
local integer i = 1
loop
if i < 9 or i == 12 then
set TRIGGER_Hero_Dies[i] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent( TRIGGER_Hero_Dies[i], Player(i-1), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerAddAction( TRIGGER_Hero_Dies[i], function Trig_Hero_Dies_Conditions )
endif
set i = i + 1
exitwhen i > 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_PlayerCam_Func002A takes nothing returns nothing
local integer id = GetPlayerId(GetEnumPlayer())+1
if udg_HERO_FloatCam[id] == false then
if udg_HERO_Ref2[id] != null then
if GetLocalPlayer() == GetEnumPlayer() then //DO NOT REFERENCE NON-GLOBALS IN A LOCAL, so NO GetHeroPlayer(id)
call PanCameraToTimed( GetUnitX(udg_HERO_Ref2[id]), GetUnitY(udg_HERO_Ref2[id]), 0.50 )
call SetCameraField( CAMERA_FIELD_TARGET_DISTANCE, 500.00 + Distance[id], 0.50 )
call SetCameraField( CAMERA_FIELD_ANGLE_OF_ATTACK, 340.00 + Angle[id], 0.50 )
call SetCameraField( CAMERA_FIELD_ROTATION, GetUnitFacing(udg_HERO_Ref2[id]) + Rotation[id], 0.50 )
call SetCameraField( CAMERA_FIELD_ZOFFSET, 170.00 - Angle[id]*3, 0.50 )
endif
endif
endif
endfunction
function Trig_PlayerCam_Actions takes nothing returns nothing
call ForForce( udg_Force[1], function Trig_PlayerCam_Func002A )
endfunction
//===========================================================================
function InitTrig_PlayerCam takes nothing returns nothing
set gg_trg_PlayerCam = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_PlayerCam, 0.20 )
call TriggerAddAction( gg_trg_PlayerCam, function Trig_PlayerCam_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
trigger array TRIGGER_Give_Lumber_Experience
endglobals
function Trig_Give_Lumber_Experience_Actions takes nothing returns nothing
local integer id = GetPlayerId(GetTriggerPlayer()) + 1
if GetWidgetLife(udg_HERO_Ref2[id]) > 0.405 and udg_HERO_Ref2[id] != null then
call AddHeroXP( udg_HERO_Ref2[id], GetPlayerState(Player(id-1), PLAYER_STATE_RESOURCE_LUMBER), true )
call SetPlayerState( Player(id-1), PLAYER_STATE_RESOURCE_LUMBER, 0 )
endif
endfunction
//===========================================================================
function InitTrig_Give_Lumber_Experience takes nothing returns nothing
local integer i = 1
loop
exitwhen i > 12
if (i < 9 or i == 12) then
set TRIGGER_Give_Lumber_Experience[i] = CreateTrigger()
call TriggerRegisterPlayerStateEvent( TRIGGER_Give_Lumber_Experience[i], Player(i-1), PLAYER_STATE_RESOURCE_LUMBER, GREATER_THAN_OR_EQUAL, 0.00 )
call TriggerAddAction( TRIGGER_Give_Lumber_Experience[i], function Trig_Give_Lumber_Experience_Actions )
endif
set i = i + 1
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
trigger array TRIG_Up
trigger array TRIG_Down
trigger array TRIG_LeftAP
trigger array TRIG_LeftAR
trigger array TRIG_RightAP
trigger array TRIG_RightAR
endglobals
function UpArrow_Actions takes nothing returns nothing
local integer id = GetPlayerId(GetTriggerPlayer())+1
if Distance[id] < 2000 then
set Distance[id] = Distance[id] + 200
set Angle[id] = Angle[id] - 5
endif
endfunction
function DMUpArrow takes nothing returns nothing
call GUIApplyCamForDM(GetTriggerPlayer())
endfunction
//===========================================================================
function InitTrig_UpArrow takes nothing returns nothing
local integer i = 1
loop
exitwhen i > bj_MAX_PLAYERS+1
set TRIG_Up[i] = CreateTrigger()
if i < 8 or i == 12 then
call TriggerRegisterPlayerEvent(TRIG_Up[i], Player(i-1), EVENT_PLAYER_ARROW_UP_DOWN )
call TriggerAddAction( TRIG_Up[i], function UpArrow_Actions)
endif
set i = i + 1
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function DownArrow_Actions takes nothing returns nothing
local integer id = GetPlayerId(GetTriggerPlayer()) + 1
if Distance[id] > -900 then
set Distance[id] = Distance[id] - 200
set Angle[id] = Angle[id] + 5
endif
endfunction
//===========================================================================
function InitTrig_DownArrow takes nothing returns nothing
local integer i = 1
loop
exitwhen i > bj_MAX_PLAYERS
set TRIG_Down[i] = CreateTrigger()
call TriggerRegisterPlayerEvent(TRIG_Down[i], Player(i-1), EVENT_PLAYER_ARROW_DOWN_DOWN )
call TriggerAddAction( TRIG_Down[i], function DownArrow_Actions)
set i = i + 1
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function LeftAR_Actions takes nothing returns nothing
local integer id = GetPlayerId(GetTriggerPlayer()) + 1
set PressedL[id] = false
call RemoveUnit(RotationDummy[id])
call ResetUnitLookAt( GetPlayerHero(id) )
set Rotation[id] = 0
endfunction
//===========================================================================
function InitTrig_LeftAR takes nothing returns nothing
local integer i = 1
loop
exitwhen i > bj_MAX_PLAYERS
set TRIG_LeftAR[i] = CreateTrigger()
call TriggerRegisterPlayerEvent(TRIG_LeftAR[i], Player(i-1), EVENT_PLAYER_ARROW_LEFT_UP)
call TriggerAddAction( TRIG_LeftAR[i], function LeftAR_Actions)
set i = i + 1
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function RightAR_Actions takes nothing returns nothing
local integer id = GetPlayerId(GetTriggerPlayer()) + 1
set PressedR[id] = false
call RemoveUnit(RotationDummy[id])
call ResetUnitLookAt( GetPlayerHero(id) )
set Rotation[id] = 0
endfunction
//===========================================================================
function InitTrig_RightAR takes nothing returns nothing
local integer i = 1
loop
exitwhen i > bj_MAX_PLAYERS
set TRIG_RightAR[i] = CreateTrigger()
call TriggerRegisterPlayerEvent(TRIG_RightAR[i], Player(i-1), EVENT_PLAYER_ARROW_RIGHT_UP)
call TriggerAddAction( TRIG_RightAR[i], function RightAR_Actions)
set i = i + 1
endloop
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope LeftArrow initializer init
public struct Data
player p
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer id = GetPlayerId(.p)+1
local real x = GetUnitX(GetPlayerHero(id)) + 200 * Cos((GetUnitFacing(GetPlayerHero(id)) + 40.00) * bj_DEGTORAD)
local real y = GetUnitY(GetPlayerHero(id)) + 200 * Sin((GetUnitFacing(GetPlayerHero(id)) + 40.00) * bj_DEGTORAD)
call SetUnitPosition( RotationDummy[id], x, y )
if Rotation[id] < 80 then
set Rotation[id] = Rotation[id] + 10
endif
if PressedL[id] == false then
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endif
endmethod
static method Actions takes nothing returns thistype
local thistype this = thistype.allocate()
local integer id = GetPlayerId(GetTriggerPlayer()) + 1
local real x = GetUnitX(GetPlayerHero(id)) + 200 * Cos((GetUnitFacing(GetPlayerHero(id)) + 40.00) * bj_DEGTORAD)
local real y = GetUnitY(GetPlayerHero(id)) + 200 * Sin((GetUnitFacing(GetPlayerHero(id)) + 40.00) * bj_DEGTORAD)
local timer tim
if PressedR[id] == false then
set .p = Player(id-1)
set PressedL[id] = true
set RotationDummy[id] = CreateUnit( Player(id-1), 'e002', x, y, bj_UNIT_FACING )
call UnitAddAbility( RotationDummy[id], 'Aloc' )
call UnitApplyTimedLife( RotationDummy[id], 'B000', 15 )
call SetUnitLookAt( udg_HERO_Ref2[id], "bone_head", RotationDummy[id], 0, 0, 90.00 )
set tim = NewTimer()
call SetTimerData(tim,this)
call TimerStart(tim, 0.2, true, function thistype.Timer )
endif
return this
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local integer i = 1
loop
exitwhen i > bj_MAX_PLAYERS
set TRIG_LeftAP[i] = CreateTrigger()
call TriggerRegisterPlayerEvent(TRIG_LeftAP[i], Player(i-1), EVENT_PLAYER_ARROW_LEFT_DOWN)
call TriggerAddAction( TRIG_LeftAP[i], function Data.Actions )
set i = i + 1
endloop
endfunction
endscope
//TESH.scrollpos=6
//TESH.alwaysfold=0
scope RightArrow initializer init
public struct Data
player p
static method Timer takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local integer id = GetPlayerId(.p)+1
local real x = GetUnitX(GetPlayerHero(id)) + 200 * Cos((GetUnitFacing(GetPlayerHero(id)) - 40.00) * bj_DEGTORAD)
local real y = GetUnitY(GetPlayerHero(id)) + 200 * Sin((GetUnitFacing(GetPlayerHero(id)) - 40.00) * bj_DEGTORAD)
call SetUnitPosition( RotationDummy[id], x, y )
if Rotation[id] > -80 then
set Rotation[id] = Rotation[id] - 10
endif
if PressedR[id] == false then
call ReleaseTimer(GetExpiredTimer())
call .destroy()
endif
endmethod
static method Actions takes nothing returns thistype
local thistype this = thistype.allocate()
local integer id = GetPlayerId(GetTriggerPlayer()) + 1
local real x = GetUnitX(GetPlayerHero(id)) + 200 * Cos((GetUnitFacing(GetPlayerHero(id)) - 40.00) * bj_DEGTORAD)
local real y = GetUnitY(GetPlayerHero(id)) + 200 * Sin((GetUnitFacing(GetPlayerHero(id)) - 40.00) * bj_DEGTORAD)
local timer tim
if PressedL[id] == false then
set .p = Player(id-1)
set PressedR[id] = true
set RotationDummy[id] = CreateUnit( Player(id-1), 'e002', x, y, bj_UNIT_FACING )
call UnitAddAbility( RotationDummy[id], 'Aloc' )
call UnitApplyTimedLife( RotationDummy[id], 'B000', 15 )
call SetUnitLookAt( udg_HERO_Ref2[id], "bone_head", RotationDummy[id], 0, 0, 90.00 )
set tim = NewTimer()
call SetTimerData(tim,this)
call TimerStart(tim, 0.2, true, function thistype.Timer )
endif
return this
endmethod
endstruct
//===========================================================================
public function init takes nothing returns nothing
local integer i = 1
loop
exitwhen i > bj_MAX_PLAYERS
set TRIG_RightAP[i] = CreateTrigger()
call TriggerRegisterPlayerEvent(TRIG_RightAP[i], Player(i-1), EVENT_PLAYER_ARROW_RIGHT_DOWN)
call TriggerAddAction( TRIG_RightAP[i], function Data.Actions )
set i = i + 1
endloop
endfunction
endscope
//TESH.scrollpos=352
//TESH.alwaysfold=0
library Terrain
function Lordaeron takes integer id returns integer
if udg_DM_SubType[id] == "summerdirt" then
return 'Ldrt'
elseif udg_DM_SubType[id] == "summerroughdirt" then
return 'Ldro'
elseif udg_DM_SubType[id] == "summergrassydirt" then
return 'Ldrg'
elseif udg_DM_SubType[id] == "summergrass" then
return 'Lgrs'
elseif udg_DM_SubType[id] == "summerdarkgrass" then
return 'Lgrd'
elseif udg_DM_SubType[id] == "fallgrass" then
return 'Fgrd'
elseif udg_DM_SubType[id] == "fallroughdirt" then
return 'Fdro'
elseif udg_DM_SubType[id] == "fallgrassdirt" then
return 'Fdrg'
elseif udg_DM_SubType[id] == "fallrock" then
return 'Frok'
elseif udg_DM_SubType[id] == "fallgrass" then
return 'Fgrs'
elseif udg_DM_SubType[id] == "falldarkgrass" then
return 'Fgrd'
elseif udg_DM_SubType[id] == "winterdirt" then
return 'Wdrt'
elseif udg_DM_SubType[id] == "winterroughdirt" then
return 'Wdro'
elseif udg_DM_SubType[id] == "wintergrassysnow" then
return 'Wsng'
elseif udg_DM_SubType[id] == "winterrock" then
return 'Wrok'
elseif udg_DM_SubType[id] == "wintersnow" then
return 'Wsnw'
elseif udg_DM_SubType[id] == "ashenvaleroughdirt" then
return 'Adrd'
elseif udg_DM_SubType[id] == "ashenvalegrass" then
return 'Agrs'
elseif udg_DM_SubType[id] == "ashenvalerock" then
return 'Arck'
elseif udg_DM_SubType[id] == "ashenvalelumpygrass" then
return 'Agrd'
elseif udg_DM_SubType[id] == "ashenvalevines" then
return 'Avin'
elseif udg_DM_SubType[id] == "ashenvalegrassydirt" then
return 'Adrg'
elseif udg_DM_SubType[id] == "ashenvaleleaves" then
return 'Alvd'
elseif udg_DM_SubType[id] == "ashenvaledirt" then
return 'Adrt'
endif
return 0
endfunction
function CityVillage takes integer id returns integer
if udg_DM_SubType[id] == "cityscapedirt" then
return 'Ydrt'
elseif udg_DM_SubType[id] == "cityscaperoughdirt" then
return 'Ydtr'
elseif udg_DM_SubType[id] == "cityscapeblackmarble" then
return 'Yblm'
elseif udg_DM_SubType[id] == "cityscapebrick" then
return 'Ybtl'
elseif udg_DM_SubType[id] == "cityscapesquaretiles" then
return 'Ysqd'
elseif udg_DM_SubType[id] == "cityscaperoundtiles" then
return 'Yrtl'
elseif udg_DM_SubType[id] == "cityscapegrass" then
return 'Ygsd'
elseif udg_DM_SubType[id] == "cityscapegrasstrim" then
return 'Yhdg'
elseif udg_DM_SubType[id] == "cityscapewhitemarble" then
return 'Ywmb'
elseif udg_DM_SubType[id] == "villagedirt" then
return 'Vdrt'
elseif udg_DM_SubType[id] == "villageroughdirt" then
return 'Vdrr'
elseif udg_DM_SubType[id] == "villagecrops" then
return 'Vcrp'
elseif udg_DM_SubType[id] == "villagecobblepath" then
return 'Vcbp'
elseif udg_DM_SubType[id] == "villagestonepath" then
return 'Vstp'
elseif udg_DM_SubType[id] == "villageshortgrass" then
return 'Vgrs'
elseif udg_DM_SubType[id] == "villagerock" then
return 'Vrck'
elseif udg_DM_SubType[id] == "villagethickgrass" then
return 'Vgrt'
elseif udg_DM_SubType[id] == "villagefalldirt" then
return 'Qdrt'
elseif udg_DM_SubType[id] == "villagefallroughdirt" then
return 'Qdrr'
elseif udg_DM_SubType[id] == "villagefallcrops" then
return 'Qcbp'
elseif udg_DM_SubType[id] == "villagefallcobblepath" then
return 'Qcbp'
elseif udg_DM_SubType[id] == "villagefallstonepath" then
return 'Qstp'
elseif udg_DM_SubType[id] == "villagefallshortgrass" then
return 'Qgrs'
elseif udg_DM_SubType[id] == "villagefallrock" then
return 'Qrck'
elseif udg_DM_SubType[id] == "villagefallthickgrass" then
return 'Qgrt'
elseif udg_DM_SubType[id] == "dalarandirt" then
return 'Xdrt'
elseif udg_DM_SubType[id] == "dalaranblackmarble" then
return 'Xblm'
elseif udg_DM_SubType[id] == "dalaranbricktiles" then
return 'Xbtl'
elseif udg_DM_SubType[id] == "dalaransquaretiles" then
return 'Xsqd'
elseif udg_DM_SubType[id] == "dalaranroundtiles" then
return 'Xrtl'
elseif udg_DM_SubType[id] == "dalarangrass" then
return 'Xgsb'
elseif udg_DM_SubType[id] == "dalarantrimgrass" then
return 'Xhdg'
elseif udg_DM_SubType[id] == "dalaranwhitemarble" then
return 'Xwmb'
elseif udg_DM_SubType[id] == "dalaranwhitemarble" then
return 'Xwmb'
elseif udg_DM_SubType[id] == "dalaranruinsdirt" then
return 'Jdrt'
elseif udg_DM_SubType[id] == "dalaranruinsroughdirt" then
return 'Jdtr'
elseif udg_DM_SubType[id] == "dalaranruinsblackmarble" then
return 'Jblm'
elseif udg_DM_SubType[id] == "dalaranruinsbricktiles" then
return 'Jbtl'
elseif udg_DM_SubType[id] == "dalaranruinssquaretiles" then
return 'Jsqd'
elseif udg_DM_SubType[id] == "dalaranruinsroundtiles" then
return 'Jrtl'
elseif udg_DM_SubType[id] == "dalaranruinsgrass" then
return 'Jgsb'
elseif udg_DM_SubType[id] == "dalaranruinstrimgrass" then
return 'Jhdg'
elseif udg_DM_SubType[id] == "dalaranruinswhitemarble" then
return 'Jwmb'
endif
return 0
endfunction
function Cliffs takes integer id returns integer
if udg_DM_SubType[id] == "ashenvaledirtcliff" then
return 'cAc2'
elseif udg_DM_SubType[id] == "ashenvalegrasscliff" then
return 'cAc1'
elseif udg_DM_SubType[id] == "barrensgrasscliff" then
return 'cBc2'
elseif udg_DM_SubType[id] == "barrensdirtcliff" then
return 'cBc1'
elseif udg_DM_SubType[id] == "blackcitadeldirtcliff" then
return 'cKc1'
elseif udg_DM_SubType[id] == "blackcitadeldarktilescliff" then
return 'cKc2'
elseif udg_DM_SubType[id] == "cityscapedirtcliff" then
return 'cYc2'
elseif udg_DM_SubType[id] == "cityscapesquaretilescliff" then
return 'cYc1'
elseif udg_DM_SubType[id] == "dalarandirtcliff" then
return 'cXc2'
elseif udg_DM_SubType[id] == "dalaransquaretilescliff" then
return 'cXc1'
elseif udg_DM_SubType[id] == "dalaranruinsdirtcliff" then
return 'cJc2'
elseif udg_DM_SubType[id] == "dalaransquaretilescliff" then
return 'cJc2'
elseif udg_DM_SubType[id] == "dungeondirtcliff" then
return 'cDc2'
elseif udg_DM_SubType[id] == "dungeonsquaretilescliff" then
return 'cDc1'
elseif udg_DM_SubType[id] == "felwooddirtcliff" then
return 'cCc2'
elseif udg_DM_SubType[id] == "felwoodgrasscliff" then
return 'cCc1'
elseif udg_DM_SubType[id] == "icecrownrunebrickscliff" then
return 'cIc2'
elseif udg_DM_SubType[id] == "icecrownsnowcliff" then
return 'cIc1'
elseif udg_DM_SubType[id] == "falldirtcliff" then
return 'cFc2'
elseif udg_DM_SubType[id] == "floors" then
return 'cFc1'
elseif udg_DM_SubType[id] == "summerdirtcliff" then
return 'cLc2'
elseif udg_DM_SubType[id] == "summergrasscliff" then
return 'cLc1'
elseif udg_DM_SubType[id] == "wintergrasscliff" then
return 'cWc2'
elseif udg_DM_SubType[id] == "wintersnowcliff" then
return 'cWc1'
elseif udg_DM_SubType[id] == "northrenddirtcliff" then
return 'cNc2'
elseif udg_DM_SubType[id] == "northrendsnowcliff" then
return 'cNc1'
elseif udg_DM_SubType[id] == "outlandabysscliff" then
return 'cOc1'
elseif udg_DM_SubType[id] == "outlandroughdirtcliff" then
return 'cOc2'
elseif udg_DM_SubType[id] == "sunkenruinsdirtcliff" then
return 'cZc2'
elseif udg_DM_SubType[id] == "sunkenruinslargebrickscliff" then
return 'cZc1'
elseif udg_DM_SubType[id] == "undergrounddirtcliff" then
return 'cGc2'
elseif udg_DM_SubType[id] == "undergroundsquaretilescliff" then
return 'cGc1'
elseif udg_DM_SubType[id] == "villagedirtcliff" then
return 'cVc2'
elseif udg_DM_SubType[id] == "villagegrassthickcliff" then
return 'cVc1'
elseif udg_DM_SubType[id] == "villagefalldirtcliff" then
return 'cQc2'
elseif udg_DM_SubType[id] == "villagefallgrassthickcliff" then
return 'cQc1'
endif
return 0
endfunction
function Outland takes integer id returns integer
if udg_DM_SubType[id] == "outlanddirt" then
return 'Odrt'
elseif udg_DM_SubType[id] == "outlandlightdirt" then
return 'Odtr'
elseif udg_DM_SubType[id] == "outlandroughdirt" then
return 'Osmb'
elseif udg_DM_SubType[id] == "outlandcrackeddirt" then
return 'Ofst'
elseif udg_DM_SubType[id] == "outlandflatstones" then
return 'Olgb'
elseif udg_DM_SubType[id] == "outlandrock" then
return 'Orok'
elseif udg_DM_SubType[id] == "outlandlightflatstones" then
return 'Ofsl'
elseif udg_DM_SubType[id] == "outlandabyss" then
return 'Oaby'
elseif udg_DM_SubType[id] == "blackcitadeldirt" then
return 'Kdrt'
elseif udg_DM_SubType[id] == "blackcitadellightdirt" then
return 'Kfsl'
elseif udg_DM_SubType[id] == "blackcitadelroughdirt" then
return 'Kdtr'
elseif udg_DM_SubType[id] == "blackcitadelflatstones" then
return 'Kfst'
elseif udg_DM_SubType[id] == "blackcitadelsmallbricks" then
return 'Ksmb'
elseif udg_DM_SubType[id] == "blackcitadellargebricks" then
return 'Klgb'
elseif udg_DM_SubType[id] == "blackcitadelsquaretiles" then
return 'Ksqt'
elseif udg_DM_SubType[id] == "blackcitadeldarktiles" then
return 'Kdkt'
endif
return 0
endfunction
function Other takes integer id returns integer
if udg_DM_SubType[id] == "barrensdirt" then
return 'Bdrt'
elseif udg_DM_SubType[id] == "barrensroughdirt" then
return 'Bdrh'
elseif udg_DM_SubType[id] == "barrenspebbles" then
return 'Bdrr'
elseif udg_DM_SubType[id] == "barrensgrassydirt" then
return 'Bdrg'
elseif udg_DM_SubType[id] == "barrensdesert" then
return 'Bdsr'
elseif udg_DM_SubType[id] == "barrensdarkdesert" then
return 'Bdsd'
elseif udg_DM_SubType[id] == "barrensrocks" then
return 'Bflr'
elseif udg_DM_SubType[id] == "barrensgrass" then
return 'Bgrr'
elseif udg_DM_SubType[id] == "felwooddirt" then
return 'Cdrt'
elseif udg_DM_SubType[id] == "felwoodroughdirt" then
return 'Cdrd'
elseif udg_DM_SubType[id] == "felwoodpoison" then
return 'Cpos'
elseif udg_DM_SubType[id] == "felwoodrock" then
return 'Crck'
elseif udg_DM_SubType[id] == "felwoodvines" then
return 'Cvin'
elseif udg_DM_SubType[id] == "felwoodgrass" then
return 'Cgrs'
elseif udg_DM_SubType[id] == "felwoodleaves" then
return 'Clvg'
elseif udg_DM_SubType[id] == "northrenddirt" then
return 'Ndrt'
elseif udg_DM_SubType[id] == "northrenddarkdirt" then
return 'Ndrd'
elseif udg_DM_SubType[id] == "northrendrock" then
return 'Nrck'
elseif udg_DM_SubType[id] == "northrendgrass" then
return 'Ngrs'
elseif udg_DM_SubType[id] == "northrendice" then
return 'Nice'
elseif udg_DM_SubType[id] == "northrendsnow" then
return 'Nsnw'
elseif udg_DM_SubType[id] == "northrendrockysnow" then
return 'Nsnr'
elseif udg_DM_SubType[id] == "dungeondirt" then
return 'Ddrt'
elseif udg_DM_SubType[id] == "dungeonbrick" then
return 'Dbrk'
elseif udg_DM_SubType[id] == "dungeonredstones" then
return 'Drds'
elseif udg_DM_SubType[id] == "dungeonlavacracks" then
return 'Dlvc'
elseif udg_DM_SubType[id] == "dungeonlava" then
return 'Dlav'
elseif udg_DM_SubType[id] == "dungeondarkrock" then
return 'Ddkr'
elseif udg_DM_SubType[id] == "dungeongraystones" then
return 'Dgrs'
elseif udg_DM_SubType[id] == "dungeonsquaretiles" then
return 'Dsqd'
elseif udg_DM_SubType[id] == "undergrounddirt" then
return 'Gdrt'
elseif udg_DM_SubType[id] == "undergroundbrick" then
return 'Gbrk'
elseif udg_DM_SubType[id] == "undergroundroundstones" then
return 'Grds'
elseif udg_DM_SubType[id] == "undergroundlavacracks" then
return 'Glvc'
elseif udg_DM_SubType[id] == "undergroundlava" then
return 'Glav'
elseif udg_DM_SubType[id] == "undergrounddarkrocks" then
return 'Gdkr'
elseif udg_DM_SubType[id] == "undergroundgraystones" then
return 'Ggrs'
elseif udg_DM_SubType[id] == "undergroundsquaretiles" then
return 'Gsqd'
elseif udg_DM_SubType[id] == "sunkenruinsdirt" then
return 'Zdrt'
elseif udg_DM_SubType[id] == "sunkenruinsroughdirt" then
return 'Zdtr'
elseif udg_DM_SubType[id] == "sunkenruinsgrassydirt" then
return 'Zdrg'
elseif udg_DM_SubType[id] == "sunkenruinssmallbricks" then
return 'Zbks'
elseif udg_DM_SubType[id] == "sunkenruinssand" then
return 'Zsan'
elseif udg_DM_SubType[id] == "sunkenruinslargebricks" then
return 'Zbkl'
elseif udg_DM_SubType[id] == "sunkenruinsroundtiles" then
return 'Ztil'
elseif udg_DM_SubType[id] == "sunkenruinsgrass" then
return 'Zgrs'
elseif udg_DM_SubType[id] == "sunkenruinsdarkgrass" then
return 'Zvin'
elseif udg_DM_SubType[id] == "icecrowndirt" then
return 'Idrt'
elseif udg_DM_SubType[id] == "icecrownroughdirt" then
return 'Idtr'
elseif udg_DM_SubType[id] == "icecrowndarkice" then
return 'Idki'
elseif udg_DM_SubType[id] == "icecrownblackbricks" then
return 'Ibkb'
elseif udg_DM_SubType[id] == "icecrownrunebricks" then
return 'Irbk'
elseif udg_DM_SubType[id] == "icecrowntiledbricks" then
return 'Itbk'
elseif udg_DM_SubType[id] == "icecrownice" then
return 'Iice'
elseif udg_DM_SubType[id] == "icecrownblacksquares" then
return 'Ibsg'
elseif udg_DM_SubType[id] == "icecrownsnow" then
return 'Isnw'
endif
return 0
endfunction
function TerrainChange takes location pt, integer id returns nothing
local integer v = GetRandomInt(-1,-4)
if Lordaeron(id) != 0 then
set DMTerrainType[id] = Lordaeron(id)
elseif CityVillage(id) != 0 then
set DMTerrainType[id] = CityVillage(id)
elseif Other(id) != 0 then
set DMTerrainType[id] = Other(id)
elseif Outland(id) != 0 then
set DMTerrainType[id] = Outland(id)
elseif Cliffs(id) != 0 then
set DMTerrainType[id] = Cliffs(id)
else
call DisplayTextToPlayer(Player(id), 0, 0, "Invalid Terrain")
call LeaderboardSetItemLabel(udg_Board[id], LeaderboardGetPlayerIndex(udg_Board[id], Player(14)), "|cFFFFFFFF-> '|r|c0000FF00Invalid Terrain|r|cFFFFFFFF'|r" )
endif
if DMTerrainVariation[id] != 0 then
set v = DMTerrainVariation[id]
endif
call SetTerrainType(GetLocationX(pt), GetLocationY(pt), DMTerrainType[id], v, IntegerBrushSize[id], DMBrushShape[id] )
endfunction
endlibrary
//TESH.scrollpos=93
//TESH.alwaysfold=0
globals
trigger array TRIGGER_Misc_Escape
trigger array TRIGGER_Misc_Select
endglobals
//*************************
// checked for leaks
//*************************
function KillGrave takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit()) == 'grav' then
debug call BJDebugMsg("KILLEDGRAVE")
call RemoveUnit(GetFilterUnit())
endif
return false
endfunction
function onGUIMiscClick takes nothing returns nothing
local integer i = 0
local integer i2 = 0
local integer id = 0
local player pl
local force fp
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if (GetTriggerUnit() == GUI_M_Portal) then
set udg_Status[id] = "misc_portal_source"
set udg_DM_Unit[id] = null
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFWay Gate...|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "Left click a Way Gate to deactivate it or to set its destination." )
call DisplayTextToForce( fp, "Right click the ground to create a new Way Gate." )
elseif (GetTriggerUnit() == GUI_M_Boot) then
if (id == 9 or id == 2) then
call CameraSetupApplyForPlayer( true, gg_cam_GUI, pl, 0 )
call DisplayTextToForce( fp, "Click the colored tile in the Toolbox of the player you'd like to boot." )
set udg_Status[id] = "misc_boot"
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFBooting...|r" )
set udg_DM_UnitType[id] = 0
set udg_DM_Player[id] = Player(14)
else
call DisplayTextToForce( fp, "Only the head DM may boot players." )
endif
//toolbox tile clicked
elseif IsUnitInGroup(GetTriggerUnit(), udg_GUI_Tile_Group) then
set i = 1
loop
exitwhen i > bj_MAX_PLAYER_SLOTS
if udg_GUI_Tile[i] == GetTriggerUnit() then
set i2 = i
endif
set i = i + 1
endloop
if (udg_Status[id] == "unit_create") then
set udg_DM_Player[id] = Player(i2-1)
if udg_DM_UnitType[id] == 0 then
call CameraSetupApplyForPlayer( true, gg_cam_Palette, pl, 0 )
call DisplayTextToForce( fp, " Left click the type of unit you would like to create." )
else
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r" + ColorName(UnitId2String(udg_DM_UnitType[id]), GetPlayerId(udg_DM_Player[id])) + "|c00FFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|cFFFF0000" + TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
endif
elseif udg_Status[id] == "unit_revive" then
if IsPlayerInForce(ConvertedPlayer(i2), udg_Force[1]) then
if not(GetPlayerSlotState(ConvertedPlayer(i2)) == PLAYER_SLOT_STATE_PLAYING) then
call DisplayTextToForce( fp, ColorNamePl(ConvertedPlayer(i2)) + " is not playing.")
elseif IsUnitDeadBJ(udg_HERO_Ref2[i2]) then
call ReviveHeroLoc( udg_HERO_Ref2[i2], GetUnitLoc(udg_HERO_Ref2[i2]), true )
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", GetUnitX(udg_HERO_Ref2[i2]), GetUnitY(udg_HERO_Ref2[i2]) ))
call GroupEnumUnitsOfPlayer( ENUM_GROUP, GetOwningPlayer(udg_HERO_Ref2[i2]), function KillGrave)
call DisplayTextToForce( udg_Force[2], ColorNamePl(ConvertedPlayer(i2)) + " has been revived.")
call DisplayTextToForce( bj_FORCE_PLAYER[i2-1], "You have been revived.")
else
call DisplayTextToForce( fp, ColorNamePl(ConvertedPlayer(i2)) + " is not dead!")
endif
else
call DisplayTextToForce( fp, "|c00FF0000Revival of NPC heroes is not available.|r")
endif
elseif udg_Status[id] == "misc_boot" then
if IsPlayerInForce(ConvertedPlayer(i2), udg_Force[3]) then
call DisplayTextToForce( fp, "You cannot boot the NPCs.")
elseif i2 == 9 then
call DisplayTextToForce( fp, "You cannot boot yourself.")
elseif not(GetPlayerSlotState(ConvertedPlayer(i2)) == PLAYER_SLOT_STATE_PLAYING) then
call DisplayTextToForce( fp, ColorNamePl(ConvertedPlayer(i2)) + " is not playing.")
else
set udg_Status[id] = "none"
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|c00FFFFFFNo Active Mode|r" )
set udg_DM_Player[id] = ConvertedPlayer(i2)
call DialogSetMessageBJ( udg_BOOT_Dialog, "Boot " + ColorNamePl(ConvertedPlayer(i2)) + "?" )
call DialogDisplayBJ( true, udg_BOOT_Dialog, pl )
endif
endif
endif
endfunction
function DMPressedEscape takes nothing returns nothing
local integer id = 0
local player pl
local force fp
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if udg_Status[id] == "none" then
call CameraSetupApplyForPlayer( true, gg_cam_GUI, pl, 0 )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "Welcome to the onscreen GUI." )
call DisplayTextToForce( fp, "Click a menu item to activate it." )
//call DisplayTextToForce( fp, " Items in |c00777777grey|r are not yet available." )
//call DisplayTextToForce( fp, " Look for them in a future release." )
else
set udg_Status[id] = "none"
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "|c0000FF00You have no current active mode.|r" )
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|c00FFFFFFNo Active Mode|r" )
endif
if udg_DebugBoardCreated then
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, ColorName("ESC",id) )
call PolledWait( 4.00 )
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, "" )
endif
endfunction
function DMMiscSelect takes nothing returns nothing
local unit GUI_Misc = gg_unit_n000_0043
local unit GUI_M_Portal = gg_unit_n000_0044
local unit GUI_M_Cinematic = gg_unit_n000_0045
local unit GUI_M_Effect = gg_unit_n000_0047
local unit GUI_M_Revive = gg_unit_n000_0047
local integer id = 0
local player pl
local force fp
local unit un
local player pu
local location loc
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set un = GetTriggerUnit()
set pu = GetOwningPlayer(un)
if udg_Status[id] == "unit_kill" and not(IsUnitType(un, UNIT_TYPE_GIANT)) and not(IsUnitOwnedByPlayer(un, Player(15))) then
call RemoveKeepAliveUnit(un)
call KillUnit( un )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
elseif udg_Status[id] == "unit_remove" and not(IsUnitType(un, UNIT_TYPE_GIANT)) and not(IsUnitOwnedByPlayer(un, Player(15))) and not(udg_HERO_Ref2[GetPlayerId(GetOwningPlayer(un)) + 1] == un )then
set loc = GetUnitLoc(un)
call DestroyEffect( AddSpecialEffectLoc( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", loc ) )
call RemoveLocation(loc)
set loc = null
if GetUnitTypeId(un) == 'h00B' then
call ClearTrainingRoomMonsters(un)
endif
call RemoveKeepAliveUnit(un)
call RemoveUnit( un )
elseif GetBooleanAnd(udg_Status[id] == "unit_side", IsPlayerInForce(pu, udg_Force[3])) then
if GetOwningPlayer( un ) == Player(12) then
call SetUnitOwner( un, Player(14), true )
else
call SetUnitOwner( un, Player(12), true )
endif
elseif udg_Status[id] == "unit_move" then
//if is hero spawner
if (un == gg_unit_h006_0197) then
call SetUnitPositionLoc( un, udg_DM_Destination[id] )
elseif not IsUnitType(un, UNIT_TYPE_GIANT) then
if not IsUnitOwnedByPlayer(un, Player(15)) then
set loc = GetUnitLoc(un)
call AddSpecialEffectLocBJ( loc, "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveLocation(loc)
call SetUnitPositionLoc( un, udg_DM_Destination[id] )
call RemoveGuardPosition( un )
if not(IsUnitType(GetLastCreatedUnit(), UNIT_TYPE_STRUCTURE)) then
call SetUnitAnimation( un, "birth" )
endif
call PauseUnitBJ( false, un )
set loc = GetUnitLoc(un)
call AddSpecialEffectLocBJ( loc, "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveLocation(loc)
endif
endif
elseif udg_Status[id] == "misc_portal_source" then
if IsUnitIdType(GetUnitTypeId(GetEnumUnit()), UNIT_TYPE_STRUCTURE) then
//we have a source
set udg_Status[id] = "misc_portal_dest"
set udg_DM_Unit[id] = un
call GUIApplyCamForDM(pl)
call WaygateActivateBJ( false, un )
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFWay Gate Link...|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "Left click a Way Gate to link it to this one." )
call DisplayTextToForce( fp, "Right click the ground to create a linking Way Gate." )
endif
elseif udg_Status[id] == "misc_portal_dest" then
if IsUnitIdType(GetUnitTypeId(GetEnumUnit()), UNIT_TYPE_STRUCTURE) then
//we have a destination
call WaygateSetDestinationLocBJ( un, GetUnitLoc(udg_DM_Unit[id]) )
call WaygateSetDestinationLocBJ( udg_DM_Unit[id], GetUnitLoc(un) )
call WaygateActivateBJ( true, un )
call WaygateActivateBJ( true, udg_DM_Unit[id] )
set udg_Status[id] = "none"
set udg_DM_Unit[id] = null
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "The two Way Gates are now linked." )
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|c00FFFFFFNo Active Mode|r" )
endif
endif
endfunction
function GUIMiscInit takes nothing returns nothing
call DialogClearBJ( udg_BOOT_Dialog )
call DialogAddButtonBJ( udg_BOOT_Dialog, "Yes" )
set udg_BOOT_DialogYes = GetLastCreatedButtonBJ()
call DialogAddButtonBJ( udg_BOOT_Dialog, "No" )
set udg_BOOT_DialogNo = GetLastCreatedButtonBJ()
endfunction
function InitTrig_Misc takes nothing returns nothing
set gg_trg_Misc = CreateTrigger()
call TriggerAddAction( gg_trg_Misc, function GUIMiscInit )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function DoGUIAnims takes nothing returns nothing
local integer i
local string str = ""
local string GUI_Tag_Tile = "Spell Lumber Second"
//Doodads Single
call CreateDestructable('XTvt', 15650, -7820, GetRandomReal(0, 360), 0.4, 0 ) //Citadel
call CreateDestructable('B009', 15650, -8915, GetRandomReal(0, 360), 0.4, 0 ) //Log
call CreateDestructable('B00T', 16680, -7820, GetRandomReal(0, 360), 0.4, 0 ) //Archway
call CreateDestructable('ITcr', 15650, -8130, GetRandomReal(0, 360), 0.4, 0 ) //Icey Rock
call CreateDestructable('B01J', 19014, -11243, 268, 0.3, 0 ) //Castle Gate
//Units
set str = "Units"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_Units), 0, 17.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_Units, 100, 100, 100, 100.00 )
set str = "Create (uc)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_U_Create), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Create, 100, 100, 100, 100.00 )
set str = "Kill (uk/uks)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_U_Kill), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Kill, 100, 100, 100, 100.00 )
set str = "Remove (ur/urs)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_U_Remove), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Remove, 100, 100, 100, 100.00 )
set str = "Side (us/uss)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_U_Side), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Side, 100, 100, 100, 100.00 )
set str = "Move (um)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_U_Move), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Move, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Give", GetUnitLoc(GUI_U_Give), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Give, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Size", GetUnitLoc(GUI_U_Size), 0, 15.00, 30, 30, 30, 0 )
call SetUnitVertexColorBJ( GUI_U_Size, 100, 100, 100, 100.00 )
set str = "Revive (uv)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_U_Revive), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_U_Revive, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Tint", GetUnitLoc(GUI_U_Tint), 0, 15.00, 30, 30, 30, 0 )
call SetUnitVertexColorBJ( GUI_U_Tint, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Invulnerable", GetUnitLoc(GUI_U_Invincible), 0, 15.00, 30, 30, 30, 0 )
call SetUnitVertexColorBJ( GUI_U_Invincible, 100, 100, 100, 100.00 )
call SetUnitAnimation(GUI_U_Tint_Invis, GUI_Tag_Tile)
call SetUnitAnimation(GUI_U_Tint_White, GUI_Tag_Tile)
call SetUnitAnimation(GUI_U_Tint_Yellow, GUI_Tag_Tile)
call SetUnitAnimation(GUI_U_Tint_Green, GUI_Tag_Tile)
call SetUnitAnimation(GUI_U_Tint_Red, GUI_Tag_Tile)
call SetUnitAnimation(GUI_U_Tint_Blue, GUI_Tag_Tile)
call SetUnitVertexColorBJ( GUI_U_Tint_Invis, 100,100,100,70 )
call SetUnitVertexColorBJ( GUI_U_Tint_Yellow, 100,100,0,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Green, 0,100,0,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Red, 100,0,0,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Blue, 0,0,100,0 )
call SetUnitScalePercent( GUI_U_Tint_Invis, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( GUI_U_Tint_White, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( GUI_U_Tint_Yellow, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( GUI_U_Tint_Green, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( GUI_U_Tint_Red, 50.00, 50.00, 50.00 )
call SetUnitScalePercent( GUI_U_Tint_Blue, 50.00, 50.00, 50.00 )
call SetUnitVertexColorBJ( GUI_U_Tint_Invis, 30,30,30,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_White, 30,30,30,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Yellow, 30,30,30,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Green, 30,30,30,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Red, 30,30,30,0 )
call SetUnitVertexColorBJ( GUI_U_Tint_Blue, 30,30,30,0 )
call RemoveUnit(GUI_U_Tint_Invis)
call RemoveUnit(GUI_U_Tint_White)
call RemoveUnit(GUI_U_Tint_Yellow)
call RemoveUnit(GUI_U_Tint_Green)
call RemoveUnit(GUI_U_Tint_Red)
call RemoveUnit(GUI_U_Tint_Blue)
set str = "Items"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_Items), 0, 17.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_Items, 100, 100, 100, 100.00 )
set str = "Create (ic)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_I_Create), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_I_Create, 100, 100, 100, 100.00 )
set str = "Remove (ir)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_I_Remove), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_I_Remove, 100, 100, 100, 100.00 )
// call CreateTextTagLocBJ( "Move", GetUnitLoc(GUI_I_Move), 0, 15.00, 30, 30, 30, 0 )
call SetUnitVertexColorBJ( GUI_I_Move, 100, 100, 100, 100.00 )
call SetUnitAnimation( GUI_I_P_GoldPile, GUI_Tag_Tile)
call SetUnitAnimation( GUI_I_P_GoldCoin, GUI_Tag_Tile)
call SetUnitAnimation( GUI_I_P_PileOfRiches, GUI_Tag_Tile)
call SetUnitVertexColorBJ( GUI_I_P_GoldPile, 100,100,100,100 )
call SetUnitVertexColorBJ( GUI_I_P_GoldCoin, 100,100,100,100 )
call SetUnitVertexColorBJ( GUI_I_P_PileOfRiches, 100,100,100,100 )
call SetUnitScalePercent( GUI_I_P_GoldPile, 200, 200, 200 )
call SetUnitScalePercent( GUI_I_P_GoldCoin, 200, 200, 200 )
call SetUnitScalePercent( GUI_I_P_PileOfRiches, 200, 200, 200 )
set i = 1
loop
exitwhen i > 40
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetRectCenter(gg_rct_PileOfRiches), GetRandomReal(5,100), GetRandomReal(0,360)), "Objects\\InventoryItems\\PotofGold\\PotofGold.mdl" )
set i = i + 1
endloop
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetRectCenter(gg_rct_PileOfRiches), GetRandomReal(5,100), GetRandomReal(0,360)), "Objects\\InventoryItems\\tomeGreen\\tomeGreen.mdl" )
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetRectCenter(gg_rct_PileOfRiches), GetRandomReal(5,100), GetRandomReal(0,360)), "Objects\\InventoryItems\\tomeRed\\tomeRed.mdl" )
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetRectCenter(gg_rct_PileOfRiches), GetRandomReal(5,100), GetRandomReal(0,360)), "Objects\\InventoryItems\\tomeBlue\\tomeBlue.mdl" )
set i = 1
loop
exitwhen i > 40
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetRectCenter(gg_rct_GoldPile), GetRandomReal(5,100), GetRandomReal(0,360)), "Objects\\InventoryItems\\PotofGold\\PotofGold.mdl" )
set i = i + 1
endloop
call AddSpecialEffectLocBJ( GetRectCenter(gg_rct_GoldCoin), "Objects\\InventoryItems\\PotofGold\\PotofGold.mdl" )
//Doodads
set str = "Doodads"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_Doodads), 0, 17.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_Doodads, 100, 100, 100, 100.00 )
set str = "Create (dc)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_D_Create), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_D_Create, 100, 100, 100, 100.00 )
set str = "Remove (dr)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_D_Remove), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_D_Remove, 100, 100, 100, 100.00 )
set str = "Kill (dk)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_D_Kill), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_D_Kill, 100, 100, 100, 100.00 )
set str = "Revive (dv)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_D_Revive), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_D_Revive, 100, 100, 100, 100.00 )
set str = "Toggle (dt)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_D_Toggle), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_D_Toggle, 100, 100, 100, 100.00 )
set str = "LoS Blocker (bs)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_T_LoSBlocker), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_T_LoSBlocker, 100, 100, 100, 100.00 )
set str = "Path Blocker (bp)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_T_PathBlocker), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_T_PathBlocker, 100, 100, 100, 100.00 )
call SetUnitAnimation( GUI_D_P_Grove, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_Junk, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_Crates, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_Rocks, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_Tree, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_Blight, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_Dispel, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_Door, GUI_Tag_Tile)
call SetUnitAnimation( GUI_D_P_DoubleDoor, GUI_Tag_Tile)
call SetUnitVertexColor( GUI_D_P_Grove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Junk, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Crates, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_FenceLine, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_EvilFence, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_NorthrendWall, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_RuinsWall, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_DungeonWall, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_CastleWall, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_InteriorWall, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_MineWall, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_CastleGate, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Door, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_DoubleDoor, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Log, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Table, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Chair, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Tree, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Blight, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Dispel, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_IceyClaw, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Flower, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Mushroom1, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Mushroom2, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Mushroom3, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks1, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks2, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks3, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks4, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks5, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks6, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks7, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks8, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks9, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Rocks10, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Log, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_IceyRock, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Citadel, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_CTower, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Archway, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Mat, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Bed, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Trough, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Grave, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Light, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_Lamp, 255,255,255,0 )
//Tree Pallette
call SetUnitVertexColor( GUI_D_P_NorthrendGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_AshenvaleGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_FallGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_UndergroundGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_DungeonGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_OutlandGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_RuinsGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_BarrensGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_FelwoodGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_SnowyGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_WinterGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_SummerGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_BrownGrove, 255,255,255,0 )
call SetUnitVertexColor( GUI_D_P_CityGrove, 255,255,255,0 )
call SetUnitScalePercent( GUI_D_P_Grove, 400, 400, 400 )
call SetUnitScalePercent( GUI_D_P_Tree, 200, 200, 200 )
call SetUnitScalePercent( GUI_D_P_Blight, 300, 300, 300 )
call SetUnitScalePercent( GUI_D_P_Dispel, 200, 200, 200 )
call AddSpecialEffectLocBJ( GetRectCenter(gg_rct_BlightDispel), "Abilities\\Spells\\NightElf\\TargetArtLumber\\TargetArtLumber.mdl" )
call SetUnitOwner( GUI_D_P_Line1, Player(14), true )
call SetUnitOwner( GUI_D_P_Line2, Player(14), true )
call SetUnitOwner( GUI_D_P_FenceLine, Player(14), true )
//Misc
set str = "Misc"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_Misc), 0, 17.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_Misc, 100, 100, 100, 100.00 )
set str = "Waygate (mw)"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_M_Portal), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_M_Portal, 100, 100, 100, 100.00 )
call SetUnitVertexColorBJ( GUI_M_Cinematic, 100, 100, 100, 100.00 )
set str = "Boot"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_M_Boot), 0, 15.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_M_Boot, 100, 100, 100, 100.00 )
//Toolbox
set str = "Toolbox"
call CreateTextTagLocBJ( str, GetUnitLoc(GUI_Toolbox), 0, 17.00, 100, 100, 100, 0 )
call SetUnitVertexColorBJ( GUI_Toolbox, 100, 100, 100, 100.00 )
call SetUnitAnimation(GUI_T_Tile_Enemy, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Blue, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Teal, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Purple, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Yellow, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Orange, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Green, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Pink, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Brown, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Red, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Ally, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Gray, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_Cyan, GUI_Tag_Tile)
call SetUnitAnimation(GUI_T_Tile_DarkGreen, GUI_Tag_Tile)
call SetUnitVertexColorBJ( GUI_T_Tile_Red, 100,0,0,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Blue, 0,0,100,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Teal, 0,100,80,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Purple, 25,0,50,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Yellow, 100,100,0,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Orange, 100,50,0,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Green, 0,100,0,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Pink, 100,30,70,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Brown, 25,15,0,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Gray, 50,50,50,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Cyan, 50,75,100,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_DarkGreen, 5,38,25,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Ally, 100,100,80,0 )
call SetUnitVertexColorBJ( GUI_T_Tile_Enemy, 0,0,0,0 )
set udg_GUI_Tile[1] = GUI_T_Tile_Red
set udg_GUI_Tile[2] = GUI_T_Tile_Blue
set udg_GUI_Tile[3] = GUI_T_Tile_Teal
set udg_GUI_Tile[4] = GUI_T_Tile_Purple
set udg_GUI_Tile[5] = GUI_T_Tile_Yellow
set udg_GUI_Tile[6] = GUI_T_Tile_Orange
set udg_GUI_Tile[7] = GUI_T_Tile_Green
set udg_GUI_Tile[8] = GUI_T_Tile_Pink
set udg_GUI_Tile[12] = GUI_T_Tile_Brown
set udg_GUI_Tile[9] = GUI_T_Tile_Gray
set udg_GUI_Tile[10] = GUI_T_Tile_Cyan
set udg_GUI_Tile[11] = GUI_T_Tile_DarkGreen
set udg_GUI_Tile[13] = GUI_T_Tile_Enemy
set udg_GUI_Tile[15] = GUI_T_Tile_Ally
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Red )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Blue )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Teal )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Purple )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Yellow )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Orange )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Green )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Pink )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Brown )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Gray )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Cyan )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_DarkGreen )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Enemy )
call GroupAddUnit( udg_GUI_Tile_Group, GUI_T_Tile_Ally )
endfunction
function Init_Create takes nothing returns nothing
call TriggerSleepAction(0)
call DoGUIAnims()
endfunction
function InitTrig_Create takes nothing returns nothing
set gg_trg_Create = CreateTrigger()
call TriggerAddAction(gg_trg_Create, function Init_Create)
endfunction
//TESH.scrollpos=321
//TESH.alwaysfold=0
globals
trigger array TRIGGER_Units_Click
endglobals
function PaletteRemoveUnit takes nothing returns boolean
call RemoveUnit(GetFilterUnit())
return false
endfunction
function HoldPosEnumUnit takes nothing returns nothing
call IssueImmediateOrder( GetEnumUnit(), "holdposition" )
call UnitAddType( GetEnumUnit(), UNIT_TYPE_GIANT )
call PauseUnit( GetEnumUnit(), true )
endfunction
function onGUIUnitsClick takes nothing returns nothing
local integer i = 0
local integer i2 = 0
local integer id = 0
local player pl
local force fp
local string typename = ""
local real x
local real xc
local real y
local real yc
local real w
local real h
local real t = 8 * 64 / 2 //town hall size half pathing
local real b = 6 * 64 / 2 //big size half pathing
local real f = 4 * 64 / 2 //four size half pathing
local real m = 3 * 64 / 2 //medium size half pathing
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if (GetTriggerUnit() == GUI_U_Create) then
//creating units
call CameraSetupApplyForPlayer( true, gg_cam_Palette, pl, 0 )
call PanCameraToTimedLocForPlayer( GetTriggerPlayer(), GetRectCenter(gg_rct_Unit_Palette), 0 )
set udg_Status[id] = "unit_create"
set udg_DM_UnitType[id] = 0
set udg_DM_Player[id] = Player(12)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFCreating Units...|r" )
call DisplayTextToForce( fp, " Click the type of unit you would like to create." )
elseif (GetTriggerUnit() == GUI_U_Kill) then
//killing units
set udg_Status[id] = "unit_kill"
call GUIApplyCamForDM(pl)
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFKilling Units|r" )
call DisplayTextToForce( fp, " Left click, box-select, or group-recall units to kill them." )
call DisplayTextToForce( fp, " |cFFFF0000Be careful; you can also kill heroes!|r" )
call DisplayTextToForce( fp, " Right click to kill all NPC units in a small area (and detonate explosives)." )
call DisplayTextToForce( fp, " Issue a move order (|c00FFFF00M|r) to your pointer to also kill players." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_U_Remove) then
//removing units
set udg_Status[id] = "unit_remove"
call GUIApplyCamForDM(pl)
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFRemoving Units|r" )
call DisplayTextToForce( fp, " Left click, box-select, or group-recall NPC units to remove them." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_U_Side) then
//side-switching units
set udg_Status[id] = "unit_side"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFSide-Switching Units|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Left click, box-select, or group-recall NPC units to toggle their allegiance." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_U_Move) then
//moving units
set udg_Status[id] = "unit_move"
call GUIApplyCamForDM(pl)
set udg_DM_Destination[id] = Location(0, 0)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFMoving Units...|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to set the destination point." )
elseif (GetTriggerUnit() == GUI_U_Revive) then
//reviving player heros (NOW DISABLED)
set udg_Status[id] = "unit_revive"
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFReviving Heros|r" )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "|c0000FF00You are now in Revival mode.|r" )
call DisplayTextToForce( fp, " Click a coloured tile in the Toolbox to revive that player's hero.")
elseif RectContainsUnit(gg_rct_Unit_Palette, GetTriggerUnit()) then
set x = GetRectMinX(CreateRect[id-1])
set y = GetRectMinY(CreateRect[id-1])
set w = GetRectWidthBJ(CreateRect[id-1])
set h = GetRectHeightBJ(CreateRect[id-1])
if (id == 1) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM1_Zone, function PaletteRemoveUnit )
elseif (id == 2) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM2_Zone, function PaletteRemoveUnit )
elseif (id == 3) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM3_Zone, function PaletteRemoveUnit )
elseif (id == 4) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM4_Zone, function PaletteRemoveUnit )
elseif (id == 5) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM5_Zone, function PaletteRemoveUnit )
elseif (id == 6) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM6_Zone, function PaletteRemoveUnit )
elseif (id == 7) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM7_Zone, function PaletteRemoveUnit )
elseif (id == 8) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM8_Zone, function PaletteRemoveUnit )
elseif (id == 9) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM9_Zone, function PaletteRemoveUnit )
elseif (id == 10) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM10_Zone, function PaletteRemoveUnit )
elseif (id == 11) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM11_Zone, function PaletteRemoveUnit )
elseif (id == 12) then
call GroupEnumUnitsInRect( ENUM_GROUP, gg_rct_Unit_DM12_Zone, function PaletteRemoveUnit )
endif
set xc = x+w/2
set yc = y+h/2
if (GetUnitTypeId(GetTriggerUnit()) == 'e00Q' ) then //Tower
set typename = "Human Building"
call CreateNUnitsAtLoc( 1, 'hwtw', Player(15), Location(xc-384, yc+4*64/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hgtw', Player(15), Location(xc-256, yc+4*64/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hctw', Player(15), Location(xc-128, yc+4*64/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hatw', Player(15), Location(xc, yc+4*64/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hlum', Player(15), Location(xc-288, yc-64), 270.00 )
call CreateNUnitsAtLoc( 1, 'hbla', Player(15), Location(xc, yc-96), 270.00 )
call CreateNUnitsAtLoc( 1, 'halt', Player(15), Location(xc+288, yc+5*64/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hhou', Player(15), Location(xc+256, yc-96-64), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00P' ) then //Town Hall
set typename = "Human Building"
call CreateNUnitsAtLoc( 1, 'htow', Player(15), Location(xc-t, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'hbar', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00R' ) then //Arcane Sanctum
set typename = "Human Building"
call CreateNUnitsAtLoc( 1, 'hars', Player(15), Location(xc-b-f, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'hgra', Player(15), Location(xc, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'harm', Player(15), Location(xc+b+f, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00S' ) then //Campaign
set typename = "Human Building"
call CreateNUnitsAtLoc( 1, 'nheb', Player(15), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmr8', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00T' ) then //
set typename = "Night Elf Building"
call CreateNUnitsAtLoc( 1, 'etol', Player(15), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'eaom', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00U' ) then //
set typename = "Night Elf Building"
call CreateNUnitsAtLoc( 1, 'nctl', Player(15), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncaw', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00W' ) then //
set typename = "Night Elf Building"
call CreateNUnitsAtLoc( 1, 'eaoe', Player(15), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'eaow', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00X' ) then //
set typename = "Night Elf Building"
call CreateNUnitsAtLoc( 1, 'edob', Player(15), Location(xc-f-f, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbwd', Player(15), Location(xc, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'edos', Player(15), Location(xc+f+f, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00V' ) then //
set typename = "Night Elf Building"
call CreateNUnitsAtLoc( 1, 'emow', Player(15), Location(xc-m*3, yc-m), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncmw', Player(15), Location(xc-m*3, yc+m), 270.00 )
call CreateNUnitsAtLoc( 1, 'etrp', Player(15), Location(xc-m, yc-m), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncap', Player(15), Location(xc-m, yc+m), 270.00 )
call CreateNUnitsAtLoc( 1, 'eate', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e011' ) then //
set typename = "Undead Building"
call CreateNUnitsAtLoc( 1, 'unpl', Player(15), Location(xc-t, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'usep', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e012' ) then //
set typename = "Undead Building"
call CreateNUnitsAtLoc( 1, 'ugrv', Player(15), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'uslh', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e013' ) then //
set typename = "Undead Building"
call CreateNUnitsAtLoc( 1, 'utod', Player(15), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'usap', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e014' ) then //
set typename = "Undead Building"
call CreateNUnitsAtLoc( 1, 'ubon', Player(15), Location(xc-5*64, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndmg', Player(15), Location(xc+3*64, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e015' ) then //
set typename = "Undead Building"
call CreateNUnitsAtLoc( 1, 'uzig', Player(15), Location(xc-m*3-64, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'uzg1', Player(15), Location(xc-m-64, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'uzg2', Player(15), Location(xc+m-64, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'uaod', Player(15), Location(xc+m*2+b-64, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00Y' ) then //
set typename = "Orc Building"
call CreateNUnitsAtLoc( 1, 'ogre', Player(15), Location(xc-t, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'obea', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00Z' ) then //
set typename = "Orc Building"
call CreateNUnitsAtLoc( 1, 'osld', Player(15), Location(xc-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'otto', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e010' ) then //
set typename = "Orc Building"
call CreateNUnitsAtLoc( 1, 'ofor', Player(15), Location(xc-m, yc+m), 270.00 )
call CreateNUnitsAtLoc( 1, 'otrb', Player(15), Location(xc-3*m, yc+m), 270.00 )
call CreateNUnitsAtLoc( 1, 'owtw', Player(15), Location(xc-128, yc-64), 270.00 )
call CreateNUnitsAtLoc( 1, 'npgf', Player(15), Location(xc-3*m, yc-m), 270.00 )
call CreateNUnitsAtLoc( 1, 'oalt', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e016' ) then //
set typename = "Naga Building"
call CreateNUnitsAtLoc( 1, 'nntt', Player(15), Location(xc-t, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnsg', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e017' ) then //
set typename = "Naga Building"
call CreateNUnitsAtLoc( 1, 'nnsa', Player(15), Location(64+xc-160-b, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnad', Player(15), Location(64+xc, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nntg', Player(15), Location(64+xc+160+96, yc+96), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnfm', Player(15), Location(64+xc+160+m, yc-128), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nvil' ) then //Villagers
set typename = "Villager"
call CreateNUnitsAtLoc( 1, 'nvil', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvl2', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvlw', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhef', Player(15), Location(x+w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvlk', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvk2', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'h002', Player(15), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'h003', Player(15), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'h004', Player(15), Location(x+w, y+h/2), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'hfoo' ) then //Humans
set typename = "Human"
call CreateNUnitsAtLoc( 1, 'nhem', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'hhes', Player(15), Location(x+w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'hsor', Player(15), Location(x+2*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nemi', Player(15), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'hmil', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hmpr', Player(15), Location(x+w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hrif', Player(15), Location(x+2*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhea', Player(15), Location(x+3*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hpea', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hfoo', Player(15), Location(x+w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hmtm', Player(15), Location(x+2*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hspt', Player(15), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hhdl', Player(15), Location(x+4*w/5, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'hkni', Player(15), Location(x+4*w/5, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'hmtt', Player(15), Location(x+w, y+h/2), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ogru' ) then //Orcs
set typename = "Orc"
call CreateNUnitsAtLoc( 1, 'opeo', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ogru', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'orai', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ocat', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'okod', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'oshm', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nw2w', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'owar', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'otau', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ospw', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'earc' ) then //Night Elf
set typename = "Night Elf"
call CreateNUnitsAtLoc( 1, 'ewsp', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'edoc', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'esen', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'emtg', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ebal', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'edot', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'earc', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwat', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nssn', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'edry', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ugho' ) then //Undead
set typename = "Undead"
call CreateNUnitsAtLoc( 1, 'uaco', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ugho', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ucry', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'uabo', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'umtw', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ucs3', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'unec', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'uske', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'uskm', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nzom', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'n002' ) then //TownStores
set typename = "Store"
call CreateNUnitsAtLoc( 1, 'n002', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'n003', Player(15), Location(x+w/2, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'n001', Player(15), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00B', Player(15), Location(x+w/2, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Hpal' ) then //Human Heroes
set typename = "Human Hero"
call CreateNUnitsAtLoc( 1, 'Hamg', Player(15), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hpal', Player(15), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hblm', Player(15), Location(x+w/5, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hmkg', Player(15), Location(x+w/5, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hart', Player(15), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Harf', Player(15), Location(x+3*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hapm', Player(15), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Huth', Player(15), Location(x+4*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hvwd', Player(15), Location(x+4*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hjai', Player(15), Location(x+4*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hlgr', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hant', Player(15), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hgam', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Obla' ) then //Orc Heroes
set typename = "Orc Hero"
call CreateNUnitsAtLoc( 1, 'Ofar', Player(15), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Obla', Player(15), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Otch', Player(15), Location(x+w/5, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Oshd', Player(15), Location(x+w/5, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Orex', Player(15), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ogld', Player(15), Location(x+3*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nbbc', Player(15), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Othr', Player(15), Location(x+4*w/5, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Orkn', Player(15), Location(x+4*w/5, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Opgh', Player(15), Location(x+w, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ogrh', Player(15), Location(x+w, y+h/3), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Udre' ) then //Undead Heroes
set typename = "Undead Hero"
call CreateNUnitsAtLoc( 1, 'Udea', Player(15), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ulic', Player(15), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ucrl', Player(15), Location(x+w/4, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Udre', Player(15), Location(x+w/4, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Uear', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nklj', Player(15), Location(x+2*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Usyl', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nman', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ubal', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Npld', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Uwar', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Edem' ) then //Night Elf Heroes
set typename = "Night Elf Hero"
call CreateNUnitsAtLoc( 1, 'Ekee', Player(15), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Edem', Player(15), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Emoo', Player(15), Location(x+w/5, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ewar', Player(15), Location(x+w/5, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Emfr', Player(15), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Emns', Player(15), Location(x+3*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'Efur', Player(15), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ecen', Player(15), Location(x+4*w/5, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ekgg', Player(15), Location(x+4*w/5, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Eevi', Player(15), Location(x+w, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'Eill', Player(15), Location(x+w, y+h/3), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Ntin' ) then //Neutral Heroes
set typename = "Neutral Hero"
call CreateNUnitsAtLoc( 1, 'Nalc', Player(15), Location(x, y+h), 270.00 )
call CreateUnit(Player(15), 'TaLe', x+1*w/4, y+h, 270.00 )
call CreateNUnitsAtLoc( 1, 'Nngs', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nplh', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nbst', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nfir', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Nbrn', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Npbm', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ntin', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'H005' ) then //
set typename = "Human/NightElf Custom Hero"
call CreateNUnitsAtLoc( 1, 'H007', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ECle', Player(15), Location(x+1*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'HSwo', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'H005', Player(15), Location(x+1*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'H00S', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'H009', Player(15), Location(x+1*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'E005', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'E004', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'E006', Player(15), Location(x+3*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'H00A', Player(15), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'E003', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'E001', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'U003' ) then //
set typename = "Orc/Undead Custom Hero"
call CreateNUnitsAtLoc( 1, 'O001', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'O004', Player(15), Location(x+1*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'O000', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'O006', Player(15), Location(x+1*w/4, y+h/2), 270.00 )
call CreateUnit(Player(15), 'TaLe', x, y, 270.00 )
call CreateNUnitsAtLoc( 1, 'O003', Player(15), Location(x+1*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'U002', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'U000', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'N004', Player(15), Location(x+3*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'N005', Player(15), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'U001', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'U003', Player(15), Location(x+w, y), 270.00 )
// elseif (GetUnitTypeId(GetTriggerUnit()) == '' ) then //
// set typename = ""
// call CreateNUnitsAtLoc( 1, '', Player(15), Location(xc-b, yc), 270.00 )
// call CreateNUnitsAtLoc( 1, '', Player(15), Location(xc+b, yc), 270.00 )
// elseif (GetUnitTypeId(GetTriggerUnit()) == '' ) then //
// set typename = ""
// call CreateNUnitsAtLoc( 1, '', Player(15), Location(xc-b, yc), 270.00 )
// call CreateNUnitsAtLoc( 1, '', Player(15), Location(xc+b, yc), 270.00 )
//********************************************************
//********************************************************
// SMW & Titanhex ADDITIONS
//********************************************************
//********************************************************
elseif (GetUnitTypeId(GetTriggerUnit()) == 'n00U' ) then //Ground Critters
set typename = "Critters"
call CreateNUnitsAtLoc( 1, 'nech', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncrb', Player(15), Location(x+w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndog', Player(15), Location(x+2*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndwm', Player(15), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfbr', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nskk', Player(15), Location(x+w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhmc', Player(15), Location(x+2*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'npng', Player(15), Location(x+3*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'npig', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'necr', Player(15), Location(x+w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrac', Player(15), Location(x+2*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrat', Player(15), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsea', Player(15), Location(x+4*w/5, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nshe', Player(15), Location(x+4*w/5, y+3*h/4), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'n00V' ) then //Flying Critters
set typename = "Flying Critters"
call CreateNUnitsAtLoc( 1, 'nalb', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsno', Player(15), Location(x+w/2, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvul', Player(15), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nshf', Player(15), Location(x+w/2, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ngsp' ) then //Goblins
set typename = "Goblins"
call CreateNUnitsAtLoc( 1, 'ngsp', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nzep', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngir', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngbl', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncgb', Player(15), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfac', Player(15), Location(x+3*w/4, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nele' ) then //Sea Creeps
set typename = "Sea Creeps"
call CreateNUnitsAtLoc( 1, 'nlpr', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nlpd', Player(15), Location(x+w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nltc', Player(15), Location(x+2*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nlds', Player(15), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nlsn', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nlkl', Player(15), Location(x+w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nscb', Player(15), Location(x+2*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsc2', Player(15), Location(x+3*w/5, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsc3', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrel', Player(15), Location(x+w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nele', Player(15), Location(x+2*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsel', Player(15), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nelb', Player(15), Location(x+4*w/5, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgn', Player(15), Location(x+4*w/5, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgh', Player(15), Location(x+w, y+h/2), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nbdm' ) then //More Dragons
set typename = "More Dragons"
call CreateNUnitsAtLoc( 1, 'nbdm', Player(15), Location(x, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbda', Player(15), Location(x, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbdw', Player(15), Location(x+w/3, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbds', Player(15), Location(x+w/3, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbdo', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n00Q', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'n00R', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nbds' ) then //Titanhex Additions
set typename = "Titanhex Additions"
call CreateNUnitsAtLoc( 1, 'sead', Player(15), Location(x, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nar2', Player(15), Location(x, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nar3', Player(15), Location(x+w/3, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbds', Player(15), Location(x+w/3, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'yfae', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'u00H', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'imp1', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'n00W' ) then //Draenei
set typename = "Draenei"
call CreateNUnitsAtLoc( 1, 'ndrf', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrm', Player(15), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrp', Player(15), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrw', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrl', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrt', Player(15), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'n00W', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrn', Player(15), Location(x+2*w/4, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrh', Player(15), Location(x+2*w/4, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrd', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrs', Player(15), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'Naka', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncat', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'eilw', Player(15), Location(x+w, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ncpn' ) then //More Orc
set typename = "More Orc"
call CreateNUnitsAtLoc( 1, 'ncpn', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nchg', Player(15), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nchr', Player(15), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nchw', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'odkt', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nckb', Player(15), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'oosc', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'oswy', Player(15), Location(x+2*w/4, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'ownr', Player(15), Location(x+2*w/4, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'osw1', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'osw2', Player(15), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'osw3', Player(15), Location(x+3*w/4, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'hrdh' ) then //Other Stuff
set typename = "Other Stuff"
call CreateNUnitsAtLoc( 1, 'nbee', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbel', Player(15), Location(x+1*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hdhw', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'hrdh', Player(15), Location(x+1*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'zzrg', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'zhyd', Player(15), Location(x+1*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'zmar', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'zcso', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hbew', Player(15), Location(x+3*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'ninc', Player(15), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'ninm', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nina', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nenc' ) then //Corrupted Creeps
set typename = "Corrupted Creeps"
call CreateNUnitsAtLoc( 1, 'nhfp', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhdc', Player(15), Location(x+1*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhhr', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nenc', Player(15), Location(x+1*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nenp', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nepl', Player(15), Location(x+1*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvdl', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngh1', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngh2', Player(15), Location(x+3*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvdw', Player(15), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvdg', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nvde', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nwlt' ) then //More Creeps
set typename = "More Creeps"
call CreateNUnitsAtLoc( 1, 'nwlt', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwlg', Player(15), Location(x+1*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwld', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nanm', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nanc', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nanw', Player(15), Location(x+3*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nane', Player(15), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nano', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nsty' ) then //Satyr and Wildkin
set typename = "Satyrs and Wildkins"
call CreateNUnitsAtLoc( 1, 'nsty', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsat', Player(15), Location(x+1*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsts', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nstl', Player(15), Location(x+1*w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsth', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nowb', Player(15), Location(x+w, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nowe', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nowk', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ngnh' ) then //Creep's Huts
set typename = "Creep's Huts"
call CreateNUnitsAtLoc( 1, 'ndch', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndh0', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndh1', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nct2', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nct1', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncnt', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngnh', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngt2', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nmh0' ) then //More Creep's Huts
set typename = "More Creep's Huts"
call CreateNUnitsAtLoc( 1, 'nth0', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nth1', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfh1', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfh0', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfr2', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfr1', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmh0', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmh1', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e009' ) then //Campaign Buildings
set typename = "Campaign Buildings"
call CreateNUnitsAtLoc( 1, 'nmgv', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrt', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwc1', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwc2', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitb', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nico', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnzg', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfgo', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00A' ) then //More Campaign Buildings
set typename = "More Campaign Buildings"
call CreateNUnitsAtLoc( 1, 'nshr', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrm', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbse', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbsm', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbsw', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngob', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'npgr', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhcn', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nten' ) then //Villager Buildings
set typename = "Villager Buildings"
call CreateNUnitsAtLoc( 1, 'ntt2', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntnt', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nten', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntn2', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nef7', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nefm', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfv4', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfv2', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e008' ) then //Red and Black Dragon Roost
set typename = "Dragon Roosts"
call CreateNUnitsAtLoc( 1, 'ndrk', Player(15), Location(xc-t, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrr', Player(15), Location(xc+b, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00B' ) then //Bronze, Blue, Green Dragon Roost
set typename = "More Dragon Roosts"
call CreateNUnitsAtLoc( 1, 'ndru', Player(15), Location(xc-b-f, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrz', Player(15), Location(xc, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrg', Player(15), Location(xc+b+f, yc), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00C' ) then //Doodads
set typename = "Doodads"
call CreateNUnitsAtLoc( 1, 'n00X', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n00Y', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n010', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n00Z', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n012', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n011', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n013', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n014', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00D' ) then //Statues
set typename = "Statues"
call CreateNUnitsAtLoc( 1, 'n015', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n016', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n017', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n018', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01A', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n019', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01C', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01B', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nmyr' ) then //Nagas
set typename = "Nagas"
call CreateNUnitsAtLoc( 1, 'nnmg', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnsu', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnrg', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhyc', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwgs', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmpe', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnsw', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmyr', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsnp', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Hvsh', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'Ange' ) then //Custom Heroes
set typename = "Custom Heroes"
call CreateNUnitsAtLoc( 1, 'H00D', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'U005', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'H00E', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'O007', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'N00T', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'H00G', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Ange', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'U004', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'HRo1' ) then //More Custom Heroes
set typename = "More Custom Heroes"
call CreateNUnitsAtLoc( 1, 'HRo1', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'H00E', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'DKni', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'VooH', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'N00T', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'URog', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'Faer', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'FQue', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e007' ) then //More Custom Things
set typename = "Custom Heroes"
call CreateNUnitsAtLoc( 1, 'h00F', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00H', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'N01G', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'N01E', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'N01F', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'shdr', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfgt', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00F' ) then //Summonable Things
set typename = "Summonable Things"
call CreateNUnitsAtLoc( 1, 'nlv2', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nlv3', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwe2', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwe3', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nlv1', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwe1', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00H' ) then //Summonable Things #2
set typename = "More Summonable Things"
call CreateNUnitsAtLoc( 1, 'ngz2', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngz3', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'npn6', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'npn4', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'npn5', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmsh', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngz1', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'npn3', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'npn1', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'npn2', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00I' ) then //Summonable Things #3
set typename = "Even More Summonable Things"
call CreateNUnitsAtLoc( 1, 'nqb3', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nqb4', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nowl', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00I', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntor', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nqb1', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nqb2', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'hwat', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'hwt2', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'hwt3', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00J' ) then //Summonable Things #4
set typename = "Some More Summonable Things"
call CreateNUnitsAtLoc( 1, 'espv', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hphx', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndr1', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndr2', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndr3', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'even', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'efon', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ucs1', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ucs2', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ucs3', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'hpxe' ) then //Misc Units
set typename = "Misc Units"
call CreateNUnitsAtLoc( 1, 'hoph', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'fidr', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'shdr', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'eleM', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'fley', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nar2', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nar3', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'shbu', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'shso', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'floc', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'now4' ) then //Misc Summons
set typename = "Misc Summons"
call CreateNUnitsAtLoc( 1, 'now4', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n02D', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'mooE', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'crow', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateUnit(Player(15), 'boch', x+w, y+h, 270)
call CreateNUnitsAtLoc( 1, 'answ', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'wrai', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'o009' ) then //Gems
set typename = "Gems"
call CreateNUnitsAtLoc( 1, 'o009', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00J', Player(15), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00K', Player(15), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00E', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00A', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00I', Player(15), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00F', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00H', Player(15), Location(x+2*w/4, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00G', Player(15), Location(x+2*w/4, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00L', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00M', Player(15), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00N', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00B', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00K' ) then //Wards
set typename = "Wards"
call CreateNUnitsAtLoc( 1, 'otot', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'osp3', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'osp4', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01I', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01H', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'o005', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'osp1', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'osp2', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'oeye', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00B', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00K' ) then //More Wards
set typename = "Wards"
call CreateNUnitsAtLoc( 1, 'otot', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'osp3', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'osp4', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01I', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01H', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'o005', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'osp1', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'osp2', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'oeye', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'o00B', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'hwa5' ) then //Extra Wards
set typename = "Titanhex Addition Wards"
call CreateNUnitsAtLoc( 1, 'hwa1', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hwa2', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hwa3', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hwa4', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hwa5', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'tcre', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'flow', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'vftr', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'PWrd', Player(15), Location(x+3*w/4, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00L' ) then //More Doodads
set typename = "More Doodads"
call CreateNUnitsAtLoc( 1, 'n01K', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01J', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01L', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01M', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01P', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01Q', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01N', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01O', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00M' ) then //More Statues
set typename = "Statues & Portal"
call CreateUnit( Player(15), 'n01R', x, y+h, 270.00 )
call CreateUnit( Player(15), 'n01V', x, y, 270.00 )
call CreateUnit( Player(15), 'n01W', x+w/3, y, 270.00 )
call CreateUnit( Player(15), 'n01X', x+2*w/3, y+h, 270.00 )
call CreateUnit( Player(15), 'n01T', x+w, y+h, 270.00 )
call CreateUnit( Player(15), 'hprt', x+w, y, 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00N' ) then //Doodads Etc...
set typename = "Doodads Etc..."
call CreateNUnitsAtLoc( 1, 'n01Y', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n025', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n029', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01S', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n028', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01U', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'e00O' ) then //Death Doodads
set typename = "Death Doodads"
call CreateNUnitsAtLoc( 1, 'n01Z', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n026', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n027', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n020', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n021', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n022', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n023', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n024', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'n02A' ) then //Even More Doodads
set typename = "Titanhex Addition Doodads"
call CreateNUnitsAtLoc( 1, 'n02A', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'n02B', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ccry', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateUnit( Player(15), 'n006', x+3*w/4, y+h, 270.00 )
call CreateUnit( Player(15), 'n00I', x+w, y+h, 270.00 )
call CreateNUnitsAtLoc( 1, 'n02C', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n02E', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'rock', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n02F', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'n01M', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'n02M' ) then //Runes
set typename = "Runes"
call CreateUnit( Player(15), 'n02M', x, y+h, 270.00 )
call CreateUnit( Player(15), 'n02N', x, y, 270.00 )
call CreateUnit( Player(15), 'n02L', x+w/3, y+h, 270.00 )
call CreateUnit( Player(15), 'n03H', x+w/3, y, 270.00 )
call CreateUnit( Player(15), 'n02P', x+2*w/3, y+h, 270.00 )
call CreateUnit( Player(15), 'n02K', x+2*w/3, y, 270.00 )
call CreateUnit( Player(15), 'n02Q', x+w, y+h, 270.00 )
call CreateUnit( Player(15), 'n02O', x+w, y, 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'n03D' ) then //LOL
set typename = "Orlandeau Added"
call CreateUnit( Player(15), 'n039', x, y+h, 270.00 )
call CreateUnit( Player(15), 'n02R', x, y, 270.00 )
call CreateUnit( Player(15), 'n03A', x+w/3, y+h, 270.00 )
call CreateUnit( Player(15), 'n03G', x+w/3, y, 270.00 )
call CreateUnit( Player(15), 'n03C', x+2*w/3, y+h, 270.00 )
call CreateUnit( Player(15), 'n03D', x+2*w/3, y, 270.00 )
call CreateUnit( Player(15), 'n03E', x+w, y+h, 270.00 )
call CreateUnit( Player(15), 'n03F', x+w, y, 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nmsh' ) then //Frost Wolfs, Bears, and little things
set typename = "Wild Life"
call CreateNUnitsAtLoc( 1, 'nwwd', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntws', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwwg', Player(15), Location(x, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsns', Player(15), Location(x+w/4, y+h/2), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwwf', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncfs', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngza', Player(15), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngz4', Player(15), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nlps', Player(15), Location(x+w, y+h/2), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nhar' ) then //Harpy
set typename = "Harpy"
call CreateNUnitsAtLoc( 1, 'nhrr', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhar', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhrh', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhrw', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhrq', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'hdes' ) then //Human/NE Boats
set typename = "Boats"
call CreateNUnitsAtLoc( 1, 'hdes', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hbot', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbsp', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'hbsh', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'edes', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'etrs', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ebsh', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbot', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'odes' ) then //Undead/Orc Boats
set typename = "Boats"
call CreateNUnitsAtLoc( 1, 'odes', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'obot', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ojgn', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'udes', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ubot', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'uubs', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'E01M' ) then //Forms
set typename = "Forms"
call CreateNUnitsAtLoc( 1, 'WoFm', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'BrFm', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'StFm', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'TrFm', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'LiFm', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'CrFm', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'E01M', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'h00N' ) then //Elementals
set typename = "Elementals"
call CreateNUnitsAtLoc( 1, 'h00N', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00L', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00I', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00J', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00M', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00O', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00P', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'h00K', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'u00P' ) then //Bone Beasts
set typename = "Bone Beasts"
call CreateNUnitsAtLoc( 1, 'u00G', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'u00H', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'u00I', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'u00J', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'u00K', Player(15), Location(x+w, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'u00L', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'u00M', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'u00N', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'u00O', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'u00P', Player(15), Location(x+w, y), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'h000' ) then //
set typename = "Houses Red"
call CreateUnit( Player(15), 'h000', xc-b, yc, 270.00 )
call CreateUnit( Player(15), 'h00C', xc+b, yc, 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'h001' ) then //
set typename = "Houses Green"
call CreateUnit( Player(15), 'h001', xc-b, yc, 270.00 )
call CreateUnit( Player(15), 'h00Q', xc+b, yc, 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'h008' ) then //
set typename = "Houses Blue"
call CreateUnit( Player(15), 'h008', xc-b, yc, 270.00 )
call CreateUnit( Player(15), 'h00R', xc+b, yc, 270.00 )
//********************************************************
//********************************************************
// CREEPS
//********************************************************
//********************************************************
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nspb' ) then //
set typename = "Spider"
call CreateNUnitsAtLoc( 1, 'nspr', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nspg', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nspb', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nssp', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgt', Player(15), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsbm', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nspd', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnwa', Player(15), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnwl', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnwr', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnws', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nnwq', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nfrl' ) then //
set typename = "Furbolg"
call CreateNUnitsAtLoc( 1, 'nfrp', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfpl', Player(15), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfps', Player(15), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfpt', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfpc', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfpe', Player(15), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfpu', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrl', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrs', Player(15), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrb', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfrg', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfre', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfra', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nsqt' ) then //
set typename = "Jungle Stalker, Sasquatch, or Wendigo"
call CreateNUnitsAtLoc( 1, 'njg1', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'njga', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'njgb', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsqt', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsqe', Player(15), Location(x+w/3, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsqo', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsqa', Player(15), Location(x+2*w/3, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwna', Player(15), Location(x+2*w/3, y+h*2/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwen', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwns', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwnr', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nenf' ) then //
set typename = "Bandit, Wizard or Centaur"
call CreateNUnitsAtLoc( 1, 'nban', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbrg', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrog', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nass', Player(15), Location(x+w/7, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nenf', Player(15), Location(x+w/7, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbld', Player(15), Location(x+w/7, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwiz', Player(15), Location(x+3*w/7, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwzr', Player(15), Location(x+3*w/7, y+h*2/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwzg', Player(15), Location(x+4*w/7, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwzd', Player(15), Location(x+4*w/7, y+h*2/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncea', Player(15), Location(x+6*w/7, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncer', Player(15), Location(x+6*w/7, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncim', Player(15), Location(x+6*w/7, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncen', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncks', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ncnk', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nbzk' ) then //
set typename = "Dragon"
call CreateNUnitsAtLoc( 1, 'nnht', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nndk', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nndr', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngrw', Player(15), Location(x+w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngdk', Player(15), Location(x+w/5, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngrd', Player(15), Location(x+w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbzw', Player(15), Location(x+2*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbzk', Player(15), Location(x+2*w/5, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbzd', Player(15), Location(x+2*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nadw', Player(15), Location(x+3*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nadk', Player(15), Location(x+3*w/5, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nadr', Player(15), Location(x+3*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbdr', Player(15), Location(x+4*w/5, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbdk', Player(15), Location(x+4*w/5, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbwm', Player(15), Location(x+4*w/5, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrdk', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrdr', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrwm', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nitr' ) then //
set typename = "Troll"
call CreateNUnitsAtLoc( 1, 'ohun', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'odoc', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'otbr', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitr', Player(15), Location(x+w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitp', Player(15), Location(x+w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitt', Player(15), Location(x+w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nits', Player(15), Location(x+2*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nith', Player(15), Location(x+2*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nitw', Player(15), Location(x+2*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nftr', Player(15), Location(x+3*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfsp', Player(15), Location(x+3*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nftt', Player(15), Location(x+3*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nftb', Player(15), Location(x+4*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfsp', Player(15), Location(x+4*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nftk', Player(15), Location(x+4*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndtr', Player(15), Location(x+5*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndtp', Player(15), Location(x+5*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndtt', Player(15), Location(x+5*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndtb', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndth', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndtw', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nmrr' ) then //
set typename = "Murloc or Mur'gul"
call CreateNUnitsAtLoc( 1, 'nmrl', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmrr', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmrm', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmpg', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmfs', Player(15), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmmu', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmcf', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmbg', Player(15), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmtw', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmsn', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmrv', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmsc', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nogr' ) then //
set typename = "Ogre"
call CreateNUnitsAtLoc( 1, 'nogr', Player(15), Location(x, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nomg', Player(15), Location(x, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nogm', Player(15), Location(x+w/3, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nogl', Player(15), Location(x+w/3, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nogo', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nogn', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'noga', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ngnb' ) then //
set typename = "Gnoll, Razormane or Kobold"
call CreateNUnitsAtLoc( 1, 'ngno', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngna', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngns', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngnb', Player(15), Location(x+w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngnw', Player(15), Location(x+w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngnv', Player(15), Location(x+w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrzt', Player(15), Location(x+3*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrzs', Player(15), Location(x+3*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nqbh', Player(15), Location(x+3*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrzb', Player(15), Location(x+4*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrzm', Player(15), Location(x+4*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrzg', Player(15), Location(x+4*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nkob', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nkog', Player(15), Location(x+w, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nkot', Player(15), Location(x+w, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nkol', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ngst' ) then //
set typename = "Golem, Infernal or Doom Guard"
call CreateNUnitsAtLoc( 1, 'ngrk', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ngst', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nggr', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'narg', Player(15), Location(x+w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nwrg', Player(15), Location(x+w/3, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgg', Player(15), Location(x+w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfgl', Player(15), Location(x+2*w/3, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ninf', Player(15), Location(x+w, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nbal', Player(15), Location(x+w, y+3*h/4), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nltl' ) then //
set typename = "Lizard or Salamander"
call CreateNUnitsAtLoc( 1, 'nltl', Player(15), Location(x, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nthl', Player(15), Location(x, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nstw', Player(15), Location(x+w/3, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nslh', Player(15), Location(x+2*w/3, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndsa', Player(15), Location(x+2*w/3, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nslr', Player(15), Location(x+2*w/3, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nslv', Player(15), Location(x+w, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsll', Player(15), Location(x+w, y+3*h/4), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ntrt' ) then //
set typename = "Water Beast"
call CreateNUnitsAtLoc( 1, 'ntrh', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntrs', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntrt', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntrg', Player(15), Location(x+w/4, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntrd', Player(15), Location(x+w/4, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgn', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgh', Player(15), Location(x+2*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsgb', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhyh', Player(15), Location(x+3*w/4, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nhyd', Player(15), Location(x+3*w/4, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nehy', Player(15), Location(x+w, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nahy', Player(15), Location(x+w, y+3*h/4), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'ntks' ) then //
set typename = "Polar Beast"
call CreateNUnitsAtLoc( 1, 'ntkf', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntka', Player(15), Location(x, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntkh', Player(15), Location(x, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntkt', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntkw', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntks', Player(15), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntkc', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nplb', Player(15), Location(x+2*w/4, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nplg', Player(15), Location(x+2*w/4, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmgw', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmgr', Player(15), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmgd', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmam', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmit', Player(15), Location(x+w, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nmdr', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nfor' ) then //
set typename = "Mutant"
call CreateNUnitsAtLoc( 1, 'nslm', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nslf', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsln', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrj', Player(15), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfor', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfot', Player(15), Location(x+2*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfod', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nubk', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nubr', Player(15), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nubw', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsra', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsrh', Player(15), Location(x+w, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsrn', Player(15), Location(x+w, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsrw', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nsoc' ) then //
set typename = "Skeleton"
call CreateNUnitsAtLoc( 1, 'nske', Player(15), Location(x, y+h/5), 270.00 )
call CreateNUnitsAtLoc( 1, 'nskg', Player(15), Location(x, y+3*h/5), 270.00 )
call CreateNUnitsAtLoc( 1, 'nska', Player(15), Location(x+w/6, y+h/5), 270.00 )
call CreateNUnitsAtLoc( 1, 'nskf', Player(15), Location(x+w/6, y+3*h/5), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsko', Player(15), Location(x+2*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsog', Player(15), Location(x+2*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsoc', Player(15), Location(x+2*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrvf', Player(15), Location(x+4*w/6, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrvs', Player(15), Location(x+4*w/6, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrvl', Player(15), Location(x+4*w/6, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrvi', Player(15), Location(x+5*w/6, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'nrvd', Player(15), Location(x+5*w/6, y+3*h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'ntrv', Player(15), Location(x+w, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nsrv', Player(15), Location(x+w, y+h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndrv', Player(15), Location(x+w, y+2*h/3), 270.00 )
call CreateNUnitsAtLoc( 1, 'nlrv', Player(15), Location(x+w, y+h), 270.00 )
elseif (GetUnitTypeId(GetTriggerUnit()) == 'nfgb' ) then //
set typename = "Dungeon Creep"
call CreateNUnitsAtLoc( 1, 'npfl', Player(15), Location(x, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfel', Player(15), Location(x, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'npfm', Player(15), Location(x, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ners', Player(15), Location(x+w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nerd', Player(15), Location(x+w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nerw', Player(15), Location(x+w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfgu', Player(15), Location(x+2*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfgb', Player(15), Location(x+2*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'nfov', Player(15), Location(x+2*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndqn', Player(15), Location(x+3*w/4, y), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndqv', Player(15), Location(x+3*w/4, yc), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndqt', Player(15), Location(x+3*w/4, y+h), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndqp', Player(15), Location(x+w, y+h/4), 270.00 )
call CreateNUnitsAtLoc( 1, 'ndqs', Player(15), Location(x+w, y+3*h/4), 270.00 )
else
set udg_Status[id] = "unit_create"
set udg_DM_UnitType[id] = GetUnitTypeId(GetTriggerUnit())
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r" + ColorName(TranslateTo(UnitId2String(udg_DM_UnitType[id])), GetPlayerId(udg_DM_Player[id])) + "|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|cFFFF0000" + TranslateTo(UnitId2String(udg_DM_UnitType[id])) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
call DisplayTextToForce( fp, " Click a unit in the Palette to create a different unit type." )
call DisplayTextToForce( fp, " Click a tile in the Toolbox to select the owner of the new unit.")
return
endif
call CameraSetupApplyForPlayer( true, gg_cam_Palette_2, pl, 0 )
call PanCameraToTimedLocForPlayer( pl, Location(xc, yc), 0 )
call DisplayTextToForce( fp, " Click the |c0000FF00" + typename + "|r you would like to create." )
// call DisplayTextToForce( fp, " Click a coloured tile in the Toolbox to select the owner of the new unit.")
call TriggerSleepAction(0)
call ForGroupBJ( GetUnitsInRectAll(gg_rct_Unit_DM_Zone_1), function HoldPosEnumUnit )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_Unit_DM_Zone_2), function HoldPosEnumUnit )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_Unit_DM_Zone_3), function HoldPosEnumUnit )
//second palette unit clicked
elseif RectContainsUnit(gg_rct_Unit_DM_Zone_1, GetTriggerUnit()) or RectContainsUnit(gg_rct_Unit_DM_Zone_2, GetTriggerUnit()) or RectContainsUnit(gg_rct_Unit_DM_Zone_3, GetTriggerUnit()) then
set udg_Status[id] = "unit_create"
set udg_DM_UnitType[id] = GetUnitTypeId(GetTriggerUnit())
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r" + ColorName(TranslateTo(UnitId2String(udg_DM_UnitType[id])), GetPlayerId(udg_DM_Player[id])) + "|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|cFFFF0000" + TranslateTo(UnitId2String(udg_DM_UnitType[id])) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
call DisplayTextToForce( fp, " Click a unit in the Palette to create a different unit type." )
call DisplayTextToForce( fp, " Click a tile in the Toolbox to select the owner of the new unit.")
endif
endfunction
/*
function InitUnits takes nothing returns nothing
local integer i = 9
loop
set TRIGGER_Units_Click[i] = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( TRIGGER_Units_Click[i], Player(i-1), EVENT_PLAYER_UNIT_SELECTED, null)
call TriggerAddAction(TRIGGER_Units_Click[i], function onGUIUnitsClick)
set i = i + 1
exitwhen i > 11
endloop
endfunction
function InitTrig_Units takes nothing returns nothing
set gg_trg_Units = CreateTrigger( )
call TriggerAddAction( gg_trg_Units, function InitUnits )
endfunction
*/
//TESH.scrollpos=114
//TESH.alwaysfold=0
globals
trigger array TRIGGER_Pointer_Point
trigger array TRIGGER_Pointer_Unit
endglobals
function ClearItemsPtEnum takes nothing returns nothing
call RemoveItem( GetEnumItem() )
endfunction
function ClearItemsPt takes location pt returns nothing
call EnumItemsInRectBJ( RectFromCenterSizeBJ(pt, 500.00, 500.00), function ClearItemsPtEnum )
endfunction
function ClearExplosivesPtEnum takes nothing returns nothing
if GetItemTypeId(GetEnumItem()) == 'I00O' then
call AddSpecialEffectLocBJ(GetItemLoc(GetEnumItem()), "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveItem( GetEnumItem() )
endif
endfunction
function ClearExplosivesPt takes location pt returns nothing
call EnumItemsInRectBJ( RectFromCenterSizeBJ(pt, 650.00, 650.00), function ClearExplosivesPtEnum )
endfunction
function ClearExplosivesPtSmall takes location pt returns nothing
call EnumItemsInRectBJ( RectFromCenterSizeBJ(pt, 350.00, 350.00), function ClearExplosivesPtEnum )
endfunction
function KillNPCEnum takes nothing returns nothing
if not IsUnitIdType(GetUnitTypeId(GetEnumUnit()), UNIT_TYPE_GIANT) then
if GetBooleanOr(IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[2]), IsPlayerInForce(GetOwningPlayer(GetEnumUnit()), udg_Force[3])) then
call KillUnit( GetEnumUnit() )
endif
endif
endfunction
function KillUnitEnum takes nothing returns nothing
if not IsUnitIdType(GetUnitTypeId(GetEnumUnit()), UNIT_TYPE_GIANT) then
call KillUnit( GetEnumUnit() )
endif
endfunction
function DoodadRestoreLife takes nothing returns nothing
if not(IsBridge(GetEnumDestructable())) then
call DestructableRestoreLife( GetEnumDestructable(), GetDestructableMaxLife(GetEnumDestructable()), true)
endif
endfunction
function DoodadKill takes nothing returns nothing
local integer i
if GetBooleanAnd(IsBridge(GetEnumDestructable()), IsDestructableAliveBJ(GetEnumDestructable())) then
set i = 1
loop
exitwhen i > 15
//yay locleaks
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetDestructableLoc(GetEnumDestructable()), GetRandomReal(100,450), GetRandomReal(0,360)), "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
set i = i + 1
endloop
endif
call KillDestructable( GetEnumDestructable() )
endfunction
function DoodadRemove takes nothing returns nothing
if IsBridge(GetEnumDestructable()) then
call KillDestructable( GetEnumDestructable() )
call ShowDestructableBJ( false, GetEnumDestructable() )
else
call RemoveDestructable( GetEnumDestructable() )
endif
endfunction
function DestroyFlag takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit()) == 'h006' then
call RemoveUnit(GetFilterUnit())
endif
return false
endfunction
//EVENT HANDLERS FOR POINTER
function OnPointerSmart takes location pt, player pl, boolean isunit returns nothing
local integer id
local force fp
local boolean shape
local location loc
local location loc2
local integer dt
local integer goldleft
local integer junk
local group grp
set id = GetConvertedPlayerId(pl)
set fp = bj_FORCE_PLAYER[id-1]
if not(RectContainsLoc(gg_rct_DMarea, pt)) then
//UNITS
if udg_Status[id] == "unit_create" and udg_DM_UnitType[id] != 0 then
if udg_DM_UnitType[id] == 'h00B' then
//New Training Room
call CreateNUnitsAtLoc( 1, udg_DM_UnitType[id], Player(12), pt, 270.00 )
call GroupAddUnitSimple( bj_lastCreatedUnit, udg_TRAIN_Rooms )
elseif udg_DM_UnitType[id] == 'h006' then
//New Flag for Player
if GetPlayerId(udg_DM_Player[id]) < 12 then
call GroupEnumUnitsOfPlayer(ENUM_GROUP, udg_DM_Player[id], function DestroyFlag)
call SetUnitScale( CreateUnitAtLoc(udg_DM_Player[id], udg_DM_UnitType[id], pt, 270.00), 0.5, 0.5, 0.5 )
else
//New Flag for All
call GroupEnumUnitsOfPlayer(ENUM_GROUP, Player(15), function DestroyFlag)
set gg_unit_h006_0197 = CreateUnitAtLoc(Player(15), udg_DM_UnitType[id], pt, 270.00)
call UnitAddType( gg_unit_h006_0197, UNIT_TYPE_GIANT )
endif
else
if IsUnitIdType(udg_DM_UnitType[id], UNIT_TYPE_HERO) and IsPlayerInForce(udg_DM_Player[id], udg_Force[1]) then
call CreateNUnitsAtLoc( 1, udg_DM_UnitType[id], udg_DM_Player[id], pt, bj_UNIT_FACING )
call RemoveGuardPosition( bj_lastCreatedUnit )
else
call CreateNUnitsAtLoc( 1, udg_DM_UnitType[id], udg_DM_Player[id], pt, bj_UNIT_FACING )
call RemoveGuardPosition( bj_lastCreatedUnit )
if not(IsUnitType(bj_lastCreatedUnit, UNIT_TYPE_STRUCTURE)) then
call SetUnitAnimation( bj_lastCreatedUnit, "birth" )
call SetUnitFacingTimed( bj_lastCreatedUnit, GetRandomReal(0, 360), 0 )
endif
set loc = GetUnitLoc(bj_lastCreatedUnit)
call AddSpecialEffectLoc( "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", loc )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveLocation(loc)
if udg_DM_UnitType[id] == 'ngol' then
//New Gold Mine
call SetResourceAmount( bj_lastCreatedUnit, 99999999 )
endif
endif
//Insert Bonus Mod After this Line
if BonusOnCreate[id-1] == true then
if udg_TEMP_String == null then
set udg_TEMP_String = ""
endif
call SetUnitBonus(bj_lastCreatedUnit, BONUS_ARMOR, GetUnitBonus(udg_GUI_Pointer[id], BONUS_ARMOR))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_DAMAGE, GetUnitBonus(udg_GUI_Pointer[id], BONUS_DAMAGE))
call SetUnitMaxState(bj_lastCreatedUnit, UNIT_STATE_MAX_MANA, GetUnitState(udg_GUI_Pointer[id], UNIT_STATE_MAX_MANA))
call SetUnitMaxState(bj_lastCreatedUnit, UNIT_STATE_MAX_LIFE, GetUnitState(udg_GUI_Pointer[id], UNIT_STATE_MAX_LIFE))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_ATTACK_SPEED, GetUnitBonus(udg_GUI_Pointer[id], BONUS_ATTACK_SPEED))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_LIFE_REGEN, GetUnitBonus(udg_GUI_Pointer[id], BONUS_LIFE_REGEN))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_MANA_REGEN, GetUnitBonus(udg_GUI_Pointer[id], BONUS_MANA_REGEN))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_MOVEMENT_SPEED, GetUnitBonus(udg_GUI_Pointer[id], BONUS_MOVEMENT_SPEED))
call SetUnitBonus(bj_lastCreatedUnit, BONUS_MANA_REGEN_PERCENT, GetUnitBonus(udg_GUI_Pointer[id], BONUS_MANA_REGEN_PERCENT))
set UnitBounty[GetUnitId(bj_lastCreatedUnit)] = UnitBounty[GetUnitId(udg_GUI_Pointer[id])]
call UnitAddAbility(bj_lastCreatedUnit, skillhash[udg_TEMP_String])
endif
//Coloring for Allies
if GetOwningPlayer(bj_lastCreatedUnit) == Player(14) then
call SetUnitColor(bj_lastCreatedUnit, GetPlayerColor(Player(id-1)))
endif
endif
elseif udg_Status[id] == "unit_move" then
call RemoveLocation(udg_DM_Destination[id])
set udg_DM_Destination[id] = pt
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, " Left click, box-select, or group-recall units to move them to (" + I2S(R2I(GetLocationX(pt))) + "," + I2S(R2I(GetLocationY(pt))) + ")." )
call DisplayTextToForce( fp, " Press |c00FFFF00ESC|r to exit." )
elseif udg_Status[id] == "unit_kill" then
set grp = GetUnitsInRectAll(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]))
call ForGroupBJ(grp, function KillNPCEnum )
call DestroyGroup(grp)
call ClearExplosivesPtSmall(pt)
//WEATHER
elseif udg_Status[id] == "weather_create" then
set udg_Status[id] = "weather_create_target"
set udg_DM_DoodPt[id] = pt
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to set the final point of the '|c0000FF00weather region|r'." )
elseif udg_Status[id] == "weather_create_target" then
set WeatherRect[udg_TEMP_IntegerArray[id]] = RectFromLoc(udg_DM_DoodPt[id], pt)
if udg_DM_SubType[id] == "wind" then
set Weather[udg_TEMP_IntegerArray[id]] = AddWeatherEffect( WeatherRect[udg_TEMP_IntegerArray[id]], 'WNcw' )
elseif udg_DM_SubType[id] == "rain" then
set Weather[udg_TEMP_IntegerArray[id]] = AddWeatherEffect( WeatherRect[udg_TEMP_IntegerArray[id]], 'RAlr' )
elseif udg_DM_SubType[id] == "heavyrain" then
set Weather[udg_TEMP_IntegerArray[id]] = AddWeatherEffect( WeatherRect[udg_TEMP_IntegerArray[id]], 'RAhr' )
elseif udg_DM_SubType[id] == "raysofmoonlight" then
set Weather[udg_TEMP_IntegerArray[id]] = AddWeatherEffect( WeatherRect[udg_TEMP_IntegerArray[id]], 'LRma' )
elseif udg_DM_SubType[id] == "raysoflight" then
set Weather[udg_TEMP_IntegerArray[id]] = AddWeatherEffect( WeatherRect[udg_TEMP_IntegerArray[id]], 'LRaa' )
elseif udg_DM_SubType[id] == "snow" then
set Weather[udg_TEMP_IntegerArray[id]] = AddWeatherEffect( WeatherRect[udg_TEMP_IntegerArray[id]], 'SNls' )
elseif udg_DM_SubType[id] == "heavysnow" then
set Weather[udg_TEMP_IntegerArray[id]] = AddWeatherEffect( WeatherRect[udg_TEMP_IntegerArray[id]], 'SNhs' )
elseif udg_DM_SubType[id] == "blizzard" then
set Weather[udg_TEMP_IntegerArray[id]] = AddWeatherEffect( WeatherRect[udg_TEMP_IntegerArray[id]], 'RAlr' )
elseif udg_DM_SubType[id] == "dalaranshield" then
set Weather[udg_TEMP_IntegerArray[id]] = AddWeatherEffect( WeatherRect[udg_TEMP_IntegerArray[id]], 'MEds' )
elseif udg_DM_SubType[id] == "whitefog" then
set Weather[udg_TEMP_IntegerArray[id]] = AddWeatherEffect( WeatherRect[udg_TEMP_IntegerArray[id]], 'FDwh' )
else
call DisplayTextToForce( fp, " "+udg_DM_SubType[id]+" is not a valid weather type." )
endif
call EnableWeatherEffect( Weather[udg_TEMP_IntegerArray[id]], true )
set udg_DM_SubType[id] = "done"
set udg_Status[id] = "None"
call DisplayTextToForce( fp, " You have created a weather region. Use none to remove it." )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
//DOODADS
elseif udg_Status[id] == "doodad_create" then
if udg_DM_SubType[id] == "grove" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), true, 0)
elseif udg_DM_SubType[id] == "rocks" then
call DoodadFillAreaRock(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), true)
elseif udg_DM_SubType[id] == "crates" then
call DoodadFillAreaCrates(RectFromCenterSizeBJ(pt, RealBrushSize[id]*0.714, RealBrushSize[id]*0.714), true)
elseif udg_DM_SubType[id] == "junk" then
call DoodadFillAreaJunk(RectFromCenterSizeBJ(pt, RealBrushSize[id]*0.365, RealBrushSize[id]*0.365), true)
elseif udg_DM_SubType[id] == "tree" then
set dt = GetDoodadTypAtPt(0,pt)
call CreateDestructableLoc( dt, pt, GetRandomDirectionDeg(), GetRandomReal(0.9,1.3), GetDoodadVariation(dt) )
call KillDestructable( GetLastCreatedDestructable() )
call DestructableRestoreLife( GetLastCreatedDestructable(), GetDestructableMaxLife(GetLastCreatedDestructable()), true )
elseif udg_DM_SubType[id] == "blight" then
call SetBlightRadiusLocBJ( true, Player(12), pt, RealBrushSize[id] )
elseif udg_DM_SubType[id] == "dispel" then
call SetBlightRadiusLocBJ( false, Player(12), pt, RealBrushSize[id]+100 )
elseif udg_DM_SubType[id] == "woodenbridge" then
if MakeBridge(0,pt) == -1 then
call DisplayTextToForce( fp, "|c00FF0000Could not create a bridge here.|r Click closer to a deep river." )
endif
elseif udg_DM_SubType[id] == "stonebridge" then
if MakeBridge(1,pt) == -1 then
call DisplayTextToForce( fp, "|c00FF0000Could not create a bridge here.|r Right click closer to a deep river." )
endif
elseif udg_DM_SubType[id] == "forcebridge" then
if MakeBridge(2,pt) == -1 then
call DisplayTextToForce( fp, "|c00FF0000Could not create a bridge here.|r Right click closer to a deep river." )
endif
elseif udg_DM_SubType[id] == "citadel" then
call MakeSingle(pt, 0)
elseif udg_DM_SubType[id] == "flower" then
call MakeSingle(pt, 1)
elseif udg_DM_SubType[id] == "iceyrock" then
call MakeSingle(pt, 2)
elseif udg_DM_SubType[id] == "iceyclaw" then
call MakeSingle(pt, 3)
elseif udg_DM_SubType[id] == "mushroomashenvale" then
call MakeSingle(pt, 4)
elseif udg_DM_SubType[id] == "rockicey" then
call MakeSingle(pt, 5)
elseif udg_DM_SubType[id] == "rockfelwood" then
call MakeSingle(pt, 6)
elseif udg_DM_SubType[id] == "rockashenvale" then
call MakeSingle(pt, 7)
elseif udg_DM_SubType[id] == "rockbarrens" then
call MakeSingle(pt, 8)
elseif udg_DM_SubType[id] == "rockdungeon" then
call MakeSingle(pt, 9)
elseif udg_DM_SubType[id] == "rocklordaeron" then
call MakeSingle(pt, 10)
elseif udg_DM_SubType[id] == "rocknorthrend" then
call MakeSingle(pt, 11)
elseif udg_DM_SubType[id] == "rockoutland" then
call MakeSingle(pt, 12)
elseif udg_DM_SubType[id] == "rockruins" then
call MakeSingle(pt, 13)
elseif udg_DM_SubType[id] == "rockunderground" then
call MakeSingle(pt, 14)
elseif udg_DM_SubType[id] == "mushroomruins" then
call MakeSingle(pt, 15)
elseif udg_DM_SubType[id] == "mushroomfelwood" then
call MakeSingle(pt, 16)
elseif udg_DM_SubType[id] == "castletower" then
call MakeSingle(pt, 17)
elseif udg_DM_SubType[id] == "bed" then
call MakeSingle(pt, 18)
elseif udg_DM_SubType[id] == "mat" then
call MakeSingle(pt, 19)
elseif udg_DM_SubType[id] == "grave" then
call MakeSingle(pt, 20)
elseif udg_DM_SubType[id] == "light" then
call MakeSingle(pt, 21)
elseif udg_DM_SubType[id] == "lamp" then
call MakeSingle(pt, 22)
elseif udg_DM_SubType[id] == "gate" or udg_DM_SubType[id] == "rollingstone" or udg_DM_SubType[id] == "wall" or udg_DM_SubType[id] == "elvengate" or udg_DM_SubType[id] == "demonicgate" or udg_DM_SubType[id] == "icerockgate" or udg_DM_SubType[id] == "castlegate" or udg_DM_SubType[id] == "door" or udg_DM_SubType[id] == "doubledoor" or udg_DM_SubType[id] == "dungeongate" then
set udg_Status[id] = "doodad_create_target"
set udg_DM_DoodPt[id] = pt
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to set the facing of the new '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
call DisplayTextToForce( fp, " (The new '|c0000FF00" + udg_DM_SubType[id] + "|r' will face where you right click.)" )
elseif udg_DM_SubType[id] == "log" or udg_DM_SubType[id] == "table" or udg_DM_SubType[id] == "chair" or udg_DM_SubType[id] == "archway" or udg_DM_SubType[id] == "bed" or udg_DM_SubType[id] == "trough" then
set udg_Status[id] = "doodad_create_target"
set udg_DM_DoodPt[id] = pt
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to set the facing of the new '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
call DisplayTextToForce( fp, " (The new '|c0000FF00" + udg_DM_SubType[id] + "|r' will face where you right click.)" )
elseif udg_DM_SubType[id] == "line" or udg_DM_SubType[id] == "losblocker" or udg_DM_SubType[id] == "pathblocker" or udg_DM_SubType[id] == "northrendwall" or udg_DM_SubType[id] == "ruinswall" or udg_DM_SubType[id] == "dungeonwall" or udg_DM_SubType[id] == "fenceline" or udg_DM_SubType[id] == "evilfence" or udg_DM_SubType[id] == "castlewall" or udg_DM_SubType[id] == "indoorwall" or udg_DM_SubType[id] == "minewall" then
set udg_Status[id] = "doodad_create_target"
set udg_DM_DoodPt[id] = pt
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at the other end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' of walls." )
endif
elseif udg_Status[id] == "doodad_create_target" then
if udg_DM_SubType[id] == "gate" then
call MakeGate(udg_DM_DoodPt[id], 1, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_Gate, pl )
elseif udg_DM_SubType[id] == "elvengate" then
call MakeGate(udg_DM_DoodPt[id], 2, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_ElvenGate, pl )
elseif udg_DM_SubType[id] == "demonicgate" then
call MakeGate(udg_DM_DoodPt[id], 3, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_DemonicGate, pl )
elseif udg_DM_SubType[id] == "dungeongate" then
call MakeGate(udg_DM_DoodPt[id], 9, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_DungeonGate, pl )
elseif udg_DM_SubType[id] == "icerockgate" then
call MakeGate(udg_DM_DoodPt[id], 4, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_IcerockGate, pl )
elseif udg_DM_SubType[id] == "rollingstone" then
call MakeGate(udg_DM_DoodPt[id], 5, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_RollingStone, pl )
elseif udg_DM_SubType[id] == "castlegate" then
call MakeGate(udg_DM_DoodPt[id], 6, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_CastleGate, pl )
elseif udg_DM_SubType[id] == "door" then
call MakeGate(udg_DM_DoodPt[id], 7, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_Door, pl )
elseif udg_DM_SubType[id] == "doubledoor" then
call MakeGate(udg_DM_DoodPt[id], 8, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_DoubleDoor, pl )
elseif udg_DM_SubType[id] == "wall" then
call MakeWall(udg_DM_DoodPt[id], 1, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_StoneWall, pl )
elseif udg_DM_SubType[id] == "line" then
call DrawWallLine(udg_DM_DoodPt[id], 1, pt)
call SelectUnitForPlayerSingle( GUI_D_P_Line1, pl )
elseif udg_DM_SubType[id] == "fenceline" then
call DrawSmallWallLine(udg_DM_DoodPt[id], 2, pt)
call SelectUnitForPlayerSingle( GUI_D_P_FenceLine, pl )
elseif udg_DM_SubType[id] == "evilfence" then
call DrawSmallWallLine(udg_DM_DoodPt[id], 3, pt)
call SelectUnitForPlayerSingle( GUI_D_P_EvilFence, pl )
elseif udg_DM_SubType[id] == "northrendwall" then
call DrawWallLine(udg_DM_DoodPt[id], 4, pt)
call SelectUnitForPlayerSingle( GUI_D_P_NorthrendWall, pl )
elseif udg_DM_SubType[id] == "ruinswall" then
call DrawWallLine(udg_DM_DoodPt[id], 5, pt)
call SelectUnitForPlayerSingle( GUI_D_P_RuinsWall, pl )
elseif udg_DM_SubType[id] == "dungeonwall" then
call DrawWallLine(udg_DM_DoodPt[id], 6, pt)
call SelectUnitForPlayerSingle( GUI_D_P_DungeonWall, pl )
elseif udg_DM_SubType[id] == "castlewall" then
call DrawMixWallLine(udg_DM_DoodPt[id], 7, pt)
call SelectUnitForPlayerSingle( GUI_D_P_CastleWall, pl )
elseif udg_DM_SubType[id] == "indoorwall" then
call DrawMixWallLine(udg_DM_DoodPt[id], 8, pt)
call SelectUnitForPlayerSingle( GUI_D_P_InteriorWall, pl )
elseif udg_DM_SubType[id] == "minewall" then
call DrawMixWallLine(udg_DM_DoodPt[id], 9, pt)
call SelectUnitForPlayerSingle( GUI_D_P_MineWall, pl )
elseif udg_DM_SubType[id] == "losblocker" then
call DrawSmallWallLine(udg_DM_DoodPt[id], 10, pt)
call SelectUnitForPlayerSingle( GUI_T_LoSBlocker, pl )
elseif udg_DM_SubType[id] == "pathblocker" then
call DrawSmallWallLine(udg_DM_DoodPt[id], 11, pt)
call SelectUnitForPlayerSingle( GUI_T_PathBlocker, pl )
elseif udg_DM_SubType[id] == "log" then
call MakeDoodadAngled(udg_DM_DoodPt[id], 1, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_Log, pl )
elseif udg_DM_SubType[id] == "archway" then
call MakeDoodadAngled(udg_DM_DoodPt[id], 2, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_Archway, pl )
elseif udg_DM_SubType[id] == "table" then
call MakeDoodadAngled(udg_DM_DoodPt[id], 3, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_Table, pl )
elseif udg_DM_SubType[id] == "chair" then
call MakeDoodadAngled(udg_DM_DoodPt[id], 4, FindFacingDirEight(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_Chair, pl )
elseif udg_DM_SubType[id] == "trough" then
call MakeDoodadAngled(udg_DM_DoodPt[id], 6, FindFacingDir(udg_DM_DoodPt[id], pt))
call SelectUnitForPlayerSingle( GUI_D_P_Trough, pl )
endif
elseif udg_Status[id] == "doodad_remove" then
call EnumDestructablesInCircleBJ( RealBrushSize[id]*0.8, pt, function DoodadRemove )
elseif udg_Status[id] == "doodad_kill" then
call EnumDestructablesInCircleBJ( RealBrushSize[id]*0.5, pt, function DoodadKill )
call ClearExplosivesPt(pt)
elseif udg_Status[id] == "doodad_revive" then
call EnumDestructablesInCircleBJ( RealBrushSize[id]*0.55, pt, function DoodadRestoreLife )
elseif udg_Status[id] == "doodad_open" then
call ModifyGateBJ( bj_GATEOPERATION_OPEN, FindNearbyGate(pt) )
set udg_Status[id] = "doodad_close"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFClosing Gates|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a gate to close it." )
elseif udg_Status[id] == "doodad_close" then
call ModifyGateBJ( bj_GATEOPERATION_CLOSE, FindNearbyGate(pt) )
set udg_Status[id] = "doodad_open"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFOpening Gates|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a gate to open it." )
//ITEMS
elseif udg_Status[id] == "item_create" then
if udg_DM_SubType[id] == "riches" then
set goldleft = 475
loop
exitwhen goldleft < 0
set junk = GetRandomInt(1,10)
set loc = PolarProjectionBJ(pt, GetRandomReal(25,150), GetRandomReal(0,360))
call DropCoin(loc, junk)
call RemoveLocation(loc)
set goldleft = goldleft - junk * 5
endloop
set loc = PolarProjectionBJ(pt, GetRandomReal(25,150), GetRandomReal(0,360))
call CreateItemLoc( RandomItemDrop(0), loc )
call RemoveLocation(loc)
set loc = PolarProjectionBJ(pt, GetRandomReal(25,150), GetRandomReal(0,360))
call CreateItemLoc( RandomItemDrop(0), loc )
call RemoveLocation(loc)
set loc = PolarProjectionBJ(pt, GetRandomReal(25,150), GetRandomReal(0,360))
call CreateItemLoc( RandomItemDrop(0), loc )
call RemoveLocation(loc)
elseif udg_DM_SubType[id] == "gold" then
set goldleft = 475
loop
exitwhen goldleft < 0
set junk = GetRandomInt(1,10)
set loc = PolarProjectionBJ(pt, GetRandomReal(25,150), GetRandomReal(0,360))
call DropCoin(loc, junk)
call RemoveLocation(loc)
set goldleft = goldleft - junk * 5
endloop
elseif udg_DM_SubType[id] == "goldcoin" then
call DropCoin(pt, GetRandomInt(1,3))
endif
elseif udg_Status[id] == "item_remove" then
call ClearItemsPt(pt)
//TERRAIN
elseif udg_Status[id] == "terrain_change" then
if udg_DM_SubType[id] == "raise" then
call TerrainDeformationCraterBJ( 0.40, true, pt, RealBrushSize[id], -32.00 )
elseif udg_DM_SubType[id] == "lower" then
call TerrainDeformationCraterBJ( 0.40, true, pt, RealBrushSize[id], 32.00 )
else
call TerrainChange(pt,id)
endif
//GROVES
elseif udg_Status[id] == "grove" then
if DMBrushShape[id] == 1 then
set shape = true
else
set shape = false
endif
if udg_DM_SubType[id] == "northrend" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 1)
elseif udg_DM_SubType[id] == "ashenvale" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 2)
elseif udg_DM_SubType[id] == "fall" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 3)
elseif udg_DM_SubType[id] == "underground" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 4)
elseif udg_DM_SubType[id] == "dungeon" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 5)
elseif udg_DM_SubType[id] == "outland" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 6)
elseif udg_DM_SubType[id] == "ruins" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 7)
elseif udg_DM_SubType[id] == "barrens" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 8)
elseif udg_DM_SubType[id] == "felwood" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 9)
elseif udg_DM_SubType[id] == "snowy" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 10)
elseif udg_DM_SubType[id] == "winter" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 11)
elseif udg_DM_SubType[id] == "city" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 12)
elseif udg_DM_SubType[id] == "summer" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 13)
elseif udg_DM_SubType[id] == "brown" then
call DoodadFillAreaGrove(RectFromCenterSizeBJ(pt, RealBrushSize[id], RealBrushSize[id]), shape, 14)
endif
//MISC
//accept ground targets only, can't right-click a unit
elseif udg_Status[id] == "misc_portal_source" and not(isunit) then
//create a source
call CreateNUnitsAtLoc( 1, 'nwgt', Player(14), pt, bj_UNIT_FACING )
set udg_Status[id] = "misc_portal_dest"
set udg_DM_Unit[id] = bj_lastCreatedUnit
call GUIApplyCamForDM(pl)
call WaygateActivateBJ( false, udg_DM_Unit[id] )
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFWay Gate Link...|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "Left click a Way Gate to link it to this one." )
call DisplayTextToForce( fp, "Right click the ground to create a linking Way Gate." )
//accept ground targets only, can't right-click a unit
elseif GetBooleanAnd(udg_Status[id] == "misc_portal_dest", not(isunit)) then
//create a destination
call CreateNUnitsAtLoc( 1, 'nwgt', Player(14), pt, bj_UNIT_FACING )
call WaygateSetDestinationLocBJ( bj_lastCreatedUnit, GetUnitLoc(udg_DM_Unit[id]) )
call WaygateSetDestinationLocBJ( udg_DM_Unit[id], GetUnitLoc(bj_lastCreatedUnit) )
call WaygateActivateBJ( true, bj_lastCreatedUnit )
call WaygateActivateBJ( true, udg_DM_Unit[id] )
set udg_Status[id] = "none"
set udg_DM_Unit[id] = null
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, "The two Way Gates are now linked." )
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|c00FFFFFFNo Active Mode|r" )
endif
endif
endfunction
function OnPointerMove takes location pt, player pl, boolean isunit returns nothing
local integer id = 0
local force fp
local location loc
local location loc2
local integer dt
local integer goldleft
local integer junk
local group grp
set id = GetConvertedPlayerId(pl)
set fp = bj_FORCE_PLAYER[id-1]
if not(RectContainsLoc(gg_rct_DMarea, pt)) then
//call DisplayTextToForce( fp, " POINTMOVE!" )
if udg_Status[id] == "unit_kill" then
set grp = GetUnitsInRectAll(RectFromCenterSizeBJ(pt, 600.00, 600.00))
call ForGroupBJ(grp, function KillUnitEnum )
call DestroyGroup(grp)
call ClearExplosivesPtSmall(pt)
endif
endif
endfunction
function OnPointerAttack takes location pt, player pl, boolean isunit returns nothing
local integer id = 0
local force fp
set id = GetConvertedPlayerId(pl)
set fp = bj_FORCE_PLAYER[id-1]
if not(RectContainsLoc(gg_rct_DMarea, pt)) then
//call DisplayTextToForce( fp, " POINTATTACK!" )
endif
endfunction
function OnPointerPatrol takes location pt, player pl returns nothing
local integer id = 0
local force fp
set id = GetConvertedPlayerId(pl)
set fp = bj_FORCE_PLAYER[id-1]
if not(RectContainsLoc(gg_rct_DMarea, pt)) then
//call DisplayTextToForce( fp, " POINTPATROL!" )
endif
endfunction
//CONSTRUCTOR & INTERFACE FOR POINTER EVENT HANDLERS
function OnPointerPoint takes location pt, player pl, integer order, boolean isunit returns nothing
//call DisplayTextToForce( bj_FORCE_PLAYER[GetConvertedPlayerId(pl) - 1], "POINTPOINT: (" + I2S(R2I(GetLocationX(pt))) + "," + I2S(R2I(GetLocationY(pt))) + ")" )
if not(RectContainsLoc(gg_rct_DMarea, pt)) then
//call DisplayTextToForce( bj_FORCE_PLAYER[GetConvertedPlayerId(pl) - 1], "POINTPOINTRECT!" )
//call DisplayTextToForce( bj_FORCE_PLAYER[GetConvertedPlayerId(pl) - 1], "Order: " + I2S(order) + " Name: " + OrderId2StringBJ(order))
if order == OrderId("smart") then
call OnPointerSmart(pt,pl,isunit)
elseif order == OrderId("move") then
call OnPointerMove(pt,pl,isunit)
elseif order == OrderId("attack") then
call OnPointerAttack(pt,pl,isunit)
elseif order == OrderId("patrol") then
call OnPointerSmart(pt,pl,isunit)
endif
endif
endfunction
function OnGUIPointOrder takes nothing returns nothing
call OnPointerPoint( GetOrderPointLoc(), GetOwningPlayer(GetOrderedUnit()), GetIssuedOrderIdBJ(), false )
endfunction
function OnGUIUnitOrder takes nothing returns nothing
if GetOrderTargetUnit() == null then
if GetOrderTargetItem() == null then
call OnPointerPoint( GetDestructableLoc(GetOrderTargetDestructable()), GetOwningPlayer(GetOrderedUnit()), GetIssuedOrderIdBJ(), true )
else
call OnPointerPoint( GetItemLoc(GetOrderTargetItem()), GetOwningPlayer(GetOrderedUnit()), GetIssuedOrderIdBJ(), true )
endif
else
call OnPointerPoint( GetUnitLoc(GetOrderTargetUnit()), GetOwningPlayer(GetOrderedUnit()), GetIssuedOrderIdBJ(), true )
endif
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
trigger array TRIGGER_Items_Click
endglobals
function onGUIItemsClick takes nothing returns nothing
local integer id = 0
local player pl
local force fp
local unit un
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
set un = GetTriggerUnit()
if un == GUI_I_Create then
call CameraSetupApplyForPlayer( true, gg_cam_Item_Palette, pl, 0 )
set udg_Status[id] = "item_create"
set udg_DM_SubType[id] = ""
set udg_DM_MiscBool[id] = false
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFCreating Items...|r" )
call DisplayTextToForce( fp, " " )
call DisplayTextToForce( fp, " Left click the item or shop you would like to create." )
elseif un == GUI_I_Remove then
call GUIApplyCamForDM(pl)
set udg_Status[id] = "item_remove"
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFRemoving Items|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to remove all items in a small area." )
elseif un == GUI_I_P_PileOfRiches then
set udg_Status[id] = "item_create"
set udg_DM_SubType[id] = "riches"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a pile of '|c0000FF00" + udg_DM_SubType[id] + "|r' (500 gold + 3 tomes)." )
elseif un == GUI_I_P_GoldPile then
set udg_Status[id] = "item_create"
set udg_DM_SubType[id] = "gold"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a pile of '|c0000FF00" + udg_DM_SubType[id] + "|r' (500 gold)." )
elseif un == GUI_I_P_GoldCoin then
set udg_Status[id] = "item_create"
set udg_DM_SubType[id] = "goldcoin"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif RectContainsUnit(gg_rct_Item_Palette, un) then
//go into unit creation mode, since we're making shops
set udg_Status[id] = "unit_create"
set udg_DM_UnitType[id] = GetUnitTypeId(GetTriggerUnit())
set udg_DM_Player[id] = Player(14)
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r" + ColorName(TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])), GetConvertedPlayerId(udg_DM_Player[id])) + "|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|cFFFF0000" + TranslateTo(UnitId2StringBJ(udg_DM_UnitType[id])) + "|r' for " + ColorNamePl(udg_DM_Player[id]) + "." )
//elseif GetBooleanAnd(udg_Status[id] == "item_remove", isItem(un)) then
// call RemoveCustomItem(un)
endif
endfunction
/*
function InitGUIItems takes nothing returns nothing
local integer i = 9
loop
set TRIGGER_Items_Click[i] = CreateTrigger()
call TriggerAddAction(TRIGGER_Items_Click[i], function onGUIItemsClick)
call TriggerRegisterPlayerUnitEvent( TRIGGER_Items_Click[i], Player(i-1), EVENT_PLAYER_UNIT_SELECTED, null)
set i = i + 1
exitwhen i > 11
endloop
endfunction
function InitTrig_Items takes nothing returns nothing
set gg_trg_Items = CreateTrigger( )
call TriggerAddAction( gg_trg_Items, function InitGUIItems )
endfunction
*/
//TESH.scrollpos=92
//TESH.alwaysfold=0
globals
trigger array TRIGGER_Doodads_Click
endglobals
function onGUIDoodadsClick takes nothing returns nothing
local integer i = 0
local integer i2 = 0
local integer id = 0
local player pl
local force fp
set id = GetConvertedPlayerId(GetTriggerPlayer())
set pl = ConvertedPlayer(id)
set fp = bj_FORCE_PLAYER[id-1]
if (GetTriggerUnit() == GUI_D_Create) then
//creating doodads
call CameraSetupApplyForPlayer( true, gg_cam_DoodadPalette, pl, 0 )
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = ""
set udg_DM_Player[id] = Player(12)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFCreating Doodads|r" )
call DisplayTextToForce( fp, " Click the type of doodad you would like to create." )
elseif (GetTriggerUnit() == GUI_D_Remove) then
//removing doodads
set udg_Status[id] = "doodad_remove"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFRemoving Doodads|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to remove doodads." )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Doodad Removal mode.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to remove a patch of trees." )
// call DisplayTextToForce( fp, " Press |cFFFFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_D_Kill) then
//killing doodads
set udg_Status[id] = "doodad_kill"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFKilling Doodads|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to kill doodads." )
call DisplayTextToForce( fp, " (This will also detonate explosives.)" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Doodad Killing mode.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to kill a patch of trees." )
// call DisplayTextToForce( fp, " Press |cFFFFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_D_Revive) then
//reviving doodads
set udg_Status[id] = "doodad_revive"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFReviving Doodads|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to revive doodads." )
call DisplayTextToForce( fp, " (To revive a bridge, create it again.)" )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Doodad Revival mode.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to create a patch of trees." )
// call DisplayTextToForce( fp, " Press |cFFFFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_D_Toggle) then
//toggling gates
set udg_Status[id] = "doodad_open"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFFOpening Gates|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a gate to open it." )
// call DisplayTextToForce( fp, " " )
// call DisplayTextToForce( fp, "|c0000FF00You are now in Doodad Killing mode.|r" )
// call DisplayTextToForce( fp, " Select your Pointer (|cFFFFFF00F1|r), then right click to kill a patch of trees." )
// call DisplayTextToForce( fp, " Press |cFFFFFF00ESC|r to exit." )
elseif (GetTriggerUnit() == GUI_D_P_Grove) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "grove"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rocks"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Junk) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "junk"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Crates) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "crates"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Tree) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "tree"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
call DisplayTextToForce( fp, " |c00FF0000Single trees should only be created under special circumstances.|r" )
call DisplayTextToForce( fp, " |c00FF0000To build a path, use groves.|r" )
elseif (GetTriggerUnit() == GUI_D_P_Blight) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "blight"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Dispel) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "dispel"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to '|c0000FF00" + udg_DM_SubType[id] + "|r' blight." )
elseif (GetTriggerUnit() == GUI_D_P_WoodenBridge) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "woodenbridge"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a deep river to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_StoneBridge) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "stonebridge"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a deep river to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_ForceBridge) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "forcebridge"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click on a deep river to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif GetTriggerUnit() == GUI_D_P_Gate then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "gate"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_ElvenGate) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "elvengate"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_DemonicGate) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "demonicgate"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_DungeonGate) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "dungeongate"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_IcerockGate) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "icerockgate"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_RollingStone) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rollingstone"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_CastleGate) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "castlegate"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Door) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "door"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_DoubleDoor) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "doubledoor"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_StoneWall) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "wall"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Line1 or GetTriggerUnit() == GUI_D_P_Line2) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "line"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' of walls you wish to create." )
elseif GetTriggerUnit() == GUI_D_P_NorthrendWall then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "northrendwall"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' you wish to create." )
elseif GetTriggerUnit() == GUI_D_P_RuinsWall then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "ruinswall"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' you wish to create." )
elseif GetTriggerUnit() == GUI_D_P_DungeonWall then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "dungeonwall"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' you wish to create." )
elseif GetTriggerUnit() == GUI_D_P_FenceLine then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "fenceline"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' you wish to create." )
elseif GetTriggerUnit() == GUI_D_P_EvilFence then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "evilfence"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' you wish to create." )
elseif GetTriggerUnit() == GUI_D_P_CastleWall then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "castlewall"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' you wish to create." )
elseif GetTriggerUnit() == GUI_D_P_InteriorWall then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "indoorwall"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' you wish to create." )
elseif GetTriggerUnit() == GUI_D_P_MineWall then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "minewall"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' you wish to create." )
elseif GetTriggerUnit() == GUI_T_LoSBlocker then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "losblocker"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' you wish to create." )
elseif GetTriggerUnit() == GUI_T_PathBlocker then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "pathblocker"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click at one end of the '|c0000FF00" + udg_DM_SubType[id] + "|r' you wish to create." )
elseif (GetTriggerUnit() == GUI_D_P_Citadel) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "citadel"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_CTower) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "castletower"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Flower) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "flower"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Mushroom1) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "mushroomashenvale"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Mushroom2) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "mushroomruins"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Mushroom3) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "mushroomfelwood"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks1) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rockicey"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks2) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rockfelwood"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks3) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rockashenvale"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks4) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rockbarrens"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks5) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rockdungeon"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks6) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rocklordaeron"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks7) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rocknorthrend"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks8) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rockoutland"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks9) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rockruins"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Rocks10) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "rockunderground"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_IceyRock) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "iceyrock"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_IceyClaw) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "iceyclaw"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Bed) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "bed"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Trough) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "trough"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Mat) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "mat"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Grave) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "grave"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Light) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "light"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Lamp) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "lamp"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
//Facer Doodads
elseif (GetTriggerUnit() == GUI_D_P_Log) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "log"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Archway) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "archway"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Table) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "table"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
elseif (GetTriggerUnit() == GUI_D_P_Chair) then
set udg_Status[id] = "doodad_create"
set udg_DM_SubType[id] = "chair"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + "|r'." )
endif
if GetTriggerUnit() == GUI_D_P_NorthrendGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "northrend"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_AshenvaleGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "ashenvale"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_FallGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "fall"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_UndergroundGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "underground"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_DungeonGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "dungeon"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_OutlandGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "outland"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_RuinsGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "ruins"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_BarrensGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "barrens"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_FelwoodGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "felwood"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_SnowyGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "snowy"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_WinterGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "winter"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_CityGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "city"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_SummerGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "summer"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
elseif GetTriggerUnit() == GUI_D_P_BrownGrove then
set udg_Status[id] = "grove"
set udg_DM_SubType[id] = "brown"
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id], pl )
call DisplayTextToForce( fp, " Right click to create a '|c0000FF00" + udg_DM_SubType[id] + " grove|r'." )
endif
endfunction
/*
function InitDoodads takes nothing returns nothing
local integer i = 9
loop
set TRIGGER_Doodads_Click[i] = CreateTrigger()
call TriggerAddAction(TRIGGER_Doodads_Click[i], function onGUIDoodadsClick)
call TriggerRegisterPlayerUnitEvent( TRIGGER_Doodads_Click[i], Player(i-1), EVENT_PLAYER_UNIT_SELECTED, null)
set i = i + 1
exitwhen i > 11
endloop
//call DoodadFillArea(gg_rct_Blend_Middle, false)
//call DoodadFillArea(gg_rct_Blend_Desert_Snow, false)
//call DoodadFillArea(gg_rct_Blend_Forest_Snow, false)
//call DoodadFillArea(gg_rct_Blend_Snow_Dungeon, false)
//call DoodadFillArea(gg_rct_Blend_Desert_Forest, false)
//call DoodadFillArea(gg_rct_Desert, false)
//call DoodadFillArea(gg_rct_Forest, false)
//call DoodadFillArea(gg_rct_Snow, false)
//call DoodadFillArea(gg_rct_Dungeon, false)
endfunction
function InitTrig_Doodads takes nothing returns nothing
set gg_trg_Doodads = CreateTrigger( )
call TriggerAddAction( gg_trg_Doodads, function InitDoodads )
endfunction
*/
//TESH.scrollpos=0
//TESH.alwaysfold=0
struct Hash
string id
static gamecache hashgc
static method onInit takes nothing returns nothing
call FlushGameCache(InitGameCache("hashgc.w3v"))
set Hash.hashgc = InitGameCache("hashgc.w3v")
endmethod
static method create takes nothing returns Hash
local Hash dat = Hash.allocate()
set dat.id = "Hashes:" + I2S(dat)
return dat
endmethod
method operator []= takes string ind, integer val returns nothing
call StoreInteger(this.hashgc,this.id,ind,val)
endmethod
method operator [] takes string ind returns integer
return GetStoredInteger(this.hashgc,this.id,ind)
endmethod
endstruct
//TESH.scrollpos=375
//TESH.alwaysfold=0
scope SetupSkills initializer Actions
globals
Hash skillhash
endglobals
private function Actions takes nothing returns nothing
//Useful Random Skills
set skillhash = Hash.create()
set skillhash["wander"] = 'Awan'
set skillhash["unload"] = 'Adro'
set skillhash["load"] = 'Aloa'
set skillhash["cargo"] = 'Sch3'
set skillhash["heroglow"] = 'A00A'
set skillhash["noattack"] = 'Abun'
set skillhash["reveal"] = 'AHta'
set skillhash["channel"] = 'ANcl'
//Human Unit Skills
set skillhash["aerialshackles"] = 'Amls'
set skillhash["barrage"] = 'Aroc'
set skillhash["calltoarms1"] = 'Amic'
set skillhash["calltoarms2"] = 'Amil'
set skillhash["cloud"] = 'Aclf'
set skillhash["controlmagic"] = 'Acmg'
set skillhash["defend"] = 'Adef'
set skillhash["dispelmagic"] = 'Adis'
set skillhash["dispel"] = 'Adis'
set skillhash["feedback1"] = 'Afbt'
set skillhash["feedback2"] = 'Afbk'
set skillhash["flakcannons"] = 'Aflk'
set skillhash["flare"] = 'Afla'
set skillhash["flyingmachinebombs"] = 'Agyb'
set skillhash["fragmentationshards"] = 'Afsh'
set skillhash["heal"] = 'Ahea'
set skillhash["innferfire"] = 'Ainf'
set skillhash["invisibility"] = 'Aivs'
set skillhash["magicdefense"] = 'Amdf'
set skillhash["magicsentry"] = 'Adts'
set skillhash["phoenixfire"] = 'Apxf'
set skillhash["polymorph"] = 'Aply'
set skillhash["slow"] = 'Aslo'
set skillhash["spellsteal"] = 'Asps'
set skillhash["repairhuman"] = 'Ahrp'
set skillhash["repair1"] = 'Ahrp'
//Human Hero Skills
set skillhash["havatar"] = 'AHav'
set skillhash["hbanish"] = 'AHbn'
set skillhash["hbash"] = 'AHbh'
set skillhash["hblizzard"] = 'AHbz'
set skillhash["hbrillianceaura"] = 'AHab'
set skillhash["hdevotionaura"] = 'AHad'
set skillhash["hdivineshield"] = 'AHds'
set skillhash["hflamestrike"] = 'AHfs'
set skillhash["hholylight"] = 'AHhb'
set skillhash["hmassteleport"] = 'AHmt'
set skillhash["hphoenix"] = 'AHpx'
set skillhash["hressurection"] = 'AHre'
set skillhash["hsiphonmana"] = 'AHdr'
set skillhash["hstormbolt"] = 'AHtb'
set skillhash["hwaterelemental"] = 'AHwe'
set skillhash["hthunderclap"] = 'AHtc'
//Orc Skills
set skillhash["ancestralspirit"] = 'Aast'
set skillhash["berserk1"] = 'Absk'
set skillhash["bloodlust"] = 'Ablo'
set skillhash["burningoil"] = 'Abof'
set skillhash["devour"] = 'Adev'
set skillhash["devourcargo"] = 'Advc'
set skillhash["disenchant"] = 'Adcn'
set skillhash["disenchant2"] = 'Adch'
set skillhash["ensnare"] = 'Aens'
set skillhash["envenomedspears"] = 'Aven'
set skillhash["healingward"] = 'Ahwd'
set skillhash["healingwardaura"] = 'Aoar'
set skillhash["lightningshield"] = 'Alsh'
set skillhash["liquidfire"] = 'Aliq'
set skillhash["pillage"] = 'Asal'
set skillhash["pulverize"] = 'Awar'
set skillhash["purge"] = 'Apg2'
set skillhash["purge2"] = 'Aprg'
set skillhash["sentryward"] = 'Aeye'
set skillhash["spiritlink"] = 'Aspl'
set skillhash["stasistrap"] = 'Asta'
set skillhash["unstableconcoction"] = 'Auco'
set skillhash["wardrums"] = 'Aakb'
set skillhash["repairorc"] = 'Arep'
set skillhash["repair2"] = 'Arep'
//Orc Hero Skills
set skillhash["hbigbadvoodoo"] = 'AOvd'
set skillhash["hbladestorm"] = 'AOww'
set skillhash["hchainlightning"] = 'AOcl'
set skillhash["hcriticalstrike"] = 'AOcr'
set skillhash["hearthquake"] = 'AOeq'
set skillhash["henduranceaura"] = 'AOae'
set skillhash["henduranceaura2"] = 'AOr2'
set skillhash["hfarsight"] = 'AOfs'
set skillhash["hferalspirit"] = 'AOsf'
set skillhash["hhealingwave"] = 'AOhw'
set skillhash["hhealingwave2"] = 'ANhw'
set skillhash["hhex"] = 'AOhx'
set skillhash["hhex2"] = 'AHhx'
set skillhash["hmirrorimage"] = 'AOmi'
set skillhash["hreincarnation"] = 'AOre'
set skillhash["hreincarnation2"] = 'AOr3'
set skillhash["hserpentward"] = 'AOsw'
set skillhash["hserpentward2"] = 'Arsw'
set skillhash["hshockwave"] = 'AOsh'
set skillhash["hshockwave2"] = 'AOs2'
set skillhash["hvoodoospirits"] = 'AOls'
set skillhash["hwarstomp"] = 'AOws'
set skillhash["hwarstomp2"] = 'AOw2'
set skillhash["hwindwalk"] = 'AOwk'
//Nightelf Unit Skills
set skillhash["abolishmagic"] = 'Aadm'
set skillhash["corrosivebreath"] = 'Acor'
set skillhash["cyclone"] = 'Acyc'
set skillhash["detonate"] = 'Adtn'
set skillhash["dismount"] = 'Adec'
set skillhash["dismounthorse"] = 'Adis'
set skillhash["dismount2"] = 'Adis'
set skillhash["mounthippogryph"] = 'Aco2'
set skillhash["pickuparcher"] = 'Aco3'
set skillhash["mounthorse"] = 'Acoa'
set skillhash["pickupfootman"] = 'Acoh'
set skillhash["eattree"] = 'Aeat'
set skillhash["elunesgrace"] = 'Aegr'
set skillhash["ethereal"] = 'Aetl'
set skillhash["faeriefire"] = 'Afae'
set skillhash["faeriefire2"] = 'Afa2'
set skillhash["hardenedskin"] = 'Assk'
set skillhash["lightningattack"] = 'Alit'
set skillhash["manaflare"] = 'Amfl'
set skillhash["phaseshift"] = 'Apsh'
set skillhash["rejuvination"] = 'Arej'
set skillhash["replenishmanaandlife"] = 'Ambt'
set skillhash["resistantskin"] = 'Arsk'
set skillhash["roar"] = 'Aroa'
set skillhash["roar2"] = 'Ara2'
set skillhash["sentinel"] = 'Aesn'
set skillhash["sentinel2"] = 'Aesr'
set skillhash["shadowmeld"] = 'Ashm'
set skillhash["hide"] = 'Ashm'
set skillhash["shadowmeld2"] = 'Sshm'
set skillhash["hide2"] = 'Sshm'
set skillhash["slowpoison"] = 'Aspo'
set skillhash["spellimmunity"] = 'Amim'
set skillhash["spiritofvengeance"] = 'Avng'
set skillhash["stormcrowform"] = 'Arav'
set skillhash["taunt"] = 'Atau'
set skillhash["warclub"] = 'Agra'
set skillhash["repairnightelf"] = 'Aren'
set skillhash["repair3"] = 'Aren'
set skillhash["renew"] = 'Aren'
//Nightelf Hero Skills
set skillhash["hblink"] = 'AEbl'
set skillhash["hblink2"] = 'ANbl'
set skillhash["hentanglingroots"] = 'AEer'
set skillhash["hevasion"] = 'AEev'
set skillhash["hfanofknives"] = 'AEfk'
set skillhash["hforceofnature"] = 'AEfn'
set skillhash["himmolation"] = 'AEim'
set skillhash["hmanaburn"] = 'AEmb'
set skillhash["hmetamorphosis"] = 'AEme'
set skillhash["hscout"] = 'AEst'
set skillhash["hsearingarrows"] = 'AHfa'
set skillhash["hshadowstrike"] = 'AEsh'
set skillhash["hstarfall"] = 'AEsf'
set skillhash["thornsaura"] = 'AEah'
set skillhash["hthornsaura"] = 'AEah'
set skillhash["htranquility"] = 'AEtq'
set skillhash["trueshotaura"] = 'AEar'
set skillhash["hvengeance"] = 'AEsv'
//Undead Unit Skills
set skillhash["absorbmana"] = 'Aabs'
set skillhash["antimagicshell"] = 'Aams'
set skillhash["antimagicshell2"] = 'Aam2'
set skillhash["auraofblight"] = 'Aabr'
set skillhash["cannabalize"] = 'Acan'
set skillhash["cannabalize2"] = 'Acn2'
set skillhash["corpsecargo"] = 'Sch2'
set skillhash["createcorpse"] = 'Agyd'
set skillhash["cripple"] = 'Acri'
set skillhash["cripple2"] = 'Scri'
set skillhash["curse"] = 'Acrs'
set skillhash["devourmagic"] = 'Advm'
set skillhash["diseasecloud"] = 'Aap1'
set skillhash["diseasecloud2"] = 'Apts'
set skillhash["diseasecloud3"] = 'Aap2'
set skillhash["dropcorpse"] = 'Amed'
set skillhash["essenceofblight"] = 'Arpl'
set skillhash["exhumecorpse"] = 'Aexh'
set skillhash["freezingbreath"] = 'Afrz'
set skillhash["frostattack"] = 'Afr2'
set skillhash["frostattack2"] = 'Afra'
set skillhash["getcorpse"] = 'Amel'
set skillhash["ghost"] = 'Agho'
set skillhash["ghost2"] = 'Aeth'
set skillhash["orbofannihilation"] = 'Afak'
set skillhash["possession"] = 'Apos'
set skillhash["possession2"] = 'Aps2'
set skillhash["raisedead"] = 'Arai'
set skillhash["replenish"] = 'Arpb'
set skillhash["replenishmana"] = 'Amb2'
set skillhash["spiderattack"] = 'Aspa'
set skillhash["spirittouch"] = 'Arpm'
set skillhash["truesight"] = 'Adtg'
set skillhash["unholyfrenzy"] = 'Auhf'
set skillhash["web"] = 'Aweb'
set skillhash["repairundead"] = 'Arst'
set skillhash["repair4"] = 'Arst'
set skillhash["restore"] = 'Arst'
set skillhash["unsummon"] = 'Auns'
//Undead Hero Skills
set skillhash["hanimatedead"] = 'AUan'
set skillhash["hcarrionbeetles"] = 'AUcb'
set skillhash["hcarrionswarm"] = 'AUcs'
set skillhash["hdarkritual"] = 'AUdr'
set skillhash["hdeathanddecay"] = 'AUdd'
set skillhash["hdeathcoil"] = 'AUdc'
set skillhash["hdeathpact"] = 'AUdp'
set skillhash["hfrostarmor"] = 'AUfa'
set skillhash["hfrostarmor2"] = 'AUfu'
set skillhash["hfrostnova"] = 'AUfn'
set skillhash["himpale"] = 'AUim'
set skillhash["hinferno"] = 'AUin'
set skillhash["hlocustswarm"] = 'AUls'
set skillhash["hsleep"] = 'AUsl'
set skillhash["hspikedcarapace"] = 'AUts'
set skillhash["hunholyaura"] = 'AUau'
set skillhash["hvampiricaura"] = 'AUav'
//Nuetral Hostile Skills
set skillhash["abolishmagic2"] = 'ACdm'
set skillhash["abolishmagic3"] = 'ACd2'
set skillhash["animatedead"] = 'ACad'
set skillhash["antimagicshell3"] = 'ACam'
set skillhash["banish"] = 'ACbn'
set skillhash["bash"] = 'ACbh'
set skillhash["bash2"] = 'ANbh'
set skillhash["blackarrow"] = 'ACbk'
set skillhash["blizzard"] = 'ACbz'
set skillhash["bloodlust2"] = 'ACbl'
set skillhash["bloodlust3"] = 'ACbb'
set skillhash["breathoffire"] = 'ACbc'
set skillhash["breathoffrost"] = 'ACbf'
set skillhash["brillianceaura"] = 'ACba'
set skillhash["cannabalize3"] = 'ACcn'
set skillhash["carrionswarm"] = 'ACca'
set skillhash["chainlightning"] = 'ACcl'
set skillhash["charm"] = 'ACch'
set skillhash["cleavingattack"] = 'ACce'
set skillhash["coldarrows"] = 'ACcw'
set skillhash["commandaura"] = 'ACac'
set skillhash["cripple2"] = 'ACcr'
set skillhash["criticalstrike"] = 'ACct'
set skillhash["crowform2"] = 'Amrf'
set skillhash["crushingwave"] = 'ACcv'
set skillhash["crushingwave2"] = 'ACc2'
set skillhash["crushingwave3"] = 'ACc3'
set skillhash["curse2"] = 'ACcs'
set skillhash["cyclone3"] = 'SCc1'
set skillhash["cyclone2"] = 'ACcy'
set skillhash["deathcoil"] = 'ACdc'
set skillhash["devotionaura"] = 'ACav'
set skillhash["devourmagic"] = 'ACde'
set skillhash["diseasecloud4"] = 'Aap3'
set skillhash["diseasecloud5"] = 'Aap4'
set skillhash["dispelmagic2"] = 'Adsm'
set skillhash["divineshield"] = 'ACds'
set skillhash["enduranceaura"] = 'SCae'
set skillhash["ensnare2"] = 'ACen'
set skillhash["entanglingroots"] = 'Aenr'
set skillhash["entanglingroots2"] = 'Aenw'
set skillhash["envenomedweapons2"] = 'ACvs'
set skillhash["evasion2"] = 'ACev'
set skillhash["evasion3"] = 'ACes'
set skillhash["factory"] = 'ANfy'
set skillhash["faeriefire3"] = 'ACff'
set skillhash["feedback3"] = 'Afbb'
set skillhash["feralspirit"] = 'ACsf'
set skillhash["feralspirit2"] = 'ACs9'
set skillhash["fingerofdeath"] = 'Afod'
set skillhash["fingerofpain2"] = 'ACf3'
set skillhash["fingerofpain"] = 'ACfd'
set skillhash["firebolt"] = 'ACfb'
set skillhash["firebolt2"] = 'Awfb'
set skillhash["flamestrike"] = 'ANfs'
set skillhash["flamestrike2"] = 'ACfs'
set skillhash["forceofnature"] = 'ACfr'
set skillhash["forkedlightning"] = 'ACfl'
set skillhash["frenzy"] = 'Afzy'
set skillhash["frostarmor"] = 'ACf2'
set skillhash["frostarmor2"] = 'ACfa'
set skillhash["frostbolt"] = 'ACcb'
set skillhash["frostnova"] = 'ACfn'
set skillhash["heal2"] = 'Anhe'
set skillhash["heal3"] = 'Anh1'
set skillhash["heal4"] = 'Anh2'
set skillhash["healingward2"] = 'AChw'
set skillhash["healingwave"] = 'AChv'
set skillhash["hex"] = 'AChx'
set skillhash["howlofterror"] = 'Acht'
set skillhash["hurlboulder"] = 'ACtb'
set skillhash["immolation"] = 'ACim'
set skillhash["impale"] = 'ACmp'
set skillhash["innerfire"] = 'ACif'
set skillhash["lifedrain"] = 'ACdr'
set skillhash["lifesteal"] = 'SCva'
set skillhash["liferegenerationaura"] = 'ACnr'
set skillhash["lightningshield2"] = 'ACls'
set skillhash["manaburn"] = 'Ambd'
set skillhash["manaburn2"] = 'Amnb'
set skillhash["manaburn3"] = 'Ambb'
set skillhash["manaregenerationaura"] = 'ANre'
set skillhash["manashield"] = 'ACmf'
set skillhash["maul"] = 'ANb2'
set skillhash["mindrot"] = 'ANmr'
set skillhash["monsoon"] = 'ACmo'
set skillhash["parasite"] = 'ACpa'
set skillhash["polymorph2"] = 'ACpy'
set skillhash["possession3"] = 'ACps'
set skillhash["pulverize2"] = 'ACpv'
set skillhash["purge3"] = 'ACpu'
set skillhash["quillspray"] = 'ANak'
set skillhash["rainoffire"] = 'ACrg'
set skillhash["rainoffire2"] = 'ACrf'
set skillhash["raisedead2"] = 'ACrd'
set skillhash["rayofdisruption"] = 'Ache'
set skillhash["reincarnation"] = 'ACrn'
set skillhash["rejuvination2"] = 'ACr2'
set skillhash["rejuvination3"] = 'ACrj'
set skillhash["resistantskin2"] = 'ACrk'
set skillhash["resistantskin3"] = 'ACsk'
set skillhash["roar2"] = 'ACro'
set skillhash["roar3"] = 'ACr1'
set skillhash["searingarrows"] = 'ACsa'
set skillhash["shadowstrike"] = 'ACss'
set skillhash["shockwave"] = 'ACsh'
set skillhash["silence"] = 'ACsi'
set skillhash["siphonmana"] = 'ACsm'
set skillhash["slam"] = 'ACtc'
set skillhash["slam2"] = 'ACt2'
set skillhash["sleep"] = 'ACsl'
set skillhash["slow2"] = 'ACsw'
set skillhash["spawnhydra"] = 'Aspy'
set skillhash["spawnhydrahatchling"] = 'Aspt'
set skillhash["spawnskeleton"] = 'Asod'
set skillhash["spawnspiderlings"] = 'Assp'
set skillhash["spawnspiders"] = 'Aspd'
set skillhash["spawntentacle"] = 'ACtn'
set skillhash["spellimmunity2"] = 'ACm2'
set skillhash["spellimmunity3"] = 'ACm3'
set skillhash["spellimmunity"] = 'ACmi'
set skillhash["spikedshell"] = 'ACth'
set skillhash["spikedshell2"] = 'ACt2'
set skillhash["summonseaelemental"] = 'ACwe'
set skillhash["taunt2"] = 'ANta'
set skillhash["thornsaura"] = 'ACah'
set skillhash["trueshotaura2"] = 'ACat'
set skillhash["unholyaura"] = 'ACua'
set skillhash["unholyfrenzy2"] = 'ACuf'
set skillhash["unholyfrenzy3"] = 'Suhf'
set skillhash["vampiricaura"] = 'ACvp'
set skillhash["warstomp"] = 'Awrs'
set skillhash["warstomp2"] = 'Awrh'
set skillhash["warstomp3"] = 'Awrg'
set skillhash["web2"] = 'ACwb'
//Nuetral Hero Skills
set skillhash["hacidbomb"] = 'ANab'
set skillhash["hbattleroar"] = 'ANbr'
set skillhash["hblackarrow"] = 'ANba'
set skillhash["hbreathoffire2"] = 'ANbf'
set skillhash["hbreathoffire"] = 'ANcf'
set skillhash["hcharm"] = 'ANch'
set skillhash["hcleavingattack"] = 'ANca'
set skillhash["hclusterrockets"] = 'ANcs'
set skillhash["hcoldarrows"] = 'ANca'
set skillhash["hdarkconversion"] = 'ANdc'
set skillhash["hdarkconversion2"] = 'SNdc'
set skillhash["hdarkportal"] = 'ANdp'
set skillhash["hdeathanddecay2"] = 'SNdd'
set skillhash["hdemolish"] = 'ANde'
set skillhash["hdoom"] = 'ANdo'
set skillhash["hdrunkenbrawler"] = 'ANdb'
set skillhash["hdrunkenbrawler2"] = 'Acdb'
set skillhash["hdrunkenhaze"] = 'ANdh'
set skillhash["hdrunkenhaze2"] = 'Acdh'
set skillhash["hearthquake2"] = 'SNeq'
set skillhash["hengineeringupgrade"] = 'ANeg'
set skillhash["hferalspirit2"] = 'ACs7'
set skillhash["hfingerofdeath"] = 'ANfd'
set skillhash["hfirebolt"] = 'ANfb'
set skillhash["hforkedlightning"] = 'ANfl'
set skillhash["hfrostarrows"] = 'ANfa'
set skillhash["hhealingspray"] = 'ANhs'
set skillhash["hhowlofterror"] = 'ANht'
set skillhash["hincinerate"] = 'ANic'
set skillhash["hincinerate2"] = 'ANia'
set skillhash["hinferno2"] = 'ANin'
set skillhash["hinferno3"] = 'SNin'
set skillhash["hlifedrain"] = 'ANdr'
set skillhash["hmanashield"] = 'ANms'
set skillhash["hmonsoon"] = 'ANmo'
set skillhash["hpocketfactory"] = 'ANsy'
set skillhash["hpoisonarrow"] = 'AEpa'
set skillhash["hrainofchaos"] = 'ANrc'
set skillhash["hrainofchaos2"] = 'ANr3'
set skillhash["hrainoffire"] = 'ANrf'
set skillhash["hreincarnation3"] = 'ANr2'
set skillhash["hreincarnation4"] = 'ANrn'
set skillhash["hsilence"] = 'ANsi'
set skillhash["hsoulburn"] = 'ANso'
set skillhash["hsoulpreservation"] = 'ANsl'
set skillhash["hspiritbeast"] = 'ACs8'
set skillhash["hstampede"] = 'ANst'
set skillhash["hstampede2"] = 'Arsp'
set skillhash["hstormbolt2"] = 'ANsb'
set skillhash["hstormearthandfire"] = 'ANef'
set skillhash["hstormearthandfire2"] = 'Acef'
set skillhash["hsummonbear"] = 'ANsg'
set skillhash["hsummonhawk"] = 'ANsw'
set skillhash["hsummonlavaspawn"] = 'ANlm'
set skillhash["hsummonmisha"] = 'Arsg'
set skillhash["hsummonprawns"] = 'Aslp'
set skillhash["hsummonquilbeast"] = 'ANsq'
set skillhash["hsummonquilbeast2"] = 'Arsq'
set skillhash["htornado"] = 'ANto'
set skillhash["htransmute"] = 'ANtm'
set skillhash["hvolcano"] = 'ANvc'
set skillhash["hwateryminion"] = 'ANwm'
set skillhash["hwindwalk2"] = 'ANwk'
//Nuetral Passive Unit Skills
set skillhash["abolishmagic4"] = 'Andm'
set skillhash["buildingdamageaura"] = 'Atdg'
set skillhash["cyclone4"] = 'Acny'
set skillhash["ensnare3"] = 'ANen'
set skillhash["frostarmor3"] = 'ACfu'
set skillhash["hardenedskin2"] = 'Ansk'
set skillhash["parasite"] = 'ANpa'
set skillhash["slowaura"] = 'Aasl'
set skillhash["tornadospin"] = 'Atsp'
set skillhash["wander2"] = 'Atwa'
//Special Skills
set skillhash["permanentimmolation"] = 'ANpi'
set skillhash["permanentimmolation2"] = 'Apig'
set skillhash["phoenixfire2"] = 'Apmf'
set skillhash["poisonsting"] = 'Apoi'
set skillhash["illusions"] = 'AIil'
set skillhash["soultheft"] = 'AIso'
set skillhash["permanentinvisibility"] = 'Apiv'
set skillhash["orbofdarkness"] = 'ANbs'
set skillhash["orboflightning"] = 'AIll'
set skillhash["orbofslow"] = 'AIsb'
set skillhash["orbofcorruption"] = 'AIcb'
set skillhash["orboffire"] = 'AIfb'
set skillhash["orboffrost"] = 'AIob'
set skillhash["orbofpoison"] = 'AIpb'
//Custom Skills
//Bard
set skillhash["bookofsongs"] = 'BooS'
set skillhash["healingrift"] = 'HeRi'
set skillhash["bladebolero"] = 'BlBo'
set skillhash["soundblast"] = 'DeSc'
set skillhash["rapido"] = 'Rapi'
set skillhash["echoes"] = 'Echo'
//Warrior
set skillhash["warthreat"] = 'WarT'
set skillhash["ancienthammer"] = 'AHam'
set skillhash["crushingblow"] = 'crub'
set skillhash["shieldblock"] = 'SBlo'
//Hunter
set skillhash["summontrainedwolf"] = 'SuWo'
set skillhash["readyaimfire"] = 'DMas'
set skillhash["cloyingpowder"] = 'ClPo'
set skillhash["spreadshot"] = 'SpSh'
set skillhash["explodingbullet"] = 'ExBu'
set skillhash["explodingshells"] = 'ExSh'
//Human Mage
set skillhash["electrocute"] = 'Elec'
set skillhash["fireball"] = 'FiBa'
set skillhash["tidalwave"] = 'IcCo'
set skillhash["doublecast"] = 'DblC'
set skillhash["stormbolt"] = 'StBo'
set skillhash["freezingblast"] = 'FrBl'
set skillhash["warmth"] = 'Warm'
set skillhash["storm"] = 'Strm'
//Human Swordsman
set skillhash["fierceslash"] = 'FieS'
set skillhash["inspiringshout"] = 'InsS'
set skillhash["swordmastery"] = 'SwMa'
set skillhash["blastingzone"] = 'BlZo'
//Human Crusader
set skillhash["shieldofdivinity"] = 'shod'
set skillhash["righteoushammer"] = 'RiHa'
set skillhash["cover"] = 'Cove'
set skillhash["sanctuary"] = 'Sanc'
//Human Assassin
set skillhash["swiftasshadows"] = 'asas'
set skillhash["assassinate"] = 'aitn'
set skillhash["backstab"] = 'BacS'
set skillhash["smokebomb"] = 'SmBo'
//Elven Cleric
set skillhash["wall"] = 'Wall'
set skillhash["divinelight"] = 'DLig'
set skillhash["callholyphoenix"] = 'suhp'
set skillhash["life"] = 'HCli'
//Elven Archer
set skillhash["magiccurtain"] = 'A05H'
set skillhash["psionicarrow"] = 'PsiA'
set skillhash["elementalvolley"] = 'ElVo'
set skillhash["mimic"] = 'mimi'
//Lightning Lord
set skillhash["summonlightningelemental"] = 'SEle'
//Dragoon Skills
set skillhash["grandblood"] = 'GBlo'
set skillhash["draconiclance"] = 'A063'
//Troll Witchdoctor
set skillhash["benevoodoo"] = 'Bene'
set skillhash["clarityaura"] = 'PoBL'
set skillhash["malvoodoo"] = 'MaVo'
set skillhash["ritualdance"] = 'RiDa'
//Orc Shaman
set skillhash["tidalhaven"] = 'THav'
set skillhash["blazeshield"] = 'BlSh'
set skillhash["whirlwind"] = 'WhWi'
set skillhash["landslide"] = 'RoDr'
//Orc Warlock
set skillhash["firewall"] = 'A011'
set skillhash["inferno"] = 'A00U'
set skillhash["firewall"] = 'A011'
set skillhash["pact"] = 'Pact'
set skillhash["manadisplacement"] = 'MaDr'
set skillhash["bloodstar"] = 'BlSt'
//Orc Samurai
set skillhash["whirringblade"] = 'blsa'
set skillhash["swordtoss"] = 'A04E'
set skillhash["pierce"] = 'Pier'
set skillhash["thirdeye"] = 'A00V'
//Orc Gruntie
set skillhash["axetoss"] = 'AxeT'
set skillhash["resolve"] = 'BlLi'
set skillhash["lacerate"] = 'Lace'
set skillhash["flurry"] = 'Flur'
//Tauren Tribesman
set skillhash["innerstrength"] = 'InSt'
set skillhash["inspire"] = 'Insp'
set skillhash["ancientghost"] = 'AnGh'
set skillhash["ancestralblessing"] = 'AnBl'
//Troll Voodoo Hunter
set skillhash["vodunspin"] = 'blsp'
set skillhash["blastward"] = 'BlWa'
set skillhash["drowsycask"] = 'DrCa'
set skillhash["insectswarm"] = 'InSw'
set skillhash["dragonsbreath"] = 'A001'
//UNDEAD******************
//Undead Baron
set skillhash["petrify"] = 'Petr'
set skillhash["chillingdeath"] = 'FrAA'
set skillhash["chillingdeathaura"] = 'FrAA'
set skillhash["chillingaura"] = 'FrAA'
set skillhash["deathchillaura"] = 'FrAA'
set skillhash["deathchill"] = 'FrAA'
set skillhash["grimgift"] = 'GrGi'
set skillhash["doom"] = 'Doom'
set skillhash["underworldpull"] = 'UnPu'
//Undead Knight
set skillhash["unholyintervention"] = 'oroc'
set skillhash["siphon"] = 'sang'
set skillhash["overwhelmingpresence"] = 'OvPr'
set skillhash["reaperspull"] = 'RePu'
//Dark Waywalker
set skillhash["souleater"] = 'SoEa'
set skillhash["shadestrike"] = 'ShSt'
set skillhash["criticalaura"] = 'CrAu'
set skillhash["massivecleave"] = 'MaCl'
//Undead Rogue
set skillhash["poisondaggers"] = 'PoDa'
set skillhash["doubleattack"] = 'DoAt'
set skillhash["blinkslash"] = 'BlSl'
set skillhash["cripplingblow"] = 'Crip'
//Vampire
set skillhash["hbloodlust"] = 'BLus'
set skillhash["bloodpower"] = 'BlPo'
set skillhash["auspice"] = 'Ausp'
set skillhash["drink"] = 'BLus'
//Undead Ranger
set skillhash["drain"] = 'drai'
set skillhash["cursedsoul"] = 'CurS'
set skillhash["carrionarrow"] = 'A00Y'
set skillhash["pestilence"] = 'Pest'
//Monk
set skillhash["chakra"] = 'chak'
set skillhash["zen"] = 'MZen'
//Undead Summoner
set skillhash["raisecorpse"] = 'RCor'
set skillhash["feastinglocust"] = 'A008'
set skillhash["boneshield"] = 'BoSh'
set skillhash["animatebones"] = 'AnBo'
set skillhash["bonebeast"] = 'BoBe'
set skillhash["revelindead"] = 'ReID'
//Undead Banshee
set skillhash["wailingessence"] = 'SoSh'
set skillhash["tormentedsound"] = 'ToSo'
//Nightelf Giant
set skillhash["smashdown"] = 'SmDo'
set skillhash["giantquake"] = 'GiQu'
set skillhash["mossarmor"] = 'A00T'
set skillhash["tauntpassive"] = 'A00P'
//Nightelf Ranger
set skillhash["arrowvolley"] = 'MuSh'
set skillhash["poisonarrows"] = 'AEpa'
set skillhash["summonowl"] = 'A00O'
set skillhash["snareshot"] = 'SnSh'
set skillhash["scavange"] = 'Scav'
//Nightelf Slayer
set skillhash["lifeandmanacombustion"] = 'LMCo'
set skillhash["combustion"] = 'LMCo'
set skillhash["lifecombustion"] = 'LCom'
set skillhash["manacombustion"] = 'MCom'
set skillhash["dryadstrike"] = 'DrSt'
set skillhash["orb"] = 'Aorb'
set skillhash["counterpierce"] = 'CoPi'
//Spell Sword Skills
set skillhash["matram"] = 'Rech'
set skillhash["bolt"] = 'Bolt'
set skillhash["phase"] = 'Phas' //Double Skill
set skillhash["elementalshift"] = 'EleS' //Double Skill
//Monk
set skillhash["blazingpalm"] = 'BlPa'
set skillhash["cleavingfist"] = 'GuFi'
set skillhash["pummel"] = 'Pulv'
set skillhash["combomastery"] = 'CoMa'
set skillhash["earthbreaker"] = 'EaBr'
//Lizardfolk Geomancer
set skillhash["sandblast"] = 'A052'
set skillhash["livingembers"] = 'LiEm'
set skillhash["earthharness"] = 'EaHa'
set skillhash["geode"] = 'Geod'
//Druid
set skillhash["animalaspect"] = 'AnAs'
set skillhash["maneatergrove"] = 'MaGr'
set skillhash["growtreants"] = 'A04P'
set skillhash["petalward"] = 'PWrd'
set skillhash["callplant"] = 'CVin'
set skillhash["growl"] = 'grow'
set skillhash["toughness"] = 'toug'
set skillhash["protect"] = 'prot'
set skillhash["claw"] = 'claw'
set skillhash["bite"] = 'bite'
set skillhash["howl"] = 'howl'
set skillhash["manaburn4"] = 'mana'
set skillhash["roots"] = 'root'
set skillhash["barkskin"] = 'bark'
set skillhash["bloom"] = 'bloo'
set skillhash["rebirth"] = 'rebi'
set skillhash["tailwhip"] = 'tail'
set skillhash["snap"] = 'snap'
set skillhash["poison"] = 'pois'
set skillhash["evasion5"] = 'evas'
set skillhash["dive"] = 'dive'
set skillhash["flock"] = 'floc'
//Moon Priestess
set skillhash["moonfire"] = 'MoFi'
set skillhash["lunarblessing"] = 'LuBl'
set skillhash["summonmoonelemental"] = 'SuME'
set skillhash["moonelemental"] = 'SuME'
set skillhash["starfall"] = 'StFa'
//Extra Hero Skills (REQUEST)
set skillhash["virtue"] = 'A01E'
set skillhash["patience"] = 'A01B'
set skillhash["prayer"] = 'A01C'
set skillhash["determination"] = 'A01D'
//Extra Hero Skills
set skillhash["icewall"] = 'IcWa'
set skillhash["galewall"] = 'GaWa'
set skillhash["doublecastactive"] = 'DblA'
set skillhash["dmteleport"] = 'DMTe'
set skillhash["comet"] = 'mete'
set skillhash["meteorstorm"] = 'MeSt'
set skillhash["megaflare"] = 'Mega'
set skillhash["nimble"] = 'A05X'
set skillhash["summonthunderelemental"] = 'SLEl'
set skillhash["life1"] = 'life'
set skillhash["calm"] = 'Calm'
set skillhash["trollherb"] = 'THer'
set skillhash["hydraward"] = 'A007'
set skillhash["witheringrememberance"] = 'WRem'
set skillhash["consumelife"] = 'CoLi'
set skillhash["stomp"] = 'A01H'
set skillhash["tormentingchains"] = 'ToCh'
set skillhash["sacremento"] = 'Sacr'
set skillhash["shock"] = 'Shoc'
set skillhash["soultrap"] = 'SoTr'
set skillhash["raisehero"] = 'RaHe'
set skillhash["berserk"] = 'Bers'
set skillhash["hphaseshift"] = 'A04N'
set skillhash["cointoss"] = 'CoiT'
set skillhash["wasted"] = 'Wast'
set skillhash["dice"] = 'Dice'
set skillhash["spinningbeer"] = 'Beer'
set skillhash["spinningbeerbottles"] = 'Beer'
set skillhash["lastcall"] = 'LstC'
set skillhash["improvedodds"] = 'ImpO'
//Extra Unit Skills
set skillhash["addtostock"] = 'Ad2S'
set skillhash["add2stock"] = 'Ad2S'
set skillhash["inventory"] = 'uinv'
set skillhash["scorch"] = 'A054'
set skillhash["shock1"] = 'A05G'
set skillhash["summonsacrifice"] = 'A04W'
set skillhash["deathanddecay"] = 'A02N'
set skillhash["crit1.2"] = 'Cr12'
set skillhash["crit1.2invisible"] = 'CrBk'
set skillhash["meleeimmunity"] = 'Mmun'
set skillhash["rangedimmunity"] = 'Rmun'
set skillhash["permanence"] = 'perm'
set skillhash["commands"] = 'comm'
set skillhash["castspell"] = 'A03N'
set skillhash["invisibilitycontrol"] = 'A04S'
set skillhash["pickupitems"] = 'A00D'
set skillhash["pickupitem"] = 'A00D'
set skillhash["itempickup"] = 'A00D'
set skillhash["takeflight"] = 'drfl'
set skillhash["annoyingsting"] = 'anst'
set skillhash["autoblink"] = 'aubl'
set skillhash["penguinsqueek"] = 'AIpz'
endfunction
endscope
//TESH.scrollpos=387
//TESH.alwaysfold=0
globals
hashtable AH
endglobals
function AttachmentList_Actions takes nothing returns nothing
//(AH, 1, TYPEDFX, REALMODELPATH)
call SaveStr(AH, 1, StringHash("barkskin"), "Abilities\\Spells\\NightElf\\Barkskin\\BarkSkinTarget.mdl")
call SaveStr(AH, 1, StringHash("trollburrow"), "buildings\\orc\\TrollBurrow\\TrollBurrow.mdl")
call SaveStr(AH, 1, StringHash("fireballmissile"), "Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl")
call SaveStr(AH, 1, StringHash("deathcoilmissile"), "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilMissile.mdl")
call SaveStr(AH, 1, StringHash("ancientprotectormissile"), "Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl")
call SaveStr(AH, 1, StringHash("orbofdeathmissile"), "Abilities\\Spells\\Undead\\OrbOfDeath\\OrbOfDeathMissile.mdl")
call SaveStr(AH, 1, StringHash("arrowmissile"), "Abilities\\Weapons\\Arrow\\ArrowMissile.mdl")
call SaveStr(AH, 1, StringHash("banditmissile"), "Abilities\\Weapons\\Banditmissile\\Banditmissile.mdl")
call SaveStr(AH, 1, StringHash("spiritofvengeancemissile"), "Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl")
call SaveStr(AH, 1, StringHash("bansheemissile"), "Abilities\\Weapons\\BansheeMissile\\BansheeMissile.mdl")
call SaveStr(AH, 1, StringHash("harpymissile"), "Abilities\\Weapons\\HarpyMissile\\HarpyMissile.mdl")
call SaveStr(AH, 1, StringHash("reddragonmissile"), "Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl")
call SaveStr(AH, 1, StringHash("bloodelfmissile"), "Abilities\\Weapons\\BloodElfMissile\\BloodElfMissile.mdl")
call SaveStr(AH, 1, StringHash("cryptfiendmissile"), "Abilities\\Weapons\\CryptFiendMissile\\CryptFiendMissile.mdl")
call SaveStr(AH, 1, StringHash("cannontowermissile"), "Abilities\\Weapons\\CannonTowerMissile\\CannonTowerMissile.mdl")
call SaveStr(AH, 1, StringHash("guardtowermissile"), "Abilities\\Weapons\\GuardTowerMissile\\GuardTowerMissile.mdl")
call SaveStr(AH, 1, StringHash("chimaeraacidmissile"), "Abilities\\Weapons\\ChimaeraAcidMissile\\ChimaeraAcidMissile.mdl")
call SaveStr(AH, 1, StringHash("chimaeralightningmissile"), "Abilities\\Weapons\\ChimaeraLightningMissile\\ChimaeraLightningMissile.mdl")
call SaveStr(AH, 1, StringHash("wingedserpentmissile"), "Abilities\\Weapons\\WingedSerpentMissile\\WingedSerpentMissile.mdl")
call SaveStr(AH, 1, StringHash("corrosivebreathmissile"), "Abilities\\Spells\\NightElf\\CorrosiveBreath\\CorrosiveBreathMissile.mdl")
call SaveStr(AH, 1, StringHash("demolishermissile"), "abilities\\weapons\\DemolisherMissile\\DemolisherMissile.mdl")
call SaveStr(AH, 1, StringHash("demonhuntermissile"), "Abilities\\Weapon\\DemonHunterMissile\\DemonHunterMissile.mdl")
call SaveStr(AH, 1, StringHash("catapultmissile"), "abilities\\weapons\\catapult\\catapultmissile.mdl")
call SaveStr(AH, 1, StringHash("dragonhawkmissile"), "Abilities\\Weapons\\DragonHawkMissile\\DragonHawkMissile.mdl")
call SaveStr(AH, 1, StringHash("druidofthetalonmissile"), "Abilities\\Weapons\\DruidoftheTalonMissile\\DruidoftheTalonMissile.mdl")
call SaveStr(AH, 1, StringHash("dryadmissile"), "Abilities\\Weapons\\Dryadmissile\\Dryadmissile.mdl")
call SaveStr(AH, 1, StringHash("voidwalkermissile"), "Abilities\\Weapons\\VoidWalkerMissile\\VoidWalkerMissile.mdl")
call SaveStr(AH, 1, StringHash("faeriedragonmissile"), "Abilities\\Weapons\\FaerieDragonMissile\\FaerieDragonMissile.mdl")
call SaveStr(AH, 1, StringHash("farseermissile"), "Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl")
call SaveStr(AH, 1, StringHash("lordofflamemissile"), "Abilities\\Weapons\\LordofFlameMissile\\LordofFlameMissile.mdl")
call SaveStr(AH, 1, StringHash("gyrocopterimpact"), "Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl")
call SaveStr(AH, 1, StringHash("gyrocoptermissile"), "Abilities\\Weapons\\GyroCopter\\GyroCopterMissile.mdl")
call SaveStr(AH, 1, StringHash("frostwyrmmissile"), "Abilities\\Weapons\\FrostWyrmMissile\\FrostWyrmMissile.mdl")
call SaveStr(AH, 1, StringHash("gargoylemissile"), "Abilities\\Weapons\\GargoyleMissile\\GargoyleMissile.mdl")
call SaveStr(AH, 1, StringHash("glaivemissile"), "Abilities\\Weapons\\GlaiveMissile\\GlaiveMissile.mdl")
call SaveStr(AH, 1, StringHash("poisonarrowmissile"), "Abilities\\Weapons\\PoisonArrow\\PoisonArrowMissile.mdl")
call SaveStr(AH, 1, StringHash("fragdriller"), "Abilities\\Weapons\\FragDriller\\FragDriller.mdl")
call SaveStr(AH, 1, StringHash("greendragonmissile"), "Abilities\\Weapons\\GreenDragonMissile\\GreenDragonMissile.mdl")
call SaveStr(AH, 1, StringHash("gryphonridermissile"), "Abilities\\Weapons\\GryphonRiderMissile\\GryphonRiderMissile.mdl")
call SaveStr(AH, 1, StringHash("zigguratfrostmissile"), "Abilities\\Weapons\\ZigguratFrostMissile\\ZigguratFrostMissile.mdl")
call SaveStr(AH, 1, StringHash("boatmissile"), "Abilities\\Weapons\\BoatMissile\\BoatMissile.mdl")
call SaveStr(AH, 1, StringHash("sentinelmissile"), "Abilities\\Weapons\\SentinelMissile\\SentinelMissile.mdl")
call SaveStr(AH, 1, StringHash("hydraliskimpact"), "Abilities\\Weapons\\HydraliskImpact\\HydraliskImpact.mdl")
call SaveStr(AH, 1, StringHash("illidanmissile"), "Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl")
call SaveStr(AH, 1, StringHash("keepergrovemissile"), "Abilities\\Weapons\\KeeperGroveMissile\\KeeperGroveMissile.mdl")
call SaveStr(AH, 1, StringHash("axemissile"), "Abilities\\Weapons\\Axe\\AxeMissile.mdl")
call SaveStr(AH, 1, StringHash("lavaspawnmissile"), "Abilities\\Weapons\\LavaSpawnMissile\\LavaSpawnMissile.mdl")
call SaveStr(AH, 1, StringHash("lichmissile"), "Abilities\\Weapons\\LichMissile\\LichMissile.mdl")
call SaveStr(AH, 1, StringHash("locustmissile"), "Abilities\\Weapons\\LocustMissile\\LocustMissile.mdl")
call SaveStr(AH, 1, StringHash("makuramissile"), "Abilities\\Weapons\\MakuraMissile\\MakuraMissile.mdl")
call SaveStr(AH, 1, StringHash("meatwagonmissile"), "Abilities\\Weapons\\MeatwagonMissile\\MeatwagonMissile.mdl")
call SaveStr(AH, 1, StringHash("mortarmissile"), "Abilities\\Weapons\\Mortar\\MortarMissile.mdl")
call SaveStr(AH, 1, StringHash("murgulmagicmissile"), "Abilities\\Weapons\\MurgulMagicMissile\\MurgulMagicMissile.mdl")
call SaveStr(AH, 1, StringHash("nagaarrowmissile"), "Abilities\\Weapons\\NagaArrowMissile\\NagaArrowMissile.mdl")
call SaveStr(AH, 1, StringHash("necromancermissile"), "Abilities\\Weapons\\NecromancerMissile\\NecromancerMissile.mdl")
call SaveStr(AH, 1, StringHash("zigguratmissile"), "Abilities\\Weapons\\ZigguratMissile\\ZigguratMissile.mdl")
call SaveStr(AH, 1, StringHash("brewmastermissile"), "Abilities\\Weapons\\BrewmasterMissile\\BrewmasterMissile.mdl")
call SaveStr(AH, 1, StringHash("phoenixmissile"), "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl")
call SaveStr(AH, 1, StringHash("priestmissile"), "Abilities\\Weapons\\PriestMissile\\PriestMissile.mdl")
call SaveStr(AH, 1, StringHash("moonpriestessmissile"), "Abilities\\Weapons\\MoonPriestessMissile\\MoonPriestessMissile.mdl")
call SaveStr(AH, 1, StringHash("bristlebackmissile"), "Abilities\\Weapons\\BristleBackMissile\\BristleBackMissile.mdl")
call SaveStr(AH, 1, StringHash("seaelementalmissile"), "Abilities\\Weapons\\SeaElementalMissile\\SeaElementalMissile.mdl")
call SaveStr(AH, 1, StringHash("rexxarmissile"), "Abilities\\Weapons\\RexxarMissile\\RexxarMissile.mdl")
call SaveStr(AH, 1, StringHash("rifleimpact"), "Abilities\\Weapons\\Rifle\\RifleImpact.mdl")
call SaveStr(AH, 1, StringHash("blackkeepermissile"), "Abilities\\Weapons\\BlackKeeperMissile\\BlackKeeperMissile.mdl")
call SaveStr(AH, 1, StringHash("serpentwardmissile"), "Abilities\\Weapons\\SerpentWardMissile\\SerpentWardMissile.mdl")
call SaveStr(AH, 1, StringHash("shadowhuntermissile"), "Abilities\\Weapons\\ShadowHunterMissile\\ShadowHunterMissile.mdl")
call SaveStr(AH, 1, StringHash("rocketmissile"), "Abilities\\Weapons\\RocketMissile\\RocketMissile.mdl")
call SaveStr(AH, 1, StringHash("steamtankimpact"), "Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl")
call SaveStr(AH, 1, StringHash("skeletalmagemissile"), "Abilities\\Weapons\\SkeletalMageMissile\\SkeletalMageMissile.mdl")
call SaveStr(AH, 1, StringHash("ancestralguardianmissile"), "Abilities\\Weapons\\AncestralGuardianMissile\\AncestralGuardianMissile.mdl")
call SaveStr(AH, 1, StringHash("sludgemissile"), "Abilities\\Weapons\\SludgeMissile\\SludgeMissile.mdl")
call SaveStr(AH, 1, StringHash("sorceressmissile"), "Abilities\\Weapons\\SorceressMissile\\SorceressMissile.mdl")
call SaveStr(AH, 1, StringHash("spellbreakermissile"), "Abilities\\Weapons\\BloodElfSpellThiefMISSILE\\BloodElfSpellThiefMISSILE.mdl")
call SaveStr(AH, 1, StringHash("vengeancemissile"), "Abilities\\Weapons\\VengeanceMissile\\VengeanceMissile.mdl")
call SaveStr(AH, 1, StringHash("snapmissile"), "Abilities\\Weapons\\snapMissile\\snapMissile.mdl")
call SaveStr(AH, 1, StringHash("battrollmissile"), "Abilities\\Weapons\\BatTrollMissile\\BatTrollMissile.mdl")
call SaveStr(AH, 1, StringHash("huntermissile"), "abilities\\weapons\\huntermissile\\huntermissile.mdl")
call SaveStr(AH, 1, StringHash("witchdoctormissile"), "Abilities\\Weapons\\WitchDoctorMissile\\WitchDoctorMissile.mdl")
call SaveStr(AH, 1, StringHash("tuskarspear"), "abilities\\weapons\\TuskarSpear\\TuskarSpear.mdl")
call SaveStr(AH, 1, StringHash("wardenmissile"), "Abilities\\Weapons\\WardenMissile\\WardenMissile.mdl")
call SaveStr(AH, 1, StringHash("waterelementalmissile"), "Abilities\\Weapons\\WaterElementalMissile\\WaterElementalMissile.mdl")
call SaveStr(AH, 1, StringHash("wyvernspearmissile"), "abilities\\weapons\\WyvernSpear\\WyvernSpearMissile.mdl")
//SPECIAL/EXPLODE/DEATH
call SaveStr(AH, 1, StringHash("abominationexplosion"), "Units\\Undead\\Abomination\\AbominationExplosion.mdl")
call SaveStr(AH, 1, StringHash("ucanceldeath"), "Objects\\Spawnmodels\\Undead\\UCancelDeath\\UCancelDeath.mdl")
call SaveStr(AH, 1, StringHash("hcanceldeath"), "Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl")
call SaveStr(AH, 1, StringHash("nagadeath"), "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl")
call SaveStr(AH, 1, StringHash("necanceldeath"), "Objects\\Spawnmodels\\NightElf\\NECancelDeath\\NECancelDeath.mdl")
call SaveStr(AH, 1, StringHash("humanlargedeathexplode"), "Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl")
call SaveStr(AH, 1, StringHash("orclargedeathexplode"), "Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl")
call SaveStr(AH, 1, StringHash("demonlargedeathexplode"), "Objects\\Spawnmodels\\Demon\\DemonLargeDeathExplode\\DemonLargeDeathExplode.mdl")
call SaveStr(AH, 1, StringHash("undeadlargedeathexplode"), "Objects\\Spawnmodels\\Undead\\UndeadLargeDeathExplode\\UndeadLargeDeathExplode.mdl")
call SaveStr(AH, 1, StringHash("nightelflargedeathexplode"), "Objects\\Spawnmodels\\NightElf\\NightElfLargeDeathExplode\\NightElfLargeDeathExplode.mdl")
call SaveStr(AH, 1, StringHash("glaivemissiletarget"), "Abilities\\Weapons\\GlaiveMissile\\GlaiveMissileTarget.mdl")
call SaveStr(AH, 1, StringHash("gryphonridermissiletarget"), "Abilities\\Weapons\\GryphonRiderMissile\\GryphonRiderMissileTarget.mdl")
call SaveStr(AH, 1, StringHash("orcsmalldeathexplode"), "Objects\\Spawnmodels\\Orc\\OrcSmallDeathExplode\\OrcSmallDeathExplode.mdl")
call SaveStr(AH, 1, StringHash("demonsmalldeathexplode"), "Objects\\Spawnmodels\\Demon\\DemonSmallDeathExplode\\DemonSmallDeathExplode.mdl")
call SaveStr(AH, 1, StringHash("wispexplode"), "Units\\NightElf\\Wisp\\WispExplode.mdl")
//ITEMS
call SaveStr(AH, 1, StringHash("battlestandard"), "Objects\\InventoryItems\\BattleStandard\\BattleStandard.mdl")
call SaveStr(AH, 1, StringHash("bundleoflumber"), "Objects\\InventoryItems\\BundleofLumber\\BundleofLumber.mdl")
call SaveStr(AH, 1, StringHash("penguin"), "Units\\Critters\\Penguin\\Penguin.mdl")
call SaveStr(AH, 1, StringHash("treasurechest"), "Objects\\InventoryItems\\TreasureChest\\treasurechest.mdl")
call SaveStr(AH, 1, StringHash("glyph"), "Objects\\InventoryItems\\Glyph\\Glyph.mdl")
call SaveStr(AH, 1, StringHash("potofgold"), "Objects\\InventoryItems\\PotofGold\\PotofGold.mdl")
call SaveStr(AH, 1, StringHash("humancaptureflag"), "Objects\\InventoryItems\\HumanCaptureFlag\\HumanCaptureFlag.mdl")
call SaveStr(AH, 1, StringHash("barrelsunit"), "Buildings\\Other\\BarrelsUnit0\\BarrelsUnit0.mdl")
call SaveStr(AH, 1, StringHash("nightelfcaptureflag"), "Objects\\InventoryItems\\NightElfCaptureFlag\\NightElfCaptureFlag.mdl")
call SaveStr(AH, 1, StringHash("orccaptureflag"), "Objects\\InventoryItems\\OrcCaptureFlag\\OrcCaptureFlag.mdl")
call SaveStr(AH, 1, StringHash("runicobject"), "Objects\\InventoryItems\\runicobject\\runicobject.mdl")
call SaveStr(AH, 1, StringHash("questionmark"), "Objects\\InventoryItems\\QuestionMark\\QuestionMark.mdl")
call SaveStr(AH, 1, StringHash("crystalshard"), "Objects\\InventoryItems\\CrystalShard\\CrystalShard.mdl")
call SaveStr(AH, 1, StringHash("shimmerweed"), "Objects\\InventoryItems\\Shimmerweed\\Shimmerweed.mdl")
call SaveStr(AH, 1, StringHash("thunderlizardegg"), "Objects\\InventoryItems\\ThunderLizardEgg\\ThunderLizardEgg.mdl")
call SaveStr(AH, 1, StringHash("phoenixegg"), "Units\\Human\\Phoenix\\PhoenixEgg.mdl")
call SaveStr(AH, 1, StringHash("tomegreen"), "Objects\\InventoryItems\\tomeGreen\\tomeGreen.mdl")
call SaveStr(AH, 1, StringHash("tomeblue"), "Objects\\InventoryItems\\tomeBlue\\tomeBlue.mdl")
call SaveStr(AH, 1, StringHash("tome"), "Objects\\InventoryItems\\tome\\tome.mdl")
call SaveStr(AH, 1, StringHash("tomebrown"), "Objects\\InventoryItems\\tomeBrown\\tomeBrown.mdl")
call SaveStr(AH, 1, StringHash("tomered"), "Objects\\InventoryItems\\tomeRed\\tomeRed.mdl")
call SaveStr(AH, 1, StringHash("undeadcaptureflag"), "Objects\\InventoryItems\\UndeadCaptureFlag\\UndeadCaptureFlag.mdl")
//ABILITIES
call SaveStr(AH, 1, StringHash("dispelmagic"), "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl")
call SaveStr(AH, 1, StringHash("absorbmana"), "Abilities\\Spells\\Undead\\AbsorbMana\\AbsorbManaBirthMissile.mdl")
call SaveStr(AH, 1, StringHash("bottlemissile"), "Abilities\\Spells\\Other\\AcidBomb\\BottleMissile.mdl")
call SaveStr(AH, 1, StringHash("ancestralspirit"), "Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl")
call SaveStr(AH, 1, StringHash("animatedead"), "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call SaveStr(AH, 1, StringHash("obsidianregenaura"), "Abilities\\Spells\\Undead\\RegenerationAura\\ObsidianRegenAura.mdl")
call SaveStr(AH, 1, StringHash("avatar"), "Abilities\\Spells\\Human\\Avatar\\AvatarCaster.mdl")
call SaveStr(AH, 1, StringHash("roar"), "Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl")
call SaveStr(AH, 1, StringHash("trollbeserker"), "Abilities\\Spells\\Orc\\TrollBerserk\\TrollBeserkerTarget.mdl")
call SaveStr(AH, 1, StringHash("blackarrowmissile"), "Abilities\\Spells\\Other\\BlackArrow\\BlackArrowMissile.mdl")
call SaveStr(AH, 1, StringHash("undeadminecircle"), "Abilities\\Spells\\Undead\\UndeadMine\\UndeadMineCircle.mdl")
call SaveStr(AH, 1, StringHash("blinktarget"), "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl")
call SaveStr(AH, 1, StringHash("blinkcaster"), "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl")
call SaveStr(AH, 1, StringHash("breathoffiredamage"), "Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl")
call SaveStr(AH, 1, StringHash("breathoffire"), "Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireMissile.mdl")
call SaveStr(AH, 1, StringHash("breathoffrost"), "Abilities\\Spells\\Other\\BreathOfFrost\\BreathOfFrostMissile.mdl")
call SaveStr(AH, 1, StringHash("brilliance"), "Abilities\\Spells\\Human\\Brilliance\\Brilliance.mdl")
call SaveStr(AH, 1, StringHash("demolisherfiremissile"), "Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl")
call SaveStr(AH, 1, StringHash("carrionswarmmissile"), "Abilities\\Spells\\Undead\\CarrionSwarm\\CarrionSwarmMissile.mdl")
call SaveStr(AH, 1, StringHash("carrionswarmdamage"), "Abilities\\Spells\\Undead\\CarrionSwarm\\CarrionSwarmDamage.mdl")
call SaveStr(AH, 1, StringHash("lightningboltmissile"), "Abilities\\Spells\\Orc\\LightningBolt\\LightningBoltMissile.mdl")
call SaveStr(AH, 1, StringHash("boltimpact"), "Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call SaveStr(AH, 1, StringHash("charm"), "Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl")
call SaveStr(AH, 1, StringHash("resourceeffect"), "Abilities\\Spells\\Items\\ResourceItems\\ResourceEffectTarget.mdl")
call SaveStr(AH, 1, StringHash("cleavedamage"), "Abilities\\Spells\\Other\\Cleave\\CleaveDamageTarget.mdl")
call SaveStr(AH, 1, StringHash("tinkerrocketmissile"), "Abilities\\Spells\\Other\\TinkerRocket\\TinkerRocketMissile.mdl")
call SaveStr(AH, 1, StringHash("coldarrowmissile"), "Abilities\\Weapons\\ColdArrow\\ColdArrowMissile.mdl")
call SaveStr(AH, 1, StringHash("drumscaster"), "Abilities\\Spells\\Orc\\WarDrums\\DrumsCasterHeal.mdl")
call SaveStr(AH, 1, StringHash("controlmagic"), "Abilities\\Spells\\Human\\ControlMagic\\ControlMagicTarget.mdl")
call SaveStr(AH, 1, StringHash("spiritwalkerchange"), "Abilities\\Spells\\Orc\\EtherealForm\\SpiritWalkerChange.mdl")
call SaveStr(AH, 1, StringHash("gravemarker"), "Abilities\\Spells\\Undead\\Graveyard\\GraveMarker.mdl")
call SaveStr(AH, 1, StringHash("crushingwavemissile"), "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveMissile.mdl")
call SaveStr(AH, 1, StringHash("crushingwave"), "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl")
call SaveStr(AH, 1, StringHash("darkportal"), "Abilities\\Spells\\Demon\\DarkPortal\\DarkPortalTarget.mdl")
call SaveStr(AH, 1, StringHash("darkritualcaster"), "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualCaster.mdl")
call SaveStr(AH, 1, StringHash("darkritualtarget"), "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl")
call SaveStr(AH, 1, StringHash("darksummonmissile"), "Abilities\\Spells\\Undead\\DarkSummoning\\DarkSummonMissile.mdl")
call SaveStr(AH, 1, StringHash("darksummon"), "Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl")
call SaveStr(AH, 1, StringHash("deathcoil"), "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl")
call SaveStr(AH, 1, StringHash("deathpactcaster"), "Abilities\\Spells\\Undead\\DeathPact\\DeathPactCaster.mdl")
call SaveStr(AH, 1, StringHash("deathpacttarget"), "Abilities\\Spells\\Undead\\DeathPact\\DeathPactTarget.mdl")
call SaveStr(AH, 1, StringHash("defend"), "Abilities\\Spells\\Human\\Defend\\DefendCaster.mdl")
call SaveStr(AH, 1, StringHash("devotionaura"), "Abilities\\Spells\\Human\\DevotionAura\\DevotionAura.mdl")
call SaveStr(AH, 1, StringHash("devour"), "Abilities\\Spells\\Orc\\Devour\\DevourEffectArt.mdl")
call SaveStr(AH, 1, StringHash("devourmagicmissile"), "Abilities\\Spells\\Undead\\DevourMagic\\DevourMagicBirthMissile.mdl")
call SaveStr(AH, 1, StringHash("plaguecloud"), "Abilities\\Spells\\Undead\\PlagueCloud\\PlagueCloudCaster.mdl")
call SaveStr(AH, 1, StringHash("disenchant"), "Abilities\\Spells\\Orc\\Disenchant\\DisenchantSpecialArt.mdl")
call SaveStr(AH, 1, StringHash("brewmastermissile"), "Abilities\\Spells\\Other\\StrongDrink\\BrewmasterMissile.mdl")
call SaveStr(AH, 1, StringHash("eattree"), "Abilities\\Spells\\NightElf\\EatTree\\EatTreeSprite.mdl")
call SaveStr(AH, 1, StringHash("commandaura"), "Abilities\\Spells\\Orc\\CommandAura\\CommandAura.mdl")
call SaveStr(AH, 1, StringHash("ensnaremissile"), "Abilities\\Spells\\Orc\\Ensnare\\EnsnareMissile.mdl")
call SaveStr(AH, 1, StringHash("roots"), "Abilities\\Spells\\NightElf\\EntangleMine\\Roots.mdl")
call SaveStr(AH, 1, StringHash("fanofknives"), "Abilities\\Spells\\NightElf\\FanOfKnives\\FanOfKnivesCaster.mdl")
call SaveStr(AH, 1, StringHash("fanofknivesmissile"), "Abilities\\Spells\\NightElf\\FanOfKnives\\FanOfKnivesMissile.mdl")
call SaveStr(AH, 1, StringHash("arcanetowerattack"), "Abilities\\Spells\\Human\\Feedback\\ArcaneTowerAttack.mdl")
call SaveStr(AH, 1, StringHash("spellbreakerattack"), "Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl")
call SaveStr(AH, 1, StringHash("feralspirit"), "Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl")
call SaveStr(AH, 1, StringHash("demonboltimpact"), "Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl")
call SaveStr(AH, 1, StringHash("flak"), "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl")
call SaveStr(AH, 1, StringHash("flamestrike"), "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeTarget.mdl")
call SaveStr(AH, 1, StringHash("flamestrike1"), "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl")
call SaveStr(AH, 1, StringHash("flare"), "Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl")
call SaveStr(AH, 1, StringHash("flyingmachineimpact"), "Abilities\\Weapons\\FlyingMachine\\FlyingMachineImpact.mdl")
call SaveStr(AH, 1, StringHash("freezingbreathmissile"), "Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathMissile.mdl")
call SaveStr(AH, 1, StringHash("nagacoldarrowmissile"), "Abilities\\Spells\\Other\\FrostArrows\\NagaColdArrowMissile.mdl")
call SaveStr(AH, 1, StringHash("frostboltmissile"), "Abilities\\Spells\\Other\\FrostBolt\\FrostBoltMissile.mdl")
call SaveStr(AH, 1, StringHash("frostnova"), "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl")
call SaveStr(AH, 1, StringHash("gather"), "Abilities\\Spells\\NightElf\\TargetArtLumber\\TargetArtLumber.mdl")
call SaveStr(AH, 1, StringHash("heal"), "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl")
call SaveStr(AH, 1, StringHash("healingsalve"), "Abilities\\Spells\\Items\\HealingSalve\\HealingSalveTarget.mdl")
call SaveStr(AH, 1, StringHash("healbottlemissile"), "Abilities\\Spells\\Other\\HealingSpray\\HealBottleMissile.mdl")
call SaveStr(AH, 1, StringHash("healingwave"), "Abilities\\Spells\\Orc\\HealingWave\\HealingWaveTarget.mdl")
call SaveStr(AH, 1, StringHash("holybolt"), "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl")
call SaveStr(AH, 1, StringHash("howlcaster"), "Abilities\\Spells\\Other\\HowlOfTerror\\HowlCaster.mdl")
call SaveStr(AH, 1, StringHash("rockboltmissile"), "Abilities\\Weapons\\RockBoltMissile\\RockBoltMissile.mdl")
call SaveStr(AH, 1, StringHash("impale"), "Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl")
call SaveStr(AH, 1, StringHash("infernal"), "Units\\Demon\\Infernal\\InfernalBirth.mdl")
call SaveStr(AH, 1, StringHash("invisibility"), "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdl")
call SaveStr(AH, 1, StringHash("agilitygain"), "Abilities\\Spells\\Items\\AIam\\AIamTarget.mdl")
call SaveStr(AH, 1, StringHash("orbdarkness"), "Abilities\\Spells\\Items\\OrbDarkness\\OrbDarkness.mdl")
call SaveStr(AH, 1, StringHash("orbcorruptionmissile"), "Abilities\\Spells\\Items\\OrbCorruption\\OrbCorruptionMissile.mdl")
call SaveStr(AH, 1, StringHash("orbcorruptionspecial"), "Abilities\\Spells\\Items\\OrbCorruption\\OrbCorruptionSpecialArt.mdl")
call SaveStr(AH, 1, StringHash("orbcorruption"), "Abilities\\Spells\\Items\\OrbCorruption\\OrbCorruption.mdl")
call SaveStr(AH, 1, StringHash("fireorbspecial"), "Abilities\\Spells\\Items\\AIfb\\AIfbSpecialArt.mdl")
call SaveStr(AH, 1, StringHash("fireorbtarget"), "Abilities\\Spells\\Items\\AIfb\\AIfbTarget.mdl")
call SaveStr(AH, 1, StringHash("frostorbspecial"), "Abilities\\Spells\\Items\\AIob\\AIobSpecialArt.mdl")
call SaveStr(AH, 1, StringHash("frostorbtarget"), "Abilities\\Spells\\Items\\AIob\\AIobTarget.mdl")
call SaveStr(AH, 1, StringHash("venomorbmissile"), "Abilities\\Spells\\Items\\OrbVenom\\OrbVenomMissile.mdl")
call SaveStr(AH, 1, StringHash("venomorbspecial"), "Abilities\\Spells\\Items\\OrbVenom\\OrbVenomSpecialArt.mdl")
call SaveStr(AH, 1, StringHash("venomorb"), "Abilities\\Spells\\Items\\OrbVenom\\OrbVenom.mdl")
call SaveStr(AH, 1, StringHash("itemcommand"), "Abilities\\Spells\\Items\\AIco\\CrownOfCmndTarget.mdl")
call SaveStr(AH, 1, StringHash("itemdispel"), "Abilities\\Spells\\Items\\AItb\\AItbTarget.mdl")
call SaveStr(AH, 1, StringHash("experiencegame"), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl")
call SaveStr(AH, 1, StringHash("itemhealing"), "Abilities\\Spells\\Items\\AIhe\\AIheTarget.mdl")
call SaveStr(AH, 1, StringHash("illusion"), "Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl")
call SaveStr(AH, 1, StringHash("itemgain"), "Abilities\\Spells\\Items\\AIlm\\AIlmTarget.mdl")
call SaveStr(AH, 1, StringHash("intgain"), "Abilities\\Spells\\Items\\AIim\\AIimTarget.mdl")
call SaveStr(AH, 1, StringHash("reveal"), "Abilities\\Spells\\Items\\PotionOfOmniscience\\CrystalBallCaster.mdl")
call SaveStr(AH, 1, StringHash("soultheft"), "Abilities\\Spells\\Items\\AIso\\AIsoTarget.mdl")
call SaveStr(AH, 1, StringHash("strgain"), "Abilities\\Spells\\Items\\AIsm\\AIsmTarget.mdl")
call SaveStr(AH, 1, StringHash("armorgain"), "Abilities\\Spells\\Items\\AIre\\AIreTarget.mdl")
call SaveStr(AH, 1, StringHash("areagain"), "Abilities\\Spells\\Items\\AIda\\AIdaCaster.mdl")
call SaveStr(AH, 1, StringHash("iteminvis"), "Abilities\\Spells\\Items\\AIvi\\AIviTarget.mdl")
call SaveStr(AH, 1, StringHash("lifesteal"), "Abilities\\Spells\\Undead\\VampiricAura\\VampiricAuraTarget.mdl")
call SaveStr(AH, 1, StringHash("magicsentry"), "Abilities\\Spells\\Human\\MagicSentry\\MagicSentryCaster.mdl")
call SaveStr(AH, 1, StringHash("manaburntarget"), "Abilities\\Spells\\NightElf\\ManaBurn\\ManaBurnTarget.mdl")
call SaveStr(AH, 1, StringHash("massteleport"), "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl")
call SaveStr(AH, 1, StringHash("massteleportcaster"), "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl")
call SaveStr(AH, 1, StringHash("massteleporttarget"), "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl")
call SaveStr(AH, 1, StringHash("mirrorimagemissile"), "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageMissile.mdl")
call SaveStr(AH, 1, StringHash("mirrorimage"), "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl")
call SaveStr(AH, 1, StringHash("levelup"), "Abilities\\Spells\\Other\\Levelup\\LevelupCaster.mdl")
call SaveStr(AH, 1, StringHash("annihilationmissile"), "Abilities\\Spells\\Undead\\OrbOfDeath\\AnnihilationMissile.mdl")
call SaveStr(AH, 1, StringHash("lightningorbspecial"), "Abilities\\Spells\\Items\\AIlb\\AIlbSpecialArt.mdl")
call SaveStr(AH, 1, StringHash("lightningorbtarget"), "Abilities\\Spells\\Items\\AIlb\\AIlbTarget.mdl")
call SaveStr(AH, 1, StringHash("sloworbmissile"), "Abilities\\Weapons\\ProcMissile\\ProcMissile.mdl")
call SaveStr(AH, 1, StringHash("sloworb"), "Abilities\\Spells\\Items\\OrbSlow\\OrbSlow.mdl")
call SaveStr(AH, 1, StringHash("parasitemissile"), "Abilities\\Spells\\Other\\Parasite\\ParasiteMissile.mdl")
call SaveStr(AH, 1, StringHash("phaseshift"), "Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl")
call SaveStr(AH, 1, StringHash("markofchaos"), "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")
call SaveStr(AH, 1, StringHash("phoenixfiremissile"), "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl")
call SaveStr(AH, 1, StringHash("pocketfactorymissile"), "Units\\Creeps\\HeroTinkerFactory\\HeroTinkerFactoryMissle.mdl")
call SaveStr(AH, 1, StringHash("poisonstringmissile"), "Abilities\\Weapons\\PoisonSting\\PoisonStingMissile.mdl")
call SaveStr(AH, 1, StringHash("fallingsheep"), "Abilities\\Spells\\Human\\Polymorph\\PolyMorphFallingSheepArt.mdl")
call SaveStr(AH, 1, StringHash("polymorph"), "Abilities\\Spells\\Human\\Polymorph\\PolyMorphTarget.mdl")
call SaveStr(AH, 1, StringHash("possessionmissile"), "Abilities\\Spells\\Undead\\Possession\\PossessionMissile.mdl")
call SaveStr(AH, 1, StringHash("purge"), "Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl")
call SaveStr(AH, 1, StringHash("quillspraymissile"), "Abilities\\Weapons\\QuillSprayMissile\\QuillSprayMissile.mdl")
call SaveStr(AH, 1, StringHash("raiseskeleton"), "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl")
call SaveStr(AH, 1, StringHash("neutralizationmissile"), "Abilities\\Spells\\Items\\WandOfNeutralization\\NeutralizationMissile.mdl")
call SaveStr(AH, 1, StringHash("reincarnation"), "Abilities\\Spells\\Orc\\Reincarnation\\ReincarnationTarget.mdl")
call SaveStr(AH, 1, StringHash("reinforce"), "Abilities\\Spells\\Orc\\ReinforcedTrollBurrow\\ReinforcedTrollBurrowTarget.mdl")
call SaveStr(AH, 1, StringHash("replenish"), "Abilities\\Spells\\Undead\\ReplenishHealth\\ReplenishHealthCaster.mdl")
call SaveStr(AH, 1, StringHash("replenishoverhead"), "Abilities\\Spells\\Undead\\ReplenishHealth\\ReplenishHealthCasterOverhead.mdl")
call SaveStr(AH, 1, StringHash("replenishmana"), "Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCaster.mdl")
call SaveStr(AH, 1, StringHash("replenishmanaoverhead"), "Abilities\\Spells\\Items\\AIma\\AImaTarget.mdl")
call SaveStr(AH, 1, StringHash("moonwellcaster"), "Abilities\\Spells\\NightElf\\MoonWell\\MoonWellCasterArt.mdl")
call SaveStr(AH, 1, StringHash("moonwelltarget"), "Abilities\\Spells\\NightElf\\MoonWell\\MoonWellTarget.mdl")
call SaveStr(AH, 1, StringHash("ressurectcaster"), "Abilities\\Spells\\Human\\Resurrect\\ResurrectCaster.mdl")
call SaveStr(AH, 1, StringHash("ressurecttarget"), "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl")
call SaveStr(AH, 1, StringHash("revive"), "Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl")
call SaveStr(AH, 1, StringHash("awaken"), "Abilities\\Spells\\Other\\Awaken\\Awaken.mdl")
call SaveStr(AH, 1, StringHash("scoutmissile"), "Units\\NightElf\\Owl\\Owl.mdl")
call SaveStr(AH, 1, StringHash("shadowstrikemissile"), "Abilities\\Spells\\NightElf\\shadowstrike\\ShadowStrikeMissile.mdl")
call SaveStr(AH, 1, StringHash("shockwavemissile"), "Abilities\\Spells\\Orc\\Shockwave\\ShockwaveMissile.mdl")
call SaveStr(AH, 1, StringHash("arrow"), "Abilities\\Spells\\Other\\Aneu\\AneuCaster.mdl")
call SaveStr(AH, 1, StringHash("shopsharing"), "Abilities\\Spells\\Other\\Aneu\\AneuCaster.mdl")
call SaveStr(AH, 1, StringHash("blackarrow"), "Abilities\\Spells\\Other\\Aneu\\AneuTarget.mdl")
call SaveStr(AH, 1, StringHash("silence"), "Abilities\\Spells\\Other\\Silence\\SilenceAreaBirth.mdl")
call SaveStr(AH, 1, StringHash("sleep"), "Abilities\\Spells\\Other\\CreepSleep\\CreepSleepTarget.mdl")
call SaveStr(AH, 1, StringHash("slow"), "Abilities\\Spells\\Human\\Slow\\SlowCaster.mdl")
call SaveStr(AH, 1, StringHash("spellshield"), "Abilities\\Spells\\Items\\SpellShieldAmulet\\SpellShieldCaster.mdl")
call SaveStr(AH, 1, StringHash("spellstealmissile"), "Abilities\\Spells\\Human\\SpellSteal\\SpellStealMissile.mdl")
call SaveStr(AH, 1, StringHash("spellsteal"), "Abilities\\Spells\\Human\\SpellSteal\\SpellStealTarget.mdl")
call SaveStr(AH, 1, StringHash("sphere"), "Abilities\\Spells\\NightElf\\SpiritOfVengeance\\SpiritOfVengeanceOrbs1.mdl")
call SaveStr(AH, 1, StringHash("bloodelfball"), "Units\\Human\\HeroBloodElf\\BloodElfBall.mdl")
call SaveStr(AH, 1, StringHash("snapmissile"), "Abilities\\Weapons\\snapMissile\\snapMissile.mdl")
call SaveStr(AH, 1, StringHash("battrollmissile"), "Abilities\\Weapons\\BatTrollMissile\\BatTrollMissile.mdl")
call SaveStr(AH, 1, StringHash("taunt"), "Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl")
call SaveStr(AH, 1, StringHash("spikedbarricade"), "Abilities\\Spells\\Orc\\SpikeBarrier\\SpikeBarrier.mdl")
call SaveStr(AH, 1, StringHash("spiritlinkzap"), "Abilities\\Spells\\Orc\\SpiritLink\\SpiritLinkZapTarget.mdl")
call SaveStr(AH, 1, StringHash("spirittouch"), "Abilities\\Spells\\Undead\\ReplenishMana\\SpiritTouchTarget.mdl")
call SaveStr(AH, 1, StringHash("stampedemissiledeath"), "Abilities\\Spells\\Other\\Stampede\\MissileDeath.mdl ")
call SaveStr(AH, 1, StringHash("stampedemissile"), "Abilities\\Spells\\Other\\Stampede\\StampedeMissile.mdl")
call SaveStr(AH, 1, StringHash("manadraincaster"), "Abilities\\Spells\\Other\\Drain\\ManaDrainCaster.mdl")
call SaveStr(AH, 1, StringHash("manadraintarget"), "Abilities\\Spells\\Other\\Drain\\ManaDrainTarget.mdl")
call SaveStr(AH, 1, StringHash("stormboltmissile"), "Abilities\\Spells\\Human\\StormBolt\\StormBoltMissile.mdl")
call SaveStr(AH, 1, StringHash("stormearthandfiremissile"), "Units\\Creeps\\FirePandarenBrewmaster\\FirePandarenBrewmaster_Missile.mdl")
call SaveStr(AH, 1, StringHash("polymorphground"), "Abilities\\Spells\\Human\\Polymorph\\PolyMorphDoneGround.mdl")
call SaveStr(AH, 1, StringHash("feralspiritdone"), "Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl")
call SaveStr(AH, 1, StringHash("summoningritualtarget"), "Abilities\\Spells\\Other\\ANrm\\ANrmTarget.mdl")
call SaveStr(AH, 1, StringHash("thornsaura"), "Abilities\\Spells\\NightElf\\ThornsAura\\ThornsAura.mdl")
call SaveStr(AH, 1, StringHash("thunderclap"), "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl")
call SaveStr(AH, 1, StringHash("tomeofretraining"), "Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl")
call SaveStr(AH, 1, StringHash("goldbottlemissile"), "Abilities\\Spells\\Other\\Transmute\\GoldBottleMissile.mdl")
call SaveStr(AH, 1, StringHash("treeoflifeupgrade"), "Abilities\\Spells\\NightElf\\TreeofLifeUpgrade\\TreeofLifeUpgradeTargetArt.mdl")
call SaveStr(AH, 1, StringHash("trueshotaura"), "Abilities\\Spells\\NightElf\\TrueshotAura\\TrueshotAura.mdl")
call SaveStr(AH, 1, StringHash("unholyaura"), "Abilities\\Spells\\Undead\\UnholyAura\\UnholyAura.mdl")
call SaveStr(AH, 1, StringHash("vampiricaura"), "Abilities\\Spells\\Undead\\VampiricAura\\VampiricAura.mdl")
call SaveStr(AH, 1, StringHash("vamppotion"), "Abilities\\Spells\\Items\\VampiricPotion\\VampPotionCaster.mdl")
call SaveStr(AH, 1, StringHash("warstomp"), "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl")
call SaveStr(AH, 1, StringHash("webmissile"), "Abilities\\Spells\\Undead\\Web\\Webmissile.mdl")
////BUFFS
call SaveStr(AH, 1, StringHash("bottleimpact"), "Abilities\\Spells\\Other\\AcidBomb\\BottleImpact.mdl")
call SaveStr(AH, 1, StringHash("aerialshacklestarget"), "Abilities\\Spells\\Human\\AerialShackles\\AerialShacklesTarget.mdl")
call SaveStr(AH, 1, StringHash("antimagicshell"), "Abilities\\Spells\\Undead\\AntiMagicShell\\AntiMagicShell.mdl")
call SaveStr(AH, 1, StringHash("banish"), "Abilities\\Spells\\Human\\Banish\\BanishTarget.mdl")
call SaveStr(AH, 1, StringHash("berserk"), "Abilities\\Spells\\Orc\\TrollBerserk\\HeadhunterWEAPONSLeft.mdl")
call SaveStr(AH, 1, StringHash("voodooaura"), "Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl")
call SaveStr(AH, 1, StringHash("voodooaura"), "Abilities\\Spells\\Orc\\Voodoo\\VoodooAuraTarget.mdl")
call SaveStr(AH, 1, StringHash("blizzard"), "Abilities\\Spells\\Human\\Blizzard\\BlizzardTarget.mdl")
call SaveStr(AH, 1, StringHash("bloodlust"), "Abilities\\Spells\\Orc\\Bloodlust\\BloodlustTarget.mdl")
call SaveStr(AH, 1, StringHash("breathoffrost"), "Abilities\\Spells\\Other\\BreathOfFrost\\BreathOfFrostTarget.mdl")
call SaveStr(AH, 1, StringHash("brillianceaura"), "Abilities\\Spells\\Other\\GeneralAuraTarget\\GeneralAuraTarget.mdl")
call SaveStr(AH, 1, StringHash("largefire"), "Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl")
call SaveStr(AH, 1, StringHash("mediumfire"), "Environment\\LargeBuildingFire\\LargeBuildingFire2.mdl")
call SaveStr(AH, 1, StringHash("smallfire"), "Environment\\SmallBuildingFire\\SmallBuildingFire2.mdl")
call SaveStr(AH, 1, StringHash("elflargefire"), "Environment\\NightElfBuildingFire\\ElfLargeBuildingFire1.mdl")
call SaveStr(AH, 1, StringHash("elfmediumfire"), "Environment\\NightElfBuildingFire\\ElfLargeBuildingFire2.mdl")
call SaveStr(AH, 1, StringHash("elfsmallfire"), "Environment\\NightElfBuildingFire\\ElfSmallBuildingFire2.mdl")
call SaveStr(AH, 1, StringHash("undeadlargefire"), "Environment\\UndeadBuildingFire\\UndeadLargeBuildingFire1.mdl")
call SaveStr(AH, 1, StringHash("undeadmediumfire"), "Environment\\UndeadBuildingFire\\UndeadLargeBuildingFire2.mdl")
call SaveStr(AH, 1, StringHash("undeadsmallfire"), "Environment\\UndeadBuildingFire\\UndeadSmallBuildingFire2.mdl")
call SaveStr(AH, 1, StringHash("cloud"), "Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl")
call SaveStr(AH, 1, StringHash("chimaeraacid"), "Abilities\\Spells\\NightElf\\CorrosiveBreath\\ChimaeraAcidTargetArt.mdl")
call SaveStr(AH, 1, StringHash("cripple"), "Abilities\\Spells\\Undead\\Cripple\\CrippleTarget.mdl")
call SaveStr(AH, 1, StringHash("curse"), "Abilities\\Spells\\Undead\\Curse\\CurseTarget.mdl")
call SaveStr(AH, 1, StringHash("cyclone"), "Abilities\\Spells\\NightElf\\Cyclone\\CycloneTarget.mdl")
call SaveStr(AH, 1, StringHash("zombify"), "Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl")
call SaveStr(AH, 1, StringHash("deathanddecay"), "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl")
call SaveStr(AH, 1, StringHash("deathanddecaydamage"), "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl")
call SaveStr(AH, 1, StringHash("plaguecloud"), "Units\\Undead\\PlagueCloud\\PlagueCloudtarget.mdl")
call SaveStr(AH, 1, StringHash("stun"), "Abilities\\Spells\\Orc\\StasisTrap\\StasisTotemTarget.mdl")
call SaveStr(AH, 1, StringHash("doomdeath"), "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl")
call SaveStr(AH, 1, StringHash("doom"), "Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl")
call SaveStr(AH, 1, StringHash("draincaster"), "Abilities\\Spells\\Other\\Drain\\DrainCaster.mdl")
call SaveStr(AH, 1, StringHash("draintarget"), "Abilities\\Spells\\Other\\Drain\\DrainTarget.mdl")
call SaveStr(AH, 1, StringHash("siphoncaster"), "Abilities\\Spells\\Other\\Drain\\ManaDrainCaster.mdl")
call SaveStr(AH, 1, StringHash("siphontarget"), "Abilities\\Spells\\Other\\Drain\\ManaDrainTarget.mdl")
call SaveStr(AH, 1, StringHash("drunkenhaze"), "Abilities\\Spells\\Other\\StrongDrink\\BrewmasterTarget.mdl")
call SaveStr(AH, 1, StringHash("earthquake"), "Abilities\\Spells\\Orc\\EarthQuake\\EarthQuakeTarget.mdl")
call SaveStr(AH, 1, StringHash("ensnareair"), "Abilities\\Spells\\Orc\\Ensnare\\ensnare_AirTarget.mdl")
call SaveStr(AH, 1, StringHash("ensnare"), "Abilities\\Spells\\Orc\\Ensnare\\ensnareTarget.mdl")
call SaveStr(AH, 1, StringHash("entanglingroots"), "Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl")
call SaveStr(AH, 1, StringHash("faeriefire"), "Abilities\\Spells\\NightElf\\FaerieFire\\FaerieFireTarget.mdl")
call SaveStr(AH, 1, StringHash("flamestrikeembers"), "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeEmbers.mdl")
call SaveStr(AH, 1, StringHash("flamestrikedamage"), "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeDamageTarget.mdl")
call SaveStr(AH, 1, StringHash("flare"), "Abilities\\Spells\\Human\\Flare\\FlareTarget.mdl")
call SaveStr(AH, 1, StringHash("freezingbreath"), "Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl")
call SaveStr(AH, 1, StringHash("frostarmordamage"), "Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorDamage.mdl")
call SaveStr(AH, 1, StringHash("frostarmor"), "Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorTarget.mdl")
call SaveStr(AH, 1, StringHash("howl"), "Abilities\\Spells\\Other\\HowlOfTerror\\HowlTarget.mdl")
call SaveStr(AH, 1, StringHash("immolationdamage"), "Abilities\\Spells\\NightElf\\Immolation\\ImmolationDamage.mdl")
call SaveStr(AH, 1, StringHash("immolation"), "Abilities\\Spells\\NightElf\\Immolation\\ImmolationTarget.mdl")
call SaveStr(AH, 1, StringHash("impalehit"), "Abilities\\Spells\\Undead\\Impale\\ImpaleHitTarget.mdl")
call SaveStr(AH, 1, StringHash("stun2"), "Abilities\\Spells\\Human\\StormBolt\\StormBoltTarget.mdl")
call SaveStr(AH, 1, StringHash("incinerate"), "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl")
call SaveStr(AH, 1, StringHash("incineratebuff"), "Abilities\\Spells\\Other\\Incinerate\\IncinerateBuff.mdl")
call SaveStr(AH, 1, StringHash("innerfire"), "Abilities\\Spells\\Human\\InnerFire\\InnerFireTarget.mdl")
call SaveStr(AH, 1, StringHash("divineshield"), "Abilities\\Spells\\Human\\DivineShield\\DivineShieldTarget.mdl")
call SaveStr(AH, 1, StringHash("lavaspawnmissile"), "Abilities\\Weapons\\LavaSpawnMissile\\LavaSpawnBirthMissile.mdl")
call SaveStr(AH, 1, StringHash("lightningshieldbuff"), "Abilities\\Spells\\Orc\\LightningShield\\LightningShieldBuff.mdl")
call SaveStr(AH, 1, StringHash("lightningshield"), "Abilities\\Spells\\Orc\\LightningShield\\LightningShieldTarget.mdl")
call SaveStr(AH, 1, StringHash("liquidfire"), "Abilities\\Spells\\Orc\\LiquidFire\\Liquidfire.mdl")
call SaveStr(AH, 1, StringHash("manaflaremissile"), "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareMissile.mdl")
call SaveStr(AH, 1, StringHash("manaflareimpact"), "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBoltImpact.mdl")
call SaveStr(AH, 1, StringHash("manaflaretarget"), "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareTarget.mdl")
call SaveStr(AH, 1, StringHash("manaflare"), "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBase.mdl")
call SaveStr(AH, 1, StringHash("manaregen"), "Abilities\\Spells\\Other\\ANrl\\ANrlTarget.mdl")
call SaveStr(AH, 1, StringHash("manashield"), "Abilities\\Spells\\Human\\ManaShield\\ManaShieldCaster.mdl")
call SaveStr(AH, 1, StringHash("mirrorimagedeath"), "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageDeathCaster.mdl")
call SaveStr(AH, 1, StringHash("monsoonrain"), "Abilities\\Spells\\Other\\Monsoon\\MonsoonRain.mdl")
call SaveStr(AH, 1, StringHash("monsoon"), "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl")
call SaveStr(AH, 1, StringHash("parasite"), "Abilities\\Spells\\Other\\Parasite\\ParasiteTarget.mdl")
call SaveStr(AH, 1, StringHash("immolationreddamage"), "Abilities\\Spells\\Other\\ImmolationRed\\ImmolationRedDamage.mdl")
call SaveStr(AH, 1, StringHash("immolationred"), "Abilities\\Spells\\Other\\ImmolationRed\\ImmolationRedTarget.mdl")
call SaveStr(AH, 1, StringHash("phaseshift"), "Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl")
call SaveStr(AH, 1, StringHash("poisonsting"), "Abilities\\Weapons\\PoisonSting\\PoisonStingTarget.mdl")
call SaveStr(AH, 1, StringHash("possession"), "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl")
call SaveStr(AH, 1, StringHash("possessiontarget"), "Abilities\\Spells\\Undead\\Possession\\PossessionTarget.mdl")
call SaveStr(AH, 1, StringHash("purge"), "Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl")
call SaveStr(AH, 1, StringHash("rainoffire"), "Abilities\\Spells\\Demon\\RainOfFire\\RainOfFireTarget.mdl")
call SaveStr(AH, 1, StringHash("rejuvenation"), "Abilities\\Spells\\NightElf\\Rejuvenation\\RejuvenationTarget.mdl")
call SaveStr(AH, 1, StringHash("revealeffect"), "Abilities\\Spells\\Other\\Andt\\Andt.mdl")
call SaveStr(AH, 1, StringHash("roartarget"), "Abilities\\Spells\\NightElf\\BattleRoar\\RoarTarget.mdl")
call SaveStr(AH, 1, StringHash("sanctuary"), "Abilities\\Spells\\Items\\StaffOfSanctuary\\Staff_Sanctuary_Target.mdl")
call SaveStr(AH, 1, StringHash("scrollofprotection"), "Abilities\\Spells\\Items\\AIda\\AIdaTarget.mdl")
call SaveStr(AH, 1, StringHash("owl"), "Units\\NightElf\\Owl\\Owl.mdl")
call SaveStr(AH, 1, StringHash("shadowstrike"), "Abilities\\Spells\\NightElf\\shadowstrike\\shadowstrike.mdl")
call SaveStr(AH, 1, StringHash("silence"), "Abilities\\Spells\\Other\\Silence\\SilenceTarget.mdl")
call SaveStr(AH, 1, StringHash("sleepspecial"), "Abilities\\Spells\\Undead\\Sleep\\SleepSpecialArt.mdl")
call SaveStr(AH, 1, StringHash("sleeptarget"), "Abilities\\Spells\\Undead\\Sleep\\SleepTarget.mdl")
call SaveStr(AH, 1, StringHash("slow"), "Abilities\\Spells\\Human\\slow\\slowtarget.mdl")
call SaveStr(AH, 1, StringHash("slowed"), "Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl")
call SaveStr(AH, 1, StringHash("soulburn"), "Abilities\\Spells\\Other\\SoulBurn\\SoulBurnbuff.mdl")
call SaveStr(AH, 1, StringHash("soulthefttarget"), "Abilities\\Spells\\Items\\AIso\\BIsvTarget.mdl")
call SaveStr(AH, 1, StringHash("speedbonus"), "Abilities\\Spells\\Items\\AIsp\\SpeedTarget.mdl")
call SaveStr(AH, 1, StringHash("spellshield"), "Abilities\\Spells\\Items\\SpellShieldAmulet\\SpellShieldCaster.mdl")
call SaveStr(AH, 1, StringHash("cryptfiendmissile"), "Abilities\\Weapons\\CryptFiendMissile\\CryptFiendMissileTarget.mdl")
call SaveStr(AH, 1, StringHash("thornyshield"), "Abilities\\Spells\\Undead\\ThornyShield\\ThornyShieldTargetChestLeft.mdl")
call SaveStr(AH, 1, StringHash("spiritlink"), "Abilities\\Spells\\Orc\\SpiritLink\\SpiritLinkTarget.mdl")
call SaveStr(AH, 1, StringHash("starfall"), "Abilities\\Spells\\NightElf\\Starfall\\StarfallCaster.mdl")
call SaveStr(AH, 1, StringHash("starfalltarget"), "Abilities\\Spells\\NightElf\\Starfall\\StarfallTarget.mdl")
call SaveStr(AH, 1, StringHash("thornsauradamage"), "Abilities\\Spells\\NightElf\\ThornsAura\\ThornsAuraDamage.mdl")
call SaveStr(AH, 1, StringHash("tornado"), "Abilities\\Spells\\Other\\Tornado\\Tornado_Target.mdl")
call SaveStr(AH, 1, StringHash("tranquility"), "Abilities\\Spells\\NightElf\\Tranquility\\Tranquility.mdl")
call SaveStr(AH, 1, StringHash("tranquilitytarget"), "Abilities\\Spells\\NightElf\\Tranquility\\TranquilityTarget.mdl")
call SaveStr(AH, 1, StringHash("transmute"), "Abilities\\Spells\\Other\\Transmute\\PileofGold.mdl")
call SaveStr(AH, 1, StringHash("unholyfrenzy"), "Abilities\\Spells\\Undead\\UnholyFrenzy\\UnholyFrenzyTarget.mdl")
call SaveStr(AH, 1, StringHash("unsummon"), "Abilities\\Spells\\Undead\\Unsummon\\UnsummonTarget.mdl")
call SaveStr(AH, 1, StringHash("volcanomissile"), "Abilities\\Spells\\Other\\Volcano\\VolcanoMissile.mdl")
call SaveStr(AH, 1, StringHash("volcano"), "Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl")
call SaveStr(AH, 1, StringHash("webair"), "Abilities\\Spells\\Undead\\Web\\Web_AirTarget.mdl")
call SaveStr(AH, 1, StringHash("web"), "Abilities\\Spells\\Undead\\Web\\WebTarget.mdl")
//SPAWNED EFFECTS
call SaveStr(AH, 1, StringHash("toonboom"), "Objects\\Spawnmodels\\Other\\ToonBoom\\ToonBoom.mdl")
call SaveStr(AH, 1, StringHash("dissipate"), "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl")
call SaveStr(AH, 1, StringHash("udeath"), "Objects\\Spawnmodels\\Undead\\UDeathMedium\\UDeath.mdl")
call SaveStr(AH, 1, StringHash("smallflamespawn"), "Objects\\Spawnmodels\\Human\\SmallFlameSpawn\\SmallFlameSpawn.mdl")
call SaveStr(AH, 1, StringHash("dust"), "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl")
call SaveStr(AH, 1, StringHash("footprint"), "Objects\\Spawnmodels\\Other\\IllidanFootprint\\IllidanSpawnFootPrint1.mdl")
call SaveStr(AH, 1, StringHash("enbirth"), "Objects\\Spawnmodels\\NightElf\\EntBirthTarget\\EntBirthTarget.mdl")
//IMPORTED FX
call SaveStr(AH, 1, StringHash("fairydust"), "FairyDust.mdx")
call SaveStr(AH, 1, StringHash("bloodbuff"), "BloodBuff_squished.mdx")
call SaveStr(AH, 1, StringHash("comet"), "Comet_squished.mdx")
call SaveStr(AH, 1, StringHash("darkstar"), "DarkStar_squished.mdx")
call SaveStr(AH, 1, StringHash("dragonroar"), "Dragonroar_squished.mdx")
call SaveStr(AH, 1, StringHash("healingwater"), "HealingWater.MDX")
call SaveStr(AH, 1, StringHash("icehammer"), "IceHammer_squished.mdx")
call SaveStr(AH, 1, StringHash("lavabreath"), "LavaBreath_squished.mdx")
call SaveStr(AH, 1, StringHash("lavabreathdamage"), "LavaBreathDamage_squished.mdx")
call SaveStr(AH, 1, StringHash("lightbeam"), "Lightbeam.mdx")
call SaveStr(AH, 1, StringHash("lightcircle"), "LightCircle.mdx")
call SaveStr(AH, 1, StringHash("lightningbeam"), "LightningBeam.mdx")
call SaveStr(AH, 1, StringHash("knockbackdust"), "MDX\\KnockbackDust.mdx")
call SaveStr(AH, 1, StringHash("knockbackwater"), "MDX\\KnockbackWater.mdx")
call SaveStr(AH, 1, StringHash("megaflare"), "Megaflare.mdx")
call SaveStr(AH, 1, StringHash("soularmor"), "SoulArmor_squished.mdx")
call SaveStr(AH, 1, StringHash("stun"), "Stun.mdx")
call SaveStr(AH, 1, StringHash("waterbreath"), "WaterBreath.mdx")
call SaveStr(AH, 1, StringHash("waterbreathdamage"), "WaterBreathDamage.mdx")
call SaveStr(AH, 1, StringHash("voodoobuff"), "VoodooBuff_squished.mdx")
call SaveStr(AH, 1, StringHash("waterbuff"), "WaterBuff.mdx")
call SaveStr(AH, 1, StringHash("redsun"), "Sun.mdx")
call SaveStr(AH, 1, StringHash("negativeaura"), "GeneralAuraTargetNegative.mdx.mdx")
call SaveStr(AH, 1, StringHash("light"), "TorchHumanOmni.mdx" )
//Attachment FX
call SaveStr(AH, 1, StringHash("wizardshat"), "WizardsHat.mdx")
call SaveStr(AH, 1, StringHash("demonwings"), "WingsoftheNightmare.mdx")
call SaveStr(AH, 1, StringHash("crownarmor"), "CrownArmor.mdx")
call SaveStr(AH, 1, StringHash("knighthelmet"), "HumanKnightHelm.mdx")
call SaveStr(AH, 1, StringHash("knighthelmet2"), "HumanKnightHelm2.mdx")
call SaveStr(AH, 1, StringHash("guardhelmet"), "HumanGuardHelm.mdx")
call SaveStr(AH, 1, StringHash("crownhelmet"), "CrownHelmet.mdx")
call SaveStr(AH, 1, StringHash("crownbootr"), "CrownBootR.mdx")
call SaveStr(AH, 1, StringHash("crownbootl"), "CrownBootL.mdx")
call SaveStr(AH, 1, StringHash("crownshield"), "CrownShield.mdx")
call SaveStr(AH, 1, StringHash("nightelfshield"), "NightElfShield.mdx")
call SaveStr(AH, 1, StringHash("hydrobane"), "Hydrobane.mdx")
call SaveStr(AH, 1, StringHash("pyrebane"), "Pyrebane.mdx")
call SaveStr(AH, 1, StringHash("woodenbow"), "WoodenBow.mdx")
call SaveStr(AH, 1, StringHash("spikedclub"), "SpikedClub.mdx")
call SaveStr(AH, 1, StringHash("skullmask"), "SkullShroud.mdx")
call SaveStr(AH, 1, StringHash("frostwings"), "ShivasWings.mdx")
call SaveStr(AH, 1, StringHash("scarf"), "Demonscarf.mdx")
call SaveStr(AH, 1, StringHash("royalscepter"), "RoyalScepter.mdx")
call SaveStr(AH, 1, StringHash("royalscepter2"), "RoyalScepter2.mdx")
call SaveStr(AH, 1, StringHash("royalcrown2"), "RoyalCorwn2.mdx")
call SaveStr(AH, 1, StringHash("royalcrown"), "RoyalCrown.mdx")
call SaveStr(AH, 1, StringHash("royalcloak"), "RoyalCloak.mdx")
call SaveStr(AH, 1, StringHash("voodoomask"), "VoodooMask.mdx")
call SaveStr(AH, 1, StringHash("truthsword"), "SwordOfOver9000Truths.mdx")
call SaveStr(AH, 1, StringHash("rodofnecromancy"), "RodOfNecromancy.mdx")
call SaveStr(AH, 1, StringHash("plateshoulders"), "PlateShoulder.mdx")
call SaveStr(AH, 1, StringHash("obsidianhelmet"), "Obsidianhelm.mdx")
call SaveStr(AH, 1, StringHash("sword"), "MithrilSword.mdx")
call SaveStr(AH, 1, StringHash("spear"), "MithrilSpear.mdx")
call SaveStr(AH, 1, StringHash("mace"), "MithrilMace.mdx")
call SaveStr(AH, 1, StringHash("dagger"), "MithrilDagger.mdx")
call SaveStr(AH, 1, StringHash("axe"), "MithrilAxe.mdx")
call SaveStr(AH, 1, StringHash("mindstaff"), "Mindstaff.mdx")
call SaveStr(AH, 1, StringHash("armor"), "MailArmor.mdx")
call SaveStr(AH, 1, StringHash("magicianstaff"), "MagicianStaff.mdx")
call SaveStr(AH, 1, StringHash("magehat"), "MageHat.mdx")
call SaveStr(AH, 1, StringHash("infernalhammer"), "InfernalDestroyer.mdx")
call SaveStr(AH, 1, StringHash("shroud"), "ImperialAssassinShroud.mdx")
call SaveStr(AH, 1, StringHash("blackcape"), "ImperialAssassinShroud2.mdx")
call SaveStr(AH, 1, StringHash("plateshoulders2"), "FWPlateShoulders.mdx")
call SaveStr(AH, 1, StringHash("hawkmask"), "FaceguardoftheHawk.mdx")
call SaveStr(AH, 1, StringHash("hawkmask2"), "FaceguardoftheHawk2.mdx")
call SaveStr(AH, 1, StringHash("dragonwings"), "DragonWings.mdx")
call SaveStr(AH, 1, StringHash("dragontail"), "DragonTail.mdx")
call SaveStr(AH, 1, StringHash("lightningdagger"), "LightningDagger.mdx")
call SaveStr(AH, 1, StringHash("holylongsword"), "LongswordofMarr.mdx")
call SaveStr(AH, 1, StringHash("lance"), "LanceOfHonor.mdx")
call SaveStr(AH, 1, StringHash("rod"), "JainaStaff.mdx")
call SaveStr(AH, 1, StringHash("hellbow"), "HellShot.mdx")
call SaveStr(AH, 1, StringHash("hellsword"), "Hellreaver.mdx")
call SaveStr(AH, 1, StringHash("staff"), "FurionStaff.mdx")
call SaveStr(AH, 1, StringHash("druidstaff"), "DruidStaff.mdx")
call SaveStr(AH, 1, StringHash("barbarianshoulders"), "BarbPlateShoulders.mdx")
call SaveStr(AH, 1, StringHash("corruptedsword"), "CorruptedBladev2.mdx")
call SaveStr(AH, 1, StringHash("crystalwings"), "ChrystalWings.mdx")
call SaveStr(AH, 1, StringHash("clotharmor"), "WitchHunterGear.MDX")
call SaveStr(AH, 1, StringHash("clotharmor2"), "WitchHunterGear2.mdx")
call SaveStr(AH, 1, StringHash("bardiche"), "Bardiche.mdx")
call SaveStr(AH, 1, StringHash("dogbags"), "DogBags_Attachments.mdx")
call SaveStr(AH, 1, StringHash("mask"), "Demonmask.mdx")
call SaveStr(AH, 1, StringHash("arcanestaff"), "ArcaneStaff.mdx")
call SaveStr(AH, 1, StringHash("voodoomask"), "VoodooMask.mdx")
call SaveStr(AH, 1, StringHash("woodbow"), "Woodbow.mdx")
call SaveStr(AH, 1, StringHash("crossbow"), "Crossbow.mdx")
call SaveStr(AH, 1, StringHash("bloodelfarmor"), "Chest_BloodElf_M.mdx" )
call SaveStr(AH, 1, StringHash("humanarmor"), "Chest_Human_M.mdx" )
call SaveStr(AH, 1, StringHash("undeadarmor"), "Chest_Undead_M.mdx" )
call SaveStr(AH, 1, StringHash("hammerofdawn"), "HammerOfDawn.mdx" )
call SaveStr(AH, 1, StringHash("maul"), "Maul.mdx" )
call SaveStr(AH, 1, StringHash("deathfrost"), "DeathFrost.mdx" )
call SaveStr(AH, 1, StringHash("rainbowstaff"), "RainbowStaff.mdx" )
call SaveStr(AH, 1, StringHash("lionshield"), "Lion_Shield.mdx" )
call SaveStr(AH, 1, StringHash("basicshield"), "Poor_Soldier's_Shield.mdx" )
call SaveStr(AH, 1, StringHash("clothhat"), "WitchHunterHat.MDX" )
call SaveStr(AH, 1, StringHash("piratehat"), "PirateHat.MDX" )
call SaveStr(AH, 1, StringHash("bandana"), "Bandana.MDX" )
call SaveStr(AH, 1, StringHash("magewand"), "NewWand.mdx" )
call SaveStr(AH, 1, StringHash("hornedhelm"), "HornedGreatHelm.mdx" )
call SaveStr(AH, 1, StringHash("batstaff"), "StaffofDemonicEntities.mdx" )
call SaveStr(AH, 1, StringHash("magicstaff"), "StaffOfAges.mdx" )
call SaveStr(AH, 1, StringHash("blackhelm"), "HornedHelm.mdx" )
call SaveStr(AH, 1, StringHash("negationstaff"), "StaffOfNegation.mdx" )
call SaveStr(AH, 1, StringHash("quarterstaff"), "Quarterstaff.mdx" )
call SaveStr(AH, 1, StringHash("wand"), "MagicWand.mdx" )
call SaveStr(AH, 1, StringHash("carapacehelm"), "CryptLordHeadGear.mdx" )
call SaveStr(AH, 1, StringHash("frostaxe"), "DeathFrost.mdx" )
call SaveStr(AH, 1, StringHash("wolfcap"), "Wolf Cap by Sunchips.mdx" )
call SaveStr(AH, 1, StringHash("torch"), "TinyTorch1.mdx" )
call SaveStr(AH, 1, StringHash(""), "" )
call SaveStr(AH, 1, StringHash(""), "" )
call SaveStr(AH, 1, StringHash(""), "" )
call SaveStr(AH, 1, StringHash(""), "" )
endfunction
//===========================================================================
function InitTrig_Attachment_List takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterTimerEventSingle( t, 1.00 )
call TriggerAddAction( t, function AttachmentList_Actions )
set AH = InitHashtable()
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function PromotePlayer takes player pl returns nothing
local integer id = GetPlayerId(pl)+1
call FogModifierStop(DM_Fog[id])
call DestroyFogModifier(DM_Fog[id])
set DM_Fog[id] = CreateFogModifierRect(pl, FOG_OF_WAR_VISIBLE, bj_mapInitialPlayableArea, true, false)
call FogModifierStart(DM_Fog[id])
call ForceRemovePlayer(udg_Force[1], pl)
call ForceAddPlayer(udg_Force[2], pl)
set udg_GUI_Pointer[id] = CreateUnit(pl, 'E000', 13300, -13000, 0)
call SetUnitInvulnerable(udg_GUI_Pointer[id], true)
call GUIApplyCamForDM(pl)
//Set Variables
set udg_Status[id] = "none"
set udg_DM_Player[id] = Player(14)
//Apply Bonus Stats
call SetUnitBonus(udg_GUI_Pointer[id], BONUS_ARMOR, 1)
call SetUnitBonus(udg_GUI_Pointer[id], BONUS_DAMAGE, 1)
call SetUnitBonus(udg_GUI_Pointer[id], BONUS_ATTACK_SPEED,1 )
call SetUnitBonus(udg_GUI_Pointer[id], BONUS_LIFE_REGEN,1 )
call SetUnitBonus(udg_GUI_Pointer[id], BONUS_MANA_REGEN,1 )
call SetUnitBonus(udg_GUI_Pointer[id], BONUS_MOVEMENT_SPEED, 320 )
call SetUnitBonus(udg_GUI_Pointer[id], BONUS_MANA_REGEN_PERCENT, 1)
call SetUnitMaxState(udg_GUI_Pointer[id], UNIT_STATE_MAX_MANA,1 )
call SetUnitMaxState(udg_GUI_Pointer[id], UNIT_STATE_MAX_LIFE, 1)
set BonusSkill[GetUnitId(udg_GUI_Pointer[id])] = "none"
//Start Trigger Creation
//MISC
set TRIGGER_Misc_Escape[id] = CreateTrigger( )
call TriggerRegisterPlayerEventEndCinematic( TRIGGER_Misc_Escape[id], pl )
call TriggerAddAction( TRIGGER_Misc_Escape[id], function DMPressedEscape )
set TRIGGER_Misc_Select[id] = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( TRIGGER_Misc_Select[id], pl, EVENT_PLAYER_UNIT_SELECTED, null)
call TriggerAddAction( TRIGGER_Misc_Select[id], function DMMiscSelect )
call TriggerAddAction( TRIGGER_Misc_Select[id], function onGUIMiscClick )
//UNITS
set TRIGGER_Units_Click[id] = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( TRIGGER_Units_Click[id], pl, EVENT_PLAYER_UNIT_SELECTED, null)
call TriggerAddAction(TRIGGER_Units_Click[id], function onGUIUnitsClick)
//POINTER
set TRIGGER_Pointer_Point[id] = CreateTrigger( )
call TriggerRegisterUnitEvent( TRIGGER_Pointer_Point[id], udg_GUI_Pointer[id], EVENT_UNIT_ISSUED_POINT_ORDER )
call TriggerAddAction( TRIGGER_Pointer_Point[id], function OnGUIPointOrder )
set TRIGGER_Pointer_Unit[id] = CreateTrigger( )
call TriggerRegisterUnitEvent( TRIGGER_Pointer_Unit[id], udg_GUI_Pointer[id], EVENT_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddAction( TRIGGER_Pointer_Unit[id], function OnGUIUnitOrder )
//ITEMS
set TRIGGER_Items_Click[id] = CreateTrigger()
call TriggerAddAction(TRIGGER_Items_Click[id], function onGUIItemsClick)
call TriggerRegisterPlayerUnitEvent( TRIGGER_Items_Click[id], pl, EVENT_PLAYER_UNIT_SELECTED, null)
//DOODADS
set TRIGGER_Doodads_Click[id] = CreateTrigger()
call TriggerAddAction(TRIGGER_Doodads_Click[id], function onGUIDoodadsClick)
call TriggerRegisterPlayerUnitEvent( TRIGGER_Doodads_Click[id], pl, EVENT_PLAYER_UNIT_SELECTED, null)
//CLASSIFY DM AS NPC
set TRIGGER_NPC_Dies[id] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent( TRIGGER_NPC_Dies[id], pl, EVENT_PLAYER_UNIT_DEATH, null )
call TriggerAddAction( TRIGGER_NPC_Dies[id], function Trig_NPC_Dies_Actions )
call SetPlayerAlliance( pl, Player(12), ALLIANCE_SHARED_CONTROL, true)
call SetPlayerAlliance( pl, Player(14), ALLIANCE_SHARED_CONTROL, true)
call SetPlayerAlliance( Player(12), pl, ALLIANCE_SHARED_CONTROL, true)
call SetPlayerAlliance( Player(14), pl, ALLIANCE_SHARED_CONTROL, true)
//APPLY CAM
call DestroyTrigger( TRIG_Up[id] )
set TRIG_Up[id] = CreateTrigger()
call TriggerRegisterPlayerEvent(TRIG_Up[id], Player(id-1), EVENT_PLAYER_ARROW_UP_DOWN )
call TriggerAddAction( TRIG_Up[id], function DMUpArrow)
//DESTROY HERO TRIGGERS
call DestroyTrigger( TRIGGER_Hero_Reviver[id] )
call DestroyTrigger( TRIGGER_Hero_Dies[id] )
call DestroyTrigger( TRIGGER_Give_Lumber_Experience[id] )
call DisableTrigger( TRIG_HERO_Selection[id] )
//SET RESOURCES
call SetPlayerState( pl, PLAYER_STATE_RESOURCE_LUMBER, 99999 )
call SetPlayerState( pl, PLAYER_STATE_RESOURCE_GOLD, 99999 )
call TriggerSleepAction(0)
//SETUP BOARD
call LeaderboardSetLabel(udg_Board[id], "Current Status")
call PlayerSetLeaderboard(pl, udg_Board[id])
call LeaderboardSetStyle( udg_Board[id], true, true, false, false )
call LeaderboardAddItemBJ( Player(14), udg_Board[id], "|c00FFFFFFNo Active Mode|r", 0 )
call LeaderboardDisplay( udg_Board[id], true )
endfunction
function DemoteDM takes player pl returns nothing
local integer i = 0
local integer id = GetPlayerId(pl)+1
call FogModifierStop(DM_Fog[id])
call DestroyFogModifier(DM_Fog[id])
set DM_Fog[id] = CreateFogModifierRect( pl, FOG_OF_WAR_VISIBLE, gg_rct_HeroSelector, true, false )
call FogModifierStart(DM_Fog[id])
call SetPlayerState( pl, PLAYER_STATE_RESOURCE_LUMBER, 0 )
call SetPlayerState( pl, PLAYER_STATE_RESOURCE_GOLD, 0 )
call ForceAddPlayer(udg_Force[1], pl)
call ForceRemovePlayer(udg_Force[2], pl)
call RemoveUnit( udg_GUI_Pointer[id] )
set udg_GUI_Pointer[id] = null
loop
exitwhen i == bj_MAX_PLAYER_SLOTS-1
if pl != Player(i) then
call SetPlayerAlliance( pl, Player(i), ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance( Player(i), pl, ALLIANCE_SHARED_VISION, false)
endif
set i = i + 1
endloop
call SetPlayerAllianceStateAllyBJ( Player(14), pl, true )
call SetPlayerAlliance(Player(14), pl, ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance(Player(14), pl, ALLIANCE_SHARED_ADVANCED_CONTROL, false)
call SetPlayerAlliance(Player(14), pl, ALLIANCE_SHARED_CONTROL, false)
call SetPlayerAllianceStateAllyBJ( pl, Player(14), true )
call SetPlayerAlliance(pl, Player(14), ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance(pl, Player(14), ALLIANCE_SHARED_ADVANCED_CONTROL, false)
call SetPlayerAlliance(pl, Player(14), ALLIANCE_SHARED_CONTROL, false)
call SetPlayerAllianceStateAllyBJ( Player(12), pl, false )
call SetPlayerAlliance(Player(12), pl, ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance(Player(12), pl, ALLIANCE_SHARED_ADVANCED_CONTROL, false)
call SetPlayerAlliance(Player(12), pl, ALLIANCE_SHARED_CONTROL, false)
call SetPlayerAllianceStateAllyBJ( pl, Player(12), false )
call SetPlayerAlliance(pl, Player(12), ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance(pl, Player(12), ALLIANCE_SHARED_ADVANCED_CONTROL, false)
call SetPlayerAlliance(pl, Player(12), ALLIANCE_SHARED_CONTROL, false)
call EnableTrigger( TRIG_HERO_Selection[id] )
//CLEAR TRIGGERS
call DestroyTrigger( TRIGGER_Misc_Escape[id] )
call DestroyTrigger( TRIGGER_Misc_Select[id] )
call DestroyTrigger( TRIGGER_Units_Click[id] )
call DestroyTrigger( TRIGGER_Pointer_Point[id] )
call DestroyTrigger( TRIGGER_Pointer_Unit[id] )
call DestroyTrigger( TRIGGER_Items_Click[id] )
call DestroyTrigger( TRIGGER_Doodads_Click[id] )
call DestroyTrigger( TRIGGER_NPC_Dies[id] )
call DestroyTrigger( TRIGGER_HERO_Restrictor[i] )
call DestroyTrigger( TRIG_Up[id] )
//REVIVE
set TRIGGER_Hero_Reviver[id] = CreateTrigger()
call TriggerRegisterPlayerEvent( TRIGGER_Hero_Reviver[id], pl, EVENT_PLAYER_END_CINEMATIC )
call TriggerAddAction( TRIGGER_Hero_Reviver[id], function Trig_Hero_Reviver_Actions )
//DEATH
set TRIGGER_Hero_Dies[id] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent( TRIGGER_Hero_Dies[id], pl, EVENT_PLAYER_UNIT_DEATH, null )
call TriggerAddAction( TRIGGER_Hero_Dies[id], function Trig_Hero_Dies_Conditions )
//CAMERA
set TRIG_Up[id] = CreateTrigger()
call TriggerRegisterPlayerEvent(TRIG_Up[id], pl, EVENT_PLAYER_ARROW_UP_DOWN )
call TriggerAddAction( TRIG_Up[id], function UpArrow_Actions)
//LUMBER to EXP
set TRIGGER_Give_Lumber_Experience[id] = CreateTrigger( )
call TriggerRegisterPlayerStateEvent( TRIGGER_Give_Lumber_Experience[id], pl, PLAYER_STATE_RESOURCE_LUMBER, GREATER_THAN_OR_EQUAL, 0.00 )
call TriggerAddAction( TRIGGER_Give_Lumber_Experience[id], function Trig_Give_Lumber_Experience_Actions )
call TriggerSleepAction(0)
call CameraSetupApplyForPlayer( true, gg_cam_HeroSelector, pl, 0 )
//SETUP BOARD
call PlayerSetLeaderboard(pl, udg_Board[id])
if HeroClass[GetUnitId(GetPlayerHero(id))] == "" and SubClass[GetUnitId(GetPlayerHero(id))] == "" then
call LeaderboardSetLabel(udg_Board[id], "No Class")
else
call LeaderboardSetLabel(udg_Board[id], HeroClass[GetUnitId(GetPlayerHero(id))] + " " + SubClass[GetUnitId(GetPlayerHero(id))])
endif
call LeaderboardSetStyle( udg_Board[id], true, true, false, false )
call LeaderboardAddItemBJ( Player(14), udg_Board[id], "|cff7cfc00Skill Points: |r|c00FFFFFF" + I2S(SKILL_PTS[GetUnitId(GetPlayerHero(id))]) + "|r|n|cffffff00Stat Points: |r|c00FFFFFF" + I2S(STAT_PTS[GetUnitId(GetPlayerHero(id))])+"|r", 0 )
call LeaderboardDisplay( udg_Board[id], true )
endfunction
//TESH.scrollpos=114
//TESH.alwaysfold=0
//*************************
// checked for leaks
//*************************
//init
function GetEverything takes nothing returns boolean
call SetDestructableInvulnerable( GetFilterDestructable(), true )
return false
endfunction
function doMainConstants takes nothing returns nothing
set udg_Force[1] = CreateForce()
set udg_Force[2] = CreateForce()
set udg_Force[3] = CreateForce()
call ForceAddPlayer( udg_Force[1], Player(0) )
call ForceAddPlayer( udg_Force[1], Player(1) )
call ForceAddPlayer( udg_Force[1], Player(2) )
call ForceAddPlayer( udg_Force[1], Player(3) )
call ForceAddPlayer( udg_Force[1], Player(4) )
call ForceAddPlayer( udg_Force[1], Player(5) )
call ForceAddPlayer( udg_Force[1], Player(6) )
call ForceAddPlayer( udg_Force[1], Player(7) )
call ForceAddPlayer( udg_Force[1], Player(11) )
call ForceAddPlayer( udg_Force[3], Player(12) )
call ForceAddPlayer( udg_Force[3], Player(14) )
call TriggerSleepAction(0)
call PromotePlayer(Player(8))
call PromotePlayer(Player(9))
call PromotePlayer(Player(10))
call SetPlayerName(Player(12), "Enemy")
call SetPlayerName(Player(14), "Ally")
endfunction
function doInitPlayers takes nothing returns nothing
local integer id = GetPlayerId(GetEnumPlayer())+1
//set exp rate
call SetPlayerHandicapXP( GetEnumPlayer(), 0.60 )
//handle alliances:
call SetPlayerAllianceStateAllyBJ ( GetEnumPlayer(), Player(14), true )
call SetPlayerAllianceStateAllyBJ ( Player(14), GetEnumPlayer(), true )
call SetPlayerAllianceStateBJ( Player(8), GetEnumPlayer(), bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( Player(9), GetEnumPlayer(), bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( Player(10), GetEnumPlayer(), bj_ALLIANCE_ALLIED )
endfunction
function doInitDMs takes nothing returns nothing
local integer id = GetPlayerId(GetEnumPlayer())+1
//set exp rate
call SetPlayerHandicapXP( GetEnumPlayer(), 0.60 )
call SetPlayerAllianceStateAllyBJ( Player(12), GetEnumPlayer(), true )
call SetPlayerAlliance( Player(12), GetEnumPlayer(), ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance( Player(12), GetEnumPlayer(), ALLIANCE_SHARED_CONTROL, true )
call SetPlayerAlliance( Player(12), GetEnumPlayer(), ALLIANCE_SHARED_ADVANCED_CONTROL, true )
call SetPlayerAllianceStateAllyBJ( Player(14), GetEnumPlayer(), true )
call SetPlayerAlliance( Player(14), GetEnumPlayer(), ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance( Player(14), GetEnumPlayer(), ALLIANCE_SHARED_CONTROL, true )
call SetPlayerAlliance( Player(14), GetEnumPlayer(), ALLIANCE_SHARED_ADVANCED_CONTROL, true )
set bj_forLoopAIndex = 0
loop
call SetPlayerAlliance(Player(15), Player(bj_forLoopAIndex), ALLIANCE_PASSIVE, true)
call SetPlayerAlliance(Player(bj_forLoopAIndex), Player(15), ALLIANCE_PASSIVE, true)
call SetPlayerAlliance(Player(13), Player(bj_forLoopAIndex), ALLIANCE_PASSIVE, true)
call SetPlayerAlliance(Player(bj_forLoopAIndex), Player(13), ALLIANCE_PASSIVE, true)
set bj_forLoopAIndex = bj_forLoopAIndex + 1
exitwhen bj_forLoopAIndex == 15
endloop
endfunction
function Init takes nothing returns nothing
call doMainConstants()
call EnumDestructablesInRect(bj_mapInitialPlayableArea, Filter(function GetEverything), null)
call ForForce( udg_Force[1], function doInitPlayers )
call ForForce( udg_Force[2], function doInitDMs )
call SetPlayerAllianceStateBJ( Player(12), Player(14), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( Player(14), Player(12), bj_ALLIANCE_UNALLIED )
call SetPlayerState(Player(12), PLAYER_STATE_GIVES_BOUNTY, 0)
call SetPlayerState(Player(14), PLAYER_STATE_GIVES_BOUNTY, 0)
call FogModifierStart( CreateFogModifierRect( Player(15), FOG_OF_WAR_MASKED, GetWorldBounds(), false, true) )
call FogModifierStart( CreateFogModifierRect( Player(14), FOG_OF_WAR_MASKED, GetWorldBounds(), false, false) )
call FogModifierStart( CreateFogModifierRect( Player(13), FOG_OF_WAR_MASKED, GetWorldBounds(), false, true) )
call FogModifierStart( CreateFogModifierRect( Player(12), FOG_OF_WAR_MASKED, GetWorldBounds(), false, false) )
//misc
call InitTranslator()
//frameskip
call TriggerSleepAction(0)
//init dms
call TriggerExecute( gg_trg_Create )
call TriggerExecute( gg_trg_Units )
call TriggerExecute( gg_trg_Misc )
call TriggerExecute( gg_trg_Items )
//init doodads
call TriggerExecute( gg_trg_Doodads )
//init playershifts
call SetUnitOwner(gg_unit_n01Q_0278, Player(13), false)
call SetUnitOwner(gg_unit_n01Q_0288, Player(13), false)
call SetUnitOwner(gg_unit_n01Q_0287, Player(13), false)
call SetUnitOwner(gg_unit_n01C_0310, Player(13), false)
//introduce map
call ClearScreen()
call DisplayTextToForce( GetPlayersAll(), "Welcome to Vuen's D&D Grand Project! (vFinale)" )
call DisplayTextToForce( GetPlayersAll(), " " )
call DisplayTextToForce( udg_Force[1], "Please wait while a DM selects available heroes." )
call DisplayTextToForce( udg_Force[2], "You are a DM." )
call DisplayTextToForce( udg_Force[2], "Click a Hero to toggle its availability." )
call DisplayTextToForce( udg_Force[2], "|c0000FF00Green|r = Allow, |c00FF0000Red|r = Deny." )
call DisplayTextToForce( udg_Force[2], "Help is available in the quest log (|cFFFFFF00F9|r)." )
call DisplayTextToPlayer( Player(8), 0, 0, "Choose quickly; the heroes are waiting." )
endfunction
function InitTrig_Initialization takes nothing returns nothing
set gg_trg_Initialization = CreateTrigger()
call TriggerAddAction(gg_trg_Initialization, function Init)
endfunction
//TESH.scrollpos=261
//TESH.alwaysfold=0
//*************************x
// checked for leaks
//*************************
//************************************
//************************************
//********** CHAT **********
//************************************
//************************************
globals
boolean array MUTE
endglobals
function GrantBonus takes nothing returns boolean
local integer id = GetPlayerId(udg_TEMP_Player)+1
local unit f = GetFilterUnit()
if udg_TEMP_String == null then
set udg_TEMP_String = ""
endif
if not(IsUnitIdType(GetUnitTypeId(f), UNIT_TYPE_GIANT)) and not(IsUnitOwnedByPlayer(f, Player(15))) then
call SetUnitBonus(f, BONUS_ARMOR, GetUnitBonus(udg_GUI_Pointer[id], BONUS_ARMOR))
call SetUnitBonus(f, BONUS_DAMAGE, GetUnitBonus(udg_GUI_Pointer[id], BONUS_DAMAGE))
call SetUnitMaxState(f, UNIT_STATE_MAX_MANA, GetUnitState(udg_GUI_Pointer[id], UNIT_STATE_MAX_MANA))
call SetUnitMaxState(f, UNIT_STATE_MAX_LIFE, GetUnitState(udg_GUI_Pointer[id], UNIT_STATE_MAX_LIFE))
call SetUnitBonus(f, BONUS_ATTACK_SPEED, GetUnitBonus(udg_GUI_Pointer[id], BONUS_ATTACK_SPEED))
call SetUnitBonus(f, BONUS_LIFE_REGEN, GetUnitBonus(udg_GUI_Pointer[id], BONUS_LIFE_REGEN))
call SetUnitBonus(f, BONUS_MANA_REGEN, GetUnitBonus(udg_GUI_Pointer[id], BONUS_MANA_REGEN))
call SetUnitBonus(f, BONUS_MOVEMENT_SPEED, GetUnitBonus(udg_GUI_Pointer[id], BONUS_MOVEMENT_SPEED))
call SetUnitBonus(f, BONUS_MANA_REGEN_PERCENT, GetUnitBonus(udg_GUI_Pointer[id], BONUS_MANA_REGEN_PERCENT))
set UnitBounty[GetUnitId(f)] = UnitBounty[GetUnitId(udg_GUI_Pointer[id])]
call UnitAddAbility(f, skillhash[udg_TEMP_String])
endif
set f = null
return false
endfunction
function CustomAuraAdd takes nothing returns boolean
set AuraFXTimer[GetUnitId(GetFilterUnit())] = NewTimer()
if not(IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT)) and not(IsUnitOwnedByPlayer(GetFilterUnit(), Player(15))) then
call SaveUnitHandle(AuraFXHash, 0, GetHandleId(AuraFXTimer[GetUnitId(GetFilterUnit())]), GetFilterUnit())
set AuraFXA[GetUnitId(GetFilterUnit())] = 1
set AuraFXB[GetUnitId(GetFilterUnit())] = 0.05
set AuraFXC[GetUnitId(GetFilterUnit())] = 1
set AuraFXD[GetUnitId(GetFilterUnit())] = 0
set AuraFXS[GetUnitId(GetFilterUnit())] = 2
set AuraFXRing[GetUnitId(GetFilterUnit())] = 0
set AuraFXTail[GetUnitId(GetFilterUnit())] = 0.01
set AuraFX[GetUnitId(GetFilterUnit())] = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeEmbers.mdl"
call TimerStart(AuraFXTimer[GetUnitId(GetFilterUnit())], 0.04, true, function CustomAuraLoop)
endif
return false
endfunction
function CustomAuraRemove takes nothing returns boolean
set AuraFXA[GetUnitId(GetFilterUnit())] = 0
set AuraFXB[GetUnitId(GetFilterUnit())] = 0
set AuraFXC[GetUnitId(GetFilterUnit())] = 0
set AuraFXD[GetUnitId(GetFilterUnit())] = 0
set AuraFXRing[GetUnitId(GetFilterUnit())] = 0
set AuraFX[GetUnitId(GetFilterUnit())] = null
call ReleaseTimer(AuraFXTimer[GetUnitId(GetFilterUnit())])
return false
endfunction
function FXTimer takes nothing returns boolean
call ReleaseTimer( AuraFXTimer[GetUnitId(GetFilterUnit())] )
set AuraFXTimer[GetUnitId(GetFilterUnit())] = NewTimer()
if not(IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT)) and not(IsUnitOwnedByPlayer(GetFilterUnit(), Player(15))) then
call SaveUnitHandle(AuraFXHash, 0, GetHandleId(AuraFXTimer[GetUnitId(GetFilterUnit())]), GetFilterUnit())
set AuraFXTail[GetUnitId(GetFilterUnit())] = 1
if AuraFXS[GetUnitId(GetFilterUnit())] < 0.5 then
set AuraFXS[GetUnitId(GetFilterUnit())] = 1.5
endif
call TimerStart(AuraFXTimer[GetUnitId(GetFilterUnit())], AuraFXS[GetUnitId(GetFilterUnit())], true, function FXTimerLoop)
endif
return false
endfunction
function PetRelease takes nothing returns boolean
set Slave[GetUnitId(GetFilterUnit())] = null
set Master[GetUnitId(GetFilterUnit())] = null
set SlaveID[GetUnitId(GetFilterUnit())] = 0
set SlavesMaster[GetUnitId(GetFilterUnit())] = null
call UnitRemoveAbility(GetFilterUnit(), 'perm')
call UnitRemoveAbility(GetFilterUnit(), 'comm')
return false
endfunction
function DoubleSkillTaunt takes nothing returns boolean
call UnitAddAbility(GetFilterUnit(), 'A00P')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'A00P')
call TauntPassive_Data.Actions(GetFilterUnit())
return false
endfunction
function DoubleSkillCounterPierce takes nothing returns boolean
call UnitAddAbility(GetFilterUnit(), 'CoPi')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'CoPi')
call CounterPierce_Data.Actions(GetFilterUnit())
return false
endfunction
function DoubleSkillShock takes nothing returns boolean
call UnitAddAbility(GetFilterUnit(), 'Shoc')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'Shoc')
call Shock_Data.Actions(GetFilterUnit())
return false
endfunction
function DoubleSkillOverwhelming takes nothing returns boolean
call UnitAddAbility(GetFilterUnit(), 'OvPr')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'OvPr')
call OverwhelmingPresence_Data.Actions(GetFilterUnit())
return false
endfunction
function DoubleSkillTailWhip takes nothing returns boolean
call UnitAddAbility(GetFilterUnit(), 'tail')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'tail')
call Tailwhip_Data.Actions(GetFilterUnit())
return false
endfunction
function DoubleSkillEarth takes nothing returns boolean
call UnitAddAbility(GetFilterUnit(), 'EaHa')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'EaHa')
call EarthHarness_Data.Actions(GetFilterUnit())
return false
endfunction
function DoubleSkillElemental takes nothing returns boolean
call UnitAddAbility(GetFilterUnit(), 'ElVo')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'ElVo')
call ElementalQuiver_Data.Actions(GetFilterUnit())
return false
endfunction
function DoubleSkillRevel takes nothing returns boolean
call UnitAddAbility(GetFilterUnit(), 'ReID')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'ReID')
call RevelInDead_Data.Actions(GetFilterUnit())
return false
endfunction
function DoubleSkillDevour takes nothing returns boolean
if not(IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT)) and not(IsUnitOwnedByPlayer(GetFilterUnit(), Player(15))) then
call UnitAddAbility(GetFilterUnit(), 'Advc')
call UnitAddAbility(GetFilterUnit(), 'Adev')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'Adev')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'Advc')
endif
return false
endfunction
function DoubleSkillLoad takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call UnitAddAbility(GetFilterUnit(), 'Sch3')
call UnitAddAbility(GetFilterUnit(), 'Achd')
call UnitAddAbility(GetFilterUnit(), 'Aloa')
call UnitAddAbility(GetFilterUnit(), 'Adro')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'Sch3')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'Achd')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'Aloa')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'Adro')
endif
return false
endfunction
function DoubleSkillElementalShift takes nothing returns boolean
if not(IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT)) and not(IsUnitOwnedByPlayer(GetFilterUnit(), Player(15))) then
call UnitAddAbility(GetFilterUnit(), 'Shif')
call UnitAddAbility(GetFilterUnit(), 'EleS')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'Shif')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'EleS')
endif
return false
endfunction
function DoubleSkillAnimalAspect takes nothing returns boolean
if not(IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT)) and not(IsUnitOwnedByPlayer(GetFilterUnit(), Player(15))) then
call UnitAddAbility(GetFilterUnit(), 'AnAs')
call UnitAddAbility(GetFilterUnit(), 'tias')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'AnAs')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'tias')
endif
return false
endfunction
function DoubleSkillPhase takes nothing returns boolean
if not IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT) then
call UnitAddAbility(GetFilterUnit(), 'Phas')
call UnitAddAbility(GetFilterUnit(), 'PhaD')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'Phas')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'PhaD')
endif
return false
endfunction
function DoubleSkillCombustion takes nothing returns boolean
if not(IsUnitIdType(GetUnitTypeId(GetFilterUnit()), UNIT_TYPE_GIANT)) and not(IsUnitOwnedByPlayer(GetFilterUnit(), Player(15))) then
call UnitAddAbility(GetFilterUnit(), 'LMCo')
call UnitAddAbility(GetFilterUnit(), 'MCom')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'LMCo')
call UnitMakeAbilityPermanent(GetFilterUnit(), true, 'MCom')
endif
return false
endfunction
function ShowLocalDebugBoard takes nothing returns nothing
if GetTriggerPlayer() == GetLocalPlayer() then
call MultiboardDisplay( udg_DebugBoard, true )
call MultiboardMinimize( udg_DebugBoard, false )
endif
endfunction
function DebugCommand takes string str, integer id returns nothing
if udg_DebugBoardCreated then
set udg_EnableMessages = true
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, ColorName(str,id) )
call PolledWait( 4.00 )
call MultiboardSetItemValueBJ( udg_DebugBoard, 4, id, "" )
endif
endfunction
function DoCommandEntered takes integer id returns boolean
local player pl = Player(id)
local force fp = bj_FORCE_PLAYER[id]
local string str = StringCase(GetEventPlayerChatString(), false)
local string text
local integer utype = UnitId(TranslateFrom(str))
local integer i1
local integer i2
local integer count = 0
local integer array ratios
if not(IsPlayerInForce(pl, udg_Force[2])) then
return false
endif
if utype != null then
set udg_Status[id+1] = "unit_create"
set udg_DM_UnitType[id+1] = utype
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id+1], "|cFFFFFFFF-> '|r" + ColorName(TranslateTo(UnitId2String(udg_DM_UnitType[id+1])), GetPlayerId(udg_DM_Player[id+1])) + "|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id+1], pl )
call DisplayTextToPlayer( pl, 0, 0, " Right click to create a '|cFFFF0000" + TranslateTo(UnitId2String(udg_DM_UnitType[id+1])) + "|r' for " + ColorNamePl(udg_DM_Player[id+1]) + "." )
call DisplayTextToPlayer( pl, 0, 0, " Click a tile in the Toolbox to select the owner of the new unit.")
return true
endif
//DM Access Commands
if SubString(str, 0, 4) == "mute" then
if SubString(str, 4, 5) == " " then
set text = SubString(str, 5, StringLength(str))
else
set text = SubString(str, 4, StringLength(str))
endif
if MUTE[GetPlayerNumFromStrSafe(text, id)-1] == false then
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, ColorNamePl(Player(GetPlayerNumFromStrSafe(text, id)-1)) + " has been muted.")
set MUTE[GetPlayerNumFromStrSafe(text, id)-1] = true
else
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, ColorNamePl(Player(GetPlayerNumFromStrSafe(text, id)-1)) + " has been un-muted.")
set MUTE[GetPlayerNumFromStrSafe(text, id)-1] = false
endif
//Units
elseif (str == "uk") then
call SelectUnitForPlayerSingle( GUI_U_Kill, pl )
elseif (str == "uks" or str == "kill") then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function KillEnumUnitSelected )
call DebugCommand(str,id)
elseif (str == "ur") then
call SelectUnitForPlayerSingle( GUI_U_Remove, pl )
elseif (str == "urs" or str == "remove") then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function RemoveEnumUnitSelected )
call DebugCommand(str,id)
elseif (str == "uv" or str == "revive") then
call SelectUnitForPlayerSingle( GUI_U_Side, pl )
call SetCameraPositionForPlayer( pl, 13339, -12696 )
call DebugCommand(str,id)
elseif (str == "us") then
call SelectUnitForPlayerSingle( GUI_U_Side, pl )
elseif (str == "uss" or str == "side") then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SideSwapEnumUnitSelected )
call DebugCommand(str,id)
elseif (str == "um") then
call SelectUnitForPlayerSingle( GUI_U_Move, pl )
elseif (str == "repick") then
if Repick then
set Repick = false
call DisplayTextToForce(udg_Force[2], "|cffffd700Repicks are now set to off.")
else
set Repick = true
call DisplayTextToForce(udg_Force[2], "|cffffd700Repicks are now set to on.")
endif
elseif SubString(str, 0, 4) == "pile" then
if SubString(str, 4, 14) == " of riches" then
call SelectUnitForPlayerSingle( GUI_I_P_PileOfRiches, pl )
elseif SubString(str, 4, 12) == "ofriches" then
call SelectUnitForPlayerSingle( GUI_I_P_PileOfRiches, pl )
elseif SubString(str, 4, 12) == " of gold" then
call SelectUnitForPlayerSingle( GUI_I_P_GoldPile, pl )
elseif SubString(str, 4, 10) == "ofgold" then
call SelectUnitForPlayerSingle( GUI_I_P_GoldPile, pl )
else
return false
endif
elseif (str == "riches") then
call SelectUnitForPlayerSingle( GUI_I_P_PileOfRiches, pl )
//Doodads
elseif (str == "dc") then
call SelectUnitForPlayerSingle( GUI_D_Create, pl )
elseif (str == "dk") then
call SelectUnitForPlayerSingle( GUI_D_Kill, pl )
elseif (str == "dr") then
call SelectUnitForPlayerSingle( GUI_D_Remove, pl )
elseif (str == "dv") then
call SelectUnitForPlayerSingle( GUI_D_Revive, pl )
elseif (str == "dt") then
call SelectUnitForPlayerSingle( GUI_D_Toggle, pl )
elseif SubString(str, StringLength(str)-5, StringLength(str)) == "grove" then
if SubString(str, 0, 9) == "northrend" then
call SelectUnitForPlayerSingle( GUI_D_P_NorthrendGrove, pl )
elseif SubString(str, 0, 9) == "ashenvale" then
call SelectUnitForPlayerSingle( GUI_D_P_AshenvaleGrove, pl )
elseif SubString(str, 0, 4) == "fall" then
call SelectUnitForPlayerSingle( GUI_D_P_FallGrove, pl )
elseif SubString(str, 0, 11) == "underground" then
call SelectUnitForPlayerSingle( GUI_D_P_UndergroundGrove, pl )
elseif SubString(str, 0, 7) == "dungeon" then
call SelectUnitForPlayerSingle( GUI_D_P_DungeonGrove, pl )
elseif SubString(str, 0, 7) == "outland" then
call SelectUnitForPlayerSingle( GUI_D_P_OutlandGrove, pl )
elseif SubString(str, 0, 4) == "ruin" or SubString(str, 0, 5) == "ruins"then
call SelectUnitForPlayerSingle( GUI_D_P_RuinsGrove, pl )
elseif SubString(str, 0, 6) == "barren" or SubString(str, 0, 7) == "barrens" then
call SelectUnitForPlayerSingle( GUI_D_P_BarrensGrove, pl )
elseif SubString(str, 0, 7) == "felwood" then
call SelectUnitForPlayerSingle( GUI_D_P_FelwoodGrove, pl )
elseif SubString(str, 0, 4) == "snow" or SubString(str, 0, 5) == "snowy" then
call SelectUnitForPlayerSingle( GUI_D_P_SnowyGrove, pl )
elseif SubString(str, 0, 6) == "winter" then
call SelectUnitForPlayerSingle( GUI_D_P_WinterGrove, pl )
elseif SubString(str, 0, 4) == "city" then
call SelectUnitForPlayerSingle( GUI_D_P_CityGrove, pl )
elseif SubString(str, 0, 6) == "summer" then
call SelectUnitForPlayerSingle( GUI_D_P_SummerGrove, pl )
elseif SubString(str, 0, 5) == "brown" then
call SelectUnitForPlayerSingle( GUI_D_P_BrownGrove, pl )
elseif SubString(str, 1, 9) == "maneater" then
set udg_TEMP_String = "maneater"
if SubString(str, 0, 1) == "'" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SkillAddEnumUnitSelected )
elseif SubString(str, 0, 1) == "@" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SkillRemoveEnumUnitSelected )
elseif SubString(str, 0, 1) == "!" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SkillSetEnumUnitSelected )
else
return false
endif
elseif (str == "grove") then
call SelectUnitForPlayerSingle( GUI_D_P_Grove, pl )
else
return false
endif
elseif (str == "rocks") then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks, pl )
elseif (str == "junk") then
call SelectUnitForPlayerSingle( GUI_D_P_Junk, pl )
elseif (str == "crates") then
call SelectUnitForPlayerSingle( GUI_D_P_Crates, pl )
elseif (str == "tree") then
call SelectUnitForPlayerSingle( GUI_D_P_Tree, pl )
elseif (str == "dispel") then
call SelectUnitForPlayerSingle( GUI_D_P_Dispel, pl )
elseif (str == "blight") then
call SelectUnitForPlayerSingle( GUI_D_P_Blight, pl )
elseif str == "mushroom1" or str == "mushroomashenvale" or str == "ashenvalemushroom" then
call SelectUnitForPlayerSingle( GUI_D_P_Mushroom1, pl )
elseif str == "mushroom2" or str == "mushroomruins" or str == "ruinsmushroom" then
call SelectUnitForPlayerSingle( GUI_D_P_Mushroom2, pl )
elseif str == "mushroom3" or str == "mushroomfelwood" or str == "felwoodmushroom" then
call SelectUnitForPlayerSingle( GUI_D_P_Mushroom3, pl )
elseif SubString(str, 0, 4) == "dood" then
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
if text == "citadel" then
call SelectUnitForPlayerSingle( GUI_D_P_Citadel, pl )
elseif text == "tower" then
call SelectUnitForPlayerSingle( GUI_D_P_CTower, pl )
elseif text == "flower" then
call SelectUnitForPlayerSingle( GUI_D_P_Flower, pl )
elseif text == "mushroom1" or text == "mushroomashenvale" or text == "ashenvalemushroom" then
call SelectUnitForPlayerSingle( GUI_D_P_Mushroom1, pl )
elseif text == "mushroom2" or text == "mushroomruins" or text == "ruinsmushroom" then
call SelectUnitForPlayerSingle( GUI_D_P_Mushroom2, pl )
elseif text == "mushroom3" or text == "mushroomfelwood" or text == "felwoodmushroom" then
call SelectUnitForPlayerSingle( GUI_D_P_Mushroom3, pl )
elseif text == "rocks1" then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks1, pl )
elseif text == "rocks2" then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks2, pl )
elseif text == "rocks3" then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks3, pl )
elseif text == "rocks4" then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks4, pl )
elseif text == "rocks5" then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks5, pl )
elseif text == "rocks6" then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks6, pl )
elseif text == "rocks6" then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks7, pl )
elseif text == "rocks7" then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks8, pl )
elseif text == "rocks9" then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks9, pl )
elseif text == "rocks10" then
call SelectUnitForPlayerSingle( GUI_D_P_Rocks10, pl )
elseif text == "iceyrock" then
call SelectUnitForPlayerSingle( GUI_D_P_IceyRock, pl )
elseif text == "iceyclaw" then
call SelectUnitForPlayerSingle( GUI_D_P_IceyClaw, pl )
elseif text == "log" then
call SelectUnitForPlayerSingle( GUI_D_P_Log, pl )
elseif text == "archway" then
call SelectUnitForPlayerSingle( GUI_D_P_Archway, pl )
elseif text == "bed" then
call SelectUnitForPlayerSingle( GUI_D_P_Bed, pl )
elseif text == "mat" then
call SelectUnitForPlayerSingle( GUI_D_P_Mat, pl )
elseif text == "grave" then
call SelectUnitForPlayerSingle( GUI_D_P_Grave, pl )
elseif text == "light" then
call SelectUnitForPlayerSingle( GUI_D_P_Light, pl )
elseif text == "table" then
call SelectUnitForPlayerSingle( GUI_D_P_Table, pl )
elseif text == "chair" then
call SelectUnitForPlayerSingle( GUI_D_P_Chair, pl )
elseif text == "lamp" then
call SelectUnitForPlayerSingle( GUI_D_P_Lamp, pl )
elseif text == "trough" then
call SelectUnitForPlayerSingle( GUI_D_P_Trough, pl )
else
return false
endif
elseif SubString(str, 0, 4) == "wood" then
if SubString(str, 4, 10) == "bridge" then
call SelectUnitForPlayerSingle( GUI_D_P_WoodenBridge, pl )
elseif SubString(str, 4, 11) == " bridge" then
call SelectUnitForPlayerSingle( GUI_D_P_WoodenBridge, pl )
elseif SubString(str, 4, 12) == "enbridge" then
call SelectUnitForPlayerSingle( GUI_D_P_WoodenBridge, pl )
elseif SubString(str, 4, 13) == "en bridge" then
call SelectUnitForPlayerSingle( GUI_D_P_WoodenBridge, pl )
else
return false
endif
elseif SubString(str, 0, 5) == "stone" then
if SubString(str, 5, 11) == "bridge" then
call SelectUnitForPlayerSingle( GUI_D_P_StoneBridge, pl )
elseif SubString(str, 5, 12) == " bridge" then
call SelectUnitForPlayerSingle( GUI_D_P_StoneBridge, pl )
elseif SubString(str, 5, 9) == "wall" then
call SelectUnitForPlayerSingle( GUI_D_P_StoneWall, pl )
elseif SubString(str, 5, 10) == " wall" then
call SelectUnitForPlayerSingle( GUI_D_P_StoneWall, pl )
else
return false
endif
//Items
elseif (str == "ir") then
call SelectUnitForPlayerSingle( GUI_I_Remove, pl )
elseif SubString(str, 0, 4) == "gold" then
if SubString(str, 4, 8) == "coin" then
call SelectUnitForPlayerSingle( GUI_I_P_GoldCoin, pl )
elseif SubString(str, 4, 9) == " coin" then
call SelectUnitForPlayerSingle( GUI_I_P_GoldCoin, pl )
elseif SubString(str, 4, 8) == "pile" then
call SelectUnitForPlayerSingle( GUI_I_P_GoldPile, pl )
elseif SubString(str, 4, 9) == " pile" then
call SelectUnitForPlayerSingle( GUI_I_P_GoldPile, pl )
elseif SubString(str, 4, 8) == "s" then
call SelectUnitForPlayerSingle( GUI_I_P_GoldCoin, pl )
elseif SubString(str,4,6) == "at" then
//Get rid of that pesky space people like to add
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function GoldAt )
call DebugCommand(str,id)
else
return false
endif
elseif SubString(str, 0, 7) == "charges" then
if (SubString(str,7,8) == " ") then
set text = SubString(str,8,StringLength(str))
else
set text = SubString(str,7,StringLength(str))
endif
set udg_TEMP_IntegerArray[1] = S2I(SubString(text, 0,1))
set udg_TEMP_IntegerArray[2] = S2I(SubString(text, 2,StringLength(text)))
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function ItemCharges )
call DebugCommand(str,id)
elseif SubString(str, 0, 7) == "destroy" then
if (SubString(str,7,8) == " ") then
set text = SubString(str,8,StringLength(str))
else
set text = SubString(str,7,StringLength(str))
endif
set udg_TEMP_Integer = S2I(SubString(text, 0,1))
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function ItemDestroy )
call DebugCommand(str,id)
//Doodads
elseif (str == "bridge") then
call SelectUnitForPlayerSingle( GUI_D_P_StoneBridge, pl )
elseif (str == "forcebridge") or (str == "force bridge") then
call SelectUnitForPlayerSingle( GUI_D_P_ForceBridge, pl )
elseif (str == "gate") then
call SelectUnitForPlayerSingle( GUI_D_P_Gate, pl )
elseif (str == "icerockgate") or (str == "icerock gate") or (str == "ice rock gate") then
call SelectUnitForPlayerSingle( GUI_D_P_IcerockGate, pl )
elseif (str == "rollingstone") or (str == "rolling stone") then
call SelectUnitForPlayerSingle( GUI_D_P_RollingStone, pl )
elseif (str == "castlegate") or (str == "castle gate") then
call SelectUnitForPlayerSingle( GUI_D_P_CastleGate, pl )
elseif (str == "elvengate") or (str == "elven gate") then
call SelectUnitForPlayerSingle( GUI_D_P_ElvenGate, pl )
elseif (str == "demonicgate") or (str == "demonic gate") or (str == "demongate") or (str == "demon gate") then
call SelectUnitForPlayerSingle( GUI_D_P_DemonicGate, pl )
elseif (str == "dungeon gate") or (str == "dungeongate") then
call SelectUnitForPlayerSingle( GUI_D_P_DungeonGate, pl )
elseif (str == "door") then
call SelectUnitForPlayerSingle( GUI_D_P_Door, pl )
elseif (str == "doubledoor") or (str == "double door") then
call SelectUnitForPlayerSingle( GUI_D_P_DoubleDoor, pl )
elseif (str == "wall") then
call SelectUnitForPlayerSingle( GUI_D_P_StoneWall, pl )
elseif (str == "line") then
call SelectUnitForPlayerSingle( GUI_D_P_Line1, pl )
elseif (str == "fenceline") or (str == "fence line") or (str == "fence") then
call SelectUnitForPlayerSingle( GUI_D_P_FenceLine, pl )
elseif (str == "evilfence") or (str == "evil fence") then
call SelectUnitForPlayerSingle( GUI_D_P_EvilFence, pl )
elseif (str == "northrendwall") or (str == "northrend wall") or (str == "north rend wall") then
call SelectUnitForPlayerSingle( GUI_D_P_NorthrendWall, pl )
elseif (str == "ruinswall") or (str == "ruins wall") or (str == "ruinwall") or (str == "ruin wall") then
call SelectUnitForPlayerSingle( GUI_D_P_RuinsWall, pl )
elseif (str == "dungeonwall") or (str == "dungeon wall") then
call SelectUnitForPlayerSingle( GUI_D_P_DungeonWall, pl )
elseif (str == "castlewall") or (str == "castle wall") then
call SelectUnitForPlayerSingle( GUI_D_P_CastleWall, pl )
elseif (str == "indoorwall") or (str == "indoor wall") then
call SelectUnitForPlayerSingle( GUI_D_P_InteriorWall, pl )
elseif (str == "minewall") or (str == "mine wall") then
call SelectUnitForPlayerSingle( GUI_D_P_MineWall, pl )
elseif str == "castletower" or str == "castle tower" then
call SelectUnitForPlayerSingle( GUI_D_P_CTower, pl )
elseif str == "bs" then
call SelectUnitForPlayerSingle( GUI_T_LoSBlocker, pl )
elseif str == "bp" then
call SelectUnitForPlayerSingle( GUI_T_PathBlocker, pl )
elseif SubString(str, 0, 5) == "block" then
if SubString(str, 5, 6) == " " then
set text = SubString(str, 6, StringLength(str))
else
set text = SubString(str, 5, StringLength(str))
endif
if text == "sight" or text == "vision" or text == "view" then
call SelectUnitForPlayerSingle( GUI_T_LoSBlocker, pl )
elseif text == "path" or text == "trail" or text == "movement" then
call SelectUnitForPlayerSingle( GUI_T_PathBlocker, pl )
endif
//Colors
elseif (str == "black") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[13], pl )
elseif (str == "enemy") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[13], pl )
elseif (str == "enemies") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[13], pl )
elseif (str == "white") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[15], pl )
elseif (str == "allies") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[15], pl )
elseif (str == "self") then
call SelectUnitForPlayerSingle( udg_GUI_Tile[id+1], pl )
//Misc
elseif (str == "mw") then
call SelectUnitForPlayerSingle( GUI_M_Portal, pl )
elseif (str == "waygate") then
call SelectUnitForPlayerSingle( GUI_M_Portal, pl )
else
set count = count + 1
endif
//Player Sleep Status
if SubString(str,0,6) == "csleep" then
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
if GetPlayerNumFromStr(text, id) < 1 or GetPlayerNumFromStr(text, id) > 16 then
call DisplayTextToPlayer( pl, 0, 0, " Player " + text + " is invalid." )
return false
else
set pl = Player(GetPlayerNumFromStr(text, id)-1)
if GetPlayerState( pl, PLAYER_STATE_NO_CREEP_SLEEP ) == 1 then
call DisplayTextToForce( fp, " Player " + ColorNamePl(Player(GetPlayerNumFromStr(text, id)-1)) + "'s creep-type units |cff7cfc00will|r sleep at night." )
call SetPlayerState(pl, PLAYER_STATE_NO_CREEP_SLEEP, 0)
elseif GetPlayerState( pl, PLAYER_STATE_NO_CREEP_SLEEP ) == 0 then
call DisplayTextToForce( fp, " Player " + ColorNamePl(Player(GetPlayerNumFromStr(text, id)-1)) + "'s creep-type units |cffff0000will not|r sleep at night." )
call SetPlayerState(pl, PLAYER_STATE_NO_CREEP_SLEEP, 1)
call WakePlayerUnits(pl)
else
return false
endif
endif
elseif SubString(str, 0, 4) == "info" then
if (SubString(str,4,5) == " ") then
set udg_TEMP_String = SubString(GetEventPlayerChatString(),5,StringLength(GetEventPlayerChatString()))
else
set udg_TEMP_String = SubString(GetEventPlayerChatString(),4,StringLength(GetEventPlayerChatString()))
endif
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function InfoTag)
elseif str == "show" then
set i1 = 1
loop
exitwhen i1 > 12
call ShowUnit(GetPlayerHero(i1), true)
set i1 = i1 + i1
endloop
//The CLASS system commands!
elseif str == "class" then
if ClassON == true then
set ClassON = false
else
set ClassON = true
endif
elseif SubString(str, 0, 4) == "slvl" then
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set SubLVL = S2I(text)
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, "Players may declare a subclass at level " + I2S(SubLVL) + "." )
elseif SubString(str, 0, 4) == "slvl" then
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set SubLVL = S2I(text)
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, "Players may declare a subclass at level " + I2S(SubLVL) + "." )
elseif SubString(str, 0, 6) == "cforce" or SubString(str, 0, 6) == "sforce" then
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
set udg_TEMP_String = text
if SubString(str, 0, 1) == "c" then
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function ForceClass)
else
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function ForceSub)
endif
//Custom Class Creation Commands
elseif SubString(str, 0, 6) == "cclass" then
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
set i1 = S2I(SubString(text, 0, 1))
if i1 > 9 then
return false
elseif i1 < 1 then
return false
endif
if (SubString(text,1,2) == " ") then
set text = SubString(text,2,StringLength(text))
else
set text = SubString(text,1,StringLength(text))
endif
set CustomClass[i1] = StringCase(SubString(text, 0, 1), true) + SubString(text, 1, StringLength(text))
elseif SubString(str,0,6) == "cskill" then
set i1 = S2I(SubString(str, 6,7))
if i1 > 7 then
return false
elseif i1 < 1 then
return false
endif
if (SubString(str,7,8) == " ") then
set text = SubString(str,8,StringLength(str))
else
set text = SubString(str,7,StringLength(str))
endif
set i2 = S2I(SubString(text, 0, 1))
if i2 > 9 then
return false
elseif i2 < 1 then
return false
endif
if (SubString(text,1,2) == " ") then
set text = SubString(text,2,StringLength(text))
else
set text = SubString(text,1,StringLength(text))
endif
if skillhash[text] != 0 then
set CustomSkill[i1+i2*7] = text
else
return false
endif
elseif SubString(str, 0, 5) == "cgear" then
if (SubString(str,5,6) == " ") then
set text = SubString(str,6,StringLength(str))
else
set text = SubString(str,5,StringLength(str))
endif
set i1 = S2I(SubString(text, 0, 1))
if i1 > 9 then
return false
elseif i1 < 1 then
return false
endif
if (SubString(text,1,2) == " ") then
set text = SubString(text,2,StringLength(text))
else
set text = SubString(text,1,StringLength(text))
endif
set CustomGear[i1] = GetInventoryFromStr(text)
elseif SubString(str, 0, 7) == "publish" then
if (SubString(str,7,8) == " ") then
set i1 = S2I(SubString(str,8,StringLength(str)))
else
set i1 = S2I(SubString(str,7,StringLength(str)))
endif
if i1 > 9 then
return false
elseif i1 < 1 then
return false
endif
call FlashQuestDialogButton()
call DestroyQuest(CustomQuest[i1])
set CustomQuest[i1] = CreateQuest()
call QuestSetTitle(CustomQuest[i1], CustomClass[i1])
call QuestSetDescription(CustomQuest[i1], "|cffffff00'" + CustomClass[i1] + "'|r may use |cff00bfff" + CustomGear[i1] + "'|r.
Learns:
" + GetObjectName(skillhash[CustomSkill[1+i1*7]]) + " (disp " + CustomSkill[1+i1*7] + ")
" + GetObjectName(skillhash[CustomSkill[2+i1*7]]) + " (disp " + CustomSkill[2+i1*7] + ")
" + GetObjectName(skillhash[CustomSkill[3+i1*7]]) + " (disp " + CustomSkill[3+i1*7] + ")
" + GetObjectName(skillhash[CustomSkill[4+i1*7]]) + " (disp " + CustomSkill[4+i1*7] + ")
" + GetObjectName(skillhash[CustomSkill[5+i1*7]]) + " (disp " + CustomSkill[5+i1*7] + ")
[ULT]" + GetObjectName(skillhash[CustomSkill[6+i1*7]]) + " (disp " + CustomSkill[6+i1*7] + ")
[ULT]" + GetObjectName(skillhash[CustomSkill[7+i1*7]]) + " (disp " + CustomSkill[7+i1*7] + ")")
call QuestSetIconPath(CustomQuest[i1], "ReplaceableTextures\\CommandButtons\\BTNBanish.blp")
call QuestSetRequired(CustomQuest[i1], true)
call QuestSetDiscovered(CustomQuest[i1], true)
call QuestSetCompleted(CustomQuest[i1], false)
//Promotion and Demotion
elseif SubString(str,0,7) == "promote" or SubString(str,0,6) == "demote" then
if SubString(str,0,7) == "promote" then
if (SubString(str,7,8) == " ") then
set text = SubString(str,8,StringLength(str))
else
set text = SubString(str,7,StringLength(str))
endif
if GetPlayerNumFromStr(text, id) < 1 or GetPlayerNumFromStr(text, id) > 12 then
call DisplayTextToPlayer( pl, 0, 0, " Player " + text + " is invalid." )
elseif udg_GUI_Pointer[GetPlayerNumFromStr(text, id)] == null then
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, " Player " + ColorNamePl(Player(GetPlayerNumFromStr(text, id)-1)) + " has been promoted to a '|cff3399ffDM|r'." )
call PromotePlayer(Player(GetPlayerNumFromStr(text, id)-1))
else
call DisplayTextToPlayer( pl, 0, 0, " DM " + ColorNamePl(Player(GetPlayerNumFromStr(text, id)-1)) + " is already a '|cff3399ffDM|r'." )
endif
else
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
if GetPlayerNumFromStr(text, id) < 1 or GetPlayerNumFromStr(text, id) > 15 then
call DisplayTextToPlayer( pl, 0, 0, " Player " + text + " is invalid." )
elseif udg_GUI_Pointer[GetPlayerNumFromStr(text, id)] != null then
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, " DM " + ColorNamePl(Player(GetPlayerNumFromStr(text, id)-1)) + " has been returned to a '|cff3399ffPlayer|r'." )
call DemoteDM(Player(GetPlayerNumFromStr(text, id)-1))
else
call DisplayTextToPlayer( pl, 0, 0, " Player " + ColorNamePl(Player(GetPlayerNumFromStr(text, id)-1)) + " is already a '|cff3399ffPlayer|r'." )
endif
endif
//Ressurection System
elseif SubString(str,0,3) == "rez" then
if (SubString(str,3,4) == " ") then
set text = SubString(str,4,StringLength(str))
else
set text = SubString(str,3,StringLength(str))
endif
if text == "on" then
set RezOff = false
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, " Ressurecting is now enabled.")
elseif text == "off" then
set RezOff = true
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, " Ressurecting is now disabled.")
elseif text == "alt" then
if AltRez == false then
set AltRez = true
call DisplayTextToForce( udg_Force[2], " Gravestone ressurecting is now set to |cffffd700On|r. ")
else
call GroupEnumUnitsOfType(ENUM_GROUP, "gravestonemarker", function RezKill)
set AltRez = false
call DisplayTextToForce( udg_Force[2], " Gravestone ressurecting is now set to |cffffd700Off|r. ")
endif
else
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function RezMarker)
return false
endif
call DebugCommand(str,id)
//XP Rate
elseif SubString(str,0,6) == "xprate" then
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
call DisplayTextToForce( udg_Force[2], " EXP Rate at |cffffd700" + R2S(S2R(text)) + "|r% ")
set i1 = 0
loop
exitwhen i1 > 11
if IsPlayerInForce(Player(i1), udg_Force[1]) then
call SetPlayerHandicapXP( Player(i1), S2R(text)/100 )
endif
set i1 = i1 + 1
endloop
call DebugCommand(str,id)
//Reset Cooldowns
elseif (str == "rcool" or str == "reset") then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function ResetCoolSelected )
call DebugCommand(str,id)
//Time Commands
elseif SubString(str,0,4) == "time" then
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
if text == "stop" then
call SuspendTimeOfDay(true)
elseif text == "start" then
call SuspendTimeOfDay(false)
elseif SubString(text, 0,5) == "scale" then
if (SubString(text,5,6) == " ") then
set text = SubString(text,6,StringLength(text))
else
set text = SubString(text,5,StringLength(text))
endif
call SetTimeOfDayScale(S2R(text))
else
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, S2R(text))
endif
//Weather
elseif SubString(str,0,7) == "weather" then
if (SubString(str,7,8) == " ") then
set text = SubString(str,8,StringLength(str))
else
set text = SubString(str,7,StringLength(str))
endif
set udg_TEMP_IntegerArray[id+1] = S2I(SubString(text, 0, 1))
if (SubString(text,1,2) == " ") then
set text = SubString(text,2,StringLength(text))
else
set text = SubString(text,1,StringLength(text))
endif
if text == "none" then
call RemoveWeatherEffect( Weather[udg_TEMP_IntegerArray[id+1]] )
call RemoveRect(WeatherRect[udg_TEMP_IntegerArray[id+1]])
set WeatherRect[udg_TEMP_IntegerArray[id+1]] = null
set Weather[udg_TEMP_IntegerArray[id+1]] = null
elseif Weather[udg_TEMP_IntegerArray[id+1]] == null then
set udg_Status[id+1] = "weather_create"
set udg_DM_SubType[id+1] = text
call GUIApplyCamForDM(pl)
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id+1], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id+1] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id+1], pl )
call DisplayTextToForce( fp, " Right click to create the first '|c0000FF00weather region|r'." )
else
call DisplayTextToForce( fp, " Invalid '|c0000FF00weather region|r' or it's already being used." )
endif
call DebugCommand(str,id+1)
//Emitters
elseif (SubString(str,0,4) == "emit") then
if SubString(str,4,5) == " " then
set i1 = 5
set i2 = 6
loop
set i2 = i2 + 1
exitwhen SubString(str, i2-1, i2) == " " or i2 > StringLength(str)
endloop
set i2 = i2 - 1
set text = SubString(str,i1,i2)
set i1 = i2 + 1
set udg_TEMP_String = SubString(str,i1,StringLength(str))
set udg_TEMP_Integer = id
if text == "interval" then
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function IntervalEnumUnitsSelected )
elseif text == "max" then
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function MaxEnumUnitsSelected )
elseif text == "bonus" then
if udg_TEMP_String == "on" then
set udg_TEMP_String = "1"
elseif udg_TEMP_String == "off" then
set udg_TEMP_String = "0"
endif
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function BonusEnumUnitsSelected )
elseif text == "bounty" then
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function BountyEnumUnitsSelected )
elseif text == "unit" then
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function UTypeEnumUnitsSelected )
elseif text == "skill" then
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function SkillEnumUnitsSelected )
elseif text == "limit" then
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function LimitEnumUnitsSelected)
elseif text == "time" then
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function TimeEnumUnitsSelected )
elseif text == "remove" then
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function DeEmitEnumUnitsSelected )
endif
elseif str == "emit" then
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function EmitEnumUnitSelected )
else
return false
endif
call DebugCommand(str,id)
//Invulnerable
elseif (str == "invuln" or str == "invulon") then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function InvulnEnumUnitSelected )
call DebugCommand(str,id)
elseif (str == "vuln" or str == "invuloff") then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function VulnEnumUnitSelected )
call DebugCommand(str,id)
//Unit Type Adds and Removes
elseif SubString(str, 2, 3) != " " or SubString(str, 2, 3) != "n" and SubString(str, 0, 2) == "is" then
if SubString(str, 2, 5) == "mec" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function IsMechanicalEnumUnitSelected )
call DebugCommand(str,id)
elseif SubString(str, 2, 5) == "sum" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function IsSummonEnumUnitSelected )
call DebugCommand(str,id)
elseif SubString(str, 2, 5) == "und" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function IsUndeadEnumUnitSelected )
call DebugCommand(str,id)
elseif SubString(str, 2, 5) == "tau" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function IsTaurenEnumUnitSelected )
call DebugCommand(str,id)
else
return false
endif
elseif str == "wayg" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function WaygateSelected )
call DebugCommand(str,id)
elseif SubString(str,0,4) == "hinv" then
if (SubString(str,4,5) == " ") then
set text = SubString(GetEventPlayerChatString(),5,StringLength(str))
else
set text = SubString(GetEventPlayerChatString(),4,StringLength(str))
endif
set udg_TEMP_String = text
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function AddInventory )
call DebugCommand(str,id)
//Magic Immune
elseif (str == "immune" or str == "immunon") then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function ImmuneEnumUnitSelected )
call DebugCommand(str,id)
elseif (str == "mune" or str == "unimmune" or str == "immunoff") then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function UnImmuneEnumUnitSelected )
call DebugCommand(str,id)
//Bestow Item
elseif SubString(str,0,6) == "bestow" then
set udg_TEMP_Integer = id
set udg_TEMP_String = SubString(str,6, 9)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function ItemBestow )
call DebugCommand(str,id)
//Bonus Replicator
elseif SubString(str,0,5) == "bonus" then
if (SubString(str,5,6) == " ") then
set text = SubString(str,6,StringLength(str))
else
set text = SubString(str,5,StringLength(str))
endif
if IsANumber(text) then
set MacroNumber[id+1] = S2I(text)
elseif text == "on" then
set BonusOnCreate[id] = true
elseif text == "off" then
set BonusOnCreate[id] = false
elseif text == "add" then
set udg_TEMP_String = BonusSkill[GetUnitId(udg_GUI_Pointer[GetPlayerId(pl)+1])]
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function GrantBonus )
else
return false
endif
call DebugCommand(str,id)
//Unit Life Bonus
elseif SubString(str,0,4) == "life" then
//Get rid of that pesky space people like to add
if SubString(str,4,6) == "at" then
//Get rid of that pesky space people like to add
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
elseif (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
set udg_TEMP_Player = pl
if SubString(str,4,5) == " " then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function LifeEnumUnitSelected )
elseif SubString(str,4,6) == "at" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SetLifeEnumUnitSelected )
endif
call DebugCommand(str,id)
//Set Unit Mana
elseif SubString(str,0,4) == "mana" then
//Get rid of that pesky space people like to add
if SubString(str,4,6) == "at" then
if SubString(str,6,7) == " " then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
elseif (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
if SubString(str,4,6) == "at" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SetManaEnumUnitSelected )
else
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function ManaEnumUnitSelected )
endif
call DebugCommand(str,id)
//Hurt Unit
elseif SubString(str,0,4) == "hurt" then
//Get rid of that pesky space people like to add
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function HurtEnumUnitSelected )
call DebugCommand(str,id)
//Recharge Unit
elseif SubString(str,0,4) == "rech" then
//Get rid of that pesky space people like to add
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function RechargeManaEnumUnitSelected )
call DebugCommand(str,id)
//Hero Level
elseif SubString(str,0,5) == "level" then
//Get rid of that pesky space people like to add
if (SubString(str,5,6) == " ") then
set text = SubString(str,6,StringLength(str))
else
set text = SubString(str,5,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function HeroLevelEnumUnitSelected )
call DebugCommand(str,id)
//Hero INT
elseif SubString(str,0,3) == "int" then
//Get rid of that pesky space people like to add
if (SubString(str,3,4) == " ") then
set text = SubString(str,4,StringLength(str))
else
set text = SubString(str,3,StringLength(str))
endif
if SubString(str,3,6) == "set" then
if SubString(str,6,7) == " " then
set text = SubString(str, 7, StringLength(str))
else
set text = SubString(str, 6, StringLength(str))
endif
endif
set udg_TEMP_Integer = S2I(text)
if SubString(str,3,6) == "set" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function HeroIntSetEnumUnitSelected)
else
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function HeroIntEnumUnitSelected )
endif
call DebugCommand(str,id)
//Hero STR BonusMod
elseif SubString(str,0,3) == "str" then
//Get rid of that pesky space people like to add
if (SubString(str,3,4) == " ") then
set text = SubString(str,4,StringLength(str))
else
set text = SubString(str,3,StringLength(str))
endif
if SubString(str,3,6) == "set" then
if SubString(str,6,7) == " " then
set text = SubString(str, 7, StringLength(str))
else
set text = SubString(str, 6, StringLength(str))
endif
endif
set udg_TEMP_Integer = S2I(text)
if SubString(str,3,6) == "set" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function HeroStrSetEnumUnitSelected)
else
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function HeroStrEnumUnitSelected )
endif
call DebugCommand(str,id)
//Hero AGI BonusMod
elseif SubString(str,0,3) == "agi" then
//Get rid of that pesky space people like to add
if (SubString(str,3,4) == " ") then
set text = SubString(str,4,StringLength(str))
else
set text = SubString(str,3,StringLength(str))
endif
if SubString(str,3,6) == "set" then
if SubString(str,6,7) == " " then
set text = SubString(str, 7, StringLength(str))
else
set text = SubString(str, 6, StringLength(str))
endif
endif
set udg_TEMP_Integer = S2I(text)
if SubString(str,3,6) == "set" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function HeroAgiSetEnumUnitSelected)
else
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function HeroAgiEnumUnitSelected )
endif
call DebugCommand(str,id)
//Unit Armor Bonus
elseif SubString(str,0,5) == "armor" then
if (SubString(str,5,6) == " ") then
set text = SubString(str,6,StringLength(str))
else
set text = SubString(str,5,StringLength(str))
endif
set udg_TEMP_Integer = IMaxBJ(-8192, IMinBJ(8192, S2I(text)))
if udg_TEMP_Integer > 8192 then
set udg_TEMP_Integer = 8192
elseif udg_TEMP_Integer < -8192 then
set udg_TEMP_Integer = -8192
endif
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function BonusARMEnumUnitSelected )
call DebugCommand(str,id)
//Unit Damage Bonus
elseif SubString(str,0,6) == "damage" then
//Get rid of that pesky space people like to add
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
set udg_TEMP_Integer = IMaxBJ(-8192, IMinBJ(8192, S2I(text)))
if udg_TEMP_Integer > 8192 then
set udg_TEMP_Integer = 8192
elseif udg_TEMP_Integer < -8192 then
set udg_TEMP_Integer = -8192
endif
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function BonusDMGEnumUnitSelected )
call DebugCommand(str,id)
//Unit Attack Speed Bonus
elseif SubString(str,0,6) == "aspeed" then
//Get rid of that pesky space people like to add
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
set udg_TEMP_Integer = IMaxBJ(-8192, IMinBJ(8192, S2I(text)))
if udg_TEMP_Integer > 8192 then
set udg_TEMP_Integer = 8192
elseif udg_TEMP_Integer < -8192 then
set udg_TEMP_Integer = -8192
endif
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function BonusAttackSpeedEnumUnitSelected )
call DebugCommand(str,id)
//Brush Size Integer & Real
elseif SubString(str,0,5) == "brush" then
//Get rid of that pesky space people like to add
if (SubString(str,5,6) == " ") then
set text = SubString(str,6,StringLength(str))
else
set text = SubString(str,5,StringLength(str))
endif
if text == "circle" then
set DMBrushShape[id+1] = 0
call DisplayTextToPlayer( pl, 0, 0, " Brush shape changed to '|cff3399ff" + text + "|r'." )
elseif text == "square" then
set DMBrushShape[id+1] = 1
call DisplayTextToPlayer( pl, 0, 0, " Brush shape changed to '|cff3399ff" + text + "|r'." )
elseif S2I(text) <= 9 then
set IntegerBrushSize[id+1] = IMaxBJ(1, IMinBJ(9, S2I(text)))
call DisplayTextToPlayer( pl, 0, 0, " Brush size changed to '|cff3399ff" + text + "|r' tiles." )
else
set RealBrushSize[id+1] = RMaxBJ(10, IMinBJ(2000, S2I(text)))
call DisplayTextToPlayer( pl, 0, 0, " Brush size changed to '|cff3399ff" + text + "|r'." )
endif
//Unit Movespeed Bonus
elseif SubString(str,0,4) == "mspd" or SubString(str, 0, 6) == "mspeed" then
//Get rid of that pesky space people like to add
if SubString(str,0,3) == "p" then
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
else
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
endif
set udg_TEMP_Integer = S2I(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SetMSPDEnumUnitSelected )
call DebugCommand(str,id)
//Unit Regeneration Bonus
elseif SubString(str,0,5) == "regen" then
if SubString(str,5,6) == "%" then
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
else
if (SubString(str,5,6) == " ") then
set text = SubString(str,6,StringLength(str))
else
set text = SubString(str,5,StringLength(str))
endif
endif
set udg_TEMP_Integer = IMaxBJ(-8192, IMinBJ(8192, S2I(text)))
if udg_TEMP_Integer > 8192 then
set udg_TEMP_Integer = 8192
elseif udg_TEMP_Integer < -8192 then
set udg_TEMP_Integer = -8192
endif
if SubString(str,5,6) == "%" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function RegenPercentEnumUnitSelected )
else
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function RegenEnumUnitSelected )
endif
call DebugCommand(str,id)
//Unit Life Recovery Bonus
elseif SubString(str,0,5) == "recov" then
//Get rid of that pesky space people like to add
if (SubString(str,5,6) == " ") then
set text = SubString(str,6,StringLength(str))
else
set text = SubString(str,5,StringLength(str))
endif
set udg_TEMP_Integer = IMaxBJ(-8192, IMinBJ(8192, S2I(text)))
if udg_TEMP_Integer > 8192 then
set udg_TEMP_Integer = 8192
elseif udg_TEMP_Integer < -8192 then
set udg_TEMP_Integer = -8192
endif
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function RecovEnumUnitSelected )
call DebugCommand(str,id)
//Unit Size
elseif SubString(str,0,4) == "size" then
//Get rid of that pesky space people like to add
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set udg_TEMP_Integer = IMaxBJ(0, IMinBJ(5000, S2I(text)))
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function UnitSizeEnumUnitSelected )
call DebugCommand(str,id)
//Unit Facing
elseif SubString(str,0,4) == "face" then
//Get rid of that pesky space people like to add
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
if text == "east" or text == "e" then
set udg_TEMP_Real = 0
elseif text == "northeast" or text == "north east" or text == "ne" then
set udg_TEMP_Real = 45
elseif text == "north" or text == "n" then
set udg_TEMP_Real = 90
elseif text == "northwest" or text == "north west" or text == "nw" then
set udg_TEMP_Real = 135
elseif text == "west" or text == "w" then
set udg_TEMP_Real = 180
elseif text == "southwest" or text == "south west" or text == "sw" then
set udg_TEMP_Real = 225
elseif text == "south" or text == "s" then
set udg_TEMP_Real = 270
elseif text == "southeast" or text == "south east" or text == "se" then
set udg_TEMP_Real = 315
else
set udg_TEMP_Real = S2R(text)
endif
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function UnitFacingEnumUnitSelected )
call DebugCommand(str,id)
//Skill Point Setting
elseif SubString(str,0,1) == "^" then
if (SubString(str,1,2) == " ") then
set text = SubString(str,2,StringLength(str))
else
set text = SubString(str,1,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SkillAmount )
//Stat Point Setting
elseif SubString(str,0,1) == "*" then
if (SubString(str,1,2) == " ") then
set text = SubString(str,2,StringLength(str))
else
set text = SubString(str,1,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function StatAmount )
//Bounty Amount
elseif SubString(str,0,6) == "bounty" then
//Get rid of that pesky space people like to add
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
set udg_TEMP_Integer = S2I(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function BountyAmount )
call DebugCommand(str,id)
//Pet Skill Add
elseif SubString(str,0,6) == "pskill" then
set i1 = S2I(SubString(str, 6,7))
if i1 > 3 then
return false
elseif i1 < 1 then
return false
endif
if (SubString(str,7,8) == " ") then
set text = SubString(str,8,StringLength(str))
else
set text = SubString(str,7,StringLength(str))
endif
if skillhash[text] != 0 then
set udg_TEMP_Integer = skillhash[text]
if i1 == 1 then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function PetSpell1 )
elseif i1 == 2 then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function PetSpell2 )
else
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function PetSpell3 )
endif
else
return false
endif
//Skill Add
elseif SubString(str,0,1) == "'" then
set text = SubString(str,1,StringLength(str))
if text == "devour" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillDevour )
elseif text == "elementalshift" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillElementalShift )
elseif text == "animalaspect" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillAnimalAspect )
elseif text == "load" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillLoad )
elseif text == "phase" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillPhase )
elseif text == "lifeandmanacombustion" or text == "combustion" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillCombustion )
elseif text == "htaunt" or text == "tauntpassive" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillTaunt )
elseif text == "overwhelmingpresence" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillOverwhelming )
elseif text == "tailwhip" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillTailWhip )
elseif text == "earthharness" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillEarth )
elseif text == "elementalquiver" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillElemental )
elseif text == "counterpierce" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillCounterPierce )
elseif text == "shock" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillShock )
elseif text == "revelindead" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DoubleSkillRevel )
elseif skillhash[text] != null then
set BonusSkill[GetUnitId(udg_GUI_Pointer[id])] = text
set udg_TEMP_String = text
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SkillAddEnumUnitSelected )
else
return false
endif
call DebugCommand(str,id)
//Skill Remove
elseif SubString(str,0,1) == "@" then
set text = SubString(str,1,StringLength(str))
if text == "permanence" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function PetRelease )
elseif text == "buffs" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function DebuffEnum )
elseif skillhash[text] != null then
set udg_TEMP_String = text
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SkillRemoveEnumUnitSelected )
else
return false
endif
call DebugCommand(str,id)
//Skill Set
elseif SubString(str,0,1) == "=" then
set i1 = 2
loop
exitwhen i1 > StringLength(str) or SubString(str, i1-1, i1) == " "
set i1 = i1 + 1
endloop
if SubString(str, i1-1, i1) == " " then
set text = SubString(str, 1, i1-1)
set udg_TEMP_Integer = S2I(SubString(str, i1, StringLength(str)))
else
set text = SubString(str,1,StringLength(str)-1)
set udg_TEMP_Integer = S2I(SubString(str, StringLength(str)-1, StringLength(str)))
endif
set udg_TEMP_String = text
if skillhash[text] != null then
set BonusSkill[GetUnitId(udg_GUI_Pointer[GetPlayerId(pl)])] = text
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SkillSetEnumUnitSelected )
else
return false
endif
call DebugCommand(str,id)
//Give
elseif SubString(str,0,4) == "give" then
//Get rid of that pesky 'to' in quatredan
if (SubString(str,4,6) == "to") then
//Get rid of that pesky space people like to add
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
else
//Get rid of that pesky space people like to add
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
endif
set udg_TEMP_Integer = GetPlayerNumFromStr(text, id)
if udg_TEMP_Integer == -1 then
call DisplayTextToPlayer( pl, 0, 0, " |c00FF0000Invalid Player: |r" + text )
return false
endif
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function GiveEnumUnitSelected )
call DebugCommand(str,id)
//Color
elseif SubString(str,0,5) == "color" then
//Get rid of that pesky space people like to add
if (SubString(str,5,6) == " ") then
set text = SubString(str,6,StringLength(str))
else
set text = SubString(str,5,StringLength(str))
endif
set udg_TEMP_Integer = GetPlayerNumFromStrSafe(text, id)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function ColorEnumUnitSelected )
call DebugCommand(str,id)
//QuestOn
elseif SubString(str,0,7) == "queston" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function QuestOnEnumUnitSelected )
call DebugCommand(str,id)
//QuestOff
elseif SubString(str,0,8) == "questoff" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function QuestOffEnumUnitSelected )
call DebugCommand(str,id)
//Play Animation
elseif SubString(str,0,4) == "play" then
//Get rid of that pesky space people like to add
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set udg_TEMP_String = text
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function PlayEnumUnitSelected )
call DebugCommand(str,id)
//Set Animation Speed
elseif SubString(str,0,4) == "anim" then
//Get rid of that pesky space people like to add
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set udg_TEMP_Real = S2R(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function AnimEnumUnitSelected )
call DebugCommand(str,id)
//Pause & Unpause
elseif str == "pause" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function PauseEnumUnitSelected )
call DebugCommand(str,id)
//Fly + Fly Height
elseif SubString(str,0,3) == "fly" then
if (SubString(str,3,4) == " ") then
set text = SubString(str,4,StringLength(str))
else
set text = SubString(str,3,StringLength(str))
endif
set udg_TEMP_Real = S2R(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function SetFlyEnumUnitSelected )
call DebugCommand(str,id)
//NO COLLISION ON & OFF
elseif SubString(str,0,2) == "nc" then
if SubString(str,2,5) == "off" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function NCOffEnumUnitSelected )
elseif str == "nc" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function NCEnumUnitSelected )
else
return false
endif
call DebugCommand(str,id)
//Customization Aura FX Commands
elseif SubString(str, 0, 6) == "custom" then
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
if SubString(text,0,3) == "add" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function CustomAuraAdd )
elseif SubString(text,0,3) == "sfx" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function FXTimer )
elseif SubString(text,0,3) == "rem" then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function CustomAuraRemove )
elseif SubString(text,0,1) == "a" or SubString(text,0,1) == "b" or SubString(text,0,1) == "c" or SubString(text,0,1) == "s" or SubString(text,0,1) == "t" then
set udg_TEMP_String = SubString(text,0,1)
if (SubString(text,1,2) == " ") then
set text = SubString(text,2,StringLength(text))
else
set text = SubString(text,1,StringLength(text))
endif
set udg_TEMP_Real = S2R(text)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function CustomAuraReal )
elseif SubString(text,0,2) == "fx" then
if (SubString(text,2,3) == " ") then
set text = SubString(text,3,StringLength(text))
else
set text = SubString(text,2,StringLength(text))
endif
set udg_TEMP_String = text
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function CustomAuraFX )
endif
call DebugCommand(str,id)
//Attachment System
elseif SubString(str, 0, 7) == "attach " then
set text = SubString(str, 7, 8)
set udg_TEMP_Integer = S2I(text)
if udg_TEMP_Integer > 9 then
return false
elseif udg_TEMP_Integer < 1 then
return false
endif
set i1 = 9
set i2 = 10
loop
set i2 = i2 + 1
exitwhen SubString(str, i2-1, i2) == " " or i2 > StringLength(str)
endloop
set i2 = i2 - 1
set udg_TEMP_String = SubString(str,i1,i2)
set i1 = i2 + 1
set udg_TEMP_String2 = SubString(str,i1,StringLength(str))
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function AttachEnumUnitSelected )
call DebugCommand(str,id)
//Tint
elseif SubString(str, 0, 4) == "tint" then
//Get rid of that pesky space people like to add
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set i1 = 1
set i2 = 2
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
if i2 > StringLength(str) or i2 > 8 then
//dobrp can lick my nuts
set udg_TEMP_RealArray[1] = S2R(SubString(text, 0, 3))
set udg_TEMP_RealArray[2] = S2R(SubString(text, 3, 6))
set udg_TEMP_RealArray[3] = S2R(SubString(text, 6, 9))
if StringLength(str) > 9 then
set udg_TEMP_RealArray[4] = S2R(SubString(text, 9, 12))
else
set udg_TEMP_RealArray[4] = 0
endif
//so can quatredan. lazy programmers
if udg_TEMP_RealArray[1] > 100 or udg_TEMP_RealArray[2] > 100 or udg_TEMP_RealArray[3] > 100 or udg_TEMP_RealArray[4] > 100 then
set udg_TEMP_RealArray[1] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[2] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[3] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[4] = udg_TEMP_RealArray[1] * 100 / 255
endif
else
//ratios
set udg_TEMP_RealArray[1] = S2R(SubString(text, i1-1, i2-1)) * 100
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[2] = S2R(SubString(text, i1-1, i2-1)) * 100
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[3] = S2R(SubString(text, i1-1, i2-1)) * 100
if StringLength(str) > i2 then //we hit a space and there's more - alpha term
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[4] = S2R(SubString(text, i1-1, i2-1)) * 100
else
set udg_TEMP_RealArray[4] = 0
endif
endif
set udg_TEMP_RealArray[1] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[1], 0), 100)
set udg_TEMP_RealArray[2] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[2], 0), 100)
set udg_TEMP_RealArray[3] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[3], 0), 100)
set udg_TEMP_RealArray[4] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[4], 0), 100)
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function TintEnumUnitSelected )
call DebugCommand(str,id)
//Water Tint
elseif SubString(str, 0, 9) == "watertint" then
//Get rid of that pesky space people like to add
if (SubString(str,9,10) == " ") then
set text = SubString(str,10,StringLength(str))
else
set text = SubString(str,9,StringLength(str))
endif
set i1 = 1
set i2 = 2
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
if i2 > StringLength(str) or i2 > 13 then
set udg_TEMP_RealArray[1] = S2R(SubString(text, 0, 3))
set udg_TEMP_RealArray[2] = S2R(SubString(text, 3, 6))
set udg_TEMP_RealArray[3] = S2R(SubString(text, 6, 9))
if StringLength(str) > 9 then
set udg_TEMP_RealArray[4] = S2R(SubString(text, 9, 12))
else
set udg_TEMP_RealArray[4] = 0
endif
if udg_TEMP_RealArray[1] > 100 or udg_TEMP_RealArray[2] > 100 or udg_TEMP_RealArray[3] > 100 or udg_TEMP_RealArray[4] > 100 then
set udg_TEMP_RealArray[1] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[2] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[3] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[4] = udg_TEMP_RealArray[1] * 100 / 255
endif
else
//ratios
set udg_TEMP_RealArray[1] = S2R(SubString(text, i1-1, i2-1)) * 100
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[2] = S2R(SubString(text, i1-1, i2-1)) * 100
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[3] = S2R(SubString(text, i1-1, i2-1)) * 100
if StringLength(str) > i2 then //we hit a space and there's more - alpha term
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[4] = S2R(SubString(text, i1-1, i2-1)) * 100
else
set udg_TEMP_RealArray[4] = 0
endif
endif
set udg_TEMP_RealArray[1] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[1], 0), 100)
set udg_TEMP_RealArray[2] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[2], 0), 100)
set udg_TEMP_RealArray[3] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[3], 0), 100)
set udg_TEMP_RealArray[4] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[4], 0), 100)
set udg_TEMP_Player = pl
call TintWater( )
call DebugCommand(str,id)
//FogEnable
elseif SubString(str, 0, 3) == "fog" then
//Get rid of that pesky space people like to add
if (SubString(str,3,4) == " ") then
set text = SubString(str,4,StringLength(str))
else
set text = SubString(str,3,StringLength(str))
endif
set i1 = 1
set i2 = 2
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
if i2 > StringLength(str) or i2 > 13 then
set udg_TEMP_RealArray[1] = S2R(SubString(text, 0, 3))
set udg_TEMP_RealArray[2] = S2R(SubString(text, 3, 6))
set udg_TEMP_RealArray[3] = S2R(SubString(text, 6, 9))
if StringLength(str) > 9 then
set udg_TEMP_RealArray[4] = S2R(SubString(text, 9, 12))
else
set udg_TEMP_RealArray[4] = 0
endif
if udg_TEMP_RealArray[1] > 100 or udg_TEMP_RealArray[2] > 100 or udg_TEMP_RealArray[3] > 100 or udg_TEMP_RealArray[4] > 100 then
//set udg_TEMP_RealArray[1] = udg_TEMP_RealArray[1] * 100 / 255
//set udg_TEMP_RealArray[2] = udg_TEMP_RealArray[1] * 100 / 255
//set udg_TEMP_RealArray[3] = udg_TEMP_RealArray[1] * 100 / 255
//set udg_TEMP_RealArray[4] = udg_TEMP_RealArray[1] * 100 / 255
endif
else
//ratios
set udg_TEMP_RealArray[1] = S2R(SubString(text, i1-1, i2-1))// * 100
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[2] = S2R(SubString(text, i1-1, i2-1))// * 100
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[3] = S2R(SubString(text, i1-1, i2-1))// * 100
if StringLength(str) > i2 then //we hit a space and there's more - alpha term
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[4] = S2R(SubString(text, i1-1, i2-1))// * 100
else
set udg_TEMP_RealArray[4] = 0
endif
endif
set udg_TEMP_RealArray[1] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[1], 0), 100)
set udg_TEMP_RealArray[2] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[2], 0), 100)
set udg_TEMP_RealArray[3] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[3], 0), 100)
set udg_TEMP_RealArray[4] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[4], 0), 100)
set udg_TEMP_Player = pl
call CreateFog( )
call DebugCommand(str,id)
//Darkness Commands
elseif SubString(str, 0, 4) == "dark" then
if str == "dark" then
call SetDayNightModels("","")
elseif SubString(str, 4, 7) == "off" then
if str == "darkoff" then
call SetDayNightModels("Environment\\DNC\\DNCAshenvale\\DNCAshenvaleTerrain\\DNCAshenvaleTerrain.mdx","Environment\\DNC\\DNCAshenvale\\DNCAshenvaleUnit\\DNCAshenvaleUnit.mdx")
elseif (SubString(str,7,8) == " ") then
set i1 = GetPlayerNumFromStr(SubString(str,8,StringLength(str)), id)
if i1 < 1 or i1 > 16 then
return false
elseif GetLocalPlayer() == Player(i1-1) then
call SetDayNightModels("Environment\\DNC\\DNCAshenvale\\DNCAshenvaleTerrain\\DNCAshenvaleTerrain.mdx","Environment\\DNC\\DNCAshenvale\\DNCAshenvaleUnit\\DNCAshenvaleUnit.mdx")
endif
else
set i1 = GetPlayerNumFromStr(SubString(str,7,StringLength(str)), id)
if i1 < 1 or i1 > 16 then
return false
elseif GetLocalPlayer() == Player(i1-1) then
call SetDayNightModels("Environment\\DNC\\DNCAshenvale\\DNCAshenvaleTerrain\\DNCAshenvaleTerrain.mdx","Environment\\DNC\\DNCAshenvale\\DNCAshenvaleUnit\\DNCAshenvaleUnit.mdx")
endif
endif
elseif (SubString(str,4,5) == " ") then
set i1 = GetPlayerNumFromStr(SubString(str,5,StringLength(str)), id)
if i1 < 1 or i1 > 16 then
return false
elseif GetLocalPlayer() == Player(i1-1) then
call SetDayNightModels("","")
endif
else
set i1 = GetPlayerNumFromStr(SubString(str,4,StringLength(str)), id)
if i1 < 1 or i1 > 16 then
return false
elseif GetLocalPlayer() == Player(i1-1) then
call SetDayNightModels("","")
endif
endif
//Ally and Vision System
elseif SubString(str, 0, 4) == "ally" then
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
if StringLength(str) == 4 then
call SelectUnitForPlayerSingle( udg_GUI_Tile[15], pl )
return true
endif
endif
if text == "attack" then
if AllyAttack == false then
set AllyAttack = true
call DisplayTextToForce( udg_Force[2], " Ally Attack On.")
else
call DisplayTextToForce( udg_Force[2], " Ally Attack Off.")
set AllyAttack = false
endif
return true
endif
set i1 = 1
set i2 = 2
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
if SubString(text, i1-1, i2-1) == "all" then
set udg_TEMP_IntegerArray[1] = 16
else
set udg_TEMP_IntegerArray[1] = GetPlayerNumFromStr(SubString(text, i1-1, i2-1), id)
endif
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
if SubString(text, i1-1, i2-1) == "all" then
set udg_TEMP_IntegerArray[2] = 16
else
set udg_TEMP_IntegerArray[2] = GetPlayerNumFromStr(SubString(text, i1-1, i2-1), id)
endif
if udg_TEMP_IntegerArray[1] > 16 or udg_TEMP_IntegerArray[1] < 1 then
call DisplayTextToPlayer( pl, 0, 0, " |c00FF0000Invalid Player for first value.|r" )
return false
elseif udg_TEMP_IntegerArray[2] > 16 or udg_TEMP_IntegerArray[2] < 1 then
call DisplayTextToPlayer( pl, 0, 0, " |c00FF0000Invalid Player for second value.|r" )
return false
elseif udg_TEMP_IntegerArray[1] == udg_TEMP_IntegerArray[2] then
call DisplayTextToPlayer( pl, 0, 0, " |c00FF0000First and Second value cannot be the same.|r" )
else
set udg_TEMP_Player = pl
call AllyPlayers( udg_TEMP_IntegerArray[1]-1,udg_TEMP_IntegerArray[2]-1 )
endif
call DebugCommand(str,id)
//Vision System
elseif SubString(str, 0, 6) == "vision" then
//Get rid of that pesky space people like to add
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
set i1 = 1
set i2 = 2
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
if SubString(text, i1-1, i2-1) == "all" then
set udg_TEMP_IntegerArray[1] = 411
else
set udg_TEMP_IntegerArray[1] = GetPlayerNumFromStr(SubString(text, i1-1, i2-1), id)
endif
set i1 = i2 + 1
set i2 = i1 + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
if SubString(text, i1-1, i2-1) == "all" then
set udg_TEMP_IntegerArray[2] = 411
else
set udg_TEMP_IntegerArray[2] = GetPlayerNumFromStr(SubString(text, i1-1, i2-1), id)
endif
set udg_TEMP_IntegerArray[3] = 0
if udg_TEMP_IntegerArray[1] == 411 then
loop
exitwhen udg_TEMP_IntegerArray[3] > 11 or IsPlayerInForce(Player(udg_TEMP_IntegerArray[3]), udg_Force[1]) and udg_TEMP_IntegerArray[3] != udg_TEMP_IntegerArray[2]
set udg_TEMP_IntegerArray[3] = udg_TEMP_IntegerArray[3] + 1
endloop
call VisionPlayers( udg_TEMP_IntegerArray[1]-1, udg_TEMP_IntegerArray[3], true )
elseif udg_TEMP_IntegerArray[2] == 411 then
loop
exitwhen udg_TEMP_IntegerArray[3] > 11 or IsPlayerInForce(Player(udg_TEMP_IntegerArray[3]), udg_Force[1]) and udg_TEMP_IntegerArray[3] != udg_TEMP_IntegerArray[1]
set udg_TEMP_IntegerArray[3] = udg_TEMP_IntegerArray[3] + 1
endloop
call VisionPlayers( udg_TEMP_IntegerArray[2]-1, udg_TEMP_IntegerArray[3], true )
elseif udg_TEMP_IntegerArray[1] > 15 or udg_TEMP_IntegerArray[1] < 1 then
call DisplayTextToPlayer( pl, 0, 0, " |c00FF0000Invalid Player for first value.|r" )
return false
elseif udg_TEMP_IntegerArray[2] > 15 or udg_TEMP_IntegerArray[2] < 1 then
call DisplayTextToPlayer( pl, 0, 0, " |c00FF0000Invalid Player for second value.|r" )
return false
elseif udg_TEMP_IntegerArray[1] == udg_TEMP_IntegerArray[2] then
call DisplayTextToPlayer( pl, 0, 0, " |c00FF0000First and Second value cannot be the same.|r" )
else
if udg_TEMP_IntegerArray[1] > 12 or udg_TEMP_IntegerArray[2] > 12 then
return false
endif
call VisionPlayers( udg_TEMP_IntegerArray[1]-1, udg_TEMP_IntegerArray[2]-1, false )
endif
call DebugCommand(str,id)
//Music
elseif SubString(str,0,5) == "music" then
//Get rid of that pesky space people like to add
if (SubString(str,5,6) == " ") then
set text = SubString(str,6,StringLength(str))
else
set text = SubString(str,5,StringLength(str))
endif
if text == "stop" then
call EndThematicMusic( )
call DisplayTextToForce( udg_Force[2], " Now |cffba55d3stopping|r music." )
elseif text == "hope" then
call StopMusic( false )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\Comradeship.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Hope|r." )
elseif text == "heroic" then
call StopMusic( false )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\HeroicVictory.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Heroic|r." )
elseif text == "doom" then
call StopMusic( false )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\Doom.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Doom|r." )
elseif text == "pursuit" then
call StopMusic( false )
call TriggerSleepAction( 0.50 )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\PursuitTheme.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Pursuit|r." )
elseif text == "strange" then
call StopMusic( false )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\BloodElfTheme.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Strange|r." )
elseif text == "credits" then
call StopMusic( false )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\Credits.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Credits|r." )
elseif text == "sad" then
call StopMusic( false )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\SadMystery.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Sad|r." )
elseif text == "defeat" then
call StopMusic( false )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\TragicConfrontation.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Defeat|r." )
elseif text == "march" then
call StopMusic( false )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\OrcX1.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3March|r." )
elseif text == "holy" then
call StopMusic( false )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\HumanX1.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Holy|r." )
elseif text == "bold" then
call StopMusic( false )
call PlayThematicMusic( "Sound\\Music\\mp3Music\\NightElfX1.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Bold|r." )
elseif text == "trial" then
call StopMusic( false )
call PlayThematicMusic( "Internal\\Sound\\Music\\mp3Music\\NightElfX1.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Trial|r." )
elseif text == "puzzle" then
call StopMusic( false )
call PlayThematicMusic( "Internal\\Sound\\Music\\mp3Music\\Orc3.mp3" )
call DisplayTextToForce( udg_Force[2], " Now playing |cffba55d3Trial|r." )
endif
//*********Expert******
elseif (str == "ka") then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function KeepAliveEnumUnitSelected )
call DebugCommand(str,id)
elseif (str == "control") then
call ForForce( udg_Force[1], function doSharePlayerEnumControl )
call ForForce( udg_Force[2], function doSharePlayerEnumControl )
call ForForce( udg_Force[3], function doSharePlayerEnumControl )
call DebugCommand(str,id)
elseif (str == "uncontrol") then
call ForForce( udg_Force[1], function doSharePlayerEnumUncontrol )
call DebugCommand(str,id)
elseif (str == "unlock") then
if pl == Player(8) then
call DisableTrigger( gg_trg_Hero_Restrictor_Lock )
endif
call DebugCommand(str,id)
elseif (str == "freehero") then
if pl == Player(8) then
set udg_FreeHero = true
endif
call DebugCommand(str,id)
//Change the Terrain
elseif SubString(str, 0, 7) == "terrain" then
set udg_Status[id+1] = "terrain_change"
call GUIApplyCamForDM(pl)
//Get rid of that pesky space people like to add
if (SubString(str,7,8) == " ") then
set text = SubString(str,8,StringLength(str))
else
set text = SubString(str,7,StringLength(str))
endif
if S2I(text) < 32 and S2I(text) > 0 then
set i1 = 0
loop
if text == I2S(i1) then
call DisplayTextToPlayer( pl, 0, 0, " Terrain variation changed to '|c0000FF00" + text + "|r'." )
set DMTerrainVariation[id+1] = i1
endif
set i1 = i1 + 1
exitwhen i1 > 32
endloop
elseif text == "random" then
set DMTerrainVariation[id+1] = 0
else
set udg_DM_SubType[id+1] = text
endif
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id+1], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id+1] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id+1], pl )
if text == "raise" then
call DisplayTextToPlayer( pl, 0, 0, " Right click to '|c0000FF00" + udg_DM_SubType[id+1] + "|r' the terrain." )
elseif text == "lower" then
call DisplayTextToPlayer( pl, 0, 0, " Right click to '|c0000FF00" + udg_DM_SubType[id+1] + "|r' the terrain." )
else
set DMTerrainType[id+1] = 0
call DisplayTextToPlayer( pl, 0, 0, " Right click to change the terrain to '|c0000FF00" + udg_DM_SubType[id+1] + "|r'." )
endif
call DebugCommand(str,id)
else
set udg_TEMP_String = udg_DM_SubType[id+1]
set udg_DM_SubType[id+1] = str
if Lordaeron(id+1) != 0 then
set DMTerrainType[id+1] = 0
set udg_Status[id+1] = "terrain_change"
set udg_DM_SubType[id+1] = str
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id+1], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id+1] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id+1], pl )
call DisplayTextToPlayer( pl, 0, 0, " Right click to change the terrain to '|c0000FF00" + udg_DM_SubType[id+1] + "|r'." )
call DebugCommand(str,id)
elseif CityVillage(id+1) != 0 then
set DMTerrainType[id+1] = 0
set udg_Status[id+1] = "terrain_change"
set udg_DM_SubType[id+1] = str
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id+1], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id+1] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id+1], pl )
call DisplayTextToPlayer( pl, 0, 0, " Right click to change the terrain to '|c0000FF00" + udg_DM_SubType[id+1] + "|r'." )
call DebugCommand(str,id)
elseif Other(id+1) != 0 then
set DMTerrainType[id+1] = 0
set udg_Status[id+1] = "terrain_change"
set udg_DM_SubType[id+1] = str
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id+1], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id+1] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id+1], pl )
call DisplayTextToPlayer( pl, 0, 0, " Right click to change the terrain to '|c0000FF00" + udg_DM_SubType[id+1] + "|r'." )
call DebugCommand(str,id)
elseif Outland(id+1) != 0 then
set DMTerrainType[id+1] = 0
set udg_Status[id+1] = "terrain_change"
set udg_DM_SubType[id+1] = str
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id+1], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id+1] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id+1], pl )
call DisplayTextToPlayer( pl, 0, 0, " Right click to change the terrain to '|c0000FF00" + udg_DM_SubType[id+1] + "|r'." )
call DebugCommand(str,id)
elseif Cliffs(id+1) != 0 then
set DMTerrainType[id+1] = 0
set udg_Status[id+1] = "terrain_change"
set udg_DM_SubType[id+1] = str
call LeaderboardSetPlayerItemLabelBJ( Player(14), udg_Board[id+1], "|cFFFFFFFF-> '|r|c0000FF00" + udg_DM_SubType[id+1] + "|r|cFFFFFFFF'|r" )
call SelectUnitForPlayerSingle( udg_GUI_Pointer[id+1], pl )
call DisplayTextToPlayer( pl, 0, 0, " Right click to change the terrain to '|c0000FF00" + udg_DM_SubType[id+1] + "|r'." )
call DebugCommand(str,id)
else
//*******Is not a command****
set udg_DM_SubType[id+1] = udg_TEMP_String
set count = count + 1
endif
endif
if count > 1 then // We checked all 2 elses and each returned no command
return false
endif
set fp = null
set pl = null
//********************RETURN
return true //is a command
endfunction
function DoChatSystem takes integer id returns nothing
local player pl = Player(id)
local force fp = bj_FORCE_PLAYER[id]
local integer num
local string text
local string str = GetEventPlayerChatString()
local integer i
local integer i2
//LBoard Commands
if SubString(str, 0, 4) == "disp" and IsPlayerInForce(pl, udg_Force[1]) then
if SubString(str,4,5) == " " then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
if text == "points" then
if HeroClass[GetUnitId(GetPlayerHero(id+1))] == null then
call LeaderboardSetLabel(udg_Board[id+1], "No Class")
else
call LeaderboardSetLabel(udg_Board[id], HeroClass[GetUnitId(GetPlayerHero(id+1))])
endif
call LeaderboardAddItemBJ( Player(14), udg_Board[id+1], "|n|cff7cfc00Skill Points: |r|c00FFFFFF" + I2S(SKILL_PTS[GetUnitId(GetPlayerHero(id+1))]) + "|r|n|cffffff00Stat Points: |r|c00FFFFFF" + I2S(STAT_PTS[GetUnitId(GetPlayerHero(id+1))])+"|r", 0 )
call LeaderboardDisplay(udg_Board[id+1], true)
call LeaderboardResizeBJ( udg_Board[id+1] )
elseif text == "hide" then
if GetLocalPlayer() == pl then
call MultiboardDisplay( DescrBoard[id+1], false )
endif
call LeaderboardDisplay(udg_Board[id+1], false)
elseif skillhash[text] != 0 then
call MultiboardSetTitleText(DescrBoard[id+1], GetObjectName(skillhash[text])+" Description")
if GetLocalPlayer() == pl then
call MultiboardDisplay( DescrBoard[id+1], true )
call MultiboardMinimize( DescrBoard[id+1], false )
endif
set text = LoadStr(AH, skillhash[text], 1)
if text == null or text == "" then
set text = "No description available for this skill./Please choose another skill to display."
set num = 9
else
set num = 0
endif
set str = ""
call MultiboardSetRowCount(DescrBoard[id+1], 10)
loop
exitwhen StringLength(text) < 1
set num = num + 1
set i2 = 1
set i = 46
loop
exitwhen i2 > StringLength(text) or SubString(text, i2-1, i2) == "/" or i2 > i
if SubString(text, i2-1, i2+1) == "|c" then
if SubString(text, i2+1, i2+9) == "ffffdc00" then
set str = "|cffffdc00"
endif
set i = i + 10
elseif SubString(text, i2-1, i2+1) == "|r" then
set i = i + 2
endif
set i2 = i2 + 1
endloop
if SubString(text, i2-1, i2) == "/" or i2 > StringLength(text) then
call MultiboardSetItemValueBJ(DescrBoard[id+1], 1, num, str+SubString(text, 0, i2-1))
else
loop
set i2 = i2 - 1
exitwhen SubString(text, i2-1, i2) == " "
endloop
call MultiboardSetItemValueBJ(DescrBoard[id+1], 1, num, str+SubString(text, 0, i2))
endif
set text = SubString(text, i2, StringLength(text))
endloop
call MultiboardSetRowCount(DescrBoard[id+1], num)
endif
//Player Stat Raise
elseif SubString(str,0,1) == "+" and IsPlayerInForce(pl, udg_Force[1]) then
set text = SubString(str,1,StringLength(str))
if text == "agi" and STAT_PTS[GetUnitId(GetPlayerHero(id+1))] > 0 then
call SetHeroAgi(GetPlayerHero(id+1), GetHeroAgi(GetPlayerHero(id+1), false) + 1, true)
set STAT_PTS[GetUnitId(GetPlayerHero(id+1))] = STAT_PTS[GetUnitId(GetPlayerHero(id+1))] - 1
elseif text == "str" and STAT_PTS[GetUnitId(GetPlayerHero(id+1))] > 0 then
call SetHeroStr(GetPlayerHero(id+1), GetHeroStr(GetPlayerHero(id+1), false) + 1, true)
set STAT_PTS[GetUnitId(GetPlayerHero(id+1))] = STAT_PTS[GetUnitId(GetPlayerHero(id+1))] - 1
elseif text == "int" and STAT_PTS[GetUnitId(GetPlayerHero(id+1))] > 0 then
call SetHeroInt(GetPlayerHero(id+1), GetHeroInt(GetPlayerHero(id+1), false) + 1, true)
set STAT_PTS[GetUnitId(GetPlayerHero(id+1))] = STAT_PTS[GetUnitId(GetPlayerHero(id+1))] - 1
elseif STAT_PTS[GetUnitId(GetPlayerHero(id+1))] < 1 and(text == "int" or text == "str" or text == "agi")then
call DisplayTextToPlayer(pl, 0, 0, "|c00FF0000You have no stat points to spend for this action!|r")
elseif ClassON then
if HeroClass[GetUnitId(GetPlayerHero(id+1))] == "" then
if not DetermineClass(GetPlayerHero(id+1), text, "") then
call DisplayTextToPlayer(pl, 0, 0, "|c00FF0000" + text + " is not a valid class.|r")
endif
elseif skillhash[text] != 0 then
if SKILL_PTS[GetUnitId(GetPlayerHero(id+1))] < 1 then
call DisplayTextToPlayer(pl, 0, 0, "|c00FF0000You have no skill points to spend for this action!|r")
else
call SkillUp(GetPlayerHero(id+1), text)
endif
elseif SubClass[GetUnitId(GetPlayerHero(id+1))] == "" and GetHeroLevel(GetPlayerHero(id+1)) >= SubLVL then
if not DetermineClass(GetPlayerHero(id+1), text, "") then
call DisplayTextToPlayer(pl, 0, 0, "|c00FF0000" + text + " is not a valid class.|r")
endif
else
call DisplayTextToPlayer(pl, 0, 0, "|c00FF0000That is not a valid '+' command!|r")
endif
else
call DisplayTextToPlayer(pl, 0, 0, "|c00FF0000Classes are turned off!|r")
endif
call LeaderboardAddItemBJ( Player(14), udg_Board[id+1], "|cff7cfc00Skill Points: |r|c00FFFFFF" + I2S(SKILL_PTS[GetUnitId(GetPlayerHero(id+1))]) + "|r|n|cffffff00Stat Points: |r|c00FFFFFF" + I2S(STAT_PTS[GetUnitId(GetPlayerHero(id+1))])+"|r", 0 )
//Player Repick (Because that shit is annoying!)
elseif str == "-repick" and IsPlayerInForce(pl, udg_Force[1]) and Repick then
call CreateUnit(Player(15), GetUnitTypeId(GetPlayerHero(id+1)), HeroPickX[GetUnitId(GetPlayerHero(id+1))], HeroPickY[GetUnitId(GetPlayerHero(id+1))], 270)
set udg_HERO_FloatCam[id+1] = true
set Rotation[id+1] = 0
set Angle[id+1] = 0
set STAT_PTS[id+1] = 1
set SKILL_PTS[id+1] = 3
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl", GetUnitX(GetPlayerHero(id+1)), GetUnitY(GetPlayerHero(id+1))))
call RemoveUnit(GetPlayerHero(id+1))
call CameraSetupApplyForPlayer( true, gg_cam_HeroSelector, pl, 0 )
//Play Animation
elseif SubString(str,0,4) == "play" and IsPlayerInForce(pl, udg_Force[1]) then
if SubString(str,4,5) == " " then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set udg_TEMP_Player = pl
set udg_TEMP_String = text
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function PlayForPlayer )
//Attach for Players
elseif SubString(str, 0, 7) == "attach " and IsPlayerInForce(pl, udg_Force[1]) then
set text = SubString(str, 7, 8)
set udg_TEMP_Integer = S2I(text)
if udg_TEMP_Integer > 9 then
set udg_TEMP_Integer = 9
elseif udg_TEMP_Integer < 1 then
set udg_TEMP_Integer = 1
endif
set i = 9
set i2 = 10
loop
set i2 = i2 + 1
exitwhen SubString(str, i2-1, i2) == " " or i2 > StringLength(str)
endloop
set i2 = i2 - 1
set udg_TEMP_String = SubString(str,i,i2)
set i = i2 + 1
set udg_TEMP_String2 = SubString(str,i,StringLength(str))
set udg_TEMP_Player = pl
if udg_TEMP_Integer >= 1 then
call GroupEnumUnitsSelected( ENUM_GROUP, pl, function AttachEnumPlayerSelected )
endif
//Info Text Tag Command
elseif SubString(str, 0, 4) == "info" and IsPlayerInForce(pl, udg_Force[1]) then
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set Info[GetUnitId(udg_HERO_Ref2[id+1])] = text
//Dice & Roll
elseif SubString(str,0,4) == "dice" or (SubString(str,0,4) == "roll" and SubString(str, 4, 7) != "ing") then
if SubString(str,4,5) == " " then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
if S2I(text) > 0 then
call DisplayTextToForce(GetPlayersAll(), ColorName(GetPlayerName(Player(id)),id) + " rolled a " + ColorName(I2S(GetRandomInt(1, S2I(text))),id) +" out of "+ ColorName(I2S(S2I(text)),id) +".")
else
call DisplayTextToForce(GetPlayersAll(), ColorName(GetPlayerName(Player(id)),id) +" rolled an invalid number: " + ColorName(text,id) )
endif
//Share Vision
elseif SubString(str,0,6) == "vision" and IsPlayerInForce(pl, udg_Force[1]) then
set i = 0
if SubString(str,6,7) == " " then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
if text == "all" then
set i = 411
else
set i = GetPlayerNumFromStr(text, id)
endif
if i == 411 then
set i = 0
loop
exitwhen i > 11 or IsPlayerInForce(Player(i), udg_Force[1]) and i != id
set i = i + 1
endloop
call VisionPlayers( id, i, true )
elseif i > 15 or i < 1 then
call DisplayTextToPlayer( pl, 0, 0, " |c00FF0000Invalid Player.|r" )
elseif i == id+1 then
call DisplayTextToPlayer( pl, 0, 0, " |c00FF0000Cannot vision yourself.|r" )
else
call VisionPlayers( id, i-1, false )
endif
//DoBRP Set Name
elseif SubString(str, 0, 7) == "setname" then
if IsANumber(SubString(str, 7, 8)) then
set num = S2I(SubString(str, 7, 8))
//Get rid of that pesky space people like to add
if SubString(str,8,9) == " " then
set text = SubString(str,9,StringLength(str))
else
set text = SubString(str,8,StringLength(str))
endif
set udg_Names[num + id*10] = text
call DisplayTextToPlayer( pl, 0, 0, "|c0000FF00Name " + I2S(num) + " set to |r" + ColorName(udg_Names[num + id*10],id))
else
call DisplayTextToPlayer( pl, 0, 0, "|c00FF0000This map uses the numbers 0-9 and ; instead of symbols for character chatting.|r" )
endif
elseif SubString(str, 0, 4) == "face" and StringLength(str) < 16 and IsPlayerInForce(pl, udg_Force[1]) then
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
if text == "east" or text == "e" then
set udg_TEMP_Real = 0
elseif text == "northeast" or text == "north east" or text == "ne" then
set udg_TEMP_Real = 45
elseif text == "north" or text == "n" then
set udg_TEMP_Real = 90
elseif text == "northwest" or text == "north west" or text == "nw" then
set udg_TEMP_Real = 135
elseif text == "west" or text == "w" then
set udg_TEMP_Real = 180
elseif text == "southwest" or text == "south west" or text == "sw" then
set udg_TEMP_Real = 225
elseif text == "south" or text == "s" then
set udg_TEMP_Real = 270
elseif text == "southeast" or text == "south east" or text == "se" then
set udg_TEMP_Real = 315
else
set udg_TEMP_Real = S2R(text)
endif
call SetUnitFacing(GetPlayerHero(id+1), udg_TEMP_Real)
//Player Tint
elseif SubString(str, 0, 4) == "tint" and IsPlayerInForce(pl, udg_Force[1]) then
//Get rid of that pesky space people like to add
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set i = 1
set i2 = 2
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
if i2 > StringLength(str) or i2 > 8 then
//dobrp can lick my nuts
set udg_TEMP_RealArray[1] = S2R(SubString(text, 0, 3))
set udg_TEMP_RealArray[2] = S2R(SubString(text, 3, 6))
set udg_TEMP_RealArray[3] = S2R(SubString(text, 6, 9))
if StringLength(str) > 9 then
set udg_TEMP_RealArray[4] = S2R(SubString(text, 9, 12))
else
set udg_TEMP_RealArray[4] = 0
endif
//so can quatredan. lazy programmers
if udg_TEMP_RealArray[1] > 100 or udg_TEMP_RealArray[2] > 100 or udg_TEMP_RealArray[3] > 100 or udg_TEMP_RealArray[4] > 100 then
set udg_TEMP_RealArray[1] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[2] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[3] = udg_TEMP_RealArray[1] * 100 / 255
set udg_TEMP_RealArray[4] = udg_TEMP_RealArray[1] * 100 / 255
endif
else
//ratios
set udg_TEMP_RealArray[1] = S2R(SubString(text, i-1, i2-1)) * 100
set i = i2 + 1
set i2 = i + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[2] = S2R(SubString(text, i-1, i2-1)) * 100
set i = i2 + 1
set i2 = i + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[3] = S2R(SubString(text, i-1, i2-1)) * 100
if StringLength(str) > i2 then //we hit a space and there's more - alpha term
set i = i2 + 1
set i2 = i + 1
loop
exitwhen i2 > StringLength(str) or SubString(text, i2-1, i2) == " "
set i2 = i2 + 1
endloop
set udg_TEMP_RealArray[4] = S2R(SubString(text, i-1, i2-1)) * 100
else
set udg_TEMP_RealArray[4] = 0
endif
endif
set udg_TEMP_RealArray[1] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[1], 0), 100)
set udg_TEMP_RealArray[2] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[2], 0), 100)
set udg_TEMP_RealArray[3] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[3], 0), 100)
set udg_TEMP_RealArray[4] = RMinBJ(RMaxBJ(udg_TEMP_RealArray[4], 0), 100)
if GetLocalPlayer() == pl then
call SetUnitVertexColorBJ( udg_HERO_Ref2[id+1], udg_TEMP_RealArray[1], udg_TEMP_RealArray[2], udg_TEMP_RealArray[3], udg_TEMP_RealArray[4] )
endif
//Player Color
elseif SubString(str, 0, 5) == "color" and IsPlayerInForce(pl, udg_Force[1]) then
//Get rid of that pesky space people like to add
if (SubString(str,5,6) == " ") then
set text = SubString(str,6,StringLength(str))
else
set text = SubString(str,5,StringLength(str))
endif
set udg_TEMP_Integer = GetPlayerNumFromStrSafe(text, id)
if pl == GetLocalPlayer() then
call SetUnitColor( udg_HERO_Ref2[id+1], GetPlayerColor(Player(udg_TEMP_Integer-1)))
endif
//Unit Size
elseif SubString(str,0,4) == "size" and IsPlayerInForce(pl, udg_Force[1]) then
//Get rid of that pesky space people like to add
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set i = IMaxBJ(80, IMinBJ(140, S2I(text)))
call SetUnitScale( GetPlayerHero(id+1), i*0.01, i*0.01, i*0.01)
//Set Name
elseif SubString(str, 0, 3) == "set" then
if IsANumber(SubString(str, 3, 4)) then
set num = S2I(SubString(str, 3, 4))
if (SubString(str,4,5) == " ") then
set text = SubString(str,5,StringLength(str))
elseif SubString(str, 4,8) == "name" then
set text = SubString(str,8,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set udg_Names[num + id*10] = text
call DisplayTextToPlayer( pl, 0, 0, "|c0000FF00Name " + I2S(num) + " set to |r" + ColorName(udg_Names[num + id*10],id))
//Set OOC
elseif SubString(str, 3,6) == "ooc" then
if (SubString(str,6,7) == " ") then
set text = SubString(str,7,StringLength(str))
else
set text = SubString(str,6,StringLength(str))
endif
set OOC[id] = text
call DisplayTextToPlayer( pl, 0, 0, "OOC set to |r" + ColorName(text,id))
//Set; Name
elseif SubString(str,3,4) == ";" then
if SubString(str,4,5) == " " then
set text = SubString(str,5,StringLength(str))
else
set text = SubString(str,4,StringLength(str))
endif
set udg_TEMP_String = text
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function SemiColonSet )
else
call DisplayTextToPlayer( pl, 0, 0, "|c00FF0000This map uses the numbers 0-9 and ; instead of symbols for character chatting.|r" )
endif
//Chat Name
elseif IsANumber(SubString(str, 0, 1)) then
set num = S2I(SubString(str, 0, 1))
//Get rid of that pesky space people like to add
if (SubString(str,1,2) == " ") then
set text = SubString(str,2,StringLength(str))
else
set text = SubString(str,1,StringLength(str))
endif
call DisplayTextToForce( GetPlayersAll(), ColorName(udg_Names[num + id*10] + ": ",id) + text)
elseif str == "promote" and (GetPlayerName(pl) == "WorldEdit" or GetPlayerName(pl) == "Titanhex") then
call PromotePlayer(pl)
//Name; (DMs Only)
elseif (SubString(str,0,1) == ";" or SubString(str,0,1) == ":") and IsPlayerInForce(pl, udg_Force[2]) then
//Get rid of that pesky space people like to add
if SubString(str,1,2) == " " then
set text = SubString(str,2,StringLength(str))
else
set text = SubString(str,1,StringLength(str))
endif
set udg_TEMP_Integer = id
if SubString(str,0,1) == ":" then
set udg_TEMP_Integer = 20
endif
set udg_TEMP_String = text
call GroupEnumUnitsSelected(ENUM_GROUP, pl, function SemiColonSpeak )
//Narrate (DMs Only)
elseif SubString(str,0,1) == "-" and IsPlayerInForce(pl, udg_Force[2]) then
//Get rid of that pesky space people like to add
if SubString(str,1,2) == " " then
set text = SubString(str,2,StringLength(str))
else
set text = SubString(str,1,StringLength(str))
endif
call DisplayTextToForce(GetPlayersAll(), ColorName("- ", id) + text)
//OOC to All (DMs Only)
elseif SubString(str,0,1) == "." and IsPlayerInForce(pl, udg_Force[2]) then
//Get rid of that pesky space people like to add
if (SubString(str,1,2) == " ") then
set text = SubString(str,2,StringLength(str))
else
set text = SubString(str,1,StringLength(str))
endif
call DisplayTextToForce( GetPlayersAll(), " |cffffd700(OOC)|r" + ColorName(OOC[id] + ": ",id) + "[" + text + "]")
//List Names
elseif StringCase(str, false) == "names" then
set i = 0
loop
exitwhen i > 9
if not(udg_Names[i + id*10] == null) then
call DisplayTextToPlayer( pl, 0, 0, "|c0000FF00 " + I2S(i) + " - |r" + ColorName(udg_Names[i + id*10],id))
endif
set i = i + 1
endloop
//Debug
elseif StringCase(str, false) == "debug" then
call ForForce( GetPlayersAll(), function ShowLocalDebugBoard )
elseif DoCommandEntered(id) then
//is a command - prevents from being ooc
else
//not any command whatsoever - ooc chat
if IsPlayerInForce(pl, udg_Force[2]) and MUTE[GetPlayerId(pl)] != true then
call DisplayTextToForce( udg_Force[2], " |cffffd700(DM)|r" + ColorName(OOC[id] + ": ",id) + "(" + str + ")")
elseif IsPlayerInForce(pl, udg_Force[1]) then
call DisplayTextToForce( GetPlayersAll(), " |cffc0c0c0(OOC)|r" + ColorName(OOC[id] + ": ",id) + "["+ str + "]")
endif
endif
set pl = null
set fp = null
set text = null
set str = null
endfunction
function ChatEntered takes nothing returns nothing
local integer id
set id = GetPlayerId(GetTriggerPlayer())
call DoChatSystem(id)
endfunction
function InitTrig_Chat takes nothing returns nothing
local integer ip
set gg_trg_Chat = CreateTrigger()
call TriggerAddAction( gg_trg_Chat, function ChatEntered )
//Add Event: Any Player types Any Chat Message
set ip = 0
loop
exitwhen ip > 11
set IntegerBrushSize[ip] = 2
set RealBrushSize[ip] = 600
set OOC[ip] = GetPlayerName(Player(ip))
call TriggerRegisterPlayerChatEvent( gg_trg_Chat, Player(ip), "", false )
set ip = ip + 1
endloop
endfunction
//TESH.scrollpos=20
//TESH.alwaysfold=0
function Trig_MultiboardMake_Actions takes nothing returns nothing
local integer i = 1
loop
exitwhen i > 12
set DescrBoard[i] = CreateMultiboard()
call MultiboardSetRowCount(DescrBoard[i], 1)
call MultiboardSetColumnCount(DescrBoard[i], 1)
call MultiboardSetTitleText(DescrBoard[i], "Skill Description")
call MultiboardSetItemsStyle(DescrBoard[i], true, false)
call MultiboardSetItemsWidth(DescrBoard[i],0.2)
call MultiboardSetItemValueBJ(DescrBoard[i], 1, 1, "Use disp skillname to display a skills description.")
call MultiboardDisplay(DescrBoard[i], false)
set udg_Board[i] = CreateLeaderboard()
if IsPlayerInForce(Player(i-1), udg_Force[2]) then
call LeaderboardSetLabel(udg_Board[i], "Current Status")
call PlayerSetLeaderboard( Player(i-1), udg_Board[i])
call LeaderboardSetStyle( udg_Board[i], true, true, false, false )
call LeaderboardAddItemBJ( Player(14), udg_Board[i], "|c00FFFFFFNo Active Mode|r", 0 )
else
call LeaderboardSetLabel(udg_Board[i], "No Class")
call PlayerSetLeaderboard( Player(i-1), udg_Board[i])
call LeaderboardSetStyle( udg_Board[i], true, true, false, false )
call LeaderboardAddItemBJ( Player(14), udg_Board[i], "|cff7cfc00Skill Points: |r|c00FFFFFF 0|r|n|cffffff00Stat Points: |r|c00FFFFFF0|r", 0 )
endif
call LeaderboardDisplay( udg_Board[i], true )
set i = i + 1
endloop
set udg_DebugBoard = CreateMultiboard()
call MultiboardSetRowCount(udg_DebugBoard, 12)
call MultiboardSetColumnCount(udg_DebugBoard, 4)
call MultiboardSetTitleText(udg_DebugBoard, "Debug Info")
set udg_DebugBoardCreated = true
call MultiboardSetItemStyleBJ( udg_DebugBoard, 0, 0, true, false )
call MultiboardSetItemWidthBJ( udg_DebugBoard, 4, 0, 4.00 )
call MultiboardDisplay( udg_DebugBoard, false )
endfunction
//===========================================================================
function InitTrig_MultiboardMake takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent( t, 1, false )
call TriggerAddAction( t, function Trig_MultiboardMake_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Info_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetOrderTargetUnit()
local real x1 = GetUnitX(c)
local real y1 = GetUnitY(c)
local real x2 = GetUnitX(t)
local real y2 = GetUnitY(t)
local real d = SquareRoot(Pow(x1 - x2, 2) + Pow(y1 - y2, 2))
local real r
local texttag tag
local string str = "|n"
if GetIssuedOrderId() == OrderId("patrol") and d < 500 then
set tag = CreateTextTag()
if GetLocalPlayer() == GetTriggerPlayer() then
set str = Info[GetUnitId(t)]
else
set str = " "
endif
call SetTextTagText(tag, str, (10*0.023/10))
set r = StringLength(str)
if r > 32 then
set r = 32
endif
call SetTextTagPos(tag, x2-r*4, y2, 120.00)
call SetTextTagLifespan(tag, StringLength(str)*0.22 - 6*(StringLength(str)/120) )
call SetTextTagPermanent(tag, false)
call SetTextTagVisibility(tag, true)
call TriggerSleepAction(0)
call IssueImmediateOrder(c, "stop")//, GetUnitX(c), GetUnitY(c))
endif
set c = null
set t = null
endfunction
//===========================================================================
function InitTrig_Info takes nothing returns nothing
set gg_trg_Info = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Info, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddAction( gg_trg_Info, function Trig_Info_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_AutoBlink_Actions takes nothing returns nothing
if GetUnitAbilityLevel(GetTriggerUnit(), 'aubl') > 0 and GetIssuedOrderId() == OrderId("smart") then
call IssuePointOrder(GetTriggerUnit(), "blink", GetOrderPointX(), GetOrderPointY())
endif
endfunction
//===========================================================================
function InitTrig_AutoBlink takes nothing returns nothing
set gg_trg_AutoBlink = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_AutoBlink, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerAddAction( gg_trg_AutoBlink, function Trig_AutoBlink_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function StopItems_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'DNIm' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'strm' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'A000' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'Mega' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'aubl' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'DMTe' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'agro' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'ssma' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'sret' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'sint' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'perm' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'shea' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'revi' then
call unitabilityhistory[GetTriggerUnit()].skip()
elseif GetSpellAbilityId() == 'drfl' then
call unitabilityhistory[GetTriggerUnit()].skip()
endif
return true
endfunction
//===========================================================================
function InitTrig_SpellBlocks takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function StopItems_Conditions ) )
set t = null
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope DMTeleport initializer init
globals
private constant integer SPELLID = 'DMTe'
private unit TEMP
private unit INT
private real X
private real Y
endglobals
private struct Data
unit c
real x
real y
static method GroupEm takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(TEMP, SPELLID)
if IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) != true then
if lvl == 2 and GetOwningPlayer(TEMP) == GetOwningPlayer(GetFilterUnit()) then
call SetUnitPosition(GetFilterUnit(), X, Y)
elseif lvl == 3 and IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) then
call SetUnitPosition(GetFilterUnit(), X, Y)
elseif lvl == 4 and IsUnitAlly(GetFilterUnit(), GetOwningPlayer(TEMP)) then
call SetUnitPosition(GetFilterUnit(), X, Y)
endif
endif
return false
endmethod
static method Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local group g = NewGroup()
local integer lvl = GetUnitAbilityLevel(D.c, SPELLID)
set TEMP = D.c
set X = D.x
set Y = D.y
if GetUnitAbilityLevel(D.c, SPELLID) > 1 then
call GroupEnumUnitsInArea(g, GetUnitX(D.c), GetUnitY(D.c), 350, Filter(function Data.GroupEm))
else
call SetUnitPosition(D.c, D.x, D.y)
endif
call ReleaseTimer(tim)
call ReleaseGroup(g)
endmethod
static method create takes unit c, real x, real y returns Data
local Data D = Data.allocate()
local timer tim = NewTimer()
set D.x = x
set D.y = y
set D.c = c
call SetTimerData(tim,D)
call TimerStart(tim, 4.40, false, function Data.Timer)
return D
endmethod
endstruct
private function Conditions takes nothing returns boolean
if GetSpellAbilityId() == SPELLID then
call Data.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
endif
return false
endfunction
//===========================================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conditions )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Cast_Spell_Conditions takes nothing returns boolean
local timer tim = NewTimer()
if GetSpellAbilityId() == 'A03N' then
call SaveUnitHandle(AuraFXHash, 0, GetHandleId(tim), GetTriggerUnit())
if GetSpellTargetUnit() == null then
call DestroyEffect(AddSpecialEffect( AuraFX[GetUnitId(GetTriggerUnit())], GetSpellTargetX(), GetSpellTargetY() ))
else
call DestroyEffect(AddSpecialEffectTarget( AuraFX[GetUnitId(GetTriggerUnit())], GetSpellTargetUnit(), "origin" ))
endif
else
call ReleaseTimer(tim)
endif
return false
endfunction
//===========================================================================
function InitTrig_Cast_Spell takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, function Trig_Cast_Spell_Conditions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function ItemGrab_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'itgr' then
if GetSpellTargetItem() != null then
set udg_TEMP_ItemArray[GetPlayerId(GetTriggerPlayer())] = GetSpellTargetItem()
elseif GetSpellTargetUnit() != null then
call UnitAddItem( GetSpellTargetUnit(), udg_TEMP_ItemArray[GetPlayerId(GetTriggerPlayer())])
else
call SetItemPosition(udg_TEMP_ItemArray[GetPlayerId(GetTriggerPlayer())], GetSpellTargetX(), GetSpellTargetY())
endif
endif
return false
endfunction
//===========================================================================
function InitTrig_ItemGrab takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function ItemGrab_Conditions ) )
set t = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Add2Stock_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'Ad2S' then
if GetSpellTargetUnit() != null then
call AddUnitToStock(GetTriggerUnit(), GetUnitTypeId(GetSpellTargetUnit()), 99, 99)
call UnitAddAbility(GetTriggerUnit(), 'Aneu')
call UnitAddAbility(GetTriggerUnit(), 'Apit')
elseif GetSpellTargetItem() != null then
call AddItemToStock(GetTriggerUnit(), GetItemTypeId(GetSpellTargetItem()), 99, 99)
call UnitAddAbility(GetTriggerUnit(), 'Aneu')
call UnitAddAbility(GetTriggerUnit(), 'Apit')
else
call UnitAddAbility(GetTriggerUnit(), 'Aneu')
call UnitAddAbility(GetTriggerUnit(), 'Apit')
endif
endif
return false
endfunction
//===========================================================================
function InitTrig_Add2Stock takes nothing returns nothing
set gg_trg_Add2Stock = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Add2Stock, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Add2Stock, Condition( function Trig_Add2Stock_Conditions ) )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_UninvulnDestructable_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'devu' then
if IsDestructableInvulnerable(GetSpellTargetDestructable()) then
call SetDestructableInvulnerable(GetSpellTargetDestructable(), false )
else
call SetDestructableInvulnerable(GetSpellTargetDestructable(), true )
endif
endif
return false
endfunction
//===========================================================================
function InitTrig_UninvulnDestructable takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, function Trig_UninvulnDestructable_Conditions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function GetBonus_Conditions takes nothing returns boolean
local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
if GetSpellAbilityId() == 'gebo' and GetSpellTargetUnit() != null then
call SetUnitBonus(GetTriggerUnit(), BONUS_ARMOR, GetUnitBonus(GetSpellTargetUnit(), BONUS_ARMOR))
call SetUnitBonus(GetTriggerUnit(), BONUS_DAMAGE, GetUnitBonus(GetSpellTargetUnit(), BONUS_DAMAGE))
call SetUnitBonus(GetTriggerUnit(), BONUS_LIFE_REGEN, GetUnitBonus(GetSpellTargetUnit(), BONUS_LIFE_REGEN))
call SetUnitBonus(GetTriggerUnit(), BONUS_STRENGTH, GetUnitBonus(GetSpellTargetUnit(), BONUS_STRENGTH))
call SetUnitBonus(GetTriggerUnit(), BONUS_AGILITY, GetUnitBonus(GetSpellTargetUnit(), BONUS_AGILITY))
call SetUnitBonus(GetTriggerUnit(), BONUS_INTELLIGENCE, GetUnitBonus(GetSpellTargetUnit(), BONUS_INTELLIGENCE))
call SetUnitBonus(GetTriggerUnit(), BONUS_MANA_REGEN, GetUnitBonus(GetSpellTargetUnit(), BONUS_MANA_REGEN))
call SetUnitBonus(GetTriggerUnit(), BONUS_ATTACK_SPEED, GetUnitBonus(GetSpellTargetUnit(), BONUS_ATTACK_SPEED))
call SetUnitBonus(GetTriggerUnit(), BONUS_MANA_REGEN_PERCENT, GetUnitBonus(GetSpellTargetUnit(), BONUS_MANA_REGEN_PERCENT))
call SetUnitBonus(GetTriggerUnit(), BONUS_MOVEMENT_SPEED, GetUnitBonus(GetSpellTargetUnit(), BONUS_MOVEMENT_SPEED))
call SetUnitMaxState(GetTriggerUnit(), UNIT_STATE_MAX_LIFE, GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MAX_LIFE))
call SetUnitMaxState(GetTriggerUnit(), UNIT_STATE_MAX_MANA, GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MAX_MANA))
set BonusSkill[GetUnitId(GetTriggerUnit())] = BonusSkill[GetUnitId(GetSpellTargetUnit())]
set UnitBounty[GetUnitId(udg_GUI_Pointer[id])] = UnitBounty[GetUnitId(GetSpellTargetUnit())]
endif
return false
endfunction
//===========================================================================
function InitTrig_GetBonus takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function GetBonus_Conditions ) )
set t = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Attack_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'agro' and GetUnitAbilityLevel( Slave[GetUnitId(GetTriggerUnit())],'Abun') > 0 then
call UnitRemoveAbility( Slave[GetUnitId(GetTriggerUnit())],'Abun')
elseif GetSpellAbilityId() == 'agro' and GetUnitAbilityLevel( Slave[GetUnitId(GetTriggerUnit())],'Abun') < 1 then
call UnitAddAbility( Slave[GetUnitId(GetTriggerUnit())],'Abun')
endif
return false
endfunction
//===========================================================================
function InitTrig_AttackToggle takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Attack_Conditions ) )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Intercept_Conditions takes nothing returns boolean
call IssueTargetOrder(Slave[GetUnitId(GetTriggerUnit())], "attack", GetAttacker())
return false
endfunction
function TogIntercept_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'sint' and Intercept[GetUnitId(GetTriggerUnit())] == null then
set Intercept[GetUnitId(GetTriggerUnit())] = CreateTrigger()
call TriggerRegisterUnitEvent( Intercept[GetUnitId(GetTriggerUnit())], GetTriggerUnit(), EVENT_UNIT_ATTACKED )
call TriggerAddCondition( Intercept[GetUnitId(GetTriggerUnit())], function Intercept_Conditions )
elseif GetSpellAbilityId() == 'sint' then
call DestroyTrigger( Intercept[GetUnitId(GetTriggerUnit())] )
set Intercept[GetUnitId(GetTriggerUnit())] = null
endif
return false
endfunction
//===========================================================================
function InitTrig_HomunInterceptToggle takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function TogIntercept_Conditions ) )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function AttackMove_Actions takes nothing returns nothing
local string s = "none"
if GetSpellTargetUnit() == null then
call IssuePointOrder( Slave[GetUnitId(GetTriggerUnit())], "move", GetSpellTargetX(), GetSpellTargetY())
if GetOwningPlayer(GetTriggerUnit()) == GetLocalPlayer() then
set s = "Abilities\\Spells\\Undead\\UndeadMine\\UndeadMineCircle.mdl"
endif
call DestroyEffect(AddSpecialEffect(s, GetSpellTargetX(), GetSpellTargetY()))
else
if GetOwningPlayer(GetTriggerUnit()) == GetLocalPlayer() then
set s = "Abilities\\Spells\\NightElf\\TrueshotAura\\TrueshotAura.mdl"
endif
if IsUnitEnemy(GetSpellTargetUnit(), GetOwningPlayer(GetTriggerUnit())) then
call IssueTargetOrder( Slave[GetUnitId(GetTriggerUnit())], "attack", GetSpellTargetUnit() )
else
call IssueTargetOrder(Slave[GetUnitId(GetTriggerUnit())], "move", GetSpellTargetUnit())
endif
call DestroyEffect(AddSpecialEffectTarget(s, GetSpellTargetUnit(), "origin"))
endif
set s = null
endfunction
function AttackMove_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'ssma'
endfunction
//===========================================================================
function InitTrig_AttackMove takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition( function AttackMove_Conditions ) )
call TriggerAddAction(t, function AttackMove_Actions )
set t = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function RevCheck_Conditions takes nothing returns boolean
local unit c = GetTriggerUnit()
if GetSpellAbilityId() == 'revi' and not((IsUnitType(Slave[GetUnitId(c)], UNIT_TYPE_DEAD)) and Slave[GetUnitId(c)] == null)then
call TriggerSleepAction(0)
call SetUnitState(c, UNIT_STATE_MANA, GetUnitState(c, UNIT_STATE_MANA) + 250)
endif
set c = null
return false
endfunction
//===========================================================================
function InitTrig_ReviveCheck takes nothing returns nothing
set gg_trg_ReviveCheck = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ReviveCheck, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_ReviveCheck, Condition( function RevCheck_Conditions ) )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Heel_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'sret' then
call IssueTargetOrder( Slave[GetUnitId(GetTriggerUnit())], "patrol", Master[GetUnitId(GetTriggerUnit())] )
endif
return false
endfunction
//===========================================================================
function InitTrig_Heel takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Heel_Conditions ) )
set t = null
endfunction
//TESH.scrollpos=66
//TESH.alwaysfold=0
scope Permanence initializer Init
globals
private constant integer SPELLID = 'perm'
private constant integer REVID = 'revi'
private constant integer COMMANDBOOK = 'comm'
private trigger array PetDeathTrigger
unit array SlavesMaster
endglobals
public struct Data
unit m
unit s
static method death takes nothing returns boolean
local unit t = GetTriggerUnit()
local unit c = SlavesMaster[GetUnitId(t)]
set UnitArmor[GetUnitId(c)] = GetUnitBonus(t, BONUS_ARMOR)
set UnitDamage[GetUnitId(c)] = GetUnitBonus(t, BONUS_DAMAGE)
set UnitLifeRegen[GetUnitId(c)] = GetUnitBonus(t, BONUS_LIFE_REGEN)
set UnitManaRegen[GetUnitId(c)] = GetUnitBonus(t, BONUS_MANA_REGEN)
set UnitAttackSpeed[GetUnitId(c)] = GetUnitBonus(t, BONUS_ATTACK_SPEED)
set UnitManaRegenPercent[GetUnitId(c)] = GetUnitBonus(t, BONUS_MANA_REGEN_PERCENT)
set UnitMoveSpeed[GetUnitId(c)] = GetUnitBonus(t, BONUS_MOVEMENT_SPEED)
set UnitLife[GetUnitId(c)] = GetUnitState(t, UNIT_STATE_MAX_LIFE)
set UnitMana[GetUnitId(c)] = GetUnitState(t, UNIT_STATE_MAX_MANA)
set SlavePlayer[GetUnitId(c)] = GetOwningPlayer(t)
//Clean Up
return true
endmethod
static method onLoop takes nothing returns nothing
local thistype this = GetTimerData(GetExpiredTimer())
local real distance = SquareRoot(Pow((GetUnitX(.m) - GetUnitX(.s)), 2) + Pow((GetUnitY(.m) - GetUnitY(.s)), 2))
if .s == null or IsUnitType(Slave[GetUnitId(.m)], UNIT_TYPE_DEAD) then
call DestroyTrigger(PetDeathTrigger[GetUnitId(.m)])
set PetDeathTrigger[GetUnitId(.m)] = null
endif
if Master[GetUnitId(.m)] != null then
if distance > 700 then
call IssueTargetOrder( .s, "patrol", .m )
endif
else
call ReleaseTimer(GetExpiredTimer())
call .destroy()
set Slave[GetUnitId(.m)] = null
set Master[GetUnitId(.m)] = null
endif
endmethod
static method create takes unit c, unit t returns thistype
local thistype this = thistype.allocate()
local timer tim = NewTimer()
set .m = c
set .s = t
call UnitRemoveAbility(.m, SPELLID)
call UnitAddAbility(.m, COMMANDBOOK)
call UnitMakeAbilityPermanent(.m, true, COMMANDBOOK)
set Master[GetUnitId(c)] = .m
set Slave[GetUnitId(c)] = .s
set SlaveID[GetUnitId(c)] = GetUnitTypeId(.s)
set SlavesMaster[GetUnitId(t)] = .m
set PetDeathTrigger[GetUnitId(.m)] = CreateTrigger()
call TriggerRegisterUnitEvent(PetDeathTrigger[GetUnitId(.m)], .s, EVENT_UNIT_DEATH)
call TriggerAddCondition(PetDeathTrigger[GetUnitId(.m)], function thistype.death)
call SetTimerData(tim,this)
call TimerStart(tim, 0.5, true, function thistype.onLoop)
return this
endmethod
static method Actions takes unit c, unit t returns nothing
if IsUnitType(Slave[GetUnitId(c)], UNIT_TYPE_DEAD) or Slave[GetUnitId(c)] == null then
if IsUnitType(Slave[GetUnitId(c)], UNIT_TYPE_HERO) then
call ReviveHero(Slave[GetUnitId(c)], GetUnitX(c), GetUnitY(c), true)
call IssueTargetOrder(t, "patrol", c)
return
else
set t = CreateUnit(SlavePlayer[GetUnitId(c)], SlaveID[GetUnitId(c)], GetUnitX(c), GetUnitY(c), GetUnitFacing(c))
call SetUnitBonus(t, BONUS_ARMOR, UnitArmor[GetUnitId(c)])
call SetUnitBonus(t, BONUS_DAMAGE, UnitDamage[GetUnitId(c)])
call SetUnitMaxState(t, UNIT_STATE_MAX_MANA, UnitMana[GetUnitId(c)])
call SetUnitMaxState(t, UNIT_STATE_MAX_LIFE, UnitLife[GetUnitId(c)])
call SetUnitBonus(t, BONUS_ATTACK_SPEED, UnitAttackSpeed[GetUnitId(c)])
call SetUnitBonus(t, BONUS_LIFE_REGEN, UnitLifeRegen[GetUnitId(c)])
call SetUnitBonus(t, BONUS_MANA_REGEN, UnitManaRegen[GetUnitId(c)])
call SetUnitBonus(t, BONUS_MOVEMENT_SPEED, UnitMoveSpeed[GetUnitId(c)])
call SetUnitBonus(t, BONUS_MANA_REGEN_PERCENT, UnitManaRegenPercent[GetUnitId(c)])
call UnitAddAbility(t, SpellID1[GetUnitId(c)])
call UnitAddAbility(t, SpellID2[GetUnitId(c)])
call UnitAddAbility(t, SpellID3[GetUnitId(c)])
endif
call IssueTargetOrder(t, "patrol", c)
call Data.create(c,t)
endif
endmethod
endstruct
private function Conditions takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
if GetSpellAbilityId() == SPELLID and Master[GetUnitId(c)] == null and Slave[GetUnitId(c)] == null then
call Data.create(c, t)
elseif GetSpellAbilityId() == REVID then
call Data.Actions( c, null )
endif
set c = null
set t = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(t, function Conditions)
call XE_PreloadAbility(SPELLID)
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
scope RefillVials initializer init
globals
private constant integer ITEMID = 'I001'
private integer FULLVIAL
endglobals
function FillVialFountain takes nothing returns boolean
local integer i = 0
local item indexItem
loop
set indexItem = UnitItemInSlot(GetFilterUnit(), i)
if indexItem != null and GetItemTypeId(indexItem) == ITEMID then
call RemoveItem(indexItem)
call UnitAddItemById(GetFilterUnit(), FULLVIAL)
endif
set i = i + 1
exitwhen i >= bj_MAX_INVENTORY
endloop
return false
endfunction
function FountainCheck takes nothing returns boolean
local unit f = GetFilterUnit()
if GetUnitTypeId(f) == 'n001' then
call BJDebugMsg(GetUnitName(f))
set FULLVIAL = 'I000'
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(f), GetUnitY(f), 400, Condition(function FillVialFountain))
elseif GetUnitTypeId(f) == 'n01C' or GetUnitTypeId(f) == 'n01B' or GetUnitTypeId(f) == 'n01T' or GetUnitTypeId(f) == 'n01X' or GetUnitTypeId(f) == 'n01W' then
set FULLVIAL = 'I000'
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(f), GetUnitY(f), 300, Condition(function FillVialFountain))
elseif GetUnitTypeId(f) == 'nbfl' then
set FULLVIAL = 'I00X'
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(f), GetUnitY(f), 300, Condition(function FillVialFountain))
elseif GetUnitTypeId(f) == 'ndfl' then
set FULLVIAL = 'I02T'
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(f), GetUnitY(f), 300, Condition(function FillVialFountain))
elseif GetUnitTypeId(f) == 'nfnp' then
set FULLVIAL = 'I02U'
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(f), GetUnitY(f), 300, Condition(function FillVialFountain))
elseif GetUnitTypeId(f) == 'nfoh' then
set FULLVIAL = 'I029'
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(f), GetUnitY(f), 300, Condition(function FillVialFountain))
elseif GetUnitTypeId(f) == 'nmoo' then
set FULLVIAL = 'I02B'
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(f), GetUnitY(f), 300, Condition(function FillVialFountain))
endif
set f = null
return false
endfunction
function RefillVials takes nothing returns nothing
call GroupEnumUnitsInRect( ENUM_GROUP, GetWorldBounds(), function FountainCheck )
endfunction
//===========================================================================
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent( t, 0.5, true )
call TriggerAddAction(t, function RefillVials)
set t = null
endfunction
endscope
//TESH.scrollpos=54
//TESH.alwaysfold=0
globals
trigger array TRIGGER_NPC_Dies
endglobals
library NPCDies requires MapScript
function IsVital takes integer it returns boolean
if it == 'maha' then
return true
elseif it == 'epg2' then
return true
elseif it == 'bpg2' then
return true
elseif it == 'seac' then
return true
elseif it == 'seha' then
return true
elseif it == 'eopn' then
return true
elseif it == 'head' then
return true
elseif it == 'glov' then
return true
elseif it == 'bpg1' then
return true
elseif it == 'epg1' then
return true
elseif it == 'fiac' then
return true
elseif it == 'feet' then
return true
elseif it == 'ecls' then
return true
elseif it == 'bcls' then
return true
elseif it == 'bopn' then
return true
endif
return false
endfunction
function Trig_NPC_Dies_Actions takes nothing returns nothing
local integer i = 0
local item indexItem
local unit un = GetDyingUnit()
call RemoveKeepAliveUnit(un)
if not (IsUnitIllusion(un)) and not(IsUnitType(un, UNIT_TYPE_SUMMONED)) then
loop
set indexItem = UnitItemInSlot(un, i)
if not IsVital(GetItemTypeId(indexItem)) then
call UnitRemoveItemFromSlot(un, i)
endif
set i = i + 1
exitwhen i >= bj_MAX_INVENTORY
endloop
endif
//revive hero
if IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) then
call PolledWait( 8.00 )
call ReviveHeroLoc( un, GetRandomLocInRect(gg_rct_NPCHeroRevive), false )
call PauseUnit( un, true )
endif
set un = null
endfunction
//===========================================================================
function InitTrig_NPC_Dies takes nothing returns nothing
local integer i = 13
loop
set TRIGGER_NPC_Dies[i] = CreateTrigger()
call TriggerRegisterPlayerUnitEventSimple( TRIGGER_NPC_Dies[i], Player(i-1), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( TRIGGER_NPC_Dies[i], function Trig_NPC_Dies_Actions )
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS + 1
endloop
endfunction
endlibrary
//TESH.scrollpos=14
//TESH.alwaysfold=0
//this leaks effects. i'm not too concerned.
//update: removed effect entirely. it looks dumb.
function Trig_KeepAlive_Periodic_Actions takes nothing returns nothing
local integer i
local integer tot
set tot = CountUnitsInGroup(udg_KA_Group)
if tot > 0 then
set i = 1
loop
exitwhen i > 1000
if not(udg_KA_Unit[i] == null) then
if IsUnitInGroup(udg_KA_Unit[i], udg_KA_Group) then //dont think this does anything, just trying to make sure it doesnt break
if IsUnitAliveBJ(udg_KA_Unit[i]) then
call SetTextTagPosUnitBJ( udg_KA_Text[i], udg_KA_Unit[i], 0 )
if GetUnitLifePercent(udg_KA_Unit[i]) < 30.00 then
call SetUnitLifePercentBJ( udg_KA_Unit[i], GetRandomReal(60.00, 85.00) )
endif
else
call KeepAliveUnit(udg_KA_Unit[i]) //remove KA
endif
set tot = tot - 1
if tot == 0 then
set i = 1000
endif
endif
endif
set i = i + 1
endloop
endif
endfunction
function InitTrig_KeepAlive_Periodic takes nothing returns nothing
set gg_trg_KeepAlive_Periodic = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_KeepAlive_Periodic, 0.20 )
call TriggerAddAction( gg_trg_KeepAlive_Periodic, function Trig_KeepAlive_Periodic_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Hide_Bridges_Func001A takes nothing returns nothing
if IsBridge(GetEnumDestructable()) then
call KillDestructable( GetEnumDestructable() )
call ShowDestructable( GetEnumDestructable(), false )
endif
endfunction
function Trig_Hide_Bridges_Actions takes nothing returns nothing
call EnumDestructablesInRectAll( GetWorldBounds(), function Trig_Hide_Bridges_Func001A )
endfunction
//===========================================================================
function InitTrig_Hide_Bridges takes nothing returns nothing
set gg_trg_Hide_Bridges = CreateTrigger( )
call TriggerAddAction( gg_trg_Hide_Bridges, function Trig_Hide_Bridges_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function SetupUnitPaletteEnum takes nothing returns nothing
local real x
local real y
set x = GetLocationX(GetUnitLoc(GetEnumUnit()))
set y = GetLocationY(GetUnitLoc(GetEnumUnit()))
call PauseUnit( GetEnumUnit(), true )
endfunction
function SetupUnitPalette takes nothing returns nothing
call TriggerSleepAction(0)
call ForGroup( GetUnitsInRectAll(gg_rct_Unit_Palette), function SetupUnitPaletteEnum )
endfunction
function InitTrig_Setup_Unit_Palette takes nothing returns nothing
set gg_trg_Setup_Unit_Palette = CreateTrigger( )
call TriggerAddAction( gg_trg_Setup_Unit_Palette, function SetupUnitPalette )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gold_Lumber_Actions takes nothing returns nothing
call SetMapFlag( MAP_RESOURCE_TRADING_ALLIES_ONLY, false )
call SetMapFlag( MAP_LOCK_RESOURCE_TRADING, false )
call SetPlayerState( Player(12), PLAYER_STATE_RESOURCE_GOLD, 9999999 )
call SetPlayerState( Player(12), PLAYER_STATE_RESOURCE_LUMBER, 9999999 )
call SetPlayerState( Player(14), PLAYER_STATE_RESOURCE_GOLD, 9999999 )
call SetPlayerState( Player(14), PLAYER_STATE_RESOURCE_LUMBER, 9999999 )
call SetPlayerState( Player(8), PLAYER_STATE_RESOURCE_GOLD, 9999999 )
call SetPlayerState( Player(8), PLAYER_STATE_RESOURCE_LUMBER, 9999999 )
call SetPlayerState( Player(9), PLAYER_STATE_RESOURCE_GOLD, 9999999 )
call SetPlayerState( Player(9), PLAYER_STATE_RESOURCE_LUMBER, 9999999 )
call SetPlayerState( Player(10), PLAYER_STATE_RESOURCE_GOLD, 9999999 )
call SetPlayerState( Player(10), PLAYER_STATE_RESOURCE_LUMBER, 9999999 )
endfunction
//===========================================================================
function InitTrig_Gold_Lumber takes nothing returns nothing
set gg_trg_Gold_Lumber = CreateTrigger( )
call TriggerAddAction( gg_trg_Gold_Lumber, function Trig_Gold_Lumber_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_IgnoreAIGuard_Actions takes nothing returns nothing
call RemoveAllGuardPositions( Player(12) )
call RemoveAllGuardPositions( Player(13) )
call RemoveAllGuardPositions( Player(14) )
call RemoveAllGuardPositions( Player(15) )
call StartMeleeAI( Player(12), "" )
call StartMeleeAI( Player(13), "" )
call StartMeleeAI( Player(14), "" )
call StartMeleeAI( Player(15), "" )
endfunction
//===========================================================================
function InitTrig_IgnoreAIGuard takes nothing returns nothing
set gg_trg_IgnoreAIGuard = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_IgnoreAIGuard, 0.10 )
call TriggerAddAction( gg_trg_IgnoreAIGuard, function Trig_IgnoreAIGuard_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
IF YOU SAVE THIS MAP, IT WILL BREAK.
This map uses a modified TerrainArt/Terrain.slk to
generate the pathing map, which makes the 'fake
cliffs' unwalkable. Saving will compute the pathing
map incorrectly, meaning units will be able to walk
over cliffs. It was left out of the map because it
doesn't actually work unless you extract it and
restart the editor, and to keep the file size small.
If you accidentally save, please delete it and e-mail
me for an original copy. I don't want people spreading
broken versions online. Stable release versions will be
save-locked.
If you'd like to make a modification to this map,
I'd be more than happy to send you the required files
via e-mail, but please wait until the map exits the
beta testing stage first.
-Vuen ([email protected])
//TESH.scrollpos=9
//TESH.alwaysfold=0
#######################################
# #
# Vuen's D&D Crystal RPG #
# #
# by Nicholas Fraser (Vuen) #
# [email protected] #
# #
#######################################
Okay. This is the readme file for this map.
This map was done entirely in the official
TFT World Editor; no WE mod or JASS editor was
used, and the WE Enhancer was only used to
add cliff terrain tiles to the map.
Feel free to use anything you'd like from this
map, and e-mail me if you have any questions.
If you use any chunks of code verbatim or if
you use my custom models, please leave credit.
I have people criticize me often for calling
it a D&D when it does not use D&D rules. The
reason is because this map was originally called
DM's Land RPG, but no one knew what that meant.
The term RPG has a different connotation when
referring to video games, and it's not the
meaning I want; besides, this map follows in the
footsteps of Neverlax and QuatreDan's D&D maps,
so everyone knows what D&D refers to.
I hope you prefer the pointer over the spawner.
I know I do, and I certainly hope it replaces
spawners in all D&D and RP maps from now on.
Feel free to email me if you have any ideas,
comments, questions, or complaints about this
map, or even if you just want to say 'Hi'!
Your feedback is what makes this map possible.
Happy Roleplaying!
//TESH.scrollpos=21
//TESH.alwaysfold=0
I always forget to update this readme, so
half of this is probably done by now. Here's
my 'planned features' list as of this writing:
known bugs
currently none aside from minor fixes
improvements
document commands directly on GUI
create units -> cam pos
select waygate ping
unit random city house, high elf house
trainkill no bounty
customval bits - invuln, train
blink smart unit/item -> blink, queue
blink not past gates/cliffs
blight/dispel manually +effect
naga units, tents (finish palette)
hero balance
?
hero ideas
priest ult wards -> mp/hp xtranquil
heal,ifire,rdead lvlskip
shaman - heal %
night elf blink
abilities
undead phoenix->infernal
fireball/meteor
fire arrow (fireball, immolation)
vampire bite
lightning strike
smite evil (priest/cleric)
find potion
items
weapons (one at a time)
caster items
gold
doodads
energyfield
rain
fog
sickness
walls
accessories:
helmet
glove
circlet/amulet
belt
boots
ring
accessory can:
add attributes
add life/mana
move speed bonus
immolation
magic damage
aura
immune
ideas
non-dm quests
player allegiance - bounty? (good/evil)
item crafting system
invuln all monsts
overhead perm-invuln (attach list boolarray, unitarray, effectarray, largest)
last unit locs: ptarray, boolarray, unitarray, count
hero build houses for respawn point
freeze gameplay (invuln all, stop+hold + ignore orders, reset abil cools)
message log
ka chance to die
follow
waygate (poll dist?)
blink
follow glob players?
mercs
ally, ka (chance?), follow, noinv, match col
town portals
//TESH.scrollpos=0
//TESH.alwaysfold=0
//The Before Release List
//The Need to Do list
Make-It-Yourself heroes
Add More Gates and Destructables
Make Customizable Spells
Individual Hero Flag
Text-Tag maker
Make Bard with RipCord(Shockwave), Song Book(Timer started songs), Heavy Rift(Double Effect, 1.5x cost, X Seconds), Harmonizing Strings(No Manacost for X Seconds)
//The Should Do list
Add Iceblock Spell (Have to kill the ice block unit placed on the target before it unfreezes)
//The Idea List
Put Spell Damage Formulas in Tooltips