//TESH.scrollpos=0
//TESH.alwaysfold=0
//
Name | Type | is_array | initial_value |
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MapTesting initializer init
globals
private constant integer HERO_ID = 'Npbm'
private constant string MAP_NAME = " |cffcdbe70P A N D A R O L L|r"
private unit hero
private integer lvl = 1
private dialog dg = DialogCreate()
private button array bt[5]
private real x
private real y
endglobals
private function createhero takes nothing returns nothing
set x = GetStartLocationX(0)
set y = GetStartLocationY(0)
set hero = CreateUnit(Player(0),HERO_ID,x, y, 0)
call SelectUnit(hero, true)
call FogEnable(false)
call FogMaskEnable(false)
call DisplayTextToPlayer(GetLocalPlayer(),x, y, MAP_NAME)
call SetMapMusic("Sound\\Music\\mp3Music\\IllidansTheme.mp3",false,0)
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,20.," |cffcdbe70 By: scorpion182")
call DisplayTimedTextToPlayer(Player(0),0,0,20.,"|cffcdbe70Press Esc to show dialog stuff.")
endfunction
private function StartDialog takes nothing returns nothing
call DialogDisplay(Player(0),dg,false)
call DialogClear(dg)
call DialogSetMessage(dg,"Setup")
set bt[0]=DialogAddButton(dg,"Level: "+I2S(lvl),0)
set bt[1]=DialogAddButton(dg,"Refresh",0)
set bt[2]=DialogAddButton(dg,"Reset Cooldown",0)
set bt[3]=DialogAddButton(dg,"Revive",0)
set bt[4]=DialogAddButton(dg,"Close",0)
call DialogDisplay(Player(0),dg,true)
endfunction
private function DialogSetup takes nothing returns nothing
if (GetClickedButton()!= bt[4]) then
if (GetClickedButton() == bt[0]) then
set lvl = lvl + 1
if (lvl > 25) then
set lvl = 1
endif
call SetHeroLevel(hero, lvl, false)
elseif (GetClickedButton() == bt[1]) then
call SetUnitState(hero, UNIT_STATE_LIFE, GetUnitState(hero,UNIT_STATE_MAX_LIFE))
call SetUnitState(hero, UNIT_STATE_MANA, GetUnitState(hero,UNIT_STATE_MAX_MANA))
elseif (GetClickedButton() == bt[2]) then
call UnitResetCooldown(hero)
elseif (GetClickedButton() == bt[3]) then
call ReviveHero(hero, x, y, false)
endif
call StartDialog()
endif
endfunction
private function init takes nothing returns nothing
local trigger t= CreateTrigger( )
call TriggerRegisterDialogEventBJ(t, dg )
call TriggerAddAction(t, function DialogSetup )
set t = CreateTrigger( )
call TriggerRegisterPlayerEventEndCinematic(t, Player(0) )
call TriggerAddAction(t, function StartDialog)
call createhero()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
/**************************************************************
*
* RegisterPlayerUnitEvent
* v4.2.0.0
* By Magtheridon96
*
* I would like to give a special thanks to Bribe, azlier
* and BBQ for improving this library. For modularity, it only
* supports player unit events.
*
* Functions passed to RegisterPlayerUnitEvent must
* return false. They can return nothing as well.
*
* Disclaimer:
* -----------
*
* - Don't use TriggerSleepAction inside registered code.
*
* API:
* ----
*
* function RegisterPlayerUnitEvent
* takes
* playerunitevent whichEvent : The event you would like to register
* code whichFunction : The code you would like to register
* returns
* nothing
*
* - Registers code that will execute when an event fires.
*
**************************************************************/
library RegisterPlayerUnitEvent // Special Thanks to Bribe and azlier
globals
private trigger array t
endglobals
function RegisterPlayerUnitEvent takes playerunitevent p, code c returns nothing
local integer i = GetHandleId(p)
local integer k = 15
if t[i] == null then
set t[i] = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(t[i], Player(k), p, null)
exitwhen k == 0
set k = k - 1
endloop
endif
call TriggerAddCondition(t[i], Filter(c))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
//============================================================================
// OrderEvent by Bribe, special thanks to Nestharus and Azlier, version 2.1.0.0
//
// API
// ---
// RegisterOrderEvent(integer orderId, code eventFunc)
// RegisterAnyOrderEvent(code eventFunc) //Runs for point/target/instant for any order
//
// Requires
// --------
// RegisterPlayerUnitEvent: hiveworkshop.com/forums/showthread.php?t=203338
//
library OrderEvent requires RegisterPlayerUnitEvent
globals
private trigger array t
endglobals
//============================================================================
function RegisterOrderEvent takes integer orderId, code c returns nothing
set orderId = orderId - 851968
if t[orderId] == null then
set t[orderId] = CreateTrigger()
endif
call TriggerAddCondition(t[orderId], Filter(c))
endfunction
//============================================================================
function RegisterAnyOrderEvent takes code c returns nothing
call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_ISSUED_ORDER, c)
call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, c)
call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, c)
endfunction
//============================================================================
private function OnOrder takes nothing returns nothing
call TriggerEvaluate(t[GetIssuedOrderId() - 851968])
endfunction
//============================================================================
private module M
private static method onInit takes nothing returns nothing
call RegisterAnyOrderEvent(function OnOrder)
endmethod
endmodule
private struct S extends array
implement M
endstruct
endlibrary
//TESH.scrollpos=63
//TESH.alwaysfold=0
library CTL /* v1.1.0.0
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* CTL or Constant Timer Loop provides a loop for constant merged timers of timeout .03125
*
* Similar to T32 but pauses timer when no structs have instances and removes structs
* from timer trigger when those structs have no instances.
*
* This can also create new timers after destroying a previous timer and generates less
* code in the module. It also generates no triggers so long as the module is implemented
* at the top of the struct.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* static method create takes nothing returns thistype
* - CTL
* - Creates new timer
*
* method destroy takes nothing returns nothing
* - CTL
* - Destroys created timer
*
* Module
*
* module CTL
* - Declare locals in here
* - Run ini code
* module CTLExpire
* - Run timer code
* -
* - thistype this refers to current expiring timer\
* module CTLNull
* - Null locals here
* module CTLEnd
*
* Example of Constant Timer Loop 32
* struct MyTimer extends array
* integer myValue
* implement CTL
* local string s="My value is "
* implement CTLExpire
* call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,s+I2S(myValue))
* call destroy()
* implement CTLNull
* set s=null //pointless, but shows how to use null block
* implement CTLEnd
* endstruct
*
* set MyTimer.create().myValue=16 //will display "My value is 16" in 5 seconds
*
* module CT32
* - A constant running timer. Useful when the timer is pretty much never ever
* - going to stop. Also allows control over loop (just provides an expiring timer).
* - Code goes in between two methods
* module CT32End
*
* Example of Constant Timer 32
*
* //Displays
* // 1
* // 2
* // 3
* struct MyTimers extends array
* integer myValue
* thistype next
* implement CTL2
* local thistype this=thistype(0).next
* loop
* exitwhen 0==this
* call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,s+I2S(myValue))
* set this=next
* endloop
* implement CTL2End
* private static method onInit takes nothing returns nothing
* set thistype(0).next=1
* set thistype(1).next=2
* set thistype(2).next=3
* set thistype(1).myValue=1
* set thistype(2).myValue=2
* set thistype(3).myValue=3
* endmethod
* endstruct
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
globals
private integer ic=0 //instance count
private integer tc=0 //timer count
private integer array rf //root first
private integer array n //next
private integer array p //previous
private integer array th //timer head
private integer array ns //next stack
private trigger t=CreateTrigger()
private timer m=CreateTimer()
private triggercondition array ct
private conditionfunc array rc
endglobals
private function E takes nothing returns nothing
local integer i=ns[0]
set ns[0]=0
loop
exitwhen 0==i
if (0==p[i]) then
if (0==n[i]) then
call TriggerRemoveCondition(t,ct[th[i]])
set ct[th[i]]=null
set tc=tc-1
set rf[th[i]]=0
else
set rf[th[i]]=n[i]
set p[n[i]]=0
endif
else
set p[n[i]]=p[i]
set n[p[i]]=n[i]
endif
set n[i]=n[0]
set n[0]=i
set i=ns[i]
endloop
if (0==tc) then
call PauseTimer(m)
else
call TriggerEvaluate(t)
endif
endfunction
private function CT takes integer r returns integer
local integer i
local integer f
if (0==n[0]) then
set i=ic+1
set ic=i
else
set i=n[0]
set n[0]=n[i]
endif
set th[i]=r
set ns[i]=-1
set f=rf[r]
if (0==f) then
set n[i]=0
set p[i]=0
set rf[r]=i
set ct[r]=TriggerAddCondition(t,rc[r])
if (0==tc) then
call TimerStart(m,.031250000,true,function E)
endif
set tc=tc+1
else
set n[i]=f
set p[i]=0
set p[f]=i
set rf[r]=i
endif
return i
endfunction
private function DT takes integer t returns nothing
debug if (0>ns[t]) then
set ns[t]=ns[0]
set ns[0]=t
debug else
debug call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"TIMER LOOP ERROR: ATTEMPT TO DESTROY NULL TIMER")
debug endif
endfunction
private keyword r
private keyword e
module CTL
static integer r
static method create takes nothing returns thistype
return CT(r)
endmethod
method destroy takes nothing returns nothing
call DT(this)
endmethod
static method e takes nothing returns boolean
local thistype this=rf[r]
endmodule
module CTLExpire
loop
exitwhen 0==this
endmodule
module CTLNull
set this=n[this]
endloop
endmodule
module CTLEnd
return false
endmethod
private static method onInit takes nothing returns nothing
set r=ic+1
set ic=r
set rc[r]=Condition(function thistype.e)
endmethod
endmodule
module CT32
static method e takes nothing returns boolean
endmodule
module CT32End
return false
endmethod
private static method onInit takes nothing returns nothing
call TriggerAddCondition(t,Condition(function thistype.e))
if (0==tc) then
call TimerStart(m,.031250000,true,function E)
endif
set tc=tc+1
endmethod
endmodule
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library PandaRoll requires CTL, OrderEvent
//*-------------------------------------------------------------------------------------------
//* __________________________________________________________________________________________
//* PANDA ROLL - v1.01
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* Requirements
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* - CTL by Nestharus
//* - OrderEvent by Bribe
//*
//* Importing
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* 1. Copy the ability, buff, dummy unit, and import dummy.mdx model
//* 2. Implement the required libraries
//* 3. Copy this trigger
//* 4. Configure the spell, and make sure the buff is correct
//*-------------------------------------------------------------------------------------------
//* CALIBRATION SECTION
//*-------------------------------------------------------------------------------------------
globals
// the rawcode of the ability
private constant integer SPELL_ID = 'A000'
// the rawcode of the buff
private constant integer BUFF_ID = 'B000'
// the rawcode of the dummy unit
private constant integer DUMMY_ID = 'e000'
// order string turn on
private constant string ORDER_ON_ID = "immolation"
// order string turn off
private constant string ORDER_OFF_ID = "unimmolation"
// effect on cast
private constant string CAST_FX = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"
// effect on hit
private constant string HIT_FX = "Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl"
// dummy effect
private constant string DUMMY_FX = "Units\\Creeps\\FirePandarenBrewmaster\\FirePandarenBrewmaster_Missile.mdl"
// dummy scaling
private constant real DUMMY_SCALE = 1.7
// dummy fly height
private constant real DUMMY_Z = 100.
// roll speed
private constant real SPEED = 1000.
// distance increment
private constant real DISTANCE_INC = SPEED * .031250000
// attack type
private constant attacktype AT = ATTACK_TYPE_NORMAL
// damage type
private constant damagetype DT = DAMAGE_TYPE_MAGIC
// weapon type
private constant weapontype WT = WEAPON_TYPE_WHOKNOWS
// caster vertex color
private constant integer RED_C_CASTER = 255
private constant integer BLUE_C_CASTER = 255
private constant integer GREEN_C_CASTER = 255
private constant integer ALPHA_C_CASTER = 255
// max distance
private constant real MAX_DISTANCE_VALUE = 2147483647.
// preload fx
private constant boolean PRELOAD = true
endglobals
// area of effect to find the closest target
private constant function GetAoE takes integer lvl returns real
return 700. + lvl * 100.
endfunction
// damage per level
private constant function GetDamage takes integer lvl returns real
return 10. * lvl
endfunction
//*-----------------------------------------------------------------------------------
//* END OF CALIBRATION SECTION
//*-----------------------------------------------------------------------------------
private struct Spell extends array
static unit array caster //caster unit
static unit array target //target unit
static unit array dummy //dummy unit
static effect array fx //dummy effect
static integer array lvl //level of ability when it cast
implement CTL
local real xCaster
local real yCaster
local real xTarget
local real yTarget
local real tempX
local real tempY
local real angle
local real dx
local real dy
local unit t
local real nearestDist
local real dist
implement CTLExpire
set xCaster = GetUnitX(caster[this])
set yCaster = GetUnitY(caster[this])
set xTarget = GetUnitX(target[this])
set yTarget = GetUnitY(target[this])
set angle = Atan2(yTarget-yCaster,xTarget-xCaster)
set dx = DISTANCE_INC * Cos(angle)
set dy = DISTANCE_INC * Sin(angle)
set t = null
set nearestDist = MAX_DISTANCE_VALUE
if GetUnitAbilityLevel(caster[this], BUFF_ID) == 0 or target[this] == null or IsUnitType(target[this],UNIT_TYPE_DEAD) then
call SetUnitPathing(caster[this], true)
call SetUnitVertexColor(caster[this], RED_C_CASTER, BLUE_C_CASTER, GREEN_C_CASTER, ALPHA_C_CASTER)
call IssueImmediateOrder(caster[this], ORDER_OFF_ID)
call DestroyEffect(AddSpecialEffect(CAST_FX, GetUnitX(caster[this]), GetUnitY(caster[this])))
call DestroyEffect(fx[this])
call RemoveUnit(dummy[this])
set caster[this] = null
set target[this] = null
set dummy[this] = null
set fx[this] = null
call destroy()
else
call SetUnitPosition(caster[this], xCaster + dx, yCaster + dy)
call SetUnitX(dummy[this], GetUnitX(caster[this]))
call SetUnitY(dummy[this], GetUnitY(caster[this]))
if (xTarget-xCaster)*(xTarget-xCaster)+(yTarget-yCaster)*(yTarget-yCaster)<2500 then
call DestroyEffect(AddSpecialEffect(HIT_FX, GetUnitX(target[this]), GetUnitY(target[this])))
call UnitDamageTarget(caster[this], target[this], GetDamage(lvl[this]), true, false, AT, DT, WT)
call GroupEnumUnitsInRange(bj_lastCreatedGroup, xCaster, yCaster, GetAoE(lvl[this]), null)
loop
set t = FirstOfGroup(bj_lastCreatedGroup)
exitwhen t == null
set tempX = xCaster - GetUnitX(t)
set tempY = yCaster - GetUnitY(t)
set dist = tempX * tempX + tempY * tempY
if dist < nearestDist and (t != target[this] and IsUnitEnemy(t, GetOwningPlayer(caster[this])) and not IsUnitType(t, UNIT_TYPE_STRUCTURE) and not IsUnitType(t,UNIT_TYPE_DEAD)) then
set nearestDist = dist
set target[this] = t
exitwhen true
endif
call GroupRemoveUnit(bj_lastCreatedGroup, t)
endloop
endif
endif
implement CTLNull
set t = null
implement CTLEnd
private static method onStart takes unit u, integer level returns nothing
local thistype this = create()
local unit t = null
local real nearestDist = MAX_DISTANCE_VALUE
local real dist
local real x
local real y
local real tempX
local real tempY
set target[this] = null
set caster[this] = u
set lvl[this] = level
set x = GetUnitX(u)
set y = GetUnitY(u)
call DestroyEffect(AddSpecialEffect(CAST_FX, x, y))
set dummy[this] = CreateUnit(GetOwningPlayer(u), DUMMY_ID, GetUnitX(u), GetUnitY(u), GetUnitFacing(u))
set fx[this] = AddSpecialEffectTarget(DUMMY_FX, dummy[this], "origin")
call SetUnitScale(dummy[this], DUMMY_SCALE, DUMMY_SCALE, DUMMY_SCALE)
call SetUnitFlyHeight(dummy[this], DUMMY_Z, 0)
call GroupEnumUnitsInRange(bj_lastCreatedGroup, x, y, GetAoE(lvl[this]), null)
loop
set t = FirstOfGroup(bj_lastCreatedGroup)
exitwhen t == null
set tempX = x - GetUnitX(t)
set tempY = y - GetUnitY(t)
set dist = tempX * tempX + tempY * tempY
if dist < nearestDist and (t != target[this] and IsUnitEnemy(t, GetOwningPlayer(caster[this])) and not IsUnitType(t, UNIT_TYPE_STRUCTURE) and not IsUnitType(t,UNIT_TYPE_DEAD)) then
set nearestDist = dist
set target[this] = t
exitwhen true
endif
call GroupRemoveUnit(bj_lastCreatedGroup, t)
endloop
call SetUnitPathing(u, false)
call SetUnitVertexColor(caster[this], RED_C_CASTER, BLUE_C_CASTER, GREEN_C_CASTER, 0)
set t = null
endmethod
private static method onRun takes nothing returns nothing
if GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ID) > 0 then
call onStart(GetTriggerUnit(), GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ID))
endif
endmethod
private static method onInit takes nothing returns nothing
call RegisterOrderEvent(OrderId(ORDER_ON_ID), function thistype.onRun)
static if PRELOAD then
call Preload(CAST_FX)
call Preload(HIT_FX)
call Preload(DUMMY_FX)
endif
endmethod
endstruct
endlibrary