//TESH.scrollpos=1474
//TESH.alwaysfold=0
// RISE OF EMPIRES LIBRARY
// All functions.
//
// ==========================
// GENERAL GAME SETTINGS
// ==========================
// ==========================
// FUNCTIONS & SYSTEMS
// ==========================
function MakeUnitFlyAble takes unit u returns nothing
call UnitAddAbility(u, 'Amrf')
call DisplayTextToForce(GetPlayersAll(),"flyable")
///call UnitRemoveAbility(u,'Amrf')
endfunction
library DAebugG
function Debug takes string s returns nothing
call DisplayTextToForce(GetPlayersAll(),s)
endfunction
endlibrary
function GetHost takes nothing returns nothing
local gamecache g = InitGameCache("Map.w3v")
call StoreInteger ( g, "Map", "Host", GetPlayerId(GetLocalPlayer ())+1)
call TriggerSyncStart ()
call SyncStoredInteger ( g, "Map", "Host" )
call TriggerSyncReady ()
set udg_Host = Player( GetStoredInteger ( g, "Map", "Host" )-1)
call FlushGameCache( g )
set g = null
endfunction
//==========================================================================================
library HandleVars initializer init
globals
private hashtable ht
endglobals
// too bad the Handle vars' old functionality forces me to make these things
// inline-unfriendly
function SetHandleHandle takes agent subject, string label, agent value returns nothing
if(value==null) then
call RemoveSavedHandle( ht, GetHandleId(subject), StringHash(label))
else
call SaveAgentHandle( ht, GetHandleId(subject), StringHash(label), value)
endif
endfunction
function SetHandleInt takes agent subject, string label, integer value returns nothing
if value==0 then
call RemoveSavedInteger(ht, GetHandleId(subject), StringHash(label))
else
call SaveInteger(ht, GetHandleId(subject), StringHash(label), value)
endif
endfunction
function SetHandleBoolean takes agent subject, string label, boolean value returns nothing
if (value == false) then
call RemoveSavedBoolean(ht, GetHandleId(subject), StringHash(label))
else
call SaveBoolean(ht, GetHandleId(subject), StringHash(label), value)
endif
endfunction
function SetHandleReal takes agent subject, string label, real value returns nothing
if (value == 0.0) then
call RemoveSavedReal(ht, GetHandleId(subject), StringHash(label))
else
call SaveReal(ht, GetHandleId(subject), StringHash(label), value)
endif
endfunction
function SetHandleString takes agent subject, string label, string value returns nothing
if ((value=="") or (value==null)) then
call RemoveSavedString(ht, GetHandleId(subject), StringHash(label))
else
call SaveStr(ht, GetHandleId(subject), StringHash(label), value) //yay for blizz' consistent naming scheme...
endif
endfunction
function GetHandleHandle takes agent subject, string label returns agent
debug call BJDebugMsg("[debug] What the heck? Why would you call HandleHandle I guess this was caused by a search and replace mistake")
return null
endfunction
// these are inline friendly, ok, maybe they aren't because jasshelper does not recognize
// GetHandleId as non-state changing. But they will be once I fix jasshelper...
function GetHandleInt takes agent subject, string label returns integer
return LoadInteger(ht, GetHandleId(subject), StringHash(label))
endfunction
function GetHandleBoolean takes agent subject, string label returns boolean
return LoadBoolean(ht, GetHandleId(subject), StringHash(label))
endfunction
function GetHandleString takes agent subject, string label returns string
return LoadStr(ht, GetHandleId(subject), StringHash(label))
endfunction
function GetHandleReal takes agent subject, string label returns real
return LoadReal(ht, GetHandleId(subject), StringHash(label))
endfunction
// got bored so I now use a textmacro...
//! textmacro FAUX_HANDLE_VARS_GetHandleHandle takes NAME, TYPE
function SetHandle$NAME$ takes agent subject, string label, $TYPE$ value returns nothing
if(value==null) then
call RemoveSavedHandle( ht, GetHandleId(subject), StringHash(label))
else
call Save$NAME$Handle( ht, GetHandleId(subject), StringHash(label), value)
endif
endfunction
function GetHandle$NAME$ takes agent subject, string label returns $TYPE$
return Load$NAME$Handle( ht, GetHandleId(subject), StringHash(label))
endfunction
//! endtextmacro
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Player","player")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Widget","widget")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Destructable","destructable")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Item","item")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Unit","unit")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Ability","ability")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Timer","timer")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Trigger","trigger")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerCondition","triggercondition")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerAction","triggeraction")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerEvent","event")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Force","force")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Group","group")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Location","location")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Rect","rect")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("BooleanExpr","boolexpr")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Sound","sound")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Effect","effect")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("UnitPool","unitpool")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("ItemPool","itempool")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Quest","quest")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("QuestItem","questitem")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("DefeatCondition","defeatcondition")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TimerDialog","timerdialog")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Leaderboard","leaderboard")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Multiboard","multiboard")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("MultiboardItem","multiboarditem")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Trackable","trackable")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Dialog","dialog")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Button","button")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TextTag","texttag")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Lightning","lightning")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Image","image")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Ubersplat","ubersplat")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Region","region")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("FogState","fogstate")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("FogModifier","fogmodifier")
// runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Hashtable","hashtable")
function FlushHandleVars takes agent subject returns nothing
call FlushChildHashtable(ht, GetHandleId(subject))
endfunction
function FlushHandleLocals takes agent subject returns nothing
call FlushHandleVars(subject)
endfunction
private function init takes nothing returns nothing
set ht=InitHashtable()
endfunction
endlibrary
// ===========================
function ReturnTrue takes nothing returns boolean
return true
endfunction
//***************************************************************************\\
//***************************************************************************\\
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Print takes string msg returns nothing
call DisplayTextToPlayer(Player(0),0,0,msg)
endfunction
//***************************************************************************\\
//***************************************************************************\\
constant function DummyID takes nothing returns integer
return 'h01Y'
endfunction
struct et
effect eff
endstruct
function AddSpecialEffectTimed_Child takes nothing returns nothing
local timer t = GetExpiredTimer()
local et a = GetTimerData(t)
call DestroyEffect(a.eff)
call a.destroy()
call ReleaseTimer(t)
endfunction
function AddSpecialEffectTimed takes widget target, string modelname, string attachmentpoint, real duration returns nothing
local timer t=NewTimer()
local et a = et.create()
set a.eff = AddSpecialEffectTarget(modelname, target, attachmentpoint)
call SetTimerData(t,a)
call TimerStart(t, duration, false, function AddSpecialEffectTimed_Child)
endfunction
//******************************************************
//******************************************************
//******************************************************
// Spieler A erklärt Spieler B wenn die Verbündezeit vorbei ist automatisch den Krieg.
// Wenn die Verbündezeit Spieler A 0 ist, wird sofort Krieg erklärt.
function DeclareWarAutomatically takes player p, player p2 returns nothing
call TriggerSleepAction( I2R(udg_Allytimer_Warmay[GetConvertedPlayerId(p)]) )
set udg_Bezeichnung_Fiesheit[GetConvertedPlayerId(p)] = ( udg_Bezeichnung_Fiesheit[GetConvertedPlayerId(p)] + 1 )
call SetPlayerAllianceStateBJ( p, p2, bj_ALLIANCE_UNALLIED )
call DisplayTextToForce( GetForceOfPlayer(p), ( "|CFFFF9900You warred " + ( GetPlayerName(p2) + "|r" ) ) )
call DisplayTextToForce( GetForceOfPlayer(p2), ( "|CFFFF9900You were enemied by " + ( GetPlayerName(p2) + "|r" ) ) )
set udg_Allies[GetConvertedPlayerId(p)] = ( udg_Allies[GetConvertedPlayerId(p)] - 1 )
set p = null
set p2 = null
endfunction
//==============================================================================
// Verkürzung eines Scripts; Call RemoveLocation ( udg_TempPoint )
// ==============================================================================
function l1 takes nothing returns nothing
call RemoveLocation (udg_TempPoint)
endfunction
function l2 takes nothing returns nothing
call RemoveLocation (udg_TempPoint2)
endfunction
function l3 takes nothing returns nothing
call RemoveLocation (udg_TempPoint3)
endfunction
function l4 takes nothing returns nothing
call RemoveLocation (udg_TempPoint4)
endfunction
function l5 takes nothing returns nothing
call RemoveLocation (udg_TempPoint5)
endfunction
//==============================================================================
// Verkürzung eines Scripts; Call DestroyGroup ( udg_TempGroup )
// ==============================================================================
function g1 takes nothing returns nothing
call DestroyGroup (udg_TempGroup)
endfunction
function g2 takes nothing returns nothing
call DestroyGroup (udg_TempGroup2)
endfunction
function g3 takes nothing returns nothing
call DestroyGroup (udg_TempGroup3)
endfunction
function g4 takes nothing returns nothing
call DestroyGroup (udg_TempGroup4)
endfunction
function g5 takes nothing returns nothing
call DestroyGroup (udg_TempGroup5)
endfunction
function EnableDebug takes nothing returns nothing
call EnableTrigger( gg_trg_Besitzer_wechseln_nicht_11_und_12 )
call EnableTrigger( gg_trg_Besitzer_wechseln_rueckgaengig )
call EnableTrigger( gg_trg_Helden_Besitzer_wechseln )
endfunction
function DisableDebug takes nothing returns nothing
call DisableTrigger( gg_trg_Besitzer_wechseln_nicht_11_und_12 )
call DisableTrigger( gg_trg_Besitzer_wechseln_rueckgaengig )
call DisableTrigger( gg_trg_Helden_Besitzer_wechseln )
endfunction
function Int2Hex takes integer int returns string
local string charMap = "0123456789ABCDEF"
local string hex = ""
local integer index = 0
if ((int < 0) or (int > 0x7FFFFFFF)) then
return "|cffff0000Invalid argument in function Int2Hex()!|r"
endif
loop
set index = ModuloInteger(int, 0x10) + 1
set int = int / 0x10
set hex = SubStringBJ(charMap, index, index) + hex
exitwhen (int == 0)
endloop
return hex
endfunction
function Runden takes real r returns integer
return R2I(r+.5)
endfunction
function Per2Clr takes string text, integer r, integer g, integer b, integer alpha returns string
local string array str
if ((r >= 0) and (r <= 100) and (g >= 0) and (g <= 100) and (b >= 0) and (b <= 100) and (alpha >= 0) and (alpha <= 100)) then
set r = R2I(0xFF / 100.000 * r)
set g = R2I(0xFF / 100.000 * g)
set b = R2I(0xFF / 100.000 * b)
set alpha = R2I(0xFF / 100.000 * alpha)
if (alpha <= 0xF) then
set str[0] = "0" + Int2Hex(alpha)
else
set str[0] = Int2Hex(alpha)
endif
if (r <= 0xF) then
set str[1] = "0" + Int2Hex(r)
else
set str[1] = Int2Hex(r)
endif
if (g <= 0xF) then
set str[2] = "0" + Int2Hex(g)
else
set str[2] = Int2Hex(g)
endif
if (b <= 0xF) then
set str[3] = "0" + Int2Hex(b)
else
set str[3] = Int2Hex(b)
endif
return "|c" + str[0] + str[1] + str[2] + str[3] + text + "|r"
else
return "|cffff0000Invalid arguments in function Per2Clr()!|r"
endif
endfunction
function ReplaceSubString takes string usedString, integer position, string replacingString returns string
local string result = ""
if (position > 0) then
set result = SubString(usedString, 0, position)
endif
set result = (result + replacingString)
if (StringLength(result) < StringLength(usedString)) then
set result = (result + SubString(usedString, StringLength(result), StringLength(usedString)))
endif
return result
endfunction
//***************************************************************************************************************
//* *
//* K N O C K B A C K *
//* Actual Code *
//* v1.27 *
//* *
//* By: Mr.Malte *
//* *
//***************************************************************************************************************
// ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//¤ Requires JassNewGenPack Editor!
//¤ Knockback System v1.27
//¤ Requires swimming dummy
//¤ Requires non-swimming dummy
//¤
//¤¤ USED SYSTEMS:
//¤
//¤ - My TSA System; Timer Struct Attachment.
//¤ - My HA System; Handle Attachment.
//¤ - My GCSA System; Game Cache Struct Attachment.
//¤ SPECIAL THANKS TO:
//¤
//¤ - Vexorian for JassNewGenPack
//¤ - Mueslirocker for SetUnitXY function
// ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//! Note!
// If you want one of my systems, TimerStructAttachment or HandleAttachment, give credits!
//! GIVE CREDITS WHEN YOU USE THE KNOCKBACK SYSTEM!
// If you want to edit the knockback System, change the values of the section
// "Configurable Data".
function GlobalKnockBack takes nothing returns nothing
call Knockback(udg_GlobOpfer, udg_GlobAtk, udg_GlobSpeed, udg_GlobDistanz, udg_GlobFriction, udg_GlobShowEffects)
endfunction
library KnockBackFunctions initializer KnockBackInit
globals
// * ================================== *
// * C O N F I G U R A B L E D A T A *
// * ================================== *
//! ====TIMER_INTERVAL====
// A higher number will increase the performance
// A lower number will make the knockback smoother
// !Note!- if you increase the speed of the timer, the units wont slide faster.
// The speed will be kept.
//! ====DUST_DENSITY====
// Every TIMER_INTERVAL * DUST_DENSITY seconds a dust effect is shown.
// Decrease DUST_DENSITY to create more densitive dust (recommended for fast-speed-knockbacks)
// Increase DUST_DENSITY to increase the performance ( recommended, when many units at the same time are knocked back)
//! ====DUST_MODEL====
// This Model is the dust that is shown. If you want to know the string of another model, go
// to the object-editor, chose your model somewhere and press ok.
// If you click on your model-field again, the string of the model is shown
// at 'Own'.
// Important: You must replace '\' in the string with '\\'
//! ====DUMMY_TYPE[1]=====
// If RETQUIRES_UNBLOCKED is true, you need two dummy units;
// DUMMY_TYPE[1] must be able to swim.
// DUMMY_TYPE[2] mustn't be able to swim.
//! ====DUMMY_TYPE[2]=====
// If RETQUIRES_UNBLOCKED is true, you need two dummy units;
// DUMMY_TYPE[1] must be able to swim.
// DUMMY_TYPE[2] mustn't be able to swim.
//! ====ATTACHMENT_SYSTEM=====
//! JUST FOR FUNCTIOM 'PRECISE_KNOCKBACK'
// This is the system which is used to attach the parameters
// of the knockback to the timer that works with them.
// Possible options;
// "TimerStructAttachment"
// "HandleAttachment"
// "Game Cache"
// If ATTACHMENT_SYSTEM is "TimerStructAttachment",
// the Knockback-System is not as fast as with "HandleAttachment", but you can run 500 knockbacks (configurable)
// at the same time without any bugs.
// If ATTACHMENT_SYSTEM is "HandleAttachment",
// the system is faster, that means less lag, but if
// your map contains a lot of units and timers and blablabla. Handles.
// Then bugs could appear.
// Actually this system is the best choice, because of the speed.
// But if the system says "HandleAttachment System is too full." somewhen,
// you should swap to the TimerStructAttachment or Game Cache
// If ATTACHMENT_SYSTEM is "Game Cache",
// you use the savest, but also the slowest Attachment System.
// You should only use this, if both systems, TSA and HA give error
// messages.
//! ====KILLTREE_RADIUS=====
// Units destroy trees in this radius.
// You can also use the function Precise_Knockback to make an individual KILLTRE_RADIUS for each knockback.
//! ====PERCENTAGE_KNOCKBACK=====
// This number should be 1.00
// 1.00 means, that the speed and friction of all Knockbacks is
// Speed*1.00 and Friction*1.00
//! =====MOVEBACK=====
// If a unit hits water, it gets moved back by this amount.
// Choose a higher number if units stuck in water often.
//! =====UNBLOCK_FACTOR=====
// If this is 0, units slide through everything and kill trees.
// If this is 1, units don't slide through water
// If this is 2 or higher, units can't do anything while
// They are knocked back, and the knockback stops if a unit
// can't stand on the new point. That means the Knockback is stopped
// by: Cliffs, units, water, doodads. By everything.
// If the UNBLOCK_FACTOR is higher than 0 and the unit is not moved, the knockback
// stops instantly.
private constant integer DUST_DENSITY = 11
private constant string DUST_MODEL = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
private constant boolean REQUIRES_UNBLOCKED = true
private constant integer DUMMY_TYPE1 = 'e01V'
private constant integer DUMMY_TYPE2 = 'e01W'
private constant real KILLTREE_RADIUS = 110.
private constant real PERCENTAGE_KNOCKBACK = 1.00
private constant real MOVEBACK = 30.
private constant integer UNBLOCK_FACTOR = 0
endglobals
private function h2i takes handle h returns integer
return GetHandleId(h)
endfunction
private function Debug takes string s returns nothing
call DisplayTextToForce(GetPlayersAll(),s)
endfunction
// End of Handle Attachment System
public struct KB
boolean bool
integer kbi
integer up
real speed
real distanz
real friction
real slidet
real killtreerange
real sin
real cos
unit atk
unit opfer
endstruct
globals
private real minx
private real maxx
private real miny
private real maxy
private integer Total = 0
private KB array Knockbackdata
private boolexpr Treekillcondition = null
private timer KnockbackTimer = CreateTimer()
private boolean IsTimerRunning = false
private integer up = 0
private boolean showdust = false
private boolean Knock_GoOn = true
endglobals
function SetUnitXY takes unit u, real x, real y returns boolean
if x < minx then
set u = null
return false
elseif x > maxx then
set u = null
return false
else
call SetUnitX(u, x)
endif
if y < miny then
set u = null
return false
elseif y > maxy then
set u = null
return false
else
call SetUnitY (u, y)
endif
set u = null
return false
endfunction
function CanStand takes unit u, real oldx, real oldy, real newx, real newy returns boolean
// SetUnitPosition setzt eine Einheit auf eine Stelle, wenn diese
// für die Einheit begehbar ist.
// Die Einheit wird also auf die neuen Koordinaten mit der Funktion
// gesetzt. Wenn die Koordinaten der Einheit nach SetUnitPosition
// newx und newy entsrpechen, kann die Einheit dort stehen.
call SetUnitPosition(u,newx,newy)
if ( GetUnitX(u) == newx and GetUnitY(u) == newy ) then
call SetUnitXY(u,oldx,oldy)
return true
endif
call SetUnitXY(u,oldx,oldy)
return false
endfunction
private function IsWaterLoc takes real x, real y returns boolean
call SetUnitPosition(udg_Knockback_Dummy1,x,y)
call SetUnitPosition(udg_Knockback_Dummy2,x,y)
if ( GetUnitX(udg_Knockback_Dummy1) == GetUnitX(udg_Knockback_Dummy2) and GetUnitY(udg_Knockback_Dummy1) == GetUnitY(udg_Knockback_Dummy2)) then
return false
endif
return true
endfunction
public function TreeFilter takes nothing returns boolean
local integer d = GetDestructableTypeId(GetFilterDestructable())
return d == 'ATtr' or d == 'BTtw' or d == 'KTtw' or d == 'YTft' or d == 'JTct' or d == 'YTst' or d == 'YTct' or d == 'YTwt' or d == 'JTwt' or d == 'JTwt' or d == 'FTtw' or d == 'CTtr' or d == 'ITtw' or d == 'NTtw' or d == 'OTtw' or d == 'ZTtw' or d == 'WTst' or d == 'LTlt' or d == 'GTsh' or d == 'Xtlt' or d == 'WTtw' or d == 'Attc' or d == 'BTtc' or d == 'CTtc' or d == 'ITtc' or d == 'NTtc' or d == 'ZTtc'
endfunction
function UpdateTotal takes nothing returns nothing
local integer i = 201
loop
exitwhen i == 0
set i = i - 1
if ( Knockbackdata[i] != null ) then
set Total = i
set i = 200
return
endif
endloop
endfunction
private function KillTree takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
// STRUCT FUNCTIONS
function PushUp_Structs takes integer fromwhere returns nothing
local integer i = fromwhere
loop
set i = i + 1
exitwhen i > Total
set Knockbackdata[i-1] = Knockbackdata[i]
endloop
set Total = Total - 1
endfunction
function FreePlace_Structs takes integer ib returns nothing
set Knockbackdata[ib] = Knockbackdata[Total]
set Total = Total - 1
endfunction
// ENDSTRUCT FUNCTIONS
private function KnockbackCreate takes nothing returns nothing
//local timer expired = GetExpiredTimer() // Used for the system - means not important for you
local integer structNR
local KB knock
local integer ib = 0 // Used for the system
local real x = 0. // Used for the system
local real y = 0. // Used for the system
local real newx = 0. // Used for the system
local real newy = 0. // Used for the system
local effect e = null // Used for the system
local real angle = 0. // Used for the system
local real speed //= knock.speed // The speed the target slides with
local real distanz //= knock.distanz // Distance the target unit slides
local boolean bool //= knock.bool // Show effects? True and the effect is shown.
local rect killtrees
if (up == DUST_DENSITY) then // up is used to count up an integer. When the integer hits the constant integer DUST_DENSITY (basic 7), the dust is shown - to decrease lagg
set up = 0
set showdust = true
endif
loop
set ib = ib + 1
exitwhen ib > Total
set Knock_GoOn = true
set knock = Knockbackdata[ib]
set speed = knock.speed
set distanz = knock.distanz
set bool = knock.bool
set x = GetUnitX(knock.opfer)
set y = GetUnitY(knock.opfer)
set angle = Atan2(y - GetUnitY(knock.atk), x - GetUnitX(knock.atk))
set killtrees = Rect(x - knock.killtreerange, y - knock.killtreerange, x + knock.killtreerange, y + knock.killtreerange)
set speed = speed - knock.friction
set knock.speed = speed
set knock.slidet = knock.slidet + speed
set newx = x + speed * knock.cos
set newy = y + speed * knock.sin
call EnumDestructablesInRect(killtrees, Treekillcondition, function KillTree)
call RemoveRect(killtrees)
if ( UNBLOCK_FACTOR == 1 ) then
if ( IsWaterLoc(newx,newy) ) then
set newx = x - MOVEBACK * knock.cos
set newy = y - MOVEBACK * knock.sin
call SetUnitXY(knock.opfer, newx, newy)
call PauseUnit(knock.opfer,false)
call RemoveRect(killtrees)
set killtrees = null
call knock.destroy()
call FreePlace_Structs(ib)
set Knock_GoOn = false
endif
endif
if ( UNBLOCK_FACTOR == 2 ) then
if ( CanStand(knock.opfer,x,y,newx,newy) == false ) then
call PauseUnit(knock.opfer,false)
call RemoveRect(killtrees)
set killtrees = null
call knock.destroy()
call FreePlace_Structs(ib)
set Knock_GoOn = false
endif
endif
if ( Knock_GoOn == true ) then
call SetUnitXY(knock.opfer, newx, newy)
call RemoveRect(killtrees)
set killtrees = null
if ( showdust ) then
if ( knock.bool == true ) then
call DestroyEffect(AddSpecialEffect(DUST_MODEL, x, y))
endif
endif
if ( speed < 0.1 ) then
call PauseUnit(knock.opfer,false)
call knock.destroy()
call FreePlace_Structs(ib)
endif
if ( knock.slidet > distanz ) then
call PauseUnit(knock.opfer,false)
call knock.destroy()
call FreePlace_Structs(ib)
endif
endif
endloop
if ( Total == 0 ) then
call PauseTimer(KnockbackTimer)
set IsTimerRunning = false
endif
set up = up + 1
set showdust = false
endfunction
function Knockback takes unit opfer, unit atk, real speed, real distanz, real friction, boolean b returns nothing
local KB knock = KB.create()
local real angle
set speed = (speed * udg_Interval*25) * PERCENTAGE_KNOCKBACK
set friction = (friction * udg_Interval*25) * PERCENTAGE_KNOCKBACK
set friction = friction/udg_KF
set speed = speed/udg_KF
set knock.opfer = opfer
set knock.atk = atk
set knock.speed = speed
set knock.distanz = distanz
set knock.slidet = 10.
set knock.friction = friction
set knock.bool = b
set knock.killtreerange = KILLTREE_RADIUS
set Total = Total + 1
set angle = Atan2(GetUnitY(opfer) - GetUnitY(atk), GetUnitX(opfer) - GetUnitX(atk))
set knock.cos = Cos(angle)
set knock.sin = Sin(angle)
if ( Total > 200 ) then
call UpdateTotal()
endif
set Knockbackdata[Total] = knock
if ( IsTimerRunning == false ) then
call TimerStart(KnockbackTimer, udg_Interval, true, function KnockbackCreate)
set IsTimerRunning = true
endif
set opfer = null
set b = false
endfunction
private function KnockBackInit takes nothing returns nothing
local location temppoint = null
set minx = GetRectMinX(bj_mapInitialPlayableArea)
set maxx = GetRectMaxX(bj_mapInitialPlayableArea)
set miny = GetRectMinY(bj_mapInitialPlayableArea)
set maxy = GetRectMaxY(bj_mapInitialPlayableArea)
if ( REQUIRES_UNBLOCKED ) then
set temppoint = GetRectCenter(GetPlayableMapRect())
call CreateUnitAtLoc(Player(15),DUMMY_TYPE1,temppoint,270.)
set udg_Knockback_Dummy1 = GetLastCreatedUnit()
call CreateUnitAtLoc(Player(15),DUMMY_TYPE2,temppoint,270.)
set udg_Knockback_Dummy2 = GetLastCreatedUnit()
call RemoveLocation(temppoint)
endif
set Treekillcondition = Filter(function TreeFilter)
endfunction
endlibrary
// End of Knockback System by Mr.Malte
function SetKnockBackDivisor takes integer i returns nothing
set udg_KF = i
endfunction
// End of Knockback System by Mr.Malte
//Erzeugt einen Index mit zwei Dimensionen
function Index2D takes integer Value1, integer Value2, integer MaxValue2 returns integer
return ((Value1 * MaxValue2) + Value2)
endfunction
//Erzeugt einen Index mit drei Dimensionen.
function Index3D takes integer Value1, integer Value2, integer Value3, integer MaxValue2, integer MaxValue3 returns integer
return ((Value1 * (MaxValue2 * MaxValue3)) + (Value2 * MaxValue3) + Value3)
endfunction
//Erzeugt einen Index mit vier Dimensionen.
function Index4D takes integer Value1, integer Value2, integer Value3, integer Value4, integer MaxValue2, integer MaxValue3, integer MaxValue4 returns integer
return ((Value1 * (MaxValue2 * MaxValue3 * MaxValue4)) + (Value2 * (MaxValue3 * MaxValue4)) + (Value3 * MaxValue4) + Value4)
endfunction
// Strings finden und ersetzen
function StrReplace takes string find, string replace, string text returns string
local integer textLength = StringLength(text)
local integer findLength = StringLength(find)
local integer i = 1
if ((find == "") or (text == "")) then
return "|cffff0000Invalid arguments in function StrReplace()!|r"
endif
loop
if (SubStringBJ(text, i, (i + (findLength - 1))) == find) then
if (i == 1) then
set text = replace + SubStringBJ(text, (i + findLength), textLength)
set textLength = StringLength(text)
elseif ((i > 1) and (i < textLength)) then
set text = SubStringBJ(text, 1, (i - 1)) + replace + SubStringBJ(text, (i + findLength), textLength)
set textLength = StringLength(text)
elseif (i == (textLength - findLength + 1)) then
set text = SubStringBJ(text, 1, (textLength - findLength)) + replace
set textLength = StringLength(text)
endif
endif
exitwhen (i == (textLength - findLength + 1))
set i = i + 1
endloop
return text
endfunction
function TextUntersuchen takes string t, string wt returns nothing
local integer b = StringLength(t)
local integer i = 0
local integer l = StringLength(wt)
local integer p = 0
loop
set p = i + l
if (SubString(t,i,p) == wt) then
set udg_KommtVor = true
return
endif
if (i == b) then
set udg_KommtVor = false
endif
set i = i + 1
exitwhen i == b
endloop
endfunction
function TimeBan takes player p, real r returns nothing
local dialog d = DialogCreate()
if ( r > 15.00 ) then
set r = 15.00
endif
call DialogDisplay(p,d,true)
call DialogSetMessageBJ(d, I2S(R2I(r)) + " seconds banned.")
call TriggerSleepAction(r)
call DialogDisplay(p,d,false)
call DialogClear(d)
call DialogDestroy(d)
set p = null
set d = null
endfunction
function StoreBeleidigung takes string s returns nothing
set udg_Beleidigungcounter = udg_Beleidigungcounter + 1
set udg_Chatstring[udg_Beleidigungcounter] = s
endfunction
function StoreLetter takes string s returns nothing
set udg_Int1 = udg_Int1 + 1
set udg_Buchstabe[udg_Int1] = s
endfunction
function U1 takes nothing returns boolean
if ( not ( SubStringBJ(udg_TempString, GetForLoopIndexB(), GetForLoopIndexB()) == udg_Buchstabe[GetForLoopIndexA()] ) ) then
return false
endif
return true
endfunction
function U2 takes nothing returns boolean
if ( not ( SubStringBJ(udg_TempString, GetForLoopIndexB(), GetForLoopIndexB()) == udg_Buchstabe[GetForLoopIndexA()] ) ) then
return false
endif
return true
endfunction
function Verschlusseln takes string sb returns nothing
set udg_TempString = sb
set udg_S = null
set bj_forLoopBIndex = 1
set bj_forLoopBIndexEnd = StringLength(udg_TempString)
loop
exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_Ibaho
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( U1() ) then
set udg_S = ( udg_S + udg_Buchstabe[( GetForLoopIndexA() - 1 )] )
//call DisplayTextToForce( GetPlayersAll(), ( I2S(GetForLoopIndexA()) + ( " - " + udg_Buchstabe[GetForLoopIndexA()] ) ) )
set bj_forLoopAIndex = bj_forLoopAIndexEnd
else
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set bj_forLoopBIndex = bj_forLoopBIndex + 1
endloop
endfunction
function Entschlusseln takes string sb returns nothing
set udg_TempString = sb
set udg_S = null
set bj_forLoopBIndex = 1
set bj_forLoopBIndexEnd = StringLength(udg_TempString)
loop
exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_Ibaho
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( U2() ) then
set udg_S = ( udg_S + udg_Buchstabe[( GetForLoopIndexA() + 1 )] )
//call DisplayTextToForce( GetPlayersAll(), ( I2S(GetForLoopIndexA()) + ( " - " + udg_Buchstabe[GetForLoopIndexA()] ) ) )
set bj_forLoopAIndex = bj_forLoopAIndexEnd
else
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set bj_forLoopBIndex = bj_forLoopBIndex + 1
endloop
endfunction
function Verschlusseln2 takes string sb returns string
set udg_TempString = sb
set udg_S = null
set bj_forLoopBIndex = 1
set bj_forLoopBIndexEnd = StringLength(udg_TempString)
loop
exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_Ibaho
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( U1() ) then
set udg_S = ( udg_S + udg_Buchstabe[( GetForLoopIndexA() - 1 )] )
set bj_forLoopAIndex = bj_forLoopAIndexEnd
else
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set bj_forLoopBIndex = bj_forLoopBIndex + 1
endloop
return udg_S
endfunction
function IsRound takes integer i returns boolean
if ( i/2 == Runden(i/2) ) then
return true
endif
return false
endfunction
function EndWut takes timer z, unit u returns nothing
call PauseTimer(z)
call FlushHandleLocals(z)
call DestroyTimer(z)
set u = null
return
endfunction
function GroupCheckZerstoeren takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function KillDestSZerwu takes nothing returns nothing
call KillDestructable( GetEnumDestructable() )
set udg_TempPoint2 = GetDestructableLoc(GetEnumDestructable())
call AddSpecialEffectLocBJ( udg_TempPoint2, "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl" )
set udg_Effekte_Zaehler = ( udg_Effekte_Zaehler + 1 )
set udg_Effekt[udg_Effekte_Zaehler] = GetLastCreatedEffectBJ()
call RemoveLocation(udg_TempPoint)
call RemoveLocation(udg_TempPoint2)
endfunction
function AttachWut takes nothing returns nothing
local timer z = GetExpiredTimer()
local unit Zer = GetHandleUnit(z, "Zer")
local integer dur = GetHandleInt(z, "ZerDu")
local integer MaxDur = GetHandleInt(z, "MaxDur")
//local group TempGroup
set udg_TempPoint = GetUnitLoc(Zer)
set dur = dur + 1
call SetHandleInt(z, "ZerDu", dur)
if ( dur == MaxDur ) then
call EndWut(z,Zer)
//return
endif
//call AddSpecialEffectLocBJ(udg_TempPoint, "Abilities\Weapons\Bolt\BoltImpact.mdl")
//call AddSpecialEffectLocBJ(udg_TempPoint, "Abilities\Weapons\Bolt\BoltImpact.mdl")
//set udg_Effekte_Zaehler = ( udg_Effekte_Zaehler + 1 )
//set udg_Effekt[udg_Effekte_Zaehler] = GetLastCreatedEffectBJ()
//set TempGroup = GetUnitsInRangeOfLocMatching(270.00, TempPoint, Condition(function GroupCheckZerstoeren))
call EnumDestructablesInCircleBJ( 170.00, udg_TempPoint, function KillDestSZerwu )
call RemoveLocation(udg_TempPoint)
set Zer = null
set dur = 0
set MaxDur = 0
//call DestroyGroup(TempGroup)
endfunction
function ZerstoerungsWut takes unit u, integer duration returns nothing
local timer z = CreateTimer()
call SetHandleHandle(z, "Zer", u)
call SetHandleInt(z, "ZerDu", 0)
call SetHandleInt(z, "MaxDur", duration)
set u = null
call TimerStart(z, 0.4, true, function AttachWut)
endfunction
function GetRandomFreePlayer takes nothing returns player
local integer a = 1
local player p
local integer b
loop
exitwhen a == 2
exitwhen b == 100
set b = b + 1
set p = ForcePickRandomPlayer(udg_Playing_Players)
if ( CountPlayersInForceBJ(GetPlayersAllies(p)) == 0 ) then
if (IsPlayerSlotState(p, PLAYER_SLOT_STATE_PLAYING)) then
set a = 2
return p
endif
endif
endloop
return p
endfunction
// Dies ist gleich die Kollisionsgroeße der Mauer. Aendern!
constant function Wallsize takes nothing returns real
return 147.
endfunction
// Diese Funktion gibt den Einheiten-Typ der Mauer wieder. Du kannst sie im Objekteditor mit STRG + D nachsehen
constant function Wall_ID takes nothing returns integer
return 'h025'
endfunction
// Die ID einer Dummy Einheit.
constant function Dummy takes nothing returns integer
return 'e00Y'
endfunction
constant function KostenProWall takes nothing returns integer
return 30
endfunction
function FilterWALL takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function WallActive takes unit BUNIT, unit UNIT, player p returns nothing
local integer Count
local location T
local location TempPoint = GetUnitLoc(BUNIT)
local location TempPoint2 = GetUnitLoc(UNIT)
local group Group
local unit u
call CreateNUnitsAtLoc( 1, Dummy(), GetOwningPlayer(BUNIT), TempPoint, bj_UNIT_FACING )
set u = GetLastCreatedUnit()
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call SetUnitFacingToFaceUnitTimed( GetLastCreatedUnit(), UNIT, 0 )
call TriggerSleepAction(0.25)
set Count = Runden(DistanceBetweenPoints(TempPoint, TempPoint2) * 0.9 / Wallsize())
if ( GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) < Count * KostenProWall() ) then
return
endif
call AdjustPlayerStateBJ(0-KostenProWall()*Count, p, PLAYER_STATE_RESOURCE_GOLD)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = Count
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set T = PolarProjectionBJ(TempPoint, Wallsize()*bj_forLoopAIndex, GetUnitFacing(u))
call CreateUnitAtLoc(p, Wall_ID(), T, bj_UNIT_FACING )
call RemoveLocation(T)
//set Group = GetUnitsInRangeOfLocMatching((Wallsize() - 5), TempPoint, Condition(function FilterWALL))
// if (CountUnitsInGroup(Group) == 0) then
// call CreateUnitAtLoc(p, Wall_ID(), T, bj_UNIT_FACING )
// call RemoveLocation(T)
//endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation(TempPoint)
call RemoveLocation(TempPoint2)
endfunction
function Filter1 takes nothing returns boolean
return ( GetOwningPlayer(GetFilterUnit()) != GetOwningPlayer(udg_Ionsteuerung) )
endfunction
function Filter2 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function IntelligenzSteuerung takes nothing returns boolean
return GetBooleanAnd(Filter1(),Filter2())
endfunction
function ClearManuelleSteuerung takes timer ste returns nothing
call FlushHandleLocals(ste)
call DestroyTimer(ste)
set ste = null
endfunction
function SteuerungBeam takes nothing returns nothing
local timer ste = GetExpiredTimer()
local unit u = GetHandleUnit(ste,"which")
local location temploc = GetUnitLoc(u)
local group tempgroup
local location temploc2
if (IsUnitSelected(u,GetOwningPlayer(u)) == true) then
call RemoveLocation(temploc)
call RemoveLocation(temploc2)
call DestroyGroup(tempgroup)
set u = null
return
endif
set udg_Ionsteuerung = u
set tempgroup = GetUnitsInRangeOfLocMatching(700.,temploc, Condition(function IntelligenzSteuerung))
set temploc2 = GetUnitLoc(GroupPickRandomUnit(tempgroup))
call IssuePointOrderLoc(u,"move",temploc2)
call RemoveLocation(temploc)
call RemoveLocation(temploc2)
call DestroyGroup(tempgroup)
set udg_Ionsteuerung = null
set u = null
endfunction
function ManuelleSteuerung takes unit u returns nothing
local timer ste = CreateTimer()
call SetHandleHandle(ste,"which",u)
call TimerStart(ste,1.00,true, function SteuerungBeam)
set u = null
endfunction
globals
integer au
endglobals
function checkAllyGen takes nothing returns nothing
if ( udg_TempPlayer == udg_TempPlayer2 ) then
set udg_TempPlayer = GetRandomFreePlayer()
set au = au + 1
if ( au > 80 ) then
return
endif
call checkAllyGen()
return
endif
set au = 0
endfunction
function loopend takes nothing returns nothing
set bj_forLoopAIndex = bj_forLoopAIndexEnd
endfunction
function spearzero takes nothing returns nothing
local timer speartimer = CreateTimer()
set udg_Spearint = 0
call PauseTimer(speartimer)
call DestroyTimer(speartimer)
endfunction
function spear takes nothing returns nothing
local timer speartimer = CreateTimer()
set udg_Spearint = 1
call TimerStart(speartimer, 0.05, false, function spearzero)
endfunction
globals
unit array Creator
location MakeLoc
endglobals
function SetMakeLoc takes location l returns nothing
set MakeLoc = l
endfunction
function EndCoolDown takes nothing returns nothing
local timer g = GetExpiredTimer()
local integer id = GetHandleInt(g,"idfortimer")
local integer pnum = GetHandleInt(g,"idplayer")
call CreateUnitAtLoc(Player(pnum),id,MakeLoc,270.)
set Creator[pnum] = GetLastCreatedUnit()
call PauseTimer(g)
call DestroyTimer(g)
set g = null
endfunction
function ArtificleCooldown takes unit u, real duration, integer unitid returns nothing
local player p = GetOwningPlayer(u)
local timer t = CreateTimer()
call KillUnit(Creator[GetPlayerId(p)])
call SetHandleInt(t,"idfortimer",unitid)
call SetHandleInt(t,"idplayer",GetPlayerId(p))
call TimerStart(t,duration,false,function EndCoolDown)
set p = null
endfunction
function foo takes nothing returns nothing
call DoNothing()
endfunction
struct XY
real x
real y
endstruct
function DistanceBetweenCoords takes real xA,real yA,real xB,real yB returns real
return SquareRoot((xB-xA)*(xB-xA)+(yB-yA)*(yB-yA))
endfunction
////////function//DistanceBetweenCoords//takes//real//xA,real//yA,//real//xB//,real//yB//returns//real
////////////////return//SquareRoot((xB-xA)*(xB-xA)+(yB-yA)*(yB-yA))
////////endfunction
function Destfilt takes nothing returns boolean
local destructable l = GetFilterDestructable()
local boolean b = DistanceBetweenCoords(GetDestructableX(l),GetDestructableY(l),Center.x,Center.y) <= 250
set l = null
return b
endfunction
globals
location LOC = Location(0,0)
integer Laufvar = 0
filterfunc FILTER
XY Center
// Locations stinken und sind unperformant!
endglobals
function EnumDestructablesInCircle takes real x, real y, real radius, code func returns nothing
local rect r
if (radius >= 0) then
set r = Rect(x - radius, y - radius, x + radius, y + radius)
call MoveLocation(LOC,x,y)// Habe alle BJ's inlned!
call EnumDestructablesInRect(r, FILTER, func)
call RemoveRect(r)
endif
set r = null
endfunction
function Descount takes nothing returns nothing
if GetWidgetLife(GetEnumDestructable()) > .405 then
set Laufvar = Laufvar + 1
endif
endfunction
function init takes nothing returns nothing
set Center = XY.create()
set FILTER = Filter(function Destfilt)
endfunction
function zi takes nothing returns boolean
return ( GetUnitTypeId(GetFilterUnit()) == 'hpea' )
endfunction
function ziii takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function zii takes nothing returns boolean
return GetBooleanAnd( zi(), ziii() )
endfunction
function GetRandomWorker takes player p returns unit
local group g = GetUnitsOfPlayerMatching(Player(0), Condition(function zii))
local unit u = GroupPickRandomUnit(g)
call DestroyGroup(g)
return u
endfunction
function MBD4P takes player p, multiboard m, boolean display returns nothing
if ( GetLocalPlayer() == p ) then
call MultiboardDisplay (m, display)
endif
endfunction
// ==============================================================
// T I M E R S T R U C T A T T A C H M E N T S Y S T E M
// ==============================================================
// TSA; TimerStructAttachment
// Description:
// Attaches an integer to a timer
// This could be used for global struct arrays.
// So attach the number of the struct to the timer.
// WARNING: Do not attach more than one integer to a timer.
// This would make the function break.
// If you want to attach a struct number, you do not even
// need to to this.
// Made by Mr.Malte
//library TimerStructAttachment initializer inline
function h2i takes handle h returns integer
return GetHandleId(h)
endfunction
globals
//integer Glob_HC
integer array Glob_DAT[700]
integer array Glob_GETHASH_DAT[700]
// The size of the system. 500 can attach 500 integers to 500 timers.
// If you want, you can also delete the prefix 'private constant ' and increase the integer
// DAT_SIZE dynamically. This will also make a better performance if you use it smartly.
// But with the prefix, the integer gets inlined.
constant integer DAT_SIZE = 700
endglobals
// set Glob_HC = Glob_HC + 1
// set Glob_DAT[Glob_HC] = b
// set Glob_GETHASH_DAT[Glob_HC] = a
// Tackert den integer b an den integer a.
// WARNUNG: Integer a darf nur ein h2i sein!
function SetTimerInteger takes timer whichTimer, integer b returns nothing
local integer i = 0
local integer a = h2i(whichTimer)
loop
set i = i + 1
exitwhen i > DAT_SIZE
//if ( i > DAT_SIZE ) then // <== If you want more performance in the system, erase this If-Then-Else function.
//call DisplayTextToForce(GetPlayersAll(),"Function SetTimerInteger is too full")
//endif
if ( Glob_GETHASH_DAT[i] == 0 and Glob_DAT[i] == 0 ) then
set Glob_DAT[i] = b
set Glob_GETHASH_DAT[i] = a
set i = DAT_SIZE
elseif ( i == DAT_SIZE ) then
call DisplayTextToForce(GetPlayersAll(),"Function SetTimerInteger is too full")
endif
endloop
endfunction
// Mithilfe von integer a, bekommt man nun den integer b
function GetTimerInteger takes timer whichTimer returns integer
local integer i = 0
local integer a = h2i(whichTimer)
loop
set i = i + 1
exitwhen i > DAT_SIZE
if ( a == Glob_GETHASH_DAT[i] ) then
return Glob_DAT[i]
endif
endloop
call DisplayTextToForce(GetPlayersAll(),"Function GetTimerInteger couldn't get stored integer")
return -1
endfunction
// Entfernt eine getackerten integer um Platz für einen neuen zu machen.
function RemoveTimerInteger takes timer whichTimer returns nothing
local integer i = 0
local integer a = h2i(whichTimer)
loop
set i = i + 1
exitwhen i > DAT_SIZE
if ( a == Glob_GETHASH_DAT[i] ) then
//call Debug("erased succesfully" + I2S(i))
set Glob_GETHASH_DAT[i] = 0
set Glob_DAT[i] = 0
set i = DAT_SIZE
return
endif
endloop
endfunction
//endlibrary
// =================================================
// H A N D L E A T T A C H M E N T S Y S T E M
// =================================================
// HAS; Handle Attachment System
// WARNING: Do only attach one integer to a handle!
// Othwerwise the system will crash!//
//
//J U S T F O R A U T H O R
// Die ID eines handles ist 0x100000 + Zähler groß.
// wenn ich 0x100000 subtrahiere, passt das handle
// in den index eines arrays.
// Index[handleid-0x100000] = integer to attach.
// Dann ist der integer, den ich antackern will in
// dem array mit der Größe des IDs des handles minus 0x100000
// gespeichert und ich kann ihn wiedergeben.
// Damit die Größe der handles die Arraygröße nicht sprengen,
// gibt es 6 verschiedene integers, jeder kann 8192 handles speichern.
// Das heißt, mein System unterstützt 6*8192 handles.
// Das sind 49152 handles.
// Made by Mr.Malte
//! Debug Scripts:
//call Debug("handle has size " + I2S(hashnumber) + "+0x100000")
//call Debug("Stored to [" + I2S(index) + "][" + I2S(hashnumber) + "]")
//library HandleAttachment
globals
integer array HandleAttachArray[50000]
endglobals
function SetHandleInteger takes handle h, integer i returns nothing
set HandleAttachArray[h2i(h)-0x100000] = i
endfunction
function GetHandleInteger takes handle h returns integer
return HandleAttachArray[h2i(h)-0x100000]
endfunction
function RemoveHandleInteger takes handle h returns nothing
set HandleAttachArray[h2i(h)-0x100000] = 0
endfunction
//endlibrary
// End of Handle Attachment System
function FilterUsualSpell takes nothing returns boolean
if (IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)) then
return false
elseif ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) ) then
return false
elseif ( IsUnitDeadBJ(GetFilterUnit()) ) then
return false
elseif ( IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) ) then
return false
endif
return true
endfunction
struct EC
effect blob
endstruct
function AddEffect_Execute takes nothing returns nothing
local timer AET = GetExpiredTimer()
local EC a = GetTimerData(AET)
call DestroyEffect(a.blob)
call a.destroy()
call ReleaseTimer(AET)
endfunction
function AddEffectTimer takes effect e, real time returns nothing
local timer AET = NewTimer()
local EC a = EC.create()
set a.blob = e
call SetTimerData(AET,a)
call TimerStart(AET,time,false,function AddEffect_Execute)
endfunction
function chiff takes string text, string password returns string
local string abc = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
local string pwr = ""
local string ciff = ""
local integer postext = 0
local integer pospw = 0
local integer a = 1
local integer b = 1
local string textklein = StringCase(text,false)
loop
set pwr = pwr + StringCase(password, false)
exitwhen StringLength(textklein) <= StringLength(pwr)
endloop
set pwr = SubStringBJ(pwr,1,StringLength(textklein))
set bj_forLoopAIndexEnd = StringLength(abc) / 2
loop
exitwhen a > StringLength(textklein)
loop
exitwhen b > bj_forLoopAIndexEnd
if (SubStringBJ(abc,b,b) == SubStringBJ(textklein,a,a)) then
set postext = b
endif
if (SubStringBJ(abc,b,b) == SubStringBJ(pwr,a,a)) then
set pospw = b - 1
endif
set b = b + 1
endloop
set b = 1
set ciff = ciff + SubStringBJ(abc,pospw + postext,pospw + postext)
set a = a + 1
endloop
return ciff
endfunction
function dechiff takes string text, string password returns string
local string abc = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
local string pwr = ""
local string ciff = ""
local integer postext = 0
local integer pospw = 0
local integer a = 1
local integer b = ( StringLength(abc) / 2 ) + 1
local integer c = 1
local string textklein = StringCase(text,false)
loop
set pwr = pwr + StringCase(password, false)
exitwhen StringLength(textklein) <= StringLength(pwr)
endloop
set pwr = SubStringBJ(pwr,1,StringLength(textklein))
set bj_forLoopAIndexEnd = StringLength(abc)
loop
exitwhen a > StringLength(textklein)
loop
exitwhen b > bj_forLoopAIndexEnd
if (SubStringBJ(abc,b,b) == SubStringBJ(textklein,a,a)) then
set postext = b
endif
if (SubStringBJ(abc,c,c) == SubStringBJ(pwr,a,a)) then
set pospw = c - 1
endif
set b = b + 1
set c = c + 1
endloop
set b = ( StringLength(abc) / 2 ) + 1
set c = 1
set ciff = ciff + SubStringBJ(abc,postext - pospw, postext - pospw)
set a = a + 1
endloop
return ciff
endfunction
function GetLevelKey takes integer level, string playername returns string
return chiff(udg_Equalvalue[level],playername)
endfunction
function GetKeyLevel takes string key, string playername returns integer
local string s = dechiff(key,playername)
local integer i = 0
loop
set i = i + 1
exitwhen i > udg_Equalint
if s == udg_Equalvalue[i] then
return i
endif
endloop
call BJDebugMsg("Error: Invalid key!")
return 0
endfunction
function PlaySoundForPlayer takes sound s, player p returns nothing
if GetLocalPlayer() == p then
call PlaySoundBJ(s)
endif
endfunction
Name | Type | is_array | initial_value |
a | unit | No | |
Abhoerer | force | No | |
Absorber | unit | Yes | |
Absorbierer_Gleichzetig | integer | No | |
Absorbierter | unit | Yes | |
Addtext | string | No | |
All_Players | force | No | |
Allies | integer | Yes | |
Allies_Bestimmung | player | Yes | |
Allies_Voll_Verbuendet | integer | Yes | |
AllyGenTempPlayers | force | No | |
Allytimer_Warmay | integer | Yes | |
Ansauger | unit | No | |
Anticounter | integer | No | |
Aufgeben | dialog | Yes | |
AufladeCounter | integer | No | |
AWP_AI | string | Yes | |
Ban_DIalog | dialog | Yes | |
Ban_Schleifencount | integer | No | |
Bancounter | integer | Yes | |
Banfound | integer | No | |
Bank_rebuild_Timer | timer | Yes | |
Banken_Limit | integer | No | 4 |
Banken_Limit_ErreichtUnit | unit | Yes | |
Banken_Limit_SpielerSpezifisch | integer | Yes | 4 |
Banmay | string | Yes | |
Banmay_Allowed | boolean | Yes | |
Banned_Geheim | boolean | Yes | |
Banned_yn | boolean | Yes | |
Basis_Income | integer | No | 400 |
Befehle_ScoreRang | integer | Yes | |
BeginningDialouge | dialog | No | |
Beleidigungcounter | integer | No | |
Bericht | string | Yes | |
Bezeichnung_Dying | integer | Yes | |
Bezeichnung_Feigheit | integer | Yes | |
Bezeichnung_Fiesheit | integer | Yes | |
Bezeichnung_Kampfkunst | integer | Yes | 2 |
Bezeichnung_Kampfsucht | integer | Yes | |
Bezeichnung_Killstau | integer | Yes | |
Bezeichnung_Milizenkills | integer | Yes | |
Black_Hole_Sucked | group | Yes | |
Bladestorm_Effektechecker | integer | No | |
Buchstabe | string | Yes | |
Bugtell_Told | integer | No | |
C | integer | No | |
Cache | gamecache | No | |
Capitulator | unit | Yes | |
CDGF | unit | Yes | |
Chance | integer | No | |
Chatstring | string | Yes | |
ChooseModes_Able | boolean | Yes | true |
ChooseModesButtons | button | Yes | |
Chose_Mode_Integer_Button | button | Yes | |
Code | string | No | |
Code_Actions_Check | integer | No | |
Code_Enterstrng | string | No | |
Code_Minus1Lenghts | integer | No | |
CoilOfDeath_Cursed | group | No | |
Color | string | Yes | |
ColorCodePlayer | string | Yes | |
Command_NeededTobeChanged | string | Yes | |
Countdown | timer | No | |
Counter_Gefhle | integer | No | |
CreateUnitName | string | Yes | |
credits | string | Yes | |
CS_2D_ArrayErgebnis | integer | No | |
CS_2D_ArrayErgebnis2 | integer | No | |
CS_2D_ArrayGroesse | integer | No | 4 |
CS_2D_ArrayIntegerA | integer | No | |
CS_2D_ArrayIntegerB | integer | No | |
CS_Facing | real | Yes | |
CS_Kugel | unit | Yes | |
CS_Run | boolean | No | |
CS_TempPoint | location | Yes | |
CS_Upcounter | integer | Yes | |
CS_WhichOne | integer | No | |
CS_Zaehler | integer | No | |
CS_Zauberer | unit | Yes | |
cscache | gamecache | No | |
Custom_Timer | timer | Yes | |
D | integer | No | |
D_Schadenminderungsentfernung | real | Yes | |
Debugfrequenz | integer | No | |
Demonengradzahl | real | No | |
Demonenpunkt | real | No | |
Demonenstuermer | unit | No | |
Dialog_Description | string | Yes | |
Dialouge_OnOrOff | boolean | Yes | |
Died_UnitLoc | location | No | |
Died_UnitLoc2 | location | No | |
DiedUnit | unit | No | |
DiedUnitType | unitcode | No | |
DIEshort | integer | No | |
DIEshort_PP | integer | No | |
Donnerblitz_Unitzaehler | integer | No | |
DP_Gebietsgroesse | real | Yes | |
DP_Innerer_Schaden | real | Yes | |
DP_Schadenminderung | real | Yes | |
DuringBan | integer | Yes | |
Dying_Bank | unit | No | |
Effekt | effect | Yes | |
Effekte_Zaehler | integer | No | |
Elemental_orb | unit | Yes | |
Elemental_Orb_Level | integer | Yes | |
ElementalOrb_Wachsen | group | No | |
ElemtalOrb_Owner | unit | Yes | |
END_MB_Max_Income | integer | Yes | |
END_MB_NGs_erobert | integer | Yes | |
END_MB_Sw_benutzt | integer | Yes | |
END_MB_Zeit | integer | Yes | |
Equalint | integer | No | |
Equalvalue | string | Yes | |
ErstellPunkt | location | No | |
Erstellungspunkt | real | No | |
f | integer | No | |
Feuergradzahl | real | No | |
Feuerstuermer | unit | Yes | |
Feuerzirkel_Entfernung | real | Yes | |
Feuerzirkelnde | group | No | |
Feuerzirkelnde_Feuergruppe | group | Yes | |
FireMissiled | group | No | |
First | boolean | No | true |
Fixtell_Counter | integer | No | |
Flamecaster | group | No | |
FlamePoint | location | No | |
Flamer | unit | No | |
FlankierungsZiel | location | Yes | |
FlankInt | integer | No | |
Flashback | group | No | |
Flashback_ConstanceVW | group | No | |
Flashed_Unit | unit | No | |
FPS | integer | No | |
Freezed | unit | No | |
Freezedgroup | group | Yes | |
FreierBaupunktAi | location | No | |
GADS_Int | integer | Yes | 0 |
Gefolterte | group | No | |
Gefuehl_AI | string | Yes | |
Gefuehl_AI2 | integer | No | |
Geholfen | force | No | |
GEN_Shorttimeunit | unit | No | |
gladiator_fury | unit | No | |
gladiator_fury_level | integer | Yes | |
GlobAtk | unit | No | |
GlobDistanz | real | No | |
GlobFriction | real | No | |
GlobOpfer | unit | No | |
GlobShowEffects | boolean | No | |
GlobSpeed | real | No | |
GM | boolean | Yes | |
GMTARGET | unit | Yes | |
Gnade_Chosed | boolean | Yes | true |
GoetlichInteger | integer | No | |
Grund_fuer_Pause | string | No | kacken |
Held | unit | No | |
HeroErfahrung | integer | Yes | |
herotype | unitcode | Yes | |
Hole | unit | No | |
Host | player | No | |
Ibaho | integer | No | |
Income_Bonus | integer | Yes | |
Income_Brutto | integer | Yes | |
Income_Check | integer | Yes | |
Income_Integer | integer | No | |
Income_Leiste | leaderboard | Yes | |
Income_Timer_Ende | real | No | 40.00 |
IncomeBringer | unitcode | Yes | |
Int1 | integer | No | |
Interval | real | No | 0.03 |
Ionenkanone_Dummy | unit | No | |
Ionenkanonenschuss | boolean | No | |
Ionsteuerung | unit | No | |
IsSingleplayer | boolean | No | |
KBBA | real | No | |
KBBB | real | No | |
KBFA | real | No | |
KBFB | real | No | |
KF | integer | No | |
Knock_Anti | unitcode | Yes | |
Knock_Friction | real | Yes | |
Knock_Range | real | Yes | |
Knock_Speed | real | Yes | |
Knock_Type | unitcode | Yes | |
Knockback_Dummy1 | unit | No | |
Knockback_Dummy2 | unit | No | |
KommandoZentrale_MaxRows | integer | No | |
Kommandozentrale_Nachrichten | boolean | No | |
KommandoZentrale_Text | string | Yes | |
KommandoZentraleMB | multiboard | No | |
KommtVor | boolean | No | |
KuenstlicheIntelligenz | string | No | |
KZPlayer | player | No | PlayerNE |
LAN_Dialog_JA | button | Yes | |
LAN_Gnade | player | No | |
LAN_Gnadenvote | dialog | Yes | |
LastAttacker | player | No | |
LastLenghts | integer | No | |
Laufvariable | integer | No | |
Laufvariable_AI | integer | No | |
LaufvariablePlasma | integer | No | |
Leap_Strike | unit | Yes | |
Leap_Strike_MoveCalculator | integer | Yes | |
Leaping_Strike_Counter | integer | No | |
Legendaerer | player | No | |
level | integer | No | |
Level_Player_Code | integer | Yes | 0 |
loopInteger | integer | No | |
MagieCounter | integer | No | |
Magiekugel | unit | Yes | |
Magiekugelopfer | unit | No | |
MagischesSchildCaster | unit | No | |
Max_Banmay | integer | No | |
Max_Modes | integer | No | 2 |
Max_Sattelitenverfolgung | integer | No | |
MB_RangZuweisung | integer | No | |
MB_Spielerplatz | integer | Yes | 15 |
Mentaler_Effekt | effect | No | |
Mentales_Ziel | unit | No | |
Messages_Written | integer | Yes | |
Millizen_Typ | integer | Yes | 1 |
Minute | integer | No | |
MOD | boolean | Yes | |
Modes_Chosen | integer | No | |
MonatsTimer | timer | No | |
Mora | real | No | |
Multibaord_Text | string | No | |
Multiboard | multiboard | No | |
Multiboard_GoOn | boolean | No | true |
Multiboard_Uhrentext | string | Yes | |
name | string | Yes | |
Navigator | integer | No | |
Navigator2 | integer | No | |
NB_Einkommen | integer | Yes | 30 |
NB_Headhunter_Spawn_Timer | timer | No | |
NB_Orc_Spawn_Timer | timer | No | |
NB_Shaman_Spawn_Timer | timer | No | |
NegativeVotings | integer | No | |
NeutralerGebaudeName | string | Yes | |
NG_Limit | integer | Yes | |
NoItem | itemcode | No | |
NoPlayer | player | No | |
NotLoosed | force | No | |
Nukes_Erlaubt | boolean | No | true |
OneTimeWin | boolean | No | false |
ParallelCounter | integer | Yes | |
Partikelopfer | unit | No | |
Performance | integer | No | |
Ping_On | boolean | No | |
Pingtimer | timer | No | |
Platzsucher_Typ | unitcode | No | h01Q |
Player_Definieren | integer | No | |
Playerinteger | integer | No | |
Playing_Players | force | No | |
PositiveVotings | integer | No | |
Progress | quest | No | |
Progress_SpieleranzahlALLSPLIT | boolean | No | |
Progress_TempSave | string | No | |
Progress_Texteinschiebung_PP | integer | No | |
Progress_Texteinschiebung_Win | integer | No | |
ProgressText | string | No | |
Prozent_Einheitenleben | string | No | |
Prozent_Sold | real | No | 1.00 |
Prozent_Sold_Spielerspezifisch | real | Yes | |
Punktanzeige | integer | Yes | |
Race | string | Yes | |
RaceDialog | dialog | Yes | |
Races_DialogButton | button | Yes | |
Radarerkenner | unit | No | |
Repicked | boolean | Yes | |
Report_DIalog | dialog | Yes | |
ReportString | string | Yes | |
ReportStringPlayer | string | Yes | |
ReturnUnittype | unitcode | Yes | |
Richtung_Scroll | integer | No | |
RocketLauncher | unit | No | |
S | string | No | |
SaugerInteger | integer | No | |
Schwiereigkeit_AI | integer | No | |
SecondDialog | dialog | No | |
Secondsleft | integer | No | |
ShotNuke | player | No | |
SimError | sound | No | |
Sold_Integer | integer | No | |
Sold_Kosten | integer | Yes | |
Sold_Koster | unitcode | Yes | |
Soldinteger | integer | Yes | |
Spearint | integer | No | |
SpentSold | integer | Yes | |
Sperre | dialog | No | |
Spieleranzahl | integer | No | 1 |
Spielerplatz | integer | Yes | |
Spielpause_BanRechte | integer | No | |
Spion_Caster | unit | Yes | |
Spion_Sattelitenziel | unit | Yes | |
Start_gold | integer | No | 500 |
Startdialog_Laufvariable | integer | No | |
StartTimer | timer | No | |
Startwood | integer | No | 120 |
Stoned | unit | No | |
Stoneskin_Active | boolean | Yes | |
Store_Unit_Cache | unit | Yes | |
SwapPlayer | integer | No | |
Temp_Caster_AI | unit | No | |
Temp_Int | integer | No | |
TempCaster | unit | No | |
TempEffect | effect | No | |
TempGroup | group | No | |
TempGroup2 | group | No | |
TempGroup3 | group | No | |
TempGroup4 | group | No | |
TempGroup5 | group | No | |
TempGroupPlasma | group | No | |
TempInt | integer | No | |
TempInteger | integer | No | |
TempInteger2 | integer | No | |
TempKugel | unit | Yes | |
TempLetter | string | No | |
TempPlayer | player | No | |
TempPlayer2 | player | No | |
tempPoint | location | Yes | |
TempPoint | location | No | |
TempPoint2 | location | No | |
TempPoint3 | location | No | |
TempPoint4 | location | No | |
TempPoint5 | location | No | |
TempPointPlasma | location | No | |
TempPointPlasma2 | location | No | |
TempPointSpecial | location | No | |
TempReal | real | No | |
TempReal2 | real | No | |
TempRealStrike | real | No | |
TempStrike | unit | No | |
TempString | string | No | |
TempString2 | string | No | |
TempUnit | unit | No | |
TempUnit2 | unit | No | |
TempVar | real | No | |
Test | boolean | No | |
Tester_message | boolean | No | |
TestRw | real | No | |
TextToBeparsed | string | No | |
TextToBeParsed_LenghtsToken | integer | No | |
TextToBeParsed_Lines | integer | No | |
TextToBeParsedAusgabe | string | Yes | |
TK_Caster | unit | Yes | |
TK_GravityReal | real | Yes | |
TK_HeightToReach | real | Yes | |
TK_Phase | integer | Yes | |
TK_Running | boolean | No | |
TK_SmoothEffects | integer | No | |
TK_Target | unit | Yes | |
TK_WhichOne | integer | No | |
TK_Zahler | integer | No | |
Todespakt_Schadenmultiplikator | real | No | |
Tornadocast | integer | No | |
Trained | integer | Yes | 1 |
Tribut_CounterZahl | integer | Yes | 0 |
ts | string | No | |
Tutorial | boolean | Yes | true |
Tutorial_Schritt | integer | Yes | |
Tutorial_Sounds | sound | Yes | |
Uhr_Minuten | integer | No | |
Uhr_Sekunden | integer | No | |
Uhr_Stunden | integer | No | |
Uhr_Text | string | No | |
Umdrehung | real | No | |
unit | unit | No | |
UnitCode | string | Yes | |
Upcounter | integer | No | |
Ursprnglicher_Name | string | Yes | |
UsePoint | location | Yes | |
Verlierer | force | No | |
Version | real | No | |
Verysafe2 | unit | No | |
Verysave | unit | No | |
Vorkommnis_String | string | Yes | |
Vorkommnisse | integer | No | |
Votecounter | integer | No | |
VoteMB | multiboard | No | |
WinMay | boolean | No | true |
WrongCodes | integer | Yes | |
Zeitalter_erreichen_Laser_Atom | integer | Yes | |
Zufall | integer | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
function FlankierenAktion takes nothing returns nothing
set udg_FlankInt = udg_FlankInt + 1
call IssuePointOrderLoc(GetEnumUnit(), "move", udg_FlankierungsZiel[udg_FlankInt])
endfunction
function FlankierenANGRIFF takes nothing returns nothing
call IssueTargetOrder( GetEnumUnit(),"attack",udg_opfer )
endfunction
function Flankieren takes unit opfer, group Wer, real closecome, real umkreis returns nothing
local location lo1 = GetUnitLoc(opfer)
local integer gc = CountUnitsInGroup(Wer)
local integer i
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = gc
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_FlankierungsZiel[bj_forLoopAIndex] = PolarProjectionBJ(lo1, closecome, umkreis/I2R(gc)*bj_forLoopAIndex)
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call ForGroupBJ(Wer, function FlankierenAktion)
set i = 0
loop
exitwhen i == gc
set i = i + 1
call RemoveLocation(udg_FlankierungsZiel[i])
endloop
set udg_FlankInt = 0
endfunction
function UmzingelungsAngriff takes unit opfer, group Wer, real closecome, real umkreis returns nothing
set udg_a = FirstOfGroup(Wer)
set udg_opfer = opfer
call Flankieren (opfer,Wer,closecome,umkreis)
call TriggerSleepAction((DistanceBetweenPoints(GetUnitLoc(udg_a), GetUnitLoc(opfer)) + closecome) / 230.)
call ForGroupBJ(Wer, function FlankierenANGRIFF)
set udg_a = null
endfunction
function AI_Kraftfaktor takes integer AI_Level returns integer
if ( AI_Level == 1 ) then
return 4
endif
if ( AI_Level == 2 ) then
return 7
endif
if ( AI_Level == 3 ) then
return 9
endif
return 9
endfunction
library Spirale requires TimerUtils
globals
private constant integer MaxTimes = 280
private constant real startDist = 800.
private constant distPerExe = 2.8571 // startDist/MaxTimes
private constant real Inc = 3.85714 // ((TurnDegrees*360.)/MaxTimes)
integer SpCount = 0
spirale array SpiralData
endglobals
struct spirale
unit u
real startdirection
integer times
endstruct
function SpiraleAusfuehrung takes nothing returns nothing
local timer g = GetExpiredTimer()
local spirale s = SpiralData[GetTimerData(g)]
local real dist = startDist - (distPerExe*s.times)
local real x = GetUnitX(s.u)
local real y = GetUnitY(s.u)
set s.times = s.times + 1
set s.startdirection = s.startdirection + Inc
set x = x+ dist * Cos(s.startdirection * bj_DEGTORAD)
set y = y+ dist * Sin(s.startdirection * bj_DEGTORAD)
call SetUnitX(s.u,x)
call SetUnitY(s.u,y)
if ( s.times > MaxTimes ) then
call s.destroy()
call ReleaseTimer(g)
endif
endfunction
function Spirale takes unit u, unit u2, real startdirection returns nothing
local timer g = NewTimer()
local spirale s
set s.u = u
set s.startdirection = startdirection
set s.times = 0
set SpCount = SpCount + 1
set SpiralData[SpCount] = s
call SetTimerData(g,SpCount)
call TimerStart(g, udg_Interval, true, function SpiraleAusfuehrung)
set g = null
set u = null
set u2 = null
endfunction
endlibrary
function GetAIBuildLoc takes unit u returns location
local location loca = GetUnitLoc(u)
local location locb
local location locreturn
local group group2
local integer i = 0
loop
exitwhen i > 500
set locb = PolarProjectionBJ(loca, GetRandomReal(100.,1200.),GetRandomReal(0.,360.))
set group2 = GetUnitsInRangeOfLocAll(250.,locb)
if ( CountUnitsInGroup(group2) == 0 ) then
set udg_Laufvariable = 0
call EnumDestructablesInCircleBJ(250.,locb,function Descount)
if ( udg_Laufvariable == 0 ) then
set locreturn = locb
call RemoveLocation(locb)
call DestroyGroup(group2)
set i = 500
return locreturn
endif
endif
call RemoveLocation(locb)
call DestroyGroup(group2)
set i = i + 1
endloop
return loca
endfunction
library Spirale requires TimerUtils
globals
private constant integer MaxTimes = 280
private constant real startDist = 800.
private constant real distPerExe = 2.8571 // startDist/MaxTimes
private constant real Inc = 3.85714 // ((TurnDegrees*360.)/MaxTimes)
integer SpCount = 0
spirale array SpiralData
endglobals
struct spirale
unit u
real startdirection
integer times
endstruct
function SpiraleAusfuehrung takes nothing returns nothing
local timer g = GetExpiredTimer()
local spirale s = SpiralData[GetTimerData(g)]
local real dist = startDist - (distPerExe*s.times)
local real x = GetUnitX(s.u)
local real y = GetUnitY(s.u)
set s.times = s.times + 1
set s.startdirection = s.startdirection + Inc
set x = x+ dist * Cos(s.startdirection * bj_DEGTORAD)
set y = y+ dist * Sin(s.startdirection * bj_DEGTORAD)
call SetUnitX(s.u,x)
call SetUnitY(s.u,y)
if ( s.times > MaxTimes ) then
call s.destroy()
call ReleaseTimer(g)
endif
endfunction
function Spirale takes unit u, unit u2, real startdirection returns nothing
local timer g = NewTimer()
local spirale s
set s.u = u
set s.startdirection = startdirection
set s.times = 0
set SpCount = SpCount + 1
set SpiralData[SpCount] = s
call SetTimerData(g,SpCount)
call TimerStart(g, udg_Interval, true, function SpiraleAusfuehrung)
set g = null
set u = null
set u2 = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
- Mauern stärker gemacht
- Altes Mauersystem wieder eingeführt
- Neues Ultimate für die Astralmagician "Disintegrate"
- LIP Control Center wurde aus dme Spiel entfernt
- ION Cannon, Special Robot, electronical cooler, energy orb, computer virus wurden aus dem Spiel entfernt
- Forschungen allgemein vrgünstigt (auch Zeitalter)
- Zeitalter können nun früher erreicht werden
- Buff von Laserzeit und auch ein paar Atomzeit Einheiten
- Produktionsdauer und Kosten einiger Einheiten vermindert
- Geheimheld verändert ;)
- Ursprungsmana von Zauberern erhöht
- Einige Trigger Veränderungen
- Atombombe Kosten um 2000 verringert
- Kleinere Bugfixes
Liste mit im Spiel unbenutzten Fähigkeiten:
Burning Heaven, Thunderstrike, Iron Will, Earthquake, Ultraspeerwurf, Arkane Kugeln, Forcebind,
Bladestorm (2), Holy Presence, Psistorm, Mana Blast, Flood, Firestorm 2, Psychokinesis, Energy Bolt,
Magic Shield, Ausbildung 2, Skystorm, Tector Beam, Timestop, Mental Confusion
//TESH.scrollpos=6
//TESH.alwaysfold=0
//***********************************************************************
//
// Game Creator: Mr.Malte
// Help from: Snakesoul
// Version: 1.15b
// Started "Rise of Empires": 2003/2004
// Finished "Rise of Empires": --------
// Hours worked at: 1500
//
//***********************************************************************
//
// I invested a lot of time into this game, about 1400 hours
// making this game and 2500 hours testing. So I hope its gonna
// played often in the Battlenet. If you are a hacker reading this,
// its not fair to steal as much work. Create your own map. I
// want the glory for this map, if you stole this Id just be angry.
// So please dont! Or I will tell my mapping friends to ban you
// in their games. (IndIANer, TheZizz, interflo, Pimp my peon maker
// usw...). I am glad to have this game almost done. I think if it is
// I will maybe stop mapping. But that needs a long time, there are
// still bugs.
|***********************************************************************|
|=======================================================================|
|===========================Map Description=============================|
|=======================================================================|
|***********************************************************************|
==About the map==
-----------------
Generic information
Maptype: Strategy
Maximal number of players: 10
Time per game: 45-90 min.
Mapmakers: Mr.Malte (map) and Snakesoul ( most of the terrain )
Spent hours to make: ca. 1500
Arrangement
1.Story
2.Gameplay
3.Neutral buildings
4.Ages
5.Features
6.Superweapons
1.Story
9th April, 1422
It happened in 1366, that say the papers and scripts. The dark age was ending, a new age was coming. The towns became fuller and fuller, the place became rare. Because of that many people plagues were scattered, horrible plagues that killed many many people. So many mightful people decided to go out, to begin completely new. Yes. It would be easy to conquer unknown places, to clean them from animals with all the soldiers. To make place for new towns and people. They mightful persons could become mightful then, be the richest and own great pieces of country. They would get idolized and requested for country. But that idea had one checkmark: Many wanted to be that rich. Exactly (XXX). And they are still fighting. They conquer the towns of the settlers (Haiatatta tribe) and make them pay tax. The tribes technologies become stolen by them, the wood is hackled, and the peaceful island gets desolated by epic fights.
You are one of these mightful persons, so be as merciless as possible, betray, kill your enemies and make your inferiors die for you! Create your own empire and be the lord of death and life. Everybody is gonna be dependent of you, everybody your slave.
2.Gameplay
At the beginning you can look for a place wehere oyu want to start and build your capital there. Actually its close to a meele map but there are only custom units and spells. So you have your base and need gold. Build a worker and construct banks that increase your income. You will get Income after 40 seconds. That could be imba, cant it? I mean the more banks the more gold you get so you can build more and more banks. But it isnt: There is a limit of banks (4) and units cost sold. So if youve got a lot units you wont be able to expend your advantage. And there are some other differences. The superweapons and the neutral buildings.
3.Neutral buildings
Neutral buildings are very important for this game; The settlers of Zalys (island) live in them. So it would be great if you will make them pay tax for you and steal their technologies. That increases your income and makes a lot of new units acquirable. Also they are great as defensepoints. For that you cant take them easily if they are still neutral, they defense automatically, with arrows and creeps. If you want to take a certain kind of neutral building (7 different kinds), you just have to write their names with a - before it. If you want to conquer one, just kill it.
4.Ages
The game starts in the dark age. You can reach these ages in this order:
Renaissance (instantly)
Atomic age (after 18. min)
Laser age (After 26. min)
That seems to be faint, but it isnt: The next age will make a lot of new units and technologies acquirable. A lot!!! And some new superweapons. If you build them one time, you are always in this age, they cant be killed or something else. You research ages in the capital. Your enemy is gonna look very silly if a Ion Cannon dazzles his immaturely soldiers I think :D
5.Features
-6 Unique custom heroes with great spells!
-I really tried to balance the map well
-Almost no memory leaks
-3 different ages
-7 different Neutral buildings
-More than 140 new units
-A lot of commands
-Well made multiboard with a lot of information
-Income and sold are shown all the time in a little leaderboard
-More than 180 new abilities!
-You can use unique superweapons
-If youre new to this game, you can read a lot of useful tips ( not wannabe tips like your hero is important, be careful with him )
-There are always some eastereggs for you to find.
6.Superweapons
Some of you might say superweapons are imba, but they arent. You just can use superweapons if you reached the atomic or laser age. They cost a lot of gold and have a lot cooldown.
Superweapons: Extremely expensive, extremely useful, and easy to use. If your base is destroyed and you dont wanna give up, just keep your money and bomb your enemies away :D. Just one rule applies: Gold is might! They are very suited to press money from somebody. He cant know if you have got the required money :)
//TESH.scrollpos=0
//TESH.alwaysfold=0
library GeometryFuncs
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return 57.29582 * Atan2(y2 - y1, x2 - x1)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ASsasine_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetAttacker()) == 'h017' ) ) then
return false
endif
return true
endfunction
function Trig_ASsasine_Actions takes nothing returns nothing
local unit TempUnit
set TempUnit = GetAttacker()
call UnitRemoveAbilityBJ( 'A03Z', TempUnit )
call TriggerSleepAction( 5.00 )
call UnitAddAbilityBJ( 'A03Z', TempUnit )
set TempUnit = null
endfunction
//===========================================================================
function InitTrig_ASsasine takes nothing returns nothing
set gg_trg_ASsasine = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ASsasine, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_ASsasine, Condition( function Trig_ASsasine_Conditions ) )
call TriggerAddAction( gg_trg_ASsasine, function Trig_ASsasine_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Chance_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetAttacker()) == 'h00Y' ) ) then
return false
endif
if ( not ( IsUnitType(GetAttackedUnitBJ(), UNIT_TYPE_STRUCTURE) == false ) ) then
return false
endif
return true
endfunction
function Trig_Chance_Func005Func003002003001 takes nothing returns boolean
return ( "1" == "1" )
endfunction
function Trig_Chance_Func005Func003002003002001 takes nothing returns boolean
return ( GetOwningPlayer(GetFilterUnit()) != GetOwningPlayer(udg_RocketLauncher) )
endfunction
function Trig_Chance_Func005Func003002003002002 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Chance_Func005Func003002003002 takes nothing returns boolean
return GetBooleanAnd( Trig_Chance_Func005Func003002003002001(), Trig_Chance_Func005Func003002003002002() )
endfunction
function Trig_Chance_Func005Func003002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Chance_Func005Func003002003001(), Trig_Chance_Func005Func003002003002() )
endfunction
function Trig_Chance_Func005Func004C takes nothing returns boolean
if ( not ( CountUnitsInGroup(udg_TempGroup) > 0 ) ) then
return false
endif
return true
endfunction
function Trig_Chance_Func005C takes nothing returns boolean
if ( not ( udg_Chance == 3 ) ) then
return false
endif
return true
endfunction
function Trig_Chance_Func007C takes nothing returns boolean
if ( not ( udg_Chance == 3 ) ) then
return false
endif
return true
endfunction
function Trig_Chance_Func010Func003002003001 takes nothing returns boolean
return ( DistanceBetweenPoints(udg_TempPoint, GetUnitLoc(GetFilterUnit())) >= 400.00 )
endfunction
function Trig_Chance_Func010Func003002003002001 takes nothing returns boolean
return ( GetOwningPlayer(GetFilterUnit()) != GetOwningPlayer(udg_RocketLauncher) )
endfunction
function Trig_Chance_Func010Func003002003002002 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Chance_Func010Func003002003002 takes nothing returns boolean
return GetBooleanAnd( Trig_Chance_Func010Func003002003002001(), Trig_Chance_Func010Func003002003002002() )
endfunction
function Trig_Chance_Func010Func003002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Chance_Func010Func003002003001(), Trig_Chance_Func010Func003002003002() )
endfunction
function Trig_Chance_Func010Func005C takes nothing returns boolean
if ( not ( CountUnitsInGroup(udg_TempGroup) > 0 ) ) then
return false
endif
return true
endfunction
function Trig_Chance_Func010C takes nothing returns boolean
if ( not ( udg_Chance == 3 ) ) then
return false
endif
return true
endfunction
function Trig_Chance_Actions takes nothing returns nothing
local unit RocketLauncher
set RocketLauncher = GetAttacker()
call SetUnitManaBJ( RocketLauncher, ( GetUnitStateSwap(UNIT_STATE_MANA, RocketLauncher) - 5.00 ) )
set udg_Chance = GetRandomInt(1, 5)
if ( Trig_Chance_Func005C() ) then
call SetUnitManaBJ( RocketLauncher, ( GetUnitStateSwap(UNIT_STATE_MANA, RocketLauncher) - 19.00 ) )
call UnitAddAbilityBJ( 'A03L', RocketLauncher )
set udg_TempGroup = GetUnitsInRangeOfLocMatching(900.00, GetUnitLoc(RocketLauncher), Condition(function Trig_Chance_Func005Func003002003))
if ( Trig_Chance_Func005Func004C() ) then
set udg_TempPoint = GetUnitLoc(GroupPickRandomUnit(udg_TempGroup))
call IssuePointOrderLocBJ( RocketLauncher, "clusterrockets", udg_TempPoint )
call RemoveLocation ( udg_TempPoint )
else
endif
call DestroyGroup ( udg_TempGroup )
call TriggerSleepAction( 1.00 )
call UnitRemoveAbilityBJ( 'A03L', RocketLauncher )
return
else
endif
set udg_Chance = GetRandomInt(1, 7)
if ( Trig_Chance_Func007C() ) then
call SetUnitManaBJ( RocketLauncher, ( GetUnitStateSwap(UNIT_STATE_MANA, RocketLauncher) - 26.00 ) )
call UnitAddAbilityBJ( 'A01V', RocketLauncher )
call IssueImmediateOrderBJ( RocketLauncher, "thunderclap" )
call TriggerSleepAction( 0.70 )
call UnitRemoveAbilityBJ( 'A01V', RocketLauncher )
return
else
endif
// -----
set udg_Chance = GetRandomInt(1, 4)
if ( Trig_Chance_Func010C() ) then
call SetUnitManaBJ( RocketLauncher, ( GetUnitStateSwap(UNIT_STATE_MANA, RocketLauncher) - 35.00 ) )
set udg_TempPoint = GetUnitLoc(RocketLauncher)
set udg_TempGroup = GetUnitsInRangeOfLocMatching(900.00, GetUnitLoc(RocketLauncher), Condition(function Trig_Chance_Func010Func003002003))
call RemoveLocation ( udg_TempPoint )
if ( Trig_Chance_Func010Func005C() ) then
call SetUnitAnimation( RocketLauncher, "spell channel" )
set udg_TempPoint = GetUnitLoc(GroupPickRandomUnit(udg_TempGroup))
set udg_TempPoint3 = GetUnitLoc(RocketLauncher)
call CreateNUnitsAtLoc( 1, 'e01B', GetOwningPlayer(GetTriggerUnit()), udg_TempPoint3, GetUnitFacing(RocketLauncher) )
call SetUnitFacingToFaceLocTimed( RocketLauncher, udg_TempPoint, 0 )
call RemoveLocation ( udg_TempPoint3 )
set udg_TempPoint2 = GetUnitLoc(GetLastCreatedUnit())
call GroupAddUnitSimple( GetLastCreatedUnit(), udg_Flashback_ConstanceVW )
call UnitApplyTimedLifeBJ( ( DistanceBetweenPoints(udg_TempPoint, udg_TempPoint2) / 900.00 ), 'BTLF', GetLastCreatedUnit() )
call RemoveLocation ( udg_TempPoint )
call RemoveLocation ( udg_TempPoint2 )
call DestroyGroup ( udg_TempGroup )
else
endif
return
else
endif
endfunction
//===========================================================================
function InitTrig_Chance takes nothing returns nothing
set gg_trg_Chance = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Chance, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Chance, Condition( function Trig_Chance_Conditions ) )
call TriggerAddAction( gg_trg_Chance, function Trig_Chance_Actions )
endfunction
//TESH.scrollpos=177
//TESH.alwaysfold=0
function Trig_Knockback_Multi_Func005Func009C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetEventDamageSource()) == 'okod' ) ) then
return false
endif
if ( not ( GetUnitTypeId(GetTriggerUnit()) != 'h00Y' ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func005C takes nothing returns boolean
if ( ( GetUnitTypeId(GetEventDamageSource()) == 'h00Y' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetEventDamageSource()) == 'h00P' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetEventDamageSource()) == 'h00O' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetEventDamageSource()) == 'h01X' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetEventDamageSource()) == 'hkni' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetEventDamageSource()) == 'h010' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetEventDamageSource()) == 'n004' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetEventDamageSource()) == 'h01N' ) ) then
return true
endif
if ( Trig_Knockback_Multi_Func005Func009C() ) then
return true
endif
return false
endfunction
function Trig_Knockback_Multi_Conditions takes nothing returns boolean
if ( not Trig_Knockback_Multi_Func005C() ) then
return false
endif
if ( not ( GetUnitAbilityLevelSwapped('A068', GetTriggerUnit()) != 1 ) ) then
return false
endif
if ( not ( GetTriggerUnit() != GetEventDamageSource() ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == false ) ) then
return false
endif
if ( not ( GetEventDamage() >= 17.00 ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func002Func001Func003C takes nothing returns boolean
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h00Y' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h01X' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h01N' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'n005' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'ocat' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'n004' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'okod' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h01M' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'h01N' ) ) then
return true
endif
return false
endfunction
function Trig_Knockback_Multi_Func002Func001C takes nothing returns boolean
if ( not Trig_Knockback_Multi_Func002Func001Func003C() ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func002C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetEventDamageSource()) != 'okod' ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func004Func001Func001Func001Func001Func001Func001C takes nothing returns boolean
if ( not ( udg_Spearint == 0 ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func004Func001Func001Func001Func001Func001C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetEventDamageSource()) == 'h01N' ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == false ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_MECHANICAL) == false ) ) then
return false
endif
if ( not ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) <= 400.00 ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func004Func001Func001Func001Func001C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetEventDamageSource()) == 'h010' ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == false ) ) then
return false
endif
if ( not ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) <= 700.00 ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func004Func001Func001Func001Func003C takes nothing returns boolean
if ( not ( udg_Zufall == 4 ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func004Func001Func001Func001C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetEventDamageSource()) == 'hkni' ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == false ) ) then
return false
endif
if ( not ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) <= 400.00 ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func004Func001Func001C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetEventDamageSource()) == 'n004' ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func004Func001C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetEventDamageSource()) == 'h00Y' ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func004C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetEventDamageSource()) == 'h01X' ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == false ) ) then
return false
endif
if ( not ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) <= 900.00 ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func008Func002C takes nothing returns boolean
if ( not ( udg_Chance == 4 ) ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Func008Func003C takes nothing returns boolean
if ( ( GetUnitTypeId(GetEventDamageSource()) == 'h00P' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetEventDamageSource()) == 'h00O' ) ) then
return true
endif
return false
endfunction
function Trig_Knockback_Multi_Func008C takes nothing returns boolean
if ( not Trig_Knockback_Multi_Func008Func003C() ) then
return false
endif
return true
endfunction
function Trig_Knockback_Multi_Actions takes nothing returns nothing
local unit Flashed_Unit
if ( Trig_Knockback_Multi_Func002C() ) then
if ( Trig_Knockback_Multi_Func002Func001C() ) then
set Flashed_Unit = null
return
else
endif
else
endif
// Check
if ( Trig_Knockback_Multi_Func004C() ) then
call Knockback ( GetTriggerUnit(), GetEventDamageSource(), 155, 670, 4, true)
else
if ( Trig_Knockback_Multi_Func004Func001C() ) then
call Knockback ( GetTriggerUnit(), GetEventDamageSource(), 230, 770, 3, true)
else
if ( Trig_Knockback_Multi_Func004Func001Func001C() ) then
call Knockback ( GetTriggerUnit(), GetEventDamageSource(), 130, 370, 3, true)
else
if ( Trig_Knockback_Multi_Func004Func001Func001Func001C() ) then
set udg_Zufall = GetRandomInt(1, 4)
if ( Trig_Knockback_Multi_Func004Func001Func001Func001Func003C() ) then
call Knockback ( GetTriggerUnit(), GetEventDamageSource(), 40, 270, 1, true)
else
endif
else
if ( Trig_Knockback_Multi_Func004Func001Func001Func001Func001C() ) then
call Knockback ( GetTriggerUnit(), GetEventDamageSource(), 70, 210, 1, true)
else
if ( Trig_Knockback_Multi_Func004Func001Func001Func001Func001Func001C() ) then
if ( Trig_Knockback_Multi_Func004Func001Func001Func001Func001Func001Func001C() ) then
set udg_TempPoint = GetUnitLoc(GetTriggerUnit())
call CreateNUnitsAtLoc( 1, 'e00C', GetOwningPlayer(GetEventDamageSource()), udg_TempPoint, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
set udg_TempUnit = GetLastCreatedUnit()
call l1()
call spear()
else
endif
call Knockback ( GetTriggerUnit(), udg_TempUnit, 100, 300, 0.88, false)
else
endif
endif
endif
endif
endif
endif
if ( Trig_Knockback_Multi_Func008C() ) then
set udg_Chance = GetRandomInt(1, 5)
if ( Trig_Knockback_Multi_Func008Func002C() ) then
call Knockback ( GetTriggerUnit(), GetEventDamageSource(), 170, 1070, -5, true)
call AddSpecialEffectTargetUnitBJ( "weapon", GetAttacker(), "Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl" )
set udg_Effekte_Zaehler = ( udg_Effekte_Zaehler + 1 )
set udg_Effekt[udg_Effekte_Zaehler] = GetLastCreatedEffectBJ()
call UnitDamageTargetBJ( GetAttacker(), GetAttackedUnitBJ(), 25.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING )
set udg_TempPoint = GetUnitLoc(GetAttackedUnitBJ())
call AddSpecialEffectLocBJ( udg_TempPoint, "Units\\NightElf\\Wisp\\WispExplode.mdl" )
call RemoveLocation ( udg_TempPoint )
set udg_Mentaler_Effekt = GetLastCreatedEffectBJ()
call TriggerSleepAction( 0.30 )
call DestroyEffectBJ( udg_Mentaler_Effekt )
call TriggerSleepAction( 0.70 )
set Flashed_Unit = null
else
endif
else
endif
endfunction
//===========================================================================
function InitTrig_Knockback_Multi takes nothing returns nothing
set gg_trg_Knockback_Multi = CreateTrigger( )
call TriggerAddCondition( gg_trg_Knockback_Multi, Condition( function Trig_Knockback_Multi_Conditions ) )
call TriggerAddAction( gg_trg_Knockback_Multi, function Trig_Knockback_Multi_Actions )
endfunction
//TESH.scrollpos=21
//TESH.alwaysfold=0
function Trig_Mental_force_Conditions takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetAttacker(), 'B00B') == true ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == false ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == false ) ) then
return false
endif
return true
endfunction
function Trig_Mental_force_Func004C takes nothing returns boolean
if ( not ( udg_Chance == 5 ) ) then
return false
endif
return true
endfunction
function Trig_Mental_force_Func006C takes nothing returns boolean
if ( not ( udg_Chance == 7 ) ) then
return false
endif
return true
endfunction
function Trig_Mental_force_Func008C takes nothing returns boolean
if ( not ( udg_Chance == 7 ) ) then
return false
endif
return true
endfunction
function Trig_Mental_force_Actions takes nothing returns nothing
local unit Mentales_Ziel
set Mentales_Ziel = GetAttackedUnitBJ()
set udg_Chance = GetRandomInt(1, 10)
if ( Trig_Mental_force_Func004C() ) then
call ShowUnitHide( Mentales_Ziel )
call PauseUnitBJ( true, Mentales_Ziel )
set udg_TempPoint = GetUnitLoc(Mentales_Ziel)
call AddSpecialEffectLocBJ( udg_TempPoint, "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" )
set udg_Effekte_Zaehler = ( udg_Effekte_Zaehler + 1 )
set udg_Effekt[udg_Effekte_Zaehler] = GetLastCreatedEffectBJ()
call AddSpecialEffectLocBJ( udg_TempPoint, "Objects\\Spawnmodels\\NightElf\\NECancelDeath\\NECancelDeath.mdl" )
set udg_Effekte_Zaehler = ( udg_Effekte_Zaehler + 1 )
set udg_Effekt[udg_Effekte_Zaehler] = GetLastCreatedEffectBJ()
call RemoveLocation ( udg_TempPoint )
call TriggerSleepAction( 2.00 )
call ShowUnitShow( Mentales_Ziel )
call PauseUnitBJ( false, Mentales_Ziel )
return
else
endif
set udg_Chance = GetRandomInt(1, 15)
if ( Trig_Mental_force_Func006C() ) then
set udg_TempPoint = GetUnitLoc(Mentales_Ziel)
call UnitDamageTargetBJ( GetAttacker(), GetAttackedUnitBJ(), 175.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING )
call AddSpecialEffectLocBJ( udg_TempPoint, "Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl" )
set udg_Effekte_Zaehler = ( udg_Effekte_Zaehler + 1 )
set udg_Effekt[udg_Effekte_Zaehler] = GetLastCreatedEffectBJ()
call AddSpecialEffectLocBJ( udg_TempPoint, "war3mapImported\\ArcaneExplosion.mdx" )
set udg_Effekte_Zaehler = ( udg_Effekte_Zaehler + 1 )
set udg_Effekt[udg_Effekte_Zaehler] = GetLastCreatedEffectBJ()
call RemoveLocation ( udg_TempPoint )
call Knockback ( GetTriggerUnit(), GetAttacker(), 170, 1070, -5, true)
return
else
endif
set udg_Chance = GetRandomInt(1, 20)
if ( Trig_Mental_force_Func008C() ) then
set udg_TempPoint = GetUnitLoc(GetAttacker())
call CreateNUnitsAtLoc( 1, 'e00Y', GetOwningPlayer(GetTriggerUnit()), udg_TempPoint, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 3.00, 'BTLF', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'A01H', GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "innerfire", GetAttacker() )
call RemoveLocation ( udg_TempPoint )
return
else
endif
endfunction
//===========================================================================
function InitTrig_Mental_force takes nothing returns nothing
set gg_trg_Mental_force = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mental_force, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Mental_force, Condition( function Trig_Mental_force_Conditions ) )
call TriggerAddAction( gg_trg_Mental_force, function Trig_Mental_force_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
constant function Eclipse_SpellID takes nothing returns integer
return 'A048' //The rawcode of the spell in your map, check hit CTRL + D to view it then fill it in here
endfunction
constant function Eclipse_NumSprites takes integer lvl returns integer
return lvl * 1 + 1
endfunction
constant function Eclipse_Damage takes integer lvl returns real
return (lvl + 0.50) * 5
endfunction
constant function Eclipse_AreaofEffect takes integer lvl returns real
return lvl * 0 + 650.0
endfunction
constant function Eclipse_FlySpeed takes nothing returns real
return 650.0
endfunction
constant function Eclipse_Timeout takes nothing returns real
return 0.05 //Setting this above 0.08 or so will cause it to look really jumpy and bad, while lower than
//0.02 may cause some slowdown. 0.05 is smooth and seems to be efficient enough for me
endfunction
constant function Eclipse_DetectionRange takes nothing returns real
return 90.0
endfunction
constant function Eclipse_Duration takes integer lvl returns real
return lvl * 0 + 20.0
endfunction
constant function Eclipse_UsesMissile takes nothing returns boolean
return true //This is used to dictate whether or not the units will fly towards the target
//or just sort of appear at it
endfunction
constant function Eclipse_ValidTargets takes nothing returns boolean
return (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) != 0.00) and (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_unit))) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false) and (GetUnitTypeId(GetFilterUnit()) != DummyID()) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND))
//This is the filter that we apply to units who are nearby, it is also used periodically to make sure the target is still valid
endfunction
//****************************************************************************************************
//Spell Section
//****************************************************************************************************
function Eclipse_Cast_Cons takes nothing returns boolean
return GetSpellAbilityId() == Eclipse_SpellID()
endfunction
function Eclipse_Movement takes nothing returns nothing
local timer t=GetExpiredTimer()
local timer s=t
local unit cast=GetHandleUnit(s, "shieldunit")
local unit missile=GetHandleUnit(s, "shieldmissile")
local unit targ=GetHandleUnit(s, "shieldtarg")
local real angle=GetHandleReal(s, "shieldangle")
local integer lvl=GetHandleInt(s, "lvl")
local string way=GetHandleString(s, "way")
local real x=GetUnitX(missile)
local real y=GetUnitY(missile)
local real speedi=GetHandleReal(s, "speedi")
local real x1
local real y1
local group g=CreateGroup()
local boolexpr cons=Condition(function Eclipse_ValidTargets)
set angle=angle + 10
//Outward bound movement
if (way == "outward") then
set x1=GetUnitX(targ)
set y1=GetUnitY(targ)
if ((x1-x)*(x1-x)+(y1-y)*(y1-y)) <= Pow(Eclipse_DetectionRange(), 2) or (GetUnitState(targ, UNIT_STATE_LIFE) <= 0.00) then
call UnitDamageTargetBJ(cast, targ, Eclipse_Damage(lvl), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(Eclipse_SpellID(), EFFECT_TYPE_TARGET, 1), targ, "chest"))
set way="inward"
set targ=null
else
call SetUnitFacing(missile, bj_RADTODEG*Atan2(y1-y, x1-x))
set x=GetUnitX(missile)+speedi*Cos(GetUnitFacing(missile)*bj_DEGTORAD)
set y=GetUnitY(missile)+speedi*Sin(GetUnitFacing(missile)*bj_DEGTORAD)
call SetUnitPosition(missile, x, y)
endif
endif
//Inward bound movement
if (way == "inward") or (way == "missile") then
//The missiles are heading back to the cast, so we must approximate it's proper location and
//make it move towards THAT location
set x1=GetUnitX(cast)+speedi*Cos(angle*bj_DEGTORAD)
set y1=GetUnitY(cast)+speedi*Sin(angle*bj_DEGTORAD)
call SetUnitFacing(missile, bj_RADTODEG*Atan2(y1-y, x1-x))
if (((x-x1)*(x-x1)+(y-y1)*(y-y1)) <= 600) then
set way="norm"
else
set x=GetUnitX(missile)+speedi*Cos(GetUnitFacing(missile)*bj_DEGTORAD)
set y=GetUnitY(missile)+speedi*Sin(GetUnitFacing(missile)*bj_DEGTORAD)
call SetUnitPosition(missile, x, y)
endif
endif
//Regular movement
if (way == "norm") then
set x=(GetUnitX(cast)+85*Cos(angle*bj_DEGTORAD))
set y=(GetUnitY(cast)+85*Sin(angle*bj_DEGTORAD))
call SetUnitPosition(missile, x, y)
set udg_unit=missile
call GroupEnumUnitsInRange(g, x, y, Eclipse_AreaofEffect(lvl), cons)
if (CountUnitsInGroup(g) > 0) then
set targ=GroupPickRandomUnit(g)
set way="outward"
endif
endif
//Refresh some of the table objects
call SetHandleString(s, "way", way)
call SetHandleReal(s, "shieldangle", angle)
call SetHandleHandle(s, "shieldtarg", targ)
if (GetUnitState(missile, UNIT_STATE_LIFE) <= 0.00) or (GetUnitState(cast, UNIT_STATE_LIFE) <= 0.00) then
call RemoveUnit(missile)
call PauseTimer(t)
call TriggerSleepAction(.1)
call DestroyTimer(t)
call FlushHandleVars(s)
endif
//Cleanup
call DestroyBoolExpr(cons)
call DestroyGroup(g)
set cons=null
set missile=null
set targ=null
set t=null
set cast=null
set g=null
endfunction
function Eclipse_Cast takes nothing returns nothing
local timer t=null
local timer s
local unit cast=GetSpellTargetUnit()
local unit caster=GetTriggerUnit()
local unit temp
local unit ttemp
local integer lvl=GetUnitAbilityLevel(GetTriggerUnit(), Eclipse_SpellID())
local integer c=Eclipse_NumSprites(lvl)
local integer i=Eclipse_NumSprites(lvl)
local real x1=GetUnitX(caster)
local real y1=GetUnitY(caster)
local real angle
local string way="norm"
local real speedi=(Eclipse_FlySpeed() / (1/Eclipse_Timeout()))
if (Eclipse_UsesMissile()) then
set way="missile"
endif
loop
exitwhen c==0
set angle=(360 / i) * c
//Create units and whatever
set temp=CreateUnit(GetOwningPlayer(caster), DummyID(), x1,y1,bj_RADTODEG*Atan2(GetUnitY(cast)-y1, GetUnitX(cast)-x1))
call AddSpecialEffectTimed(temp, GetAbilityEffectById(Eclipse_SpellID(), EFFECT_TYPE_TARGET, 1), "chest", Eclipse_Duration(lvl) - .3)
set t=CreateTimer()
call UnitApplyTimedLife(temp, 'BTLF', Eclipse_Duration(lvl))
set s=t
call SetHandleHandle(s, "shieldunit", cast)
call SetHandleHandle(s, "shieldmissile", temp)
call SetHandleReal(s, "shieldangle", angle)
call SetHandleInt(s,"lvl", lvl)
call SetHandleString(s, "way", way)
call SetHandleReal(s, "speedi", speedi)
call TimerStart(t, Eclipse_Timeout(), true, function Eclipse_Movement)
set t=null
set ttemp=null
set temp=null
set c=c-1
endloop
set cast=null
set caster=null
endfunction
//===========================================================================
function InitTrig_Eclipse_of_Sanity takes nothing returns nothing
set gg_trg_Eclipse_of_Sanity = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Eclipse_of_Sanity, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Eclipse_of_Sanity, Condition( function Eclipse_Cast_Cons ))
call TriggerAddAction( gg_trg_Eclipse_of_Sanity, function Eclipse_Cast )
endfunction
//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=6
//TESH.alwaysfold=0
//==============================================================================
// ABC -- STRUCT ATTACHMENT SYSTEM BY COHADAR -- v6.1
//==============================================================================
//==============================================================================
// Quick function index:
//==============================================================================
//
// ----------------------------------------------------------------------
// Set Functions - these functions attach struct to a handle
// ----------------------------------------------------------------------
// SetTimerStructA(timer, struct)
// SetTimerStructB(timer, struct)
// SetTimerStructC(timer, struct)
//
// SetTriggerStructA(trigger, struct)
// SetTriggerStructB(trigger, struct)
// SetTriggerStructC(trigger, struct)
//
// SetDialogStructA(dialog, struct)
// SetDialogStructB(dialog, struct)
// SetDialogStructC(dialog, struct)
//
// SetRegionStructA(region, struct)
// SetRegionStructB(region, struct)
// SetRegionStructC(region, struct)
//
// ----------------------------------------------------------------------
// Get Functions - these functions retrieve attached structs
// ----------------------------------------------------------------------
// GetTimerStructA(timer) -> struct
// GetTimerStructB(timer) -> struct
// GetTimerStructC(timer) -> struct
//
// GetTriggerStructA(trigger) -> struct
// GetTriggerStructB(trigger) -> struct
// GetTriggerStructC(trigger) -> struct
//
// GetDialogStructA(dialog) -> struct
// GetDialogStructB(dialog) -> struct
// GetDialogStructC(dialog) -> struct
//
// GetRegionStructA(region) -> struct
// GetRegionStructB(region) -> struct
// GetRegionStructC(region) -> struct
//
// ----------------------------------------------------------------------
// Clear Functions - these functions clear and return attached value
// ----------------------------------------------------------------------
// ClearTimerStructA(timer) -> struct
// ClearTimerStructB(timer) -> struct
// ClearTimerStructC(timer) -> struct
//
// ClearTriggerStructA(trigger) -> struct
// ClearTriggerStructB(trigger) -> struct
// ClearTriggerStructC(trigger) -> struct
//
// ClearDialogStructA(dialog) -> struct
// ClearDialogStructB(dialog) -> struct
// ClearDialogStructC(dialog) -> struct
//
// ClearRegionStructA(region) -> struct
// ClearRegionStructB(region) -> struct
// ClearRegionStructC(region) -> struct
//
//==============================================================================
//==============================================================================
// DOCUMENTATION:
//==============================================================================
//
// PURPOUSE OF ABC:
// * Type safe handle attaching.
//
// * Currently supported handle types are timer, trigger, dialog and region
//
// PROS:
// * ABC is faster than gamecache based systems.
//
// * You can attach up to 3 structs on the same handle
//
// * System reports collision, and clearing of non-existent value.
//
// * This system will work even if your map leaks
// and will NOT slow down because of it.
//
// CONS:
// * you must manually clear the stored value - REMEMBER THIS RULE!!!
// Don't forget to use Clear functions
//
// DETAILS:
// * You can use Get to check if struct is attached to handle
// It will return 0 if it is not.
//
// * ABC will not interfere with other attachment systems
// You can freely use any other system alongside ABC
//
// * For unit attaching I recommend using PUI
//
// SPECIAL THANKS TO:
// * NagelBagel - for finding errors in versions 4.3 and 4.4
// * Here-b-Trollz - for testing ABC and for making cool spells with it.
// * Toadcop - for being pain in the ass and for pushing me to improve ABC.
// * emjlr3 - for pointing out the need for non-generic trigger attachments
// * PandaMine - I found a bug in ABC by examining his HSAS vs ABC test
// * All those people out there who use and support my systems
// Thank you guys.
//
// HOW TO IMPORT:
// * Just create a trigger named ABC
// * convert it to text and replace the whole trigger text with this one
//
//==============================================================================
//==============================================================================
// Macro function cores
//==============================================================================
//------------------------------------------------------------------------------
//! textmacro ABC_Set takes X, NAME, TYPE
local integer i = GetHandleId(key)
set i = i - (i / HASH) * HASH
if $NAME$Key$X$[i] == null then
set $NAME$Key$X$[i] = key
set $NAME$Value$X$[i] = value
else
debug set $NAME$Collision$X$[i] = $NAME$Collision$X$[i] + 1
debug if $NAME$MaxCollision$X$ < $NAME$Collision$X$[i] then
debug set $NAME$MaxCollision$X$ = $NAME$Collision$X$[i]
debug call BJDebugMsg("|cFFFF00FFWarning: Set$NAME$Struct$X$("+I2S(GetHandleId(key))+", "+I2S(value)+") - index: "+I2S(i)+", collision: "+I2S($NAME$MaxCollision$X$))
debug endif
call SaveInteger($NAME$Hash, '$X$', GetHandleId(key), value)
endif
//! endtextmacro
//------------------------------------------------------------------------------
//! textmacro ABC_Get takes X, NAME, TYPE
local integer i = GetHandleId(key)
set i = i - (i / HASH) * HASH
if $NAME$Key$X$[i] == key then
return $NAME$Value$X$[i]
else
return LoadInteger($NAME$Hash, '$X$', GetHandleId(key))
endif
//! endtextmacro
//------------------------------------------------------------------------------
//! textmacro ABC_Clear takes X, NAME, TYPE
local integer ret
local integer i = GetHandleId(key)
set i = i - (i / HASH) * HASH
if $NAME$Key$X$[i] == key then
set ret = $NAME$Value$X$[i]
set $NAME$Key$X$[i] = null
set $NAME$Value$X$[i] = 0
else
if HaveSavedInteger($NAME$Hash, '$X$', GetHandleId(key)) then
debug set $NAME$Collision$X$[i] = $NAME$Collision$X$[i] - 1
set ret = LoadInteger($NAME$Hash, '$X$', GetHandleId(key))
call RemoveSavedInteger($NAME$Hash, '$X$', GetHandleId(key))
else
call BJDebugMsg("|cFFFF0000ERROR: Clear$NAME$Struct$X$("+I2S(GetHandleId(key))+") - clear attempt on bad key")
set ret = 0
endif
endif
return ret
//! endtextmacro
//==============================================================================
library ABC initializer Init
globals
private constant integer HASH = 8191
private timer array TimerKeyA
private timer array TimerKeyB
private timer array TimerKeyC
private trigger array TriggerKeyA
private trigger array TriggerKeyB
private trigger array TriggerKeyC
private dialog array DialogKeyA
private dialog array DialogKeyB
private dialog array DialogKeyC
private region array RegionKeyA
private region array RegionKeyB
private region array RegionKeyC
private integer array TimerValueA
private integer array TimerValueB
private integer array TimerValueC
private integer array TriggerValueA
private integer array TriggerValueB
private integer array TriggerValueC
private integer array DialogValueA
private integer array DialogValueB
private integer array DialogValueC
private integer array RegionValueA
private integer array RegionValueB
private integer array RegionValueC
private integer array TimerCollisionA
private integer array TimerCollisionB
private integer array TimerCollisionC
private integer array TriggerCollisionA
private integer array TriggerCollisionB
private integer array TriggerCollisionC
private integer array DialogCollisionA
private integer array DialogCollisionB
private integer array DialogCollisionC
private integer array RegionCollisionA
private integer array RegionCollisionB
private integer array RegionCollisionC
private integer TimerMaxCollisionA = 0
private integer TimerMaxCollisionB = 0
private integer TimerMaxCollisionC = 0
private integer TriggerMaxCollisionA = 0
private integer TriggerMaxCollisionB = 0
private integer TriggerMaxCollisionC = 0
private integer DialogMaxCollisionA = 0
private integer DialogMaxCollisionB = 0
private integer DialogMaxCollisionC = 0
private integer RegionMaxCollisionA = 0
private integer RegionMaxCollisionB = 0
private integer RegionMaxCollisionC = 0
private hashtable TimerHash
private hashtable TriggerHash
private hashtable DialogHash
private hashtable RegionHash
endglobals
//==============================================================================
// Collision check functions
//==============================================================================
//------------------------------------------------------------------------------
function GetTimerCollisionA takes nothing returns integer
return TimerMaxCollisionA
endfunction
//------------------------------------------------------------------------------
function GetTimerCollisionB takes nothing returns integer
return TimerMaxCollisionB
endfunction
//------------------------------------------------------------------------------
function GetTimerCollisionC takes nothing returns integer
return TimerMaxCollisionC
endfunction
//------------------------------------------------------------------------------
function GetTriggerCollisionA takes nothing returns integer
return TriggerMaxCollisionA
endfunction
//------------------------------------------------------------------------------
function GetTriggerCollisionB takes nothing returns integer
return TriggerMaxCollisionB
endfunction
//------------------------------------------------------------------------------
function GetTriggerCollisionC takes nothing returns integer
return TriggerMaxCollisionC
endfunction
//------------------------------------------------------------------------------
function GetDialogCollisionA takes nothing returns integer
return DialogMaxCollisionA
endfunction
//------------------------------------------------------------------------------
function GetDialogCollisionB takes nothing returns integer
return DialogMaxCollisionB
endfunction
//------------------------------------------------------------------------------
function GetDialogCollisionC takes nothing returns integer
return DialogMaxCollisionC
endfunction
//------------------------------------------------------------------------------
function GetRegionCollisionA takes nothing returns integer
return RegionMaxCollisionA
endfunction
//------------------------------------------------------------------------------
function GetRegionCollisionB takes nothing returns integer
return RegionMaxCollisionB
endfunction
//------------------------------------------------------------------------------
function GetRegionCollisionC takes nothing returns integer
return RegionMaxCollisionC
endfunction
//==============================================================================
// Set functions
//==============================================================================
//------------------------------------------------------------------------------
function SetTimerStructA takes timer key, integer value returns nothing
//! runtextmacro ABC_Set("A", "Timer", "timer")
endfunction
//------------------------------------------------------------------------------
function SetTimerStructB takes timer key, integer value returns nothing
//! runtextmacro ABC_Set("B", "Timer", "timer")
endfunction
//------------------------------------------------------------------------------
function SetTimerStructC takes timer key, integer value returns nothing
//! runtextmacro ABC_Set("C", "Timer", "timer")
endfunction
//------------------------------------------------------------------------------
function SetTriggerStructA takes trigger key, integer value returns nothing
//! runtextmacro ABC_Set("A", "Trigger", "trigger")
endfunction
//------------------------------------------------------------------------------
function SetTriggerStructB takes trigger key, integer value returns nothing
//! runtextmacro ABC_Set("B", "Trigger", "trigger")
endfunction
//------------------------------------------------------------------------------
function SetTriggerStructC takes trigger key, integer value returns nothing
//! runtextmacro ABC_Set("C", "Trigger", "trigger")
endfunction
//------------------------------------------------------------------------------
function SetDialogStructA takes dialog key, integer value returns nothing
//! runtextmacro ABC_Set("A", "Dialog", "dialog")
endfunction
//------------------------------------------------------------------------------
function SetDialogStructB takes dialog key, integer value returns nothing
//! runtextmacro ABC_Set("B", "Dialog", "dialog")
endfunction
//------------------------------------------------------------------------------
function SetDialogStructC takes dialog key, integer value returns nothing
//! runtextmacro ABC_Set("C", "Dialog", "dialog")
endfunction
//------------------------------------------------------------------------------
function SetRegionStructA takes region key, integer value returns nothing
//! runtextmacro ABC_Set("A", "Region", "region")
endfunction
//------------------------------------------------------------------------------
function SetRegionStructB takes region key, integer value returns nothing
//! runtextmacro ABC_Set("B", "Region", "region")
endfunction
//------------------------------------------------------------------------------
function SetRegionStructC takes region key, integer value returns nothing
//! runtextmacro ABC_Set("C", "Region", "region")
endfunction
//==============================================================================
// Get functions
//==============================================================================
//------------------------------------------------------------------------------
function GetTimerStructA takes timer key returns integer
//! runtextmacro ABC_Get("A", "Timer", "timer")
endfunction
//------------------------------------------------------------------------------
function GetTimerStructB takes timer key returns integer
//! runtextmacro ABC_Get("B", "Timer", "timer")
endfunction
//------------------------------------------------------------------------------
function GetTimerStructC takes timer key returns integer
//! runtextmacro ABC_Get("C", "Timer", "timer")
endfunction
//------------------------------------------------------------------------------
function GetTriggerStructA takes trigger key returns integer
//! runtextmacro ABC_Get("A", "Trigger", "trigger")
endfunction
//------------------------------------------------------------------------------
function GetTriggerStructB takes trigger key returns integer
//! runtextmacro ABC_Get("B", "Trigger", "trigger")
endfunction
//------------------------------------------------------------------------------
function GetTriggerStructC takes trigger key returns integer
//! runtextmacro ABC_Get("C", "Trigger", "trigger")
endfunction
//------------------------------------------------------------------------------
function GetDialogStructA takes dialog key returns integer
//! runtextmacro ABC_Get("A", "Dialog", "dialog")
endfunction
//------------------------------------------------------------------------------
function GetDialogStructB takes dialog key returns integer
//! runtextmacro ABC_Get("B", "Dialog", "dialog")
endfunction
//------------------------------------------------------------------------------
function GetDialogStructC takes dialog key returns integer
//! runtextmacro ABC_Get("C", "Dialog", "dialog")
endfunction
//------------------------------------------------------------------------------
function GetRegionStructA takes region key returns integer
//! runtextmacro ABC_Get("A", "Region", "region")
endfunction
//------------------------------------------------------------------------------
function GetRegionStructB takes region key returns integer
//! runtextmacro ABC_Get("B", "Region", "region")
endfunction
//------------------------------------------------------------------------------
function GetRegionStructC takes region key returns integer
//! runtextmacro ABC_Get("C", "Region", "region")
endfunction
//==============================================================================
// Clear functions
//==============================================================================
//------------------------------------------------------------------------------
function ClearTimerStructA takes timer key returns integer
//! runtextmacro ABC_Clear("A", "Timer", "timer")
endfunction
//------------------------------------------------------------------------------
function ClearTimerStructB takes timer key returns integer
//! runtextmacro ABC_Clear("B", "Timer", "timer")
endfunction
//------------------------------------------------------------------------------
function ClearTimerStructC takes timer key returns integer
//! runtextmacro ABC_Clear("C", "Timer", "timer")
endfunction
//------------------------------------------------------------------------------
function ClearTriggerStructA takes trigger key returns integer
//! runtextmacro ABC_Clear("A", "Trigger", "trigger")
endfunction
//------------------------------------------------------------------------------
function ClearTriggerStructB takes trigger key returns integer
//! runtextmacro ABC_Clear("B", "Trigger", "trigger")
endfunction
//------------------------------------------------------------------------------
function ClearTriggerStructC takes trigger key returns integer
//! runtextmacro ABC_Clear("C", "Trigger", "trigger")
endfunction
//------------------------------------------------------------------------------
function ClearDialogStructA takes dialog key returns integer
//! runtextmacro ABC_Clear("A", "Dialog", "dialog")
endfunction
//------------------------------------------------------------------------------
function ClearDialogStructB takes dialog key returns integer
//! runtextmacro ABC_Clear("B", "Dialog", "dialog")
endfunction
//------------------------------------------------------------------------------
function ClearDialogStructC takes dialog key returns integer
//! runtextmacro ABC_Clear("C", "Dialog", "dialog")
endfunction
//------------------------------------------------------------------------------
function ClearRegionStructA takes region key returns integer
//! runtextmacro ABC_Clear("A", "Region", "region")
endfunction
//------------------------------------------------------------------------------
function ClearRegionStructB takes region key returns integer
//! runtextmacro ABC_Clear("B", "Region", "region")
endfunction
//------------------------------------------------------------------------------
function ClearRegionStructC takes region key returns integer
//! runtextmacro ABC_Clear("C", "Region", "region")
endfunction
//==============================================================================
// Initialization
//==============================================================================
private function Init takes nothing returns nothing
set TimerKeyA[HASH-1] = null
set TimerKeyB[HASH-1] = null
set TimerKeyC[HASH-1] = null
set TriggerKeyA[HASH-1] = null
set TriggerKeyB[HASH-1] = null
set TriggerKeyC[HASH-1] = null
set DialogKeyA[HASH-1] = null
set DialogKeyB[HASH-1] = null
set DialogKeyC[HASH-1] = null
set RegionKeyA[HASH-1] = null
set RegionKeyB[HASH-1] = null
set RegionKeyC[HASH-1] = null
set TimerValueA[HASH-1] = 0
set TimerValueB[HASH-1] = 0
set TimerValueC[HASH-1] = 0
set TriggerValueA[HASH-1] = 0
set TriggerValueB[HASH-1] = 0
set TriggerValueC[HASH-1] = 0
set DialogValueA[HASH-1] = 0
set DialogValueB[HASH-1] = 0
set DialogValueC[HASH-1] = 0
set RegionValueA[HASH-1] = 0
set RegionValueB[HASH-1] = 0
set RegionValueC[HASH-1] = 0
set TimerCollisionA[HASH-1] = 0
set TimerCollisionB[HASH-1] = 0
set TimerCollisionC[HASH-1] = 0
set TriggerCollisionA[HASH-1] = 0
set TriggerCollisionB[HASH-1] = 0
set TriggerCollisionC[HASH-1] = 0
set DialogCollisionA[HASH-1] = 0
set DialogCollisionB[HASH-1] = 0
set DialogCollisionC[HASH-1] = 0
set RegionCollisionA[HASH-1] = 0
set RegionCollisionB[HASH-1] = 0
set RegionCollisionC[HASH-1] = 0
set TimerHash = InitHashtable()
set TriggerHash = InitHashtable()
set DialogHash = InitHashtable()
set RegionHash = InitHashtable()
endfunction
endlibrary
//==============================================================================
// END OF ABC STRUCT ATTACHMENT SYSTEM
//=======================================================
//TESH.scrollpos=61
//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 = 512
//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
scope BlackHole
globals
private constant string BlackHole_FX = "Effects\\BlackHole.mdx" //Path of the model, used for preloading
private constant string Explode_FX = "Effects\\DarkNova.mdx" //Same as above
private constant string Dust = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
private constant integer BlackHole_ID = 'A042' //Rawcode of the Black Hole dummy spell
private constant integer Dummy_ID = 'e014' //Rawcode of the Black Hole dummy unit
private constant integer Explode_ID = 'e015' //Rawcode of the Explosion dummy unit
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_CHAOS
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_UNIVERSAL
endglobals
private constant function SuckRadius takes integer lvl returns real
return 800. //Units within this distance will get moved closer to the center
endfunction
private constant function SuckDistance takes integer lvl returns real
return 100.//Distance the unit must be within for it to be sucked inside
endfunction
private constant function SuckSpeed takes integer lvl returns real
return 4.45 //Distance travelled every interval when units are sucked
endfunction
private constant function Expiration takes integer lvl returns real
return 11. //The black hole explodes upon expiration!
endfunction
private constant function ExplosionDamage takes integer lvl returns real
return 350. //Damage upon explosion
endfunction
private constant function ExplosionRadius takes integer lvl returns real
return 670. //Explosion AOE radius
endfunction
private constant function KnockbackSpeed takes integer lvl returns real
return 45. //Same as SUCK_SPEED but applies to knockback
endfunction
private constant function KnockbackBreak takes integer lvl returns real
return 0.55 //The higher the value, the greater the friction.
endfunction
private function Filter takes nothing returns boolean
return not IsUnitType(GetFilterUnit(),UNIT_TYPE_MAGIC_IMMUNE) and GetWidgetLife(GetFilterUnit()) > .405 and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)
//return not GetWidgetLife(GetFilterUnit()) > .405
//Determines which units are sucked in.
endfunction
private function ShouldUnitBeKnockedBack takes unit u, player p returns boolean
return (not IsUnitType(GetFilterUnit(),UNIT_TYPE_MAGIC_IMMUNE) and GetWidgetLife(GetFilterUnit()) > .405 and IsUnitEnemy(u,p)) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)
//return (not GetWidgetLife(GetFilterUnit()) > .405 and IsUnitEnemy(u,p))
//Determines if the unit 'u' should be knocked back.
//unit 'u' acts like GetFilterUnit() and player 'p' is only used for purposes like trying to affect only enemies
//In that case, use IsUnitEnemy(u,p)
endfunction
//***********************************************
//*
//* P R I V A T E C O D E
//* Feel free to modify at your own risk
//*
//***********************************************
private struct data
unit caster
unit dummy //This is private and just used for the black hole model
real expiration
real x
real y
group sucked
integer lvl
method onDestroy takes nothing returns nothing
call DestroyGroup(.sucked)
endmethod
endstruct
private function ExplosionMove takes nothing returns nothing
local timer t = GetExpiredTimer()
local data d = data(GetTimerStructA(t))
local real x
local real y
local real a
local unit temp
local group g
if d.expiration <= 0 then //Remember that expiration is used as KNOCKBACK_SPEED? =þ
call PauseTimer(t)
call DestroyTimer(t)
call data.destroy(d)
else
set g = CreateGroup()
call GroupAddGroup(d.sucked,g)
loop
set temp = FirstOfGroup(g)
exitwhen temp == null
set x = GetUnitX(temp)
set y = GetUnitY(temp)
set a = AngleBetweenPointsXY(d.x,d.y,x,y)
set x = x + d.expiration * Cos(a*0.01745)
set y = y + d.expiration * Sin(a*0.01745)
if (x < GetRectMinX(bj_mapInitialPlayableArea) or x > GetRectMaxX(bj_mapInitialPlayableArea)) or (y < GetRectMinY(bj_mapInitialPlayableArea) or y > GetRectMaxY(bj_mapInitialPlayableArea)) then
call GroupRemoveUnit(d.sucked,temp)
else
call DestroyEffect(AddSpecialEffect(Dust,x,y))
call SetUnitX(temp,x)
call SetUnitY(temp,y) //I just realized SetUnitPosition is laggy. SetUnitX/y is much better :)
//call SetUnitPosition(temp,x,y) //SetUnitPosition so that it checks for pathing =þ
endif
call GroupRemoveUnit(g,temp)
endloop
call DestroyGroup(g)
set d.expiration = d.expiration - KnockbackBreak(d.lvl)
endif
endfunction
private function Unhide takes nothing returns nothing
call ShowUnit(GetEnumUnit(),true)
call SetUnitInvulnerable(GetEnumUnit(),false)
call PauseUnit(GetEnumUnit(),false)
endfunction
private function Callback takes nothing returns nothing
local timer t = GetExpiredTimer()
local data d = data(GetTimerStructA(t))
local group g = CreateGroup()
local unit temp
local real x
local real y
local real a
if d.expiration <= 0 then
//Begin explosion
call KillUnit(d.dummy)
call DestroyEffect(AddSpecialEffect(Explode_FX,d.x,d.y))
set d.dummy = CreateUnit(Player(13),Explode_ID,d.x,d.y,270)
call SetUnitTimeScale(d.dummy,.5)
call UnitApplyTimedLife(d.dummy,'BTLF',5.)
call SetUnitAnimation(d.dummy,"Birth") //Just to be sure =þ
call ForGroup(d.sucked, function Unhide)
call GroupEnumUnitsInRange(g,d.x,d.y,ExplosionRadius(d.lvl),Condition(function Filter))
loop
set temp = FirstOfGroup(g)
exitwhen temp == null
if IsUnitEnemy(temp,GetOwningPlayer(d.caster)) then
call UnitDamageTarget(d.caster,temp,ExplosionDamage(d.lvl),true,false,ATTACK_TYPE,DAMAGE_TYPE,null)
endif
call GroupRemoveUnit(g,temp)
if ShouldUnitBeKnockedBack(temp,GetOwningPlayer(d.caster)) then
call GroupAddUnit(d.sucked,temp) //Add it so that it will get knocked back later
endif
endloop
//**** Start the knockback now! ****
//**** Well not really =þ ****
set d.expiration = KnockbackSpeed(d.lvl) //I do not want to declare another member for the struct so I use expiration
call PauseTimer(t)
call TimerStart(t,udg_Interval,true,function ExplosionMove)
else
call GroupEnumUnitsInRange(g,d.x,d.y,SuckRadius(d.lvl),Condition(function Filter))
loop
set temp = FirstOfGroup(g)
exitwhen temp == null
if IsUnitEnemy(temp,GetOwningPlayer(d.caster)) and not IsUnitInGroup(temp,d.sucked) then
set x = GetUnitX(temp)
set y = GetUnitY(temp)
set a = AngleBetweenPointsXY(x,y,d.x,d.y)
if DistanceBetweenPointsXY(d.x,d.y,x,y) <= SuckDistance(d.lvl) then
//Unit is within sucking distance, kick that unit into the hole, THIS IS SPARTAAA!!!
call GroupAddUnit(d.sucked,temp)
call ShowUnit(temp,false)
call SetUnitInvulnerable(temp,true)
call PauseUnit(temp,true)
call SetUnitX(temp,d.x)
call SetUnitY(temp,d.y)
else
set x = x + SuckSpeed(d.lvl) * Cos(a*0.01745)
set y = y + SuckSpeed(d.lvl) * Sin(a*0.01745)
call SetUnitX(temp,x)
call SetUnitY(temp,y)
endif
endif
call GroupRemoveUnit(g,temp)
endloop
set d.expiration = d.expiration - udg_Interval
endif
call DestroyGroup(g)
set g = null
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == BlackHole_ID
endfunction
private function Actions takes nothing returns nothing
local location l
local timer t
local data d
set l = GetSpellTargetLoc()
set t = CreateTimer()
set d = data.create()
set d.caster = GetTriggerUnit()
set d.x = GetLocationX(l)
set d.y = GetLocationY(l)
set d.dummy = CreateUnit(GetOwningPlayer(d.caster),Dummy_ID,d.x,d.y,270)
set d.sucked = CreateGroup()
set d.lvl = GetUnitAbilityLevel(d.caster,BlackHole_ID)
set d.expiration = Expiration(d.lvl)
call SetTimerStructA(t,d)
call TimerStart(t,udg_Interval,true,function Callback)
call RemoveLocation(l)
set l = null
endfunction
function InitTrig_Black_Hole takes nothing returns nothing
local trigger t = CreateTrigger( )
call Preload(BlackHole_FX)
call Preload(Explode_FX)
call Preload(Dust)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
set t = null
endfunction
endscope
//TESH.scrollpos=296
//TESH.alwaysfold=0
scope Fulmination
globals
private constant integer ABILITY_RAWCODE = 'A04M'
// The rawcode of the casted Fulmination ability.
private constant integer DUMMY_RAWCODE = 'e018'
// The "Water Particle"'s rawcode.
private constant real FRAMERATE = 40.0
// The framerate (frames per second) of the main function.
private constant real GRAVITY_ACCEL = -1550.0
// Gravity's acceleration in wc3units per second per second.
private constant integer PARTICLE_AMOUNT = 4
// The amount of particles created per cast.
private constant real INITIAL_VELOCITY = 200.0
// The initial velocity of each particle.
private constant real INCR_VELOCITY = 250.0
// The increment in velocity of each particle based on hero level.
private constant real INITIAL_DURATION = 3.5
// The initial duration of the spell.
private constant real INCR_DURATION = 0.5
// The increment in duration of the spell based on hero level.
private constant real FRICTION_COEFF = 0.93
// The coefficient in velocity par particles during ground collision.
private constant real RESTITUTE_DURATION = 1.2
// The time required for all particles to reassemble.
private constant real INITIAL_HEIGHT = 50.0
// The initial created height offset for particles.
private constant real PT_TARGET_SPEED = 800.0
// The speed at which particles are propulsed on point target orders.
private constant real AOA_MINIMUM = bj_PI/6.0
// The minimum angle of attack towards which particles are projected on cast.
private constant real AOA_MAXIMUM = bj_PI/2.5
// The maximum angle of attack towards which particles are projected on cast.
private constant real COLLISION_RADIUS = 2.0
// The collision radius for particles and the ground.
private constant string PARTICLE_FX = "Abilities\\Spells\\Items\\OrbCorruption\\OrbCorruptionSpecialArt.mdl"
// The particle model effect.
private constant string ONCAST_FX = "Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl"
// The model effect displayed on the caster on cast.
private constant string ONRESTITUTE_FX = "Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl"
// The model effect displayed on the caster on reassembly of particles.
endglobals
//-----------------------------------------------------//
// ~~~~~~~~~~~~~~~~ DO NOT EDIT BELOW ~~~~~~~~~~~~~~~~ //
//-----------------------------------------------------//
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILITY_RAWCODE
endfunction
globals
private location tloc
private location tloc2
private real minX
private real minY
private real maxX
private real maxY
private timer T
endglobals
private keyword main
private struct particleGroup
unit caster
effect array e[PARTICLE_AMOUNT]
unit array dummy[PARTICLE_AMOUNT]
real array xP[PARTICLE_AMOUNT]
real array yP[PARTICLE_AMOUNT]
real array zP[PARTICLE_AMOUNT]
real array xV[PARTICLE_AMOUNT]
real array yV[PARTICLE_AMOUNT]
real array zV[PARTICLE_AMOUNT]
trigger pointTarget
real duration
integer ID
static particleGroup array P
static integer COUNT = 0
static particleGroup array P_D
static integer COUNT_D = 0
method onDestroy takes nothing returns nothing
local integer i = 0
loop
exitwhen i >= PARTICLE_AMOUNT
call DestroyEffect(this.e[i])
set this.xV[i] = 0.0
set this.yV[i] = 0.0
call KillUnit(this.dummy[i])
call ShowUnit(this.dummy[i], false)
set i = i + 1
endloop
call DestroyTrigger(this.pointTarget)
set particleGroup.COUNT = particleGroup.COUNT - 1
set particleGroup.P[this.ID] = particleGroup.P[particleGroup.COUNT]
set particleGroup.P[this.ID].ID = this.ID
if particleGroup.COUNT == 0 then
call PauseTimer(T)
endif
endmethod
static method pointOrder takes nothing returns boolean
local unit u = GetTriggerUnit()
local particleGroup p = particleGroup(GetUnitUserData(u))
local integer i = 0
local real x = GetOrderPointX()
local real y = GetOrderPointY()
if p.duration > 0.0 then
loop
exitwhen i >= PARTICLE_AMOUNT
if p.dummy[i] == u then
call MoveLocation(tloc, x, y)
set p.xV[i] = x - p.xP[i]
set p.yV[i] = y - p.yP[i]
set p.zV[i] = GetLocationZ(tloc) - p.zP[i]
set y = PT_TARGET_SPEED/(SquareRoot(p.xV[i]*p.xV[i] + p.yV[i]*p.yV[i] + p.zV[i]*p.zV[i])*FRAMERATE + 0.01)
set p.xV[i] = p.xV[i]*y
set p.yV[i] = p.yV[i]*y
set p.zV[i] = p.zV[i]*y
return false
endif
set i = i + 1
endloop
endif
set u = null
return false
endmethod
static method onInit takes nothing returns nothing
set tloc = Location(0.0, 0.0)
set tloc2 = Location(0.0, 0.0)
set minX = GetRectMinX(bj_mapInitialPlayableArea)
set minY = GetRectMinY(bj_mapInitialPlayableArea)
set maxX = GetRectMaxX(bj_mapInitialPlayableArea)
set maxY = GetRectMaxY(bj_mapInitialPlayableArea)
set T = CreateTimer()
endmethod
endstruct
private function main takes nothing returns nothing
local integer i = 0
local integer k = 0
local particleGroup p
local real x
local real y
local real z
loop
exitwhen i >= particleGroup.COUNT
set p = particleGroup.P[i]
if p.duration <= -1.0 then
loop
exitwhen k >= PARTICLE_AMOUNT
set p.xP[k] = p.xP[k] + p.xV[k]
set p.yP[k] = p.yP[k] + p.yV[k]
set p.zP[k] = p.zP[k] + p.zV[k]
call SetUnitX(p.dummy[k], p.xP[k])
call SetUnitY(p.dummy[k], p.yP[k])
call MoveLocation(tloc, p.xP[k], p.yP[k])
set z = GetLocationZ(tloc)
if p.zP[k] > z then
call SetUnitFlyHeight(p.dummy[k], p.zP[k] - z, 0.0)
endif
set k = k + 1
endloop
set p.duration = p.duration - 1.0/FRAMERATE
if p.duration <= -1.0 - RESTITUTE_DURATION then
call SetUnitPosition(p.caster, p.xP[0], p.yP[0])
call ShowUnit(p.caster, true)
if GetLocalPlayer() == GetOwningPlayer(p.caster) then
call ClearSelection()
call SelectUnit(p.caster, true)
endif
call DestroyEffect(AddSpecialEffectTarget(ONRESTITUTE_FX, p.caster, "origin"))
set particleGroup.P_D[particleGroup.COUNT_D] = p
set particleGroup.COUNT_D = particleGroup.COUNT_D + 1
endif
else
loop
exitwhen k >= PARTICLE_AMOUNT
set p.zV[k] = p.zV[k] + GRAVITY_ACCEL/(FRAMERATE*FRAMERATE)
set p.xP[k] = p.xP[k] + p.xV[k]
set p.yP[k] = p.yP[k] + p.yV[k]
set p.zP[k] = p.zP[k] + p.zV[k]
if p.xP[k] < minX or p.yP[k] < minY or p.xP[k] > maxX or p.yP[k] > maxY then
set p.xP[k] = p.xP[k] - p.xV[k]
set p.yP[k] = p.yP[k] - p.yV[k]
set p.xV[k] = 0.0
set p.yV[k] = 0.0
endif
call MoveLocation(tloc, p.xP[k], p.yP[k])
set z = GetLocationZ(tloc)
call SetUnitX(p.dummy[k], p.xP[k])
call SetUnitY(p.dummy[k], p.yP[k])
call SetUnitFlyHeight(p.dummy[k], p.zP[k] - z, 0.0)
if z > p.zP[k] then
set p.zP[k] = z
call MoveLocation(tloc, p.xP[k] - COLLISION_RADIUS, p.yP[k])
call MoveLocation(tloc2, p.xP[k] + COLLISION_RADIUS, p.yP[k])
set x = GetLocationZ(tloc) - GetLocationZ(tloc2)
call MoveLocation(tloc, p.xP[k], p.yP[k] - COLLISION_RADIUS)
call MoveLocation(tloc2, p.xP[k], p.yP[k] + COLLISION_RADIUS)
set y = GetLocationZ(tloc) - GetLocationZ(tloc2)
set z = -2.0*(p.xV[k]*x + p.yV[k]*y + p.zV[k]*2.0*COLLISION_RADIUS)/(x*x + y*y + 4.0*COLLISION_RADIUS*COLLISION_RADIUS)
set p.xV[k] = FRICTION_COEFF*(p.xV[k] + x*z)
set p.yV[k] = FRICTION_COEFF*(p.yV[k] + y*z)
set p.zV[k] = FRICTION_COEFF*(p.zV[k] + 2.0*COLLISION_RADIUS*z)
endif
set k = k + 1
endloop
set p.duration = p.duration - 1.0/FRAMERATE
if p.duration <= 0.0 then
set x = p.xP[0]
set y = p.yP[0]
set k = 1
loop
exitwhen k >= PARTICLE_AMOUNT
set x = x + p.xP[k]
set y = y + p.yP[k]
call IssueImmediateOrder(p.dummy[k], "stop")
call UnitAddAbility(p.dummy[k], 'Aloc')
set k = k + 1
endloop
set x = x/PARTICLE_AMOUNT
set y = y/PARTICLE_AMOUNT
call MoveLocation(tloc, x, y)
set z = GetLocationZ(tloc)
set k = 0
loop
exitwhen k >= PARTICLE_AMOUNT
set p.xV[k] = (x - p.xP[k])/(RESTITUTE_DURATION*FRAMERATE)
set p.yV[k] = (y - p.yP[k])/(RESTITUTE_DURATION*FRAMERATE)
set p.zV[k] = (z + INITIAL_HEIGHT - p.zP[k])/(RESTITUTE_DURATION*FRAMERATE)
set k = k + 1
endloop
set p.duration = -1.0
endif
endif
set k = 0
set i = i + 1
endloop
set i = 0
loop
exitwhen i >= particleGroup.COUNT_D
call particleGroup.P_D[i].destroy()
set i = i + 1
endloop
set particleGroup.COUNT_D = 0
endfunction
private function Actions takes nothing returns nothing
local particleGroup p = particleGroup.create()
local integer i = 0
local unit caster = GetTriggerUnit()
local player owner = GetOwningPlayer(caster)
local integer level = GetUnitAbilityLevel(caster, ABILITY_RAWCODE)
local real speed = (INITIAL_VELOCITY + level*INCR_VELOCITY)/FRAMERATE
local real yaw
local real aoa
local real cos
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local real z
call MoveLocation(tloc, x, y)
set z = GetLocationZ(tloc)
set p.pointTarget = CreateTrigger()
call SelectUnit(caster, GetLocalPlayer() != owner)
loop
exitwhen i >= PARTICLE_AMOUNT
set yaw = i*360.0/PARTICLE_AMOUNT
set p.dummy[i] = CreateUnit(owner, DUMMY_RAWCODE, x, y, yaw)
set p.xP[i] = x
set p.yP[i] = y
call UnitAddAbility(p.dummy[i], 'Amrf')
call UnitRemoveAbility(p.dummy[i], 'Amrf')
call UnitAddAbility(p.dummy[i], 'Aloc')
call ShowUnit(p.dummy[i], false)
call UnitRemoveAbility(p.dummy[i], 'Aloc')
call ShowUnit(p.dummy[i], true)
call SelectUnit(p.dummy[i], GetLocalPlayer() == owner)
call SetUnitFlyHeight(p.dummy[i], INITIAL_HEIGHT + GetUnitFlyHeight(caster), 0.0)
set p.e[i] = AddSpecialEffectTarget(PARTICLE_FX, p.dummy[i], "origin")
set p.zP[i] = z + GetUnitFlyHeight(p.dummy[i])
set aoa = GetRandomReal(AOA_MINIMUM, AOA_MAXIMUM)
set cos = Cos(aoa)*speed
set yaw = yaw*bj_DEGTORAD
set p.xV[i] = cos*Cos(yaw)
set p.yV[i] = cos*Sin(yaw)
set p.zV[i] = Sin(aoa)*speed
call TriggerRegisterUnitEvent(p.pointTarget, p.dummy[i], EVENT_UNIT_ISSUED_POINT_ORDER)
call SetUnitUserData(p.dummy[i], integer(p))
set i = i + 1
endloop
call TriggerAddCondition(p.pointTarget, Filter(function particleGroup.pointOrder))
set p.caster = caster
call ShowUnit(caster, false)
call DestroyEffect(AddSpecialEffect(ONCAST_FX, x, y))
set p.duration = INITIAL_DURATION + level*INCR_DURATION
set p.ID = particleGroup.COUNT
set particleGroup.P[particleGroup.COUNT] = p
set particleGroup.COUNT = particleGroup.COUNT + 1
if particleGroup.COUNT == 1 then
call TimerStart(T, 1.0/FRAMERATE, true, function main)
endif
endfunction
public function InitTrig takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(trig, Condition(function Conditions))
call TriggerAddAction(trig, function Actions)
call Preload(PARTICLE_FX)
call Preload(ONCAST_FX)
call Preload(ONRESTITUTE_FX)
endfunction
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
function ForGroupIon takes nothing returns nothing
call Knockback(GetEnumUnit(), udg_TempUnit, 140, 300, 5, false)
endfunction
function FilterIon2 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction
function FilterIon1 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function FilterIon3 takes nothing returns boolean
return GetBooleanAnd( FilterIon2(), FilterIon1() )
endfunction
function Trig_Laser_strike_dmg_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'e01F' ) ) then
return false
endif
return true
endfunction
function Trig_Laser_strike_dmg_Actions takes nothing returns nothing
local unit laser = GetTriggerUnit()
local location TempPoint = GetUnitLoc(laser)
local group TempGroup = GetUnitsInRangeOfLocMatching(430, TempPoint, Condition(function FilterIon3))
set udg_TempPoint = GetUnitLoc(laser)
set udg_TempUnit = GetTriggerUnit()
call SetUnitTimeScalePercent( laser, 170.00 )
call TriggerSleepAction(1.6)
call SetUnitTimeScalePercent( laser, 80.00 )
call UnitDamagePointLoc( laser, 0, 370, TempPoint, 200, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE )
if (GetPlayerTechCountSimple('R000', GetOwningPlayer(laser)) == 1) then
call UnitDamagePointLoc( laser, 0, 370, TempPoint, 20, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE )
endif
call ForGroupBJ( TempGroup, function ForGroupIon )
call TriggerSleepAction(0.90)
call RemoveLocation(udg_TempPoint)
call RemoveLocation(TempPoint)
set laser = null
set udg_TempUnit = null
endfunction
//===========================================================================
function InitTrig_Laser_strike_dmg takes nothing returns nothing
set gg_trg_Laser_strike_dmg = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Laser_strike_dmg, GetPlayableMapRect() )
call TriggerAddCondition( gg_trg_Laser_strike_dmg, Condition( function Trig_Laser_strike_dmg_Conditions ) )
call TriggerAddAction( gg_trg_Laser_strike_dmg, function Trig_Laser_strike_dmg_Actions )
endfunction
//TESH.scrollpos=13
//TESH.alwaysfold=0
function ForGroupIo2n takes nothing returns nothing
call Knockback(GetEnumUnit(), udg_TempUnit, 290, 900, 5, false)
endfunction
function FilterIon22 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction
function FilterIon15 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function FilterIon32 takes nothing returns boolean
return GetBooleanAnd( FilterIon22(), FilterIon15() )
endfunction
function Trig_Laser_strike_dmg_Conditions2 takes nothing returns boolean
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'e01M' ) ) then
return false
endif
return true
endfunction
function Trig_Laser_strike_dmg_Actions2 takes nothing returns nothing
local unit laser = GetTriggerUnit()
local location TempPoint = GetUnitLoc(laser)
local group TempGroup = GetUnitsInRangeOfLocMatching(430, TempPoint, Condition(function FilterIon32))
set udg_TempPoint = GetUnitLoc(laser)
set udg_TempUnit = GetTriggerUnit()
call ForGroupBJ( TempGroup, function ForGroupIo2n )
call TriggerSleepAction(0.1)
call UnitDamagePointLoc( laser, 0, 1370, TempPoint, 1000, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE )
if (GetPlayerTechCountSimple('R00M', GetOwningPlayer(laser)) == 1) then
call UnitDamagePointLoc( laser, 0, 350, TempPoint, 2500, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE )
call CreateUnitAtLoc(GetOwningPlayer(laser), 'e01Q', TempPoint, 60.)
call UnitApplyTimedLife(laser, 'BTLF' ,5.00)
endif
call TriggerSleepAction(0.90)
call RemoveLocation(udg_TempPoint)
call RemoveLocation(TempPoint)
set laser = null
set udg_TempUnit = null
endfunction
//===========================================================================
function InitTrig_Laser_strike_dmg_Kopieren takes nothing returns nothing
set gg_trg_Laser_strike_dmg_Kopieren = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Laser_strike_dmg_Kopieren, GetPlayableMapRect() )
call TriggerAddCondition( gg_trg_Laser_strike_dmg_Kopieren, Condition( function Trig_Laser_strike_dmg_Conditions2 ) )
call TriggerAddAction( gg_trg_Laser_strike_dmg_Kopieren, function Trig_Laser_strike_dmg_Actions2 )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Tp_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A05E' ) ) then
return false
endif
return true
endfunction
function Trig_Tp_Actions takes nothing returns nothing
local unit user = GetTriggerUnit()
call TriggerSleepAction(3.00)
call UnitRemoveAbility(user, 'A05E' )
set user = null
endfunction
//===========================================================================
function InitTrig_Tp takes nothing returns nothing
set gg_trg_Tp = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Tp, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Tp, Condition( function Trig_Tp_Conditions ) )
call TriggerAddAction( gg_trg_Tp, function Trig_Tp_Actions )
endfunction
//TESH.scrollpos=15
//TESH.alwaysfold=0
//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//¤
//¤ *****************
//¤ - Following Rocket -
//¤ *****************
//¤
//¤ By: Mr.Malte
//¤
//¤ This is my first spell with local Handle Vars
//¤
//¤
//¤
//¤ CREDITS:
//¤
//¤ - KaTTaNa's Local Handle Variables.
//¤
//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
constant function Rocket_FollowInterval takes nothing returns real
return 0.02 // The time when the rocket changes its direction.
endfunction
constant function Rocket_DummyID takes nothing returns integer
return 'e000' // The rawcode of the rocket dummy
endfunction
constant function Rocket_AbilityID takes nothing returns integer
return 'A003' // The rawcode of the Ability
endfunction
constant function Rocket_RangeOfExplode takes nothing returns real
return 80.00 // The rocket explodes when it comes in this range of the target
endfunction
function Trig_Sprengstoffrakete_Kopieren_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == Rocket_AbilityID() ) ) then
return false
endif
return true
endfunction
function Trig_Sprengstoffrakete_Kopieren_Func001C takes nothing returns boolean
if ( not ( GetPlayerState(GetOwningPlayer(GetSpellAbilityUnit()), PLAYER_STATE_RESOURCE_GOLD) >= 1500 ) ) then
return false
endif
return true
endfunction
function Follow takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit Supertarget = GetHandleUnit(t, "target")
local unit Supercaster = GetHandleUnit(t, "cast")
local location TempPoint = GetUnitLoc(Supertarget)
local location TempPoint2 = GetUnitLoc(Supercaster)
local real angle = AngleBetweenPoints(TempPoint, TempPoint2)
// Hier kann man nun die Aktionen einfügen.
// Alle Variablen die benötigt werden sind
//nun local Handle vars
if ( DistanceBetweenPoints (TempPoint, TempPoint2) <= Rocket_RangeOfExplode() ) then
call PauseTimer(t)
//call IssuePointOrderLocBJ( Supercaster, "selfdestruct", TempPoint )
call KillUnit( Supercaster )
set Supercaster = null
set Supertarget = null
call RemoveLocation( TempPoint )
call RemoveLocation( TempPoint2 )
set TempPoint = null
set TempPoint2 = null
call FlushHandleLocals(t)
call PauseTimer(t)
call DestroyTimer(t)
set t = null
return
endif
//call IssuePointOrderLocBJ( Supercaster, "selfdestruct", TempPoint )
call RemoveLocation(TempPoint)
call SetUnitFacingToFaceUnitTimed (Supercaster, Supertarget, 0.00)
set TempPoint = PolarProjectionBJ(GetUnitLoc(Supercaster), 32.00, GetUnitFacing(Supercaster))
call SetUnitPositionLoc (Supercaster, TempPoint)
//call IssueTargetOrderBJ( Supercaster, "selfdestruct", Supertarget )
//if ( not ( IsUnitAliveBJ(Supercaster) == true ) ) then
// set Supercaster = null
// set Supertarget = null
// call RemoveLocation( TempPoint )
// set TempPoint = null
// call FlushHandleLocals(t)
// call PauseTimer(t)
// call DestroyTimer(t)
// set t = null
// return
//endif
set t = null
set Supertarget = null
set Supercaster = null
call RemoveLocation( TempPoint )
call RemoveLocation( TempPoint2 )
set TempPoint = null
set TempPoint2 = null
endfunction
function Trig_Sprengstoffrakete_Kopieren_Actions takes nothing returns nothing
local unit Supertarget = GetSpellTargetUnit()
local unit Supercaster = null
local timer t = CreateTimer()
local location TempPoint = GetUnitLoc(Supertarget)
call SetHandleHandle(t, "target", Supertarget)
//call SetHandleHandle(t, "cast", Supercaster)
//call TimerStart(t, Rocket_FollowInterval(), true, function Follow())
//========================================================
if ( Trig_Sprengstoffrakete_Kopieren_Func001C() ) then
set udg_END_MB_Sw_benutzt[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = ( udg_END_MB_Sw_benutzt[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] + 1 )
set udg_Bezeichnung_Feigheit[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = ( udg_Bezeichnung_Feigheit[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] + 1 )
set udg_Bezeichnung_Fiesheit[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = ( udg_Bezeichnung_Fiesheit[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] + 1 )
set udg_TempPoint2 = GetUnitLoc(GetSpellTargetUnit())
call CreateNUnitsAtLoc( 1, Rocket_DummyID(), GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(GetTriggerUnit()), bj_UNIT_FACING )
set Supercaster = GetLastCreatedUnit()
call SetHandleHandle(t, "cast", Supercaster)
call TimerStart(t, Rocket_FollowInterval(), true, function Follow)
set t = null
set Supertarget = null
set Supercaster = null
call DisplayTextToForce( GetPlayersAll(), ( "|CFFFF0000Attention:|r " + ( ( udg_ColorCodePlayer[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] + GetPlayerName(GetOwningPlayer(GetTriggerUnit())) ) + ( "|r is just using the super weapon |cffFFFF00\"" + ( GetAbilityName(GetSpellAbilityId()) + "\"|r" ) ) ) ) )
call AdjustPlayerStateBJ( -1500, GetOwningPlayer(GetSpellAbilityUnit()), PLAYER_STATE_RESOURCE_GOLD )
call PingMinimapLocForForce( GetForceOfPlayer(GetOwningPlayer(GetSpellTargetUnit())), udg_TempPoint2, 5.00 )
call PingMinimapLocForForce( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), udg_TempPoint2, 5.00 )
else
call IssueImmediateOrderBJ( GetSpellAbilityUnit(), "stop" )
set Supercaster = null
set Supertarget = null
call RemoveLocation( TempPoint )
set TempPoint = null
call FlushHandleLocals(t)
call PauseTimer(t)
call DestroyTimer(t)
set t = null
endif
endfunction
//===========================================================================
function InitTrig_Lenkrakete_1 takes nothing returns nothing
set gg_trg_Lenkrakete_1 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Lenkrakete_1, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Lenkrakete_1, Condition( function Trig_Sprengstoffrakete_Kopieren_Conditions ) )
call TriggerAddAction( gg_trg_Lenkrakete_1, function Trig_Sprengstoffrakete_Kopieren_Actions )
endfunction
//TESH.scrollpos=15
//TESH.alwaysfold=0
function becomestone takes unit caster returns nothing
local integer e = 0
local integer ID = 'A04D'
local integer lvl = GetUnitAbilityLevelSwapped(ID, caster)
loop
set e = e + 1
call TriggerSleepAction ( 0.4 )
call SetUnitVertexColorBJ( caster, 100 - e * 8., 100 - e * 8., 100 - e * 8., 0 )
call SetUnitMoveSpeed ( caster, (230 - e * 10) + lvl * 9 )
exitwhen e == 5
endloop
endfunction
function Trig_Stoneskin_activate_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A04D' ) ) then
return false
endif
return true
endfunction
function Trig_Stoneskin_activate_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer ID = 'A04D'
local integer lvl = GetUnitAbilityLevelSwapped(ID, caster)
local real duration = 15.
call SetUnitScalePercent( caster, 125, 125, 125 )
//call SetUnitVertexColorBJ( caster, 60.00, 60.00, 60.00, 0 )
call becomestone(caster)
//call SetUnitMoveSpeed ( caster, 180 + lvl * 15 )
set udg_Stoneskin_Active[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = true
call TriggerSleepAction( duration )
set udg_Stoneskin_Active[GetConvertedPlayerId(GetOwningPlayer(caster))] = false
call SetUnitScalePercent( caster, 100, 100, 100 )
call SetUnitVertexColorBJ( caster, 100.00, 100.00, 100.00, 0 )
call SetUnitMoveSpeed ( caster, 280 )
set caster = null
endfunction
//===========================================================================
function InitTrig_Stoneskin_activate takes nothing returns nothing
set gg_trg_Stoneskin_activate = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Stoneskin_activate, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Stoneskin_activate, Condition( function Trig_Stoneskin_activate_Conditions ) )
call TriggerAddAction( gg_trg_Stoneskin_activate, function Trig_Stoneskin_activate_Actions )
endfunction
//TESH.scrollpos=228
//TESH.alwaysfold=0
//***********************************************************************************************
//* Thunder Whirl *
//* Created by Fireeye *
//* Credits *
//* JassNewGenPack: *
//* Vexorian - JassHelper *
//* PipeDream - Grimoire *
//* PitzerMike - PJass *
//* v.1.3d *
//***********************************************************************************************
scope ThunderWhirl
//***********************************************************************************************
//* Private Keywords for Caster Struct and Knockback Struct *
//***********************************************************************************************
private keyword KnockBack
private keyword Cast
//***********************************************************************************************
//* UCP (User Configuration Part) *
//***********************************************************************************************
//* For a detailed explanation look in the Read Me! *
//***********************************************************************************************
//***********************************************************************************************
//* formulas *
//***********************************************************************************************
private constant function DecreaseCircleSpeed takes integer level returns real
return level*0.0091 //The increament/decreament of the speed
endfunction
private constant function DistanceFormula takes integer level returns real
return 340.00-level*40.00 //To calculate the minimal distance between caster and target
endfunction
private constant function DamageFormula takes integer level returns real
return 1.00+level*4.00 //The hit damage
endfunction
//***********************************************************************************************
//* globals + structs *
//***********************************************************************************************
globals
private integer orderid = 0 //Set this to your order id, if you don't know the order id leave it 0
private constant integer TerrainItem = 'afac' //Raw Code of item for path check
private constant boolean DestroyTreesKnocked = true //Should knocked units kill trees?
private constant boolean DestroyTreesCycle = true //The same but for target unit
private constant real TreeHitR = 96 //If DestroyTrees is enabled this will declare the size of the used rect
private constant real DecreaseKBSpeed = .20 //How fast the knocked unit should reach 0
private constant real StartKBSpeed = 19. //Start Knockback Speed
private constant boolean UseCasterAsAnchor = true //setting it to false will manipulate the knockback angle
private constant boolean KBPauseUnit = false //set to false if you don't want to pause the knocked unit
private constant damagetype DamageType = DAMAGE_TYPE_UNIVERSAL //UNIVERSAL don't take the armor amount in account while NORMAL does
private constant attacktype AttackType = ATTACK_TYPE_CHAOS //What kind of damage you want to deal (Readme for more informations)
private constant real PickRange = 100. //The collision range for target unit to knock units
private constant real SpeedForMinDis = 5. //r-Speed to reach Min Distance
private constant real StartCircleSpeed = 4. //Start Speed of target unit (in degree)
private constant integer EffectInterval = 10 //How often a slide effect should be created, have to be > 0
private constant string SlideEffect = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl" //The slide effect
private constant string HitEffectAdd = "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl" //The additional collision effect
private constant string HitEffect = "Abilities\\Weapons\\ChimaeraLightningMissile\\ChimaeraLightningMissile.mdl" //The collision effect
private constant string CasterEffect = "Abilities\\Spells\\Other\\Monsoon\\MonsoonRain.mdl" //The effect created @ the position of the caster
private constant string ASeax = "DefaultEAXON" //Don't really know this option
private constant boolean ASWantToFadeOut = false //Do you want to fade out the Sound effect?
private constant integer ASFadeOut = 2 //Fadeout rate
private constant integer ASFadeIn = 2 //Fadein rate
private constant boolean ASCutoff = true //Should the sound stop playing when out of range?
private constant boolean AS3D = true //Should it be a 3-D Sound?
private constant boolean ASLoop = true //Loop ...
private constant integer ASVolume = 200 //Volumen in %
private constant integer ASDuration = 1622 //Sound duration, you can find it in the sound editor
private constant integer ASoundChannel = 10 //The channel used by the sound
private constant real ASCutoffRange = 10000. //Playing Range of this sound
private constant string AmbientSound = "Abilities\\Spells\\Other\\Monsoon\\MonsoonRainLoop.wav" //The sound file path
private constant string LightningId = "CLPB" //The lightning id ...
private constant integer Abilityid = 'A04B' //The id of the dummy ability
private constant real TimerTimeOut = 0.03 //The Timer Time Out, lower values = smoother, but faster any maybe more buggy
//***************************************************************************************
//* UCP ending *
//***************************************************************************************
private timer Timer = CreateTimer()
private integer loopi = 0
private Cast array glob
private integer Integer = 0
private KnockBack array kbglob
private integer kbInteger = 0
private group GetUnit = CreateGroup()
private group KBGroup = CreateGroup()
private group AlreadyTarget = CreateGroup()
private item TerrainCheck
private boolexpr Bex = null
private rect TreeRect
endglobals
private struct Cast
sound ambientsound = null
unit caster = null
real x1 = 0
real y1 = 0
unit target = null
lightning l = null
effect e1 = null
effect e2 = null
real damage = 0
real speed = 0
real angle = 0
real cdistance = 0
real mindistance = 0
real increament = 0
method onDestroy takes nothing returns nothing
call DestroyLightning(this.l)
call DestroyEffect(this.e1)
call DestroyEffect(this.e2)
call StopSound(this.ambientsound,true,ASWantToFadeOut)
set this.caster = null
set this.ambientsound = null
set this.target = null
set this.l = null
set this.e1 = null
set this.e2 = null
endmethod
endstruct
private struct KnockBack
unit u = null
unit caster = null
real speed = 0
real xfactor = 0
real yfactor = 0
integer i = 1
method onDestroy takes nothing returns nothing
set this.u = null
set this.caster = null
endmethod
endstruct
//***********************************************************************************************
//* Conditions *
//***********************************************************************************************
private function Cast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Abilityid
endfunction
private function KBFilter takes nothing returns boolean
local unit u = GetFilterUnit()
local Cast dat = glob[loopi]
return IsPlayerEnemy(GetOwningPlayer(u),GetOwningPlayer(dat.caster)) and u != dat.target and not IsUnitInGroup(u,KBGroup) and IsUnitType(u,UNIT_TYPE_GROUND) and GetWidgetLife(u) > .405
endfunction
private function LoopConditions takes nothing returns boolean
local Cast dat = glob[loopi]
return GetUnitCurrentOrder(dat.caster) == orderid and orderid != 0 and GetWidgetLife(dat.caster) > .405 and GetWidgetLife(dat.target) > .405
endfunction
//***********************************************************************************************
//* Knockback *
//***********************************************************************************************
private function CreateKB takes nothing returns nothing
local unit u = GetEnumUnit()
local KnockBack kbdat = KnockBack.create()
local Cast dat = glob[loopi]
local real angle
local real ux
local real uy
set kbdat.u = u
call SetUnitPathing(u,false)
if UseCasterAsAnchor then
set angle = Atan2(GetUnitY(u)-GetUnitY(dat.caster),GetUnitX(u)-GetUnitX(dat.caster))
else
set angle = Atan2(GetUnitY(u)-GetUnitY(dat.target),GetUnitX(u)-GetUnitX(dat.target))
endif
if u != dat.target then
set kbdat.speed = StartKBSpeed
set ux = GetUnitX(u)
set uy = GetUnitY(u)
call DestroyEffect(AddSpecialEffect(HitEffectAdd,ux,uy))
call DestroyEffect(AddSpecialEffect(HitEffect,ux,uy))
call UnitDamageTarget(dat.caster,dat.target,dat.damage,true,false,AttackType,DamageType,WEAPON_TYPE_WHOKNOWS)
call UnitDamageTarget(dat.caster,u,dat.damage,true,false,AttackType,DamageType,WEAPON_TYPE_WHOKNOWS)
else
set kbdat.speed = dat.cdistance*dat.speed*2/3
set angle = dat.angle+(bj_PI/2)
endif
set kbdat.xfactor = Cos(angle)
set kbdat.yfactor = Sin(angle)
call PauseUnit(u,KBPauseUnit)
call SetUnitUserData(u,kbInteger)
set kbdat.caster = dat.caster
call GroupAddUnit(KBGroup,u)
set kbglob[kbInteger] = kbdat
set kbInteger = kbInteger + 1
set u = null
endfunction
private function KnockbackDestroyTrees takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
private function KBActions takes nothing returns nothing
local unit u = GetEnumUnit()
local integer i = GetUnitUserData(u)
local KnockBack kbdat = kbglob[i]
local real cx = GetUnitX(u)+(kbdat.xfactor*kbdat.speed)
local real cy = GetUnitY(u)+(kbdat.yfactor*kbdat.speed)
if kbdat.u == u then
if DestroyTreesKnocked then
call SetRect(TreeRect,cx-TreeHitR,cy-TreeHitR,cx+TreeHitR,cy+TreeHitR)
call EnumDestructablesInRect(TreeRect,null,function KnockbackDestroyTrees)
endif
call SetItemPosition(TerrainCheck,cx,cy)
if GetItemX(TerrainCheck)==cx and GetItemY(TerrainCheck)==cy then
call SetUnitX(u,cx)
call SetUnitY(u,cy)
endif
call SetItemVisible(TerrainCheck,false)
set kbdat.speed = kbdat.speed - DecreaseKBSpeed
set kbdat.i = kbdat.i + 1
if kbdat.i > EffectInterval then
call DestroyEffect(AddSpecialEffect(SlideEffect,cx,cy))
set kbdat.i = kbdat.i - EffectInterval
endif
if kbdat.speed <= 0.405 then
call SetUnitUserData(u,0)
call PauseUnit(u,false)
call SetUnitPathing(u,true)
call IssueTargetOrder(u,"attack",kbdat.caster)
call kbdat.destroy()
set kbInteger = kbInteger - 1
if kbInteger > 0 then
set kbglob[i] = kbglob[kbInteger]
endif
call GroupRemoveUnit(KBGroup,u)
endif
else
call SetUnitUserData(u,0)
call GroupRemoveUnit(KBGroup,u)
call PauseUnit(u,false)
call SetUnitPathing(u,true)
endif
set u = null
endfunction
//***********************************************************************************************
//* Cycle Actions *
//***********************************************************************************************
private function Callback takes nothing returns nothing
local Cast twdat
local real x1
local real y1
local real x2
local real y2
set loopi = 0
loop
exitwhen loopi >= Integer
set twdat = glob[loopi]
if GetWidgetLife(twdat.target) <= 0.405 then
call IssueImmediateOrder(twdat.caster,"stop")
endif
if LoopConditions() then
set x1 = twdat.x1
set y1 = twdat.y1
set twdat.angle = twdat.angle + twdat.speed
set twdat.speed = twdat.speed + twdat.increament
if twdat.cdistance >= twdat.mindistance + SpeedForMinDis then
set twdat.cdistance = twdat.cdistance - SpeedForMinDis
elseif twdat.cdistance <= twdat.mindistance - SpeedForMinDis then
set twdat.cdistance = twdat.cdistance + SpeedForMinDis
elseif twdat.cdistance != twdat.mindistance then
set twdat.cdistance = twdat.mindistance
endif
if twdat.angle >= 2*bj_PI then
set twdat.angle = twdat.angle - 2*bj_PI
endif
set x2 = x1+twdat.cdistance*Cos(twdat.angle)
set y2 = y1+twdat.cdistance*Sin(twdat.angle)
call SetUnitX(twdat.target,x2)
call SetUnitY(twdat.target,y2)
if DestroyTreesCycle then
call SetRect(TreeRect,x2-TreeHitR,y2-TreeHitR,x2+TreeHitR,y2+TreeHitR)
call EnumDestructablesInRect(TreeRect,null,function KnockbackDestroyTrees)
endif
call SetUnitFacing(twdat.target,twdat.angle*(bj_RADTODEG))
call SetUnitFacing(twdat.caster,twdat.angle*(bj_RADTODEG))
call MoveLightning(twdat.l,true,x1,y1,x2,y2)
call GroupEnumUnitsInRange(GetUnit,x2,y2,PickRange,Bex)
call ForGroup(GetUnit,function CreateKB)
call GroupAddGroup(GetUnit,KBGroup)
call GroupClear(GetUnit)
set loopi = loopi + 1
else
call GroupAddUnit(GetUnit,twdat.target)
call ForGroup(GetUnit,function CreateKB)
call GroupRemoveUnit(AlreadyTarget,twdat.target)
call GroupClear(GetUnit)
call twdat.destroy()
set Integer = Integer - 1
set glob[loopi] = glob[Integer]
endif
endloop
call ForGroup(KBGroup,function KBActions)
if Integer <= 0 and kbInteger <= 0 then
call PauseTimer(Timer)
endif
endfunction
//***********************************************************************************************
//* Cast Actions *
//***********************************************************************************************
private function Cast_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local Cast twdat = Cast.create()
local integer level = GetUnitAbilityLevel(caster,Abilityid)
local real cx = GetUnitX(caster)
local real cy = GetUnitY(caster)
local real tx = GetUnitX(target)
local real ty = GetUnitY(target)
if target != null and not IsUnitInGroup(target,AlreadyTarget) then
if orderid == 0 then
set orderid = GetUnitCurrentOrder(caster)
endif
set twdat.caster = caster
set twdat.target = target
set twdat.l = AddLightning(LightningId,true,cx,cy,tx,ty)
set twdat.ambientsound = CreateSound(AmbientSound,ASLoop,AS3D,ASCutoff,ASFadeIn,ASFadeOut,ASeax)
call SetSoundDuration(twdat.ambientsound,ASDuration)
call SetSoundChannel(twdat.ambientsound,ASoundChannel)
call SetSoundDistanceCutoff(twdat.ambientsound,ASCutoffRange)
call SetSoundVolume(twdat.ambientsound,ASVolume)
call SetSoundPosition(twdat.ambientsound,cx,cy,32.00)
call StartSound(twdat.ambientsound)
set twdat.angle = Atan2(ty-cy,tx-cx)
set twdat.speed = StartCircleSpeed*bj_DEGTORAD
set twdat.increament = DecreaseCircleSpeed (level)*bj_DEGTORAD
set twdat.x1 = cx
set twdat.y1 = cy
set twdat.cdistance = SquareRoot((tx-cx)*(tx-cx)+(ty-cy)*(ty-cy))
set twdat.mindistance = DistanceFormula(level)
set twdat.damage = DamageFormula(level)
set twdat.e1 = AddSpecialEffect(CasterEffect,cx,cy)
set twdat.e2 = AddSpecialEffect(CasterEffect,cx,cy)
set glob[Integer] = twdat
call PauseUnit(target,true)
call GroupAddUnit(AlreadyTarget,target)
set Integer = Integer + 1
if Integer == 1 then
call TimerStart(Timer,TimerTimeOut,true,function Callback )
endif
else
call PauseUnit(caster,true)
call IssueImmediateOrder(caster,"stop")
call PauseUnit(caster,false)
endif
set caster = null
set target = null
endfunction
public function InitTrig takes nothing returns nothing
local trigger tr = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(tr, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition(tr, Condition( function Cast_Conditions ) )
call TriggerAddAction(tr, function Cast_Actions )
call Preload(LightningId)
call Preload(CasterEffect)
call Preload(HitEffect)
call Preload(HitEffectAdd)
call Preload(SlideEffect)
set Bex = Condition(function KBFilter)
set TreeRect = Rect(256.0 , 2400.0 , 448.0 , 2656.0)
set TerrainCheck = CreateItem(TerrainItem,0.00,0.00)
call SetItemVisible(TerrainCheck,false)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function CheckOmilash takes unit target returns boolean
if ( not ( OrderId2StringBJ(GetUnitCurrentOrder(target)) == "move" ) ) then
return false
endif
return true
endfunction
function Hellows takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local location TempPoint = GetUnitLoc(target)
local integer ID = 'A04N'
local integer lvl = GetUnitAbilityLevelSwapped(ID, caster)
local integer maxStrikes = lvl * 20
local integer e = 0
local effect SPEF = null
call SetUnitInvulnerable( GetTriggerUnit(), true )
call UnitAddAbilityBJ( 'A04Q', caster )
call UnitAddAbilityBJ( 'A04R', caster )
call AddSpecialEffectTargetUnitBJ( "weapon", caster, "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl" )
set SPEF = GetLastCreatedEffectBJ()
loop
set e = e + 1
call SetUnitTimeScalePercent( caster, 250.00 )
call IssueTargetOrderBJ( caster, "attack", target )
call TriggerSleepAction ( 0.75 )
if ( CheckOmilash(target) ) then
set TempPoint = PolarProjectionBJ(GetUnitLoc(target), ( GetUnitMoveSpeed(target) / 3.35 ), GetUnitFacing(target))
else
set TempPoint = GetUnitLoc (target)
endif
call SetUnitTimeScalePercent( caster, 100.00 )
call SetUnitPositionLoc( caster, TempPoint )
call RemoveLocation ( TempPoint )
if ( ( IsUnitDeadBJ(target) == true ) ) then
set e = maxStrikes
endif
exitwhen e == maxStrikes
endloop
call UnitRemoveAbilityBJ( 'A04Q', caster )
call UnitRemoveAbilityBJ( 'A04R', caster )
call SetUnitInvulnerable( caster, false )
call DestroyEffectBJ( SPEF )
set caster = null
set target = null
set SPEF = null
endfunction
function honkitions takes nothing returns boolean
if ( not ( GetSpellAbilityId () == 'A04N' ) ) then
return false
endif
return true
endfunction
//===========================================================================
function InitTrig_Omnilash takes nothing returns nothing
set gg_trg_Omnilash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ ( gg_trg_Omnilash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Omnilash, function Hellows )
call TriggerAddCondition( gg_trg_Omnilash, Condition( function honkitions ) )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Unbezeichneter_Ausl__ser_002_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local location TempPoint = GetUnitLoc(target)
local effect SPEF2 = null
call SetUnitInvulnerable( GetTriggerUnit(), true )
call UnitAddAbilityBJ( 'A04S', caster )
call UnitAddAbilityBJ( 'A04Q', caster )
call AddSpecialEffectTargetUnitBJ( "weapon", caster, "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl" )
set SPEF2 = GetLastCreatedEffectBJ()
call SetUnitPositionLoc( caster, TempPoint )
call IssueTargetOrderBJ( caster, "attack", target )
call RemoveLocation ( TempPoint )
call TriggerSleepAction ( 0.45 )
call UnitRemoveAbilityBJ( 'A04S', caster )
call UnitRemoveAbilityBJ( 'A04Q', caster )
call SetUnitInvulnerable( caster, false )
call DestroyEffectBJ( SPEF2 )
set caster = null
set target = null
set SPEF2 = null
endfunction
function Stormblade_conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId () == 'A04O' ) ) then
return false
endif
return true
endfunction
//===========================================================================
function InitTrig_Stomrblade takes nothing returns nothing
set gg_trg_Stomrblade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ ( gg_trg_Stomrblade, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Stomrblade, function Trig_Unbezeichneter_Ausl__ser_002_Actions )
call TriggerAddCondition( gg_trg_Stomrblade, Condition( function Stormblade_conditions ) )
endfunction
//TESH.scrollpos=18
//TESH.alwaysfold=0
function vis takes unit caster returns nothing
local integer b = 0
loop
call TriggerSleepAction ( 0.25 )
set b = b + 1
call SetUnitVertexColorBJ( caster, 50., 50., 50., (100 - b * ( 100 / 3 )) )
if ( b == 3 ) then
call SetUnitVertexColorBJ( caster, 50., 50., 50., (100 - b * ( 100 / 3 )) )
call UnitRemoveAbilityBJ( 'Agho', caster )
endif
exitwhen b == 3
endloop
endfunction
function invisible takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer ID = 'A03Y'
local integer lvl = GetUnitAbilityLevelSwapped(ID, caster)
local integer e = 0
loop
call TriggerSleepAction ( 0.25 )
set e = e + 1
call SetUnitVertexColorBJ( caster, 50., 50., 50., e * ( 100 / 6 ) )
if ( e == 5 ) then
call UnitAddAbilityBJ( 'Agho', caster)
call TriggerSleepAction ( 2.00 + lvl * 3.00 )
call vis(caster)
//call UnitRemoveAbilityBJ( 'Agho', caster) )
//call SetUnitVertexColorBJ( caster, 100, 100, 100, 100 )
endif
exitwhen e == 5
endloop
set caster = null
endfunction
function conditio takes nothing returns boolean
if ( not ( GetSpellAbilityId () == 'A03Y' ) ) then
return false
endif
return true
endfunction
//===========================================================================
function InitTrig_Invisible_walk takes nothing returns nothing
set gg_trg_Invisible_walk = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Invisible_walk, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Invisible_walk, Condition( function conditio ) )
call TriggerAddAction( gg_trg_Invisible_walk, function invisible )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function invis takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer ID = 'A04K'
local integer lvl = GetUnitAbilityLevelSwapped(ID, caster)
local real time = lvl * 2.50
local integer e = 0
loop
call TriggerSleepAction ( time / 10 )
set e = e + 1
call SetUnitVertexColorBJ( caster, 100, 100, 100, e * ( 100 / 15 ) )
if ( e == 15 ) then
call SetUnitVertexColorBJ( caster, 100, 100, 100, 100 )
call ShowUnitHide( caster )
call PauseUnitBJ( true, caster )
endif
exitwhen e == 15
endloop
endfunction
function Actions takes nothing returns nothing
local location Shellloc = GetUnitLoc(GetTriggerUnit())
local unit caster = GetTriggerUnit()
local location TempPoint = GetUnitLoc(caster)
local integer ID = 'A04K'
local integer Type = GetUnitTypeId(GetTriggerUnit())
local integer lvl = GetUnitAbilityLevelSwapped(ID, caster)
local real time = lvl * 2.5
local real life = GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit())
local real mana = GetUnitStateSwap(UNIT_STATE_MANA, GetTriggerUnit()) - 125.
call TriggerSleepAction ( 1.00 )
call invis()
call TriggerSleepAction ( time )
call ShowUnitShow( caster )
set TempPoint = GetUnitLoc(caster)
if ( IsUnitAliveBJ(caster) == true ) then
call PauseUnitBJ( false, caster )
call AddSpecialEffectLoc ( "Units\\NightElf\\Wisp\\WispExplode.mdl" , TempPoint )
call AddSpecialEffectLoc ( "Units\\NightElf\\Wisp\\WispExplode.mdl" , Shellloc )
call SetUnitVertexColorBJ( caster, 100, 100, 100, 0 )
call SetUnitLifeBJ ( caster, life )
call SetUnitManaBJ ( caster, mana )
call SetUnitPositionLoc( caster, Shellloc )
call RemoveLocation ( Shellloc )
call RemoveLocation ( TempPoint )
else
call ReviveHeroLoc( caster, Shellloc, false )
call PauseUnitBJ( false, caster )
call AddSpecialEffectLoc ( "Abilities\\Spells\\Other\\Awaken\\Awaken.mdl" , Shellloc )
call AddSpecialEffectLoc ( "Units\\NightElf\\Wisp\\WispExplode.mdl" , TempPoint )
call AddSpecialEffectLoc ( "Units\\NightElf\\Wisp\\WispExplode.mdl" , Shellloc )
call SetUnitVertexColorBJ( caster, 100, 100, 100, 0 )
call SetUnitLifeBJ ( caster, life )
call SetUnitManaBJ ( caster, mana )
call SetUnitPositionLoc( caster, Shellloc )
call RemoveLocation ( Shellloc )
call RemoveLocation ( TempPoint )
endif
endfunction
//===========================================================================
//Event and Condition/s
function Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId () == 'A04K' ) ) then
return false
endif
return true
endfunction
//===========================================================================
function InitTrig_t takes nothing returns nothing
set gg_trg_t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ ( gg_trg_t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddAction( gg_trg_t, function Actions )
call TriggerAddCondition( gg_trg_t, Condition( function Conditions ) )
endfunction
//TESH.scrollpos=109
//TESH.alwaysfold=0
scope Energy
//********************************************************************************
globals
private constant string Energy_FX = "Effects\\BlackHole.mdx" //Path of the model, used for preloading
private constant string Dust = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
private constant integer BlackHole_ID = 'A04P' //Rawcode of the Black Hole dummy spell
private constant integer Dummy_ID = 'e016' //Rawcode of the Black Hole dummy unit
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_CHAOS
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_UNIVERSAL
endglobals
function levelbestimmung takes nothing returns integer
local unit caster = GetTriggerUnit()
local integer ID = 'A04P'
local integer levelabi = GetUnitAbilityLevelSwapped(ID, caster)
set caster = null
return levelabi
endfunction
private constant function SuckRadius takes integer lvl returns real
return 450.
endfunction
private constant function SuckDistance takes integer lvl returns real
return 0.//Distance the unit must be within for it to be sucked inside
endfunction
private constant function SuckSpeed takes integer levelabi returns real
return -5.83 + (levelabi * -1.15) //Distance travelled every interval when units are sucked
endfunction
private constant function Expiration takes integer levelabi returns real
return 3. + (levelabi * 4.) //The black hole explodes upon expiration!
endfunction
private constant function ExplosionDamage takes integer lvl returns real
return 0. //Damage upon explosion
endfunction
private constant function ExplosionRadius takes integer lvl returns real
return 0. //Explosion AOE radius
endfunction
private constant function KnockbackSpeed takes integer lvl returns real
return 0. //Same as SUCK_SPEED but applies to knockback
endfunction
private constant function KnockbackBreak takes integer lvl returns real
return 0.00 //The higher the value, the greater the friction.
endfunction
private function Filter takes nothing returns boolean
return not IsUnitType(GetFilterUnit(),UNIT_TYPE_MAGIC_IMMUNE) and GetWidgetLife(GetFilterUnit()) > .405 and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)
//return not GetWidgetLife(GetFilterUnit()) > .405
//Determines which units are sucked in.
endfunction
private function ShouldUnitBeKnockedBack takes unit u, player p returns boolean
return (not IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL) and GetWidgetLife(GetFilterUnit()) > .405) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) //Determines if the unit 'u' should be knocked back.
//unit 'u' acts like GetFilterUnit() and player 'p' is only used for purposes like trying to affect only enemies
//In that case, use IsUnitEnemy(u,p)
endfunction
private struct data
unit caster
unit dummy //This is private and just used for the black hole model
real expiration
real x
real y
group sucked
integer lvl
method onDestroy takes nothing returns nothing
call DestroyGroup(.sucked)
endmethod
endstruct
private function ExplosionMove takes nothing returns nothing
local timer t = GetExpiredTimer()
local data d = data(GetTimerStructA(t))
local real x
local real y
local real a
local unit temp
local group g
if d.expiration <= 0 then //Remember that expiration is used as KNOCKBACK_SPEED? =þ
call PauseTimer(t)
call DestroyTimer(t)
call data.destroy(d)
else
set g = CreateGroup()
call GroupAddGroup(d.sucked,g)
loop
set temp = FirstOfGroup(g)
exitwhen temp == null
set x = GetUnitX(temp)
set y = GetUnitY(temp)
set a = AngleBetweenPointsXY(d.x,d.y,x,y)
set x = x + d.expiration * Cos(a*0.01745)
set y = y + d.expiration * Sin(a*0.01745)
if (x < GetRectMinX(bj_mapInitialPlayableArea) or x > GetRectMaxX(bj_mapInitialPlayableArea)) or (y < GetRectMinY(bj_mapInitialPlayableArea) or y > GetRectMaxY(bj_mapInitialPlayableArea)) then
call GroupRemoveUnit(d.sucked,temp)
else
call DestroyEffect(AddSpecialEffect(Dust,x,y))
call SetUnitX(temp,x)
call SetUnitY(temp,y) //I just realized SetUnitPosition is laggy. SetUnitX/y is much better :)
//call SetUnitPosition(temp,x,y) //SetUnitPosition so that it checks for pathing =þ
endif
call GroupRemoveUnit(g,temp)
endloop
call DestroyGroup(g)
set d.expiration = d.expiration - KnockbackBreak(d.lvl)
endif
endfunction
private function Unhide takes nothing returns nothing
call ShowUnit(GetEnumUnit(),true)
call SetUnitInvulnerable(GetEnumUnit(),false)
call PauseUnit(GetEnumUnit(),false)
endfunction
private function Callback takes nothing returns nothing
local timer t = GetExpiredTimer()
local data d = data(GetTimerStructA(t))
local group g = CreateGroup()
local unit temp
local real x
local real y
local real a
if d.expiration <= 0 then
//Begin explosion
call KillUnit(d.dummy)
call SetUnitTimeScale(d.dummy,.5)
call UnitApplyTimedLife(d.dummy,'BTLF',5.)
call SetUnitAnimation(d.dummy,"Birth") //Just to be sure =þ
call ForGroup(d.sucked, function Unhide)
call GroupEnumUnitsInRange(g,d.x,d.y,ExplosionRadius(d.lvl),Condition(function Filter))
loop
set temp = FirstOfGroup(g)
exitwhen temp == null
if IsUnitEnemy(temp,GetOwningPlayer(d.caster)) then
call UnitDamageTarget(d.caster,temp,ExplosionDamage(d.lvl),true,false,ATTACK_TYPE,DAMAGE_TYPE,null)
endif
call GroupRemoveUnit(g,temp)
if ShouldUnitBeKnockedBack(temp,GetOwningPlayer(d.caster)) then
call GroupAddUnit(d.sucked,temp) //Add it so that it will get knocked back later
endif
endloop
//**** Start the knockback now! ****
//**** Well not really =þ ****
set d.expiration = KnockbackSpeed(d.lvl) //I do not want to declare another member for the struct so I use expiration
call PauseTimer(t)
call TimerStart(t,udg_Interval,true,function ExplosionMove)
else
call GroupEnumUnitsInRange(g,d.x,d.y,SuckRadius(d.lvl),Condition(function Filter))
loop
set temp = FirstOfGroup(g)
exitwhen temp == null
if IsUnitEnemy(temp,GetOwningPlayer(d.caster)) and not IsUnitInGroup(temp,d.sucked) then
set x = GetUnitX(temp)
set y = GetUnitY(temp)
set a = AngleBetweenPointsXY(x,y,d.x,d.y)
if DistanceBetweenPointsXY(d.x,d.y,x,y) <= SuckDistance(d.lvl) then
//Unit is within sucking distance, kick that unit into the hole, THIS IS SPARTAAA!!!
call GroupAddUnit(d.sucked,temp)
call ShowUnit(temp,false)
call SetUnitInvulnerable(temp,true)
call PauseUnit(temp,true)
call SetUnitX(temp,d.x)
call SetUnitY(temp,d.y)
else
set x = x + SuckSpeed(d.lvl) * Cos(a*0.01745)
set y = y + SuckSpeed(d.lvl) * Sin(a*0.01745)
call SetUnitX(temp,x)
call SetUnitY(temp,y)
endif
endif
call GroupRemoveUnit(g,temp)
endloop
set d.expiration = d.expiration - udg_Interval
endif
call DestroyGroup(g)
set g = null
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == BlackHole_ID
endfunction
private function Actions takes nothing returns nothing
local location l
local timer t
local data d
set l = GetSpellTargetLoc()
set t = CreateTimer()
set d = data.create()
set d.caster = GetTriggerUnit()
set d.x = GetLocationX(l)
set d.y = GetLocationY(l)
set d.dummy = CreateUnit(GetOwningPlayer(d.caster),Dummy_ID,d.x,d.y,270)
set d.sucked = CreateGroup()
set d.lvl = GetUnitAbilityLevel(d.caster,BlackHole_ID)
set d.expiration = Expiration(d.lvl)
call SetTimerStructA(t,d)
call TimerStart(t,udg_Interval,true,function Callback)
call RemoveLocation(l)
set l = null
endfunction
function InitTrig_Kraftfeld takes nothing returns nothing
local trigger t = CreateTrigger( )
call Preload(Energy_FX)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
set t = null
endfunction
endscope
//TESH.scrollpos=18
//TESH.alwaysfold=0
function Trig_Magisches_Schild_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A010' ) ) then
return false
endif
return true
endfunction
function Trig_Magisches_Schild_Func003C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A010', GetSpellAbilityUnit()) == 1 ) ) then
return false
endif
return true
endfunction
function Trig_Magisches_Schild_Func004C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A010', GetSpellAbilityUnit()) == 2 ) ) then
return false
endif
return true
endfunction
function Trig_Magisches_Schild_Func005C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A010', GetSpellAbilityUnit()) == 3 ) ) then
return false
endif
return true
endfunction
function Trig_Magisches_Schild_Actions takes nothing returns nothing
local unit MagischesSchildCaster = GetSpellAbilityUnit()
call GroupAddUnitSimple( GetSpellAbilityUnit(), udg_Flamecaster )
if ( Trig_Magisches_Schild_Func003C() ) then
call UnitAddAbilityBJ( 'A016', MagischesSchildCaster )
call TriggerSleepAction( 11.00 )
call GroupRemoveUnitSimple( MagischesSchildCaster, udg_Flamecaster )
call UnitRemoveAbilityBJ( 'A016', MagischesSchildCaster )
set MagischesSchildCaster = null
else
endif
if ( Trig_Magisches_Schild_Func004C() ) then
set MagischesSchildCaster = GetSpellAbilityUnit()
call UnitAddAbilityBJ( 'A017', MagischesSchildCaster )
call TriggerSleepAction( 13.00 )
call GroupRemoveUnitSimple( MagischesSchildCaster, udg_Flamecaster )
call UnitRemoveAbilityBJ( 'A017', MagischesSchildCaster )
set MagischesSchildCaster = null
else
endif
if ( Trig_Magisches_Schild_Func005C() ) then
set MagischesSchildCaster = GetSpellAbilityUnit()
call UnitAddAbilityBJ( 'A018', MagischesSchildCaster )
call TriggerSleepAction( 15.00 )
call GroupRemoveUnitSimple( MagischesSchildCaster, udg_Flamecaster )
call UnitRemoveAbilityBJ( 'A018', MagischesSchildCaster )
set MagischesSchildCaster = null
else
endif
endfunction
//===========================================================================
function InitTrig_Magisches_Schild takes nothing returns nothing
set gg_trg_Magisches_Schild = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Magisches_Schild, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Magisches_Schild, Condition( function Trig_Magisches_Schild_Conditions ) )
call TriggerAddAction( gg_trg_Magisches_Schild, function Trig_Magisches_Schild_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Laser_Bombardement_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A05F' ) ) then
return false
endif
return true
endfunction
function Trig_Laser_Bombardement_Func001C takes nothing returns boolean
if ( not ( GetPlayerState(GetOwningPlayer(GetTriggerUnit()), PLAYER_STATE_RESOURCE_GOLD) >= 6000 ) ) then
return false
endif
return true
endfunction
function Trig_Laser_Bombardement_Actions takes nothing returns nothing
local location TempPoint = GetSpellTargetLoc()
if ( Trig_Laser_Bombardement_Func001C() ) then
call AdjustPlayerStateBJ( -6000, GetOwningPlayer(GetTriggerUnit()), PLAYER_STATE_RESOURCE_GOLD )
set udg_END_MB_Sw_benutzt[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = ( udg_END_MB_Sw_benutzt[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] + 1 )
call DisplayTextToForce( GetPlayersAll(), ( "|CFFFF0000Attention:|r " + ( ( udg_ColorCodePlayer[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] + GetPlayerName(GetOwningPlayer(GetTriggerUnit())) ) + ( "|r is just using the super weapon |cffFFFF00\"" + ( GetAbilityName(GetSpellAbilityId()) + "\"|r" ) ) ) ) )
set udg_Bezeichnung_Feigheit[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = ( udg_Bezeichnung_Feigheit[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] + 3 )
set udg_Bezeichnung_Fiesheit[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = ( udg_Bezeichnung_Fiesheit[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] + 3 )
else
call RemoveLocation ( TempPoint )
return
endif
set udg_TempPoint = GetSpellTargetLoc()
set bj_forLoopBIndex = 1
set bj_forLoopBIndexEnd = 14
if (GetPlayerTechCountSimple('R000', GetOwningPlayer(GetTriggerUnit())) == 1) then
set bj_forLoopBIndexEnd = 16
endif
loop
exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
set udg_TempPoint2 = PolarProjectionBJ(TempPoint, GetRandomReal(0, 800.00), GetRandomDirectionDeg())
call CreateNUnitsAtLoc( 1, 'e01F', GetOwningPlayer(GetTriggerUnit()), udg_TempPoint2, bj_UNIT_FACING )
call RemoveLocation ( udg_TempPoint2 )
call PolledWait( 0.80 )
set bj_forLoopBIndex = bj_forLoopBIndex + 1
endloop
call RemoveLocation ( TempPoint )
endfunction
//===========================================================================
function InitTrig_Laser_Bombardement takes nothing returns nothing
set gg_trg_Laser_Bombardement = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Laser_Bombardement, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Laser_Bombardement, Condition( function Trig_Laser_Bombardement_Conditions ) )
call TriggerAddAction( gg_trg_Laser_Bombardement, function Trig_Laser_Bombardement_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Feuergeschoss_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A03T' ) ) then
return false
endif
return true
endfunction
function Trig_Feuergeschoss_Actions takes nothing returns nothing
local unit TempUnit
local effect TempEffect
set TempUnit = GetSpellTargetUnit()
call GroupAddUnitSimple( GetSpellTargetUnit(), udg_FireMissiled )
call AddSpecialEffectTargetUnitBJ( "chest", GetSpellTargetUnit(), "Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl" )
set TempEffect = GetLastCreatedEffectBJ()
call TriggerSleepAction( 11.00 )
call DestroyEffectBJ( TempEffect )
call GroupRemoveUnitSimple( TempUnit, udg_FireMissiled )
set TempUnit = null
endfunction
//===========================================================================
function InitTrig_Feuergeschoss takes nothing returns nothing
set gg_trg_Feuergeschoss = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Feuergeschoss, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Feuergeschoss, Condition( function Trig_Feuergeschoss_Conditions ) )
call TriggerAddAction( gg_trg_Feuergeschoss, function Trig_Feuergeschoss_Actions )
endfunction
//TESH.scrollpos=7
//TESH.alwaysfold=0
//**********************************************************
//*** ***
//*** Spell Windkanal Erstellt von N8-11_GER und @Cedi ***
//*** modifiziert von XieLong ***
//*** ***
//**********************************************************
scope Windkanal // Diese Zeile einfach ignorieren
globals // Diese Zeile auch einfach ignorieren
//================================Objekt-IDs==============================
private integer Spell_Id = 'A03W' //<<-- hier die ID des Spells eintragen (rawcode). Wird herrausgefunden, wenn man im Objekt Editor Strg+D drückt.
//===========================Spell-Einstellungen==========================
//private integer Weather_Type = 'WNcw'
//private string Effect_on_Units = "Abilities\\Weapons\\SteamMissile\\SteamMissile.mdl"
endglobals // Diese Zeile auch ignorieren
private function AreaOfEffect takes integer Level returns real
return 500.
endfunction
private function MovementSpeedModifier takes integer Level returns real
return 13. * Level * 3.
endfunction
private function MaximumDuration takes integer Level returns real
return 1.0 * Level + 2.
endfunction
//================================Bedingung===============================
private function Spell_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == Spell_Id )
endfunction
//============================SpecialFunctions============================
struct WKanal
unit c
group g
integer time
integer lvl
real CosAngle
real SinAngle
trigger tr
triggeraction ta
timer ti
location l
rect r
weathereffect w
real AoE
real MSM
method onDestroy takes nothing returns nothing
call PauseTimer( this.ti )
call DestroyTimer( this.ti )
call FlushHandleLocals( this.ti )
call TriggerRemoveAction(this.tr, this.ta)
call DestroyTrigger(this.tr)
call DestroyGroup(this.g)
call RemoveLocation(this.l)
call RemoveRect(this.r)
call EnableWeatherEffect(this.w, false)
call RemoveWeatherEffect(this.w)
endmethod
endstruct
//================================Functions=====================================
private function Spell_Filter takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction
private function Spell_EndCast takes nothing returns nothing
local WKanal data = GetHandleInt(GetTriggeringTrigger(), "struct")
call data.destroy()
endfunction
private function Spell_Move takes nothing returns nothing
local timer t = GetExpiredTimer()
local WKanal data = GetHandleInt( t, "struct" )
local real x
local real y
local unit u
call GroupEnumUnitsInRangeOfLoc( data.g, data.l, AreaOfEffect(data.lvl), Condition( function Spell_Filter ))
call GroupRemoveUnit( data.g, data.c )
if data.time <= 0 then
call data.destroy()
else
set data.time = data.time - 1
loop
set u = FirstOfGroup( data.g )
exitwhen u == null
call GroupRemoveUnit( data.g, u )
set x = GetUnitX(u) + data.MSM * data.CosAngle
set y = GetUnitY(u) + data.MSM * data.SinAngle
if RectContainsCoords(bj_mapInitialPlayableArea, x, y) then
call SetUnitX(u, x)
call SetUnitY(u, y)
endif
//if ModuloInteger(data.time, 5) == 0 then
// call DestroyEffect( AddSpecialEffectTarget( Effect_on_Units, u, "chest" ) )
//endif
endloop
endif
set t = null
set u = null
endfunction
private function Spell_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local timer t = CreateTimer()
local trigger tr = CreateTrigger()
local real angle
local WKanal data = WKanal.create()
set data.g = CreateGroup()
set data.l = GetSpellTargetLoc()
set angle = Atan2(GetLocationY(data.l) - GetUnitY(c), GetLocationX(data.l) - GetUnitX(c))
set data.CosAngle = Cos(angle)
set data.SinAngle = Sin(angle)
set data.lvl = GetUnitAbilityLevel(c, Spell_Id)
set data.AoE = AreaOfEffect(data.lvl)
set data.r = GetRectFromCircleBJ(data.l, data.AoE/2)
//set data.w = AddWeatherEffect(data.r, Weather_Type)
//call EnableWeatherEffect(data.w, true)
set data.c = c
set data.time = R2I(MaximumDuration(data.lvl) * 25)
set data.MSM = MovementSpeedModifier(data.lvl) / 25
call TriggerRegisterUnitEvent(tr, c, EVENT_UNIT_SPELL_ENDCAST)
set data.ta = TriggerAddAction(tr, function Spell_EndCast)
set data.tr = tr
call SetHandleInt(tr, "struct", data)
set data.ti = t
call SetHandleInt(t, "struct", data)
call TimerStart( t, 0.08, true, function Spell_Move )
set c = null
set t = null
endfunction
//===========================================================================
function InitTrig_Flood_disturb takes nothing returns nothing
set gg_trg_Flood_disturb = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Flood_disturb, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Flood_disturb, Condition( function Spell_Conditions ) )
call TriggerAddAction( gg_trg_Flood_disturb, function Spell_Actions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Battlefury_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A01M' ) ) then
return false
endif
return true
endfunction
function Trig_Battlefury_Actions takes nothing returns nothing
local unit gladiator_fury
set gladiator_fury = GetSpellAbilityUnit()
call SetUnitMoveSpeed( gladiator_fury, 999.00 )
set udg_gladiator_fury_level[GetConvertedPlayerId(GetOwningPlayer(gladiator_fury))] = GetUnitAbilityLevelSwapped('A01M', gladiator_fury)
call SetUnitScalePercent( gladiator_fury, 120.00, 120.00, 120.00 )
call SetUnitVertexColorBJ( gladiator_fury, 100, 40.00, 40.00, 15.00 )
call SetUnitTimeScalePercent( gladiator_fury, 200.00 )
call ModifyHeroStat( bj_HEROSTAT_AGI, gladiator_fury, bj_MODIFYMETHOD_ADD, ( udg_gladiator_fury_level[GetConvertedPlayerId(GetOwningPlayer(gladiator_fury))] * 6 ) )
call PolledWait( ( ( I2R(GetUnitAbilityLevelSwapped('A01M', GetSpellAbilityUnit())) * 4.00 ) + 2.00 ) )
call ModifyHeroStat( bj_HEROSTAT_AGI, gladiator_fury, bj_MODIFYMETHOD_SUB, ( udg_gladiator_fury_level[GetConvertedPlayerId(GetOwningPlayer(gladiator_fury))] * 6 ) )
call SetUnitTimeScalePercent( gladiator_fury, 100.00 )
call SetUnitMoveSpeed( gladiator_fury, GetUnitDefaultMoveSpeed(gladiator_fury) )
call SetUnitScalePercent( gladiator_fury, 100, 100, 100 )
call SetUnitVertexColorBJ( gladiator_fury, 100, 100.00, 100.00, 0.00 )
endfunction
//===========================================================================
function InitTrig_Battlefury takes nothing returns nothing
set gg_trg_Battlefury = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Battlefury, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Battlefury, Condition( function Trig_Battlefury_Conditions ) )
call TriggerAddAction( gg_trg_Battlefury, function Trig_Battlefury_Actions )
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope WordOfMight
//= Needed Object and their ids (Make sure to copy all objects into your map and adjust the rawcodes)
//== Abilities
//=== Word of Might
constant function Word_of_Might_SpellId takes nothing returns integer
return 'A01H' // The spell's rawcode.
endfunction
//= End of ObjectIds
//===========================================================================
//= Spell datas and settings
function Word_of_Might_AbsorbedDamage takes integer lvl returns real
return 75. * lvl
endfunction
function Word_of_Might_Duration takes integer lvl returns real
return 0. // 0 == endless
endfunction
constant function Word_of_Might_ShieldEffect takes nothing returns string
return "Abilities\\Spells\\Items\\StaffOfSanctuary\\Staff_Sanctuary_Target.mdl"
endfunction
//== Any other data/setting have to be changed within the object-editor
//= End of datas/settings
//===========================================================================
// *** Spell Script ***
function Word_of_Might_Condtions takes nothing returns boolean
return GetSpellAbilityId() == Word_of_Might_SpellId()
endfunction
function DelayedDamageTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t, "u")
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) + GetHandleReal(t, "dmg"))
endfunction
function DelayedDamage takes unit u,real r returns nothing
local timer t = CreateTimer()
call SetHandleReal(t, "dmg", r)
call SetHandleHandle(t, "u", u)
call TimerStart(t, 0, false,function DelayedDamageTimer)
endfunction
function DelayedDamageCheck takes unit u,real r returns nothing
local real maxL = GetUnitState(u, UNIT_STATE_MAX_LIFE)
local real l = GetUnitState(u, UNIT_STATE_LIFE)
if r > (maxL - l)then
if r >= l then
call SetUnitState(u, UNIT_STATE_LIFE, maxL)
call DelayedDamage(u, r - (maxL - l))
else
call DelayedDamage(u, r)
endif
else
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u,UNIT_STATE_LIFE) + r)
endif
endfunction
globals
private triggeraction array TA
endglobals
private function SetHandleAction takes handle h, triggeraction b returns nothing
set TA[ModuloInteger(GetHandleId(h)-0x100000,8191)] = b
endfunction
private function GetHandleAction takes handle h returns triggeraction
return TA[ModuloInteger(GetHandleId(h)-0x100000,8191)]
endfunction
function Word_of_Might_Heal takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local real dmg = GetEventDamage()
local real life = GetHandleReal(t, "ShieldLife")
if( life < dmg )then
call DelayedDamageCheck(GetTriggerUnit(), life)
call DestroyEffect(GetHandleEffect(t,"ShieldFX"))
call TriggerRemoveAction(t, GetHandleAction(t))
call FlushHandleLocals(t)
call DestroyTrigger(t)
elseif(dmg > 0)then
call DelayedDamageCheck(GetTriggerUnit(), dmg)
call SetHandleReal(t,"ShieldLife", life-dmg)
endif
endfunction
function Word_of_Might_Actions takes nothing returns nothing
local trigger t = CreateTrigger()
local unit u = GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), Word_of_Might_SpellId())
local real dur = Word_of_Might_Duration(lvl)
local triggeraction a = TriggerAddAction(t, function Word_of_Might_Heal)
local effect e = AddSpecialEffectTarget(Word_of_Might_ShieldEffect(), u, "head")
call SetHandleAction(t, a)
call TriggerRegisterUnitEvent(t, u, EVENT_UNIT_DAMAGED)
call SetHandleReal(t, "ShieldLife", Word_of_Might_AbsorbedDamage(lvl))
call SetHandleHandle(t, "ShieldFX", e)
if dur > 0 and t != null then
call DestroyEffect(e)
call TriggerSleepAction(dur)
call TriggerRemoveAction(t, a)
call FlushHandleLocals(t)
call DestroyTrigger(t)
endif
set t = null
set u = null
set a = null
set e = null
endfunction
function InitTrig_Word_of_Might takes nothing returns nothing
local integer i = 0
set gg_trg_Word_of_Might = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Word_of_Might, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition(function ReturnTrue))
set i = i + 1
exitwhen i == 16
endloop
call TriggerAddCondition(gg_trg_Word_of_Might, Condition(function Word_of_Might_Condtions))
call TriggerAddAction(gg_trg_Word_of_Might, function Word_of_Might_Actions)
endfunction
endscope
//TESH.scrollpos=18
//TESH.alwaysfold=0
//***************************************************************************\\
// Spell Name: Zurückstoßen \\
// Spell Author: XieLong \\
// Spell Editer: Mr.Malte \\
// Conforms to the JESP Standard \\
//***************************************************************************\\
//= Needed Object and their ids (Make sure to copy all objects into your map and adjust the rawcodes)
//== Abilities
//=== Schmetterschlag
constant function Zurueckstossen_SpellId takes nothing returns integer
return 'A01J' // The spell's rawcode.
endfunction
//= End of ObjectIds
//===========================================================================
//= Spell datas and settings
function Zurueckstossen_Distance takes integer lvl returns real
return 230.
endfunction
function Zurueckstossen_BonusDamage takes integer lvl returns real
return 10 + (15. * lvl)
endfunction
function Zurueckstossen_Chance takes integer lvl returns real
return 25.
endfunction
//== Visueller Effekt, wenn eine Einheit zurückgestoßen wird
function Zurueckstossen_Eyecandy takes nothing returns string
return "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl"
endfunction
//== Any other data/setting have to be changed within the object-editor
//= End of datas/settings
//===========================================================================
// *** Spell Script ***
//= Das Script wird natürlich von unten nach oben gelesen, und darum auch sorum geschrieben...
// ...die unterste Funktion ist also die erste!
// Die Condition, damit die Trigger-Aktionen ausgeführt werden
function Zurueckstossen_Conditions takes nothing returns boolean
// Da es sich um eine passive Fähigkeit handelt, muss der Level dieses Skills größer als 0 sein, also der Attacker muss ihn haben
return (GetUnitAbilityLevel(GetAttacker(), Zurueckstossen_SpellId()) > 0)
endfunction
// 3. Die Callback-Funktion
function Zurueckstossen_Knockback takes nothing returns nothing
// Die erste lokale Variabel sollte den Timer auffangen, der ausgelaufen ist:
local timer time = GetExpiredTimer()
// Nun werden die angehangen Information abgerufen und ebenfalls in lokalen Variablen gespeichert
local unit Attacker = GetHandleUnit(time, "Attacker")
local unit Attacked = GetHandleUnit(time, "Attacked")
local real x = GetUnitX(Attacked)
local real y = GetUnitY(Attacked)
local real angle = GetHandleReal(time, "angle")
// Ein Sonderfall ist dieses 'i'. Es wurde nicht schon vor Timer-Start angehangen
// Dies ist aber kein Problem, und bedeutet nur, dass es beim ersten Aufruf '0' ist.
local integer i = GetHandleInt(time, "i")
// 'i' ist unsere Countdown-Zähler, mit dem wir in dieser Abfrage prüfen, ob der Timer oft genug abgelaufen ist.
if i <= GetHandleInt(time, "steps") then
// Der Timer ist noch gültig, daher werden nun unsere eigentlichen Verschiebe-Aktionen ausgeführt
// Ein kleiner Specialeffect, lässts stauben...
call DestroyEffect(AddSpecialEffect(Zurueckstossen_Eyecandy(), x, y))
// Hier wird nun die Position der Unit verschoben, anhand der trigonometrischen Sätze
call SetUnitX(Attacked, x + 5 * Cos(angle))
call SetUnitY(Attacked, y + 5 * Sin(angle))
// Dann noch etwas Schaden... natürlich lesen wir diesen auch wieder vom Timer ab
call UnitDamageTarget(Attacker, Attacked, GetHandleReal(time, "dmg"), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
// Und nun die wichtigste Aktion in dieser Funktion: Den Countdown-Zähler hochzählen
// wenn diese Aktion vergessen wird, wird der Timer nie aufhören und man hat eine Endlosschleife
call SetHandleInt(time, "i", i + 1)
else
// Der Timer ist nun also ausgelaufen (der Countdown-Timer wurde hoch genug gezählt)
// daher folgen nun die 3 Standard-Aktionen zur Beendigung eines Timers
// 1. Timer anhalten, damit er nicht noch einmal ausläuft
call PauseTimer(time)
// 2. Alle angehängten Werte/Objekte bereinigen, ansonsten entstehen Leaks
call FlushHandleLocals(time)
// 3. Den Timer zerstören
call DestroyTimer(time)
endif
// Nullen aller Objekt-Referenzen zur Vermeidung von Leaks
set time = null
set Attacker = null
set Attacked = null
endfunction
// 2. Die Aktionen, die bei dem Event ausgelöst werden
function Zurueckstossen_Actions takes nothing returns nothing
// Alle wichtigen Werte und Objekte werden in lokalen Variablen gespeichert
// ....dadurch vermeidet man unnötige Funktionsaufrufe innerhalb der Aktionen
local unit Attacker = GetAttacker()
local unit Attacked = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(Attacker, Zurueckstossen_SpellId())
local real angle
local integer steps
// Das ist unser wichtiger Timer, der das Zurückstoßen übernehmen wird
local timer time
// Hier wird die Chance zum Zurückstoßen ausgewertet
if (IsUnitType(Attacked, UNIT_TYPE_STRUCTURE) == true) then
return
else // Hier könnten weitere Filter hinkommen, ebenso mit return als Aktion, wenns true ist
endif
if GetRandomReal(0, 100) <= Zurueckstossen_Chance(lvl) then
// Es kommt ein Rückstoß
// Als erstes erzeugen wir einen Timer, denn an diesen werden wir durch Kattana's Local Handle Vars System
// ...(ein GC+RB-System) alle relevanten Werten/Objekte anhängen
set time = CreateTimer()
// Berechnung des Rückstoß-Winkels
set angle = Atan2(GetUnitY(Attacked) - GetUnitY(Attacker), GetUnitX(Attacked) - GetUnitX(Attacker))
// ...und der benötigten Verschiebungsschritte
set steps = R2I((Zurueckstossen_Distance(lvl)/5)+.5)
// Hier kommen die 'Anhänge-Funktionen':
// Durch einen selbstgewählten, einmaligen String wird ein Wert/Objekt an ein anderes Objekt gehangen
// Units sind Objekte, also Handles und werden auch als solche angehangen
call SetHandleHandle(time, "Attacker", Attacker)
call SetHandleHandle(time, "Attacked", Attacked)
// Für alle einfachen Variablentypen gibt es ansonsten eigene AnhängeFunktionen
call SetHandleReal(time, "dmg", Zurueckstossen_BonusDamage(lvl)/steps)
call SetHandleInt(time, "steps", steps)
call SetHandleReal(time, "angle", angle)
// Nun wurden alle benötigten Informationen an den Timer angehangen und der Timer kann gestartet werden
// Dabei verwenden wir die folgende Funktion, mit den Parametern
// <welcherTimer>, <AuslaufPeriode>, <periodischer Timer?>, <Callback-Funktion>
call TimerStart(time, 0.025, true, function Zurueckstossen_Knockback)
// die Callback-Funktion wird, solbald der Timer ausläuft, in einem eigenen Thread aufgerufen,
// ...funktioniert also unabhängig von unserem Haupttrigger
// Weiter gehts also bei >Zurueckstossen_Knockback
endif
// Nullen aller Objekt-Referenzen zur Vermeidung von Leaks
set time = null
set Attacker = null
set Attacked = null
endfunction
//===========================================================================
//== 1. Initiatlisierung der Trigger (hier nur einer)
function InitTrig_endfunction takes nothing returns nothing
local integer i = 0
set gg_trg_endfunction = CreateTrigger( )
// Statt die BJ-Funktion 'TriggerRegisterAnyUnitEventBJ' zu verwenden, nehme ich diese Schleife
set i = 0
loop
// Durch das 'Condition(function ReturnTrue)' werden sog. null-Boolexpr-Leaks vermieden, die unter Umständen auftreten,
// wenn statt einer Boolexpr einfach 'null' übergeben wird
call TriggerRegisterPlayerUnitEvent(gg_trg_endfunction, Player(i), EVENT_PLAYER_UNIT_ATTACKED, Condition(function ReturnTrue))
set i = i + 1
exitwhen i == 16
endloop
call TriggerAddCondition( gg_trg_endfunction, Condition( function Zurueckstossen_Conditions ) )
call TriggerAddAction( gg_trg_endfunction, function Zurueckstossen_Actions )
endfunction
//TESH.scrollpos=31
//TESH.alwaysfold=0
function Trig_Einfrieren_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'AEer' ) ) then
return false
endif
return true
endfunction
function Trig_Einfrieren_Func003Func001C takes nothing returns boolean
if ( not ( IsUnitType(GetSpellTargetUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_Einfrieren_Func003C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('AEer', GetTriggerUnit()) == 1 ) ) then
return false
endif
return true
endfunction
function Trig_Einfrieren_Func004Func002002003 takes nothing returns boolean
return ( GetOwningPlayer(GetFilterUnit()) != GetOwningPlayer(GetTriggerUnit()) )
endfunction
function Trig_Einfrieren_Func004Func004A takes nothing returns nothing
set udg_TempPoint = GetUnitLoc(GetEnumUnit())
call CreateNUnitsAtLoc( 1, 'e00Y', GetOwningPlayer(GetTriggerUnit()), udg_TempPoint, bj_UNIT_FACING )
call UnitAddAbilityBJ( 'A03A', GetLastCreatedUnit() )
call RemoveLocation ( udg_TempPoint )
call UnitApplyTimedLifeBJ( 3.00, 'BTLF', GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "entanglingroots", GetEnumUnit() )
endfunction
function Trig_Einfrieren_Func004Func006C takes nothing returns boolean
if ( not ( IsUnitType(GetSpellTargetUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_Einfrieren_Func004C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('AEer', GetTriggerUnit()) == 2 ) ) then
return false
endif
return true
endfunction
function Trig_Einfrieren_Actions takes nothing returns nothing
local unit Freezed
set Freezed = GetSpellTargetUnit()
if ( Trig_Einfrieren_Func003C() ) then
if ( Trig_Einfrieren_Func003Func001C() ) then
call SetUnitTimeScalePercent( GetSpellTargetUnit(), 0.00 )
call PauseUnitBJ( true, GetSpellTargetUnit() )
call PolledWait( 8.00 )
call PauseUnitBJ( false, Freezed )
call SetUnitTimeScalePercent( Freezed, 100.00 )
else
call SetUnitTimeScalePercent( GetSpellTargetUnit(), 0.00 )
call PauseUnitBJ( true, GetSpellTargetUnit() )
call PolledWait( 13.00 )
call SetUnitTimeScalePercent( Freezed, 100.00 )
call PauseUnitBJ( false, Freezed )
endif
else
endif
if ( Trig_Einfrieren_Func004C() ) then
set udg_TempPoint = GetUnitLoc(GetSpellTargetUnit())
set udg_TempGroup = GetUnitsInRangeOfLocMatching(180.00, udg_TempPoint, Condition(function Trig_Einfrieren_Func004Func002002003))
call RemoveLocation ( udg_TempPoint )
call ForGroupBJ( udg_TempGroup, function Trig_Einfrieren_Func004Func004A )
call DestroyGroup ( udg_TempGroup )
if ( Trig_Einfrieren_Func004Func006C() ) then
call SetUnitTimeScalePercent( GetSpellTargetUnit(), 0.00 )
call PauseUnitBJ( true, GetSpellTargetUnit() )
call PolledWait( 8.00 )
call PauseUnitBJ( false, Freezed )
call SetUnitTimeScalePercent( Freezed, 100.00 )
else
call SetUnitTimeScalePercent( GetSpellTargetUnit(), 0.00 )
call PauseUnitBJ( true, GetSpellTargetUnit() )
call PolledWait( 13.00 )
call SetUnitTimeScalePercent( Freezed, 100.00 )
call PauseUnitBJ( false, Freezed )
endif
else
endif
set Freezed = null
endfunction
//===========================================================================
function InitTrig_Einfrieren takes nothing returns nothing
set gg_trg_Einfrieren = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Einfrieren, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Einfrieren, Condition( function Trig_Einfrieren_Conditions ) )
call TriggerAddAction( gg_trg_Einfrieren, function Trig_Einfrieren_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Dummyfreeze_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A03A' ) ) then
return false
endif
return true
endfunction
function Trig_Dummyfreeze_Actions takes nothing returns nothing
local unit DummyFreezed
set DummyFreezed = GetSpellTargetUnit()
call SetUnitTimeScalePercent( GetSpellTargetUnit(), 0.00 )
call PauseUnitBJ( true, GetSpellTargetUnit() )
call PolledWait( 2.20 )
call PauseUnitBJ( false, DummyFreezed )
call SetUnitTimeScalePercent( DummyFreezed, 100.00 )
set DummyFreezed = null
endfunction
//===========================================================================
function InitTrig_Dummyfreeze takes nothing returns nothing
set gg_trg_Dummyfreeze = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Dummyfreeze, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Dummyfreeze, Condition( function Trig_Dummyfreeze_Conditions ) )
call TriggerAddAction( gg_trg_Dummyfreeze, function Trig_Dummyfreeze_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Dummystone_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A02R' ) ) then
return false
endif
return true
endfunction
function Trig_Dummystone_Actions takes nothing returns nothing
local unit Stoned
set Stoned = GetSpellTargetUnit()
set udg_TempPoint = GetUnitLoc(GetSpellTargetUnit())
call AddSpecialEffectLocBJ( udg_TempPoint, "Units\\NightElf\\Wisp\\WispExplode.mdl" )
set udg_Effekte_Zaehler = ( udg_Effekte_Zaehler + 1 )
set udg_Effekt[udg_Effekte_Zaehler] = GetLastCreatedEffectBJ()
call RemoveLocation ( udg_TempPoint )
call SetUnitTimeScalePercent( GetSpellTargetUnit(), 0.00 )
call SetUnitVertexColorBJ( GetSpellTargetUnit(), 30.00, 30.00, 30.00, 0 )
call SetUnitInvulnerable( GetSpellTargetUnit(), true )
call PauseUnitBJ( true, GetSpellTargetUnit() )
call PolledWait( ( I2R(GetUnitAbilityLevelSwapped('A02R', GetTriggerUnit())) * 2.50 ) )
call SetUnitInvulnerable( Stoned, false )
call PauseUnitBJ( false, Stoned )
call SetUnitTimeScalePercent( Stoned, 100.00 )
call SetUnitVertexColorBJ( Stoned, 100.00, 100.00, 100.00, 0 )
set Stoned = null
endfunction
//===========================================================================
function InitTrig_Dummystone takes nothing returns nothing
set gg_trg_Dummystone = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Dummystone, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Dummystone, Condition( function Trig_Dummystone_Conditions ) )
call TriggerAddAction( gg_trg_Dummystone, function Trig_Dummystone_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_astralmage_Kopieren_Kopieren_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'AHfs' ) ) then
return false
endif
return true
endfunction
function Trig_astralmage_Kopieren_Kopieren_Actions takes nothing returns nothing
local unit Flamer
set Flamer = GetSpellAbilityUnit()
set udg_FlamePoint = GetSpellTargetLoc()
call CreateNUnitsAtLoc( 1, 'e004', GetOwningPlayer(GetSpellAbilityUnit()), udg_FlamePoint, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetLastCreatedUnit() )
call SetUnitTimeScalePercent( GetLastCreatedUnit(), 77.00 )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 72
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_TempPoint3 = PolarProjectionBJ(udg_FlamePoint, 600.00, ( I2R(GetForLoopIndexA()) * 5.00 ))
call CreateNUnitsAtLoc( 1, 'e005', GetOwningPlayer(Flamer), udg_FlamePoint, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 4.00, 'BTLF', GetLastCreatedUnit() )
call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", udg_TempPoint3 )
call RemoveLocation( udg_TempPoint3 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation( udg_FlamePoint )
endfunction
//===========================================================================
function InitTrig_astralmage_Kopieren_Kopieren takes nothing returns nothing
set gg_trg_astralmage_Kopieren_Kopieren = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_astralmage_Kopieren_Kopieren, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_astralmage_Kopieren_Kopieren, Condition( function Trig_astralmage_Kopieren_Kopieren_Conditions ) )
call TriggerAddAction( gg_trg_astralmage_Kopieren_Kopieren, function Trig_astralmage_Kopieren_Kopieren_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Feuerzirkel_Init_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A02Y' ) ) then
return false
endif
return true
endfunction
function Trig_Feuerzirkel_Init_Actions takes nothing returns nothing
local unit TempUnit
set udg_Feuerzirkel_Entfernung[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = 35.00
call GroupAddUnitSimple( GetSpellAbilityUnit(), udg_Feuerzirkelnde )
set TempUnit = GetSpellAbilityUnit()
call PolledWait( 12.00 )
call GroupRemoveUnitSimple( TempUnit, udg_Feuerzirkelnde )
endfunction
//===========================================================================
function InitTrig_Feuerzirkel_Init takes nothing returns nothing
set gg_trg_Feuerzirkel_Init = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Feuerzirkel_Init, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Feuerzirkel_Init, Condition( function Trig_Feuerzirkel_Init_Conditions ) )
call TriggerAddAction( gg_trg_Feuerzirkel_Init, function Trig_Feuerzirkel_Init_Actions )
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
function Trig_Kugel_Erstellen_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00J' ) ) then
return false
endif
return true
endfunction
function Trig_Kugel_Erstellen_Actions takes nothing returns nothing
local unit TempUnit2
set udg_Magiekugelopfer = GetSpellTargetUnit()
set TempUnit2 = GetSpellAbilityUnit()
set udg_Mora = AngleBetweenPoints(GetUnitLoc(GetSpellAbilityUnit()), GetUnitLoc(GetSpellTargetUnit()))
call SetUnitFacingToFaceUnitTimed( TempUnit2, udg_Magiekugelopfer, 0 )
call PauseUnitBJ( true, udg_Magiekugelopfer )
call SetUnitFacingToFaceUnitTimed( udg_Magiekugelopfer, GetSpellAbilityUnit(), 0 )
set udg_TempPoint = PolarProjectionBJ(GetUnitLoc(GetSpellAbilityUnit()), 128.00, GetUnitFacing(GetSpellAbilityUnit()))
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 18
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_MagieCounter = ( udg_MagieCounter + 1 )
call CreateNUnitsAtLoc( 1, 'e00T', GetOwningPlayer(GetSpellAbilityUnit()), udg_TempPoint, ( I2R(GetForLoopIndexA()) * 20.00 ) )
call UnitApplyTimedLifeBJ( ( DistanceBetweenPoints(GetUnitLoc(udg_Magiekugelopfer), GetUnitLoc(TempUnit2)) / 595.00 ), 'BTLF', GetLastCreatedUnit() )
set udg_Magiekugel[udg_MagieCounter] = GetLastCreatedUnit()
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation ( udg_TempPoint )
call TriggerSleepAction( ( DistanceBetweenPoints(GetUnitLoc(udg_TempUnit), GetUnitLoc(TempUnit2)) / 577.00 ) )
call PauseUnitBJ( false, udg_Magiekugelopfer )
set udg_TempPoint2 = GetUnitLoc(udg_Magiekugelopfer)
call CreateNUnitsAtLoc( 1, 'e00F', Player(PLAYER_NEUTRAL_PASSIVE), udg_TempPoint2, bj_UNIT_FACING )
call RemoveLocation ( udg_TempPoint2 )
call SetUnitTimeScalePercent( GetLastCreatedUnit(), 65.00 )
call UnitApplyTimedLifeBJ( 3.00, 'BTLF', GetLastCreatedUnit() )
set udg_Magiekugelopfer = null
endfunction
//===========================================================================
function InitTrig_Kugel_Erstellen takes nothing returns nothing
set gg_trg_Kugel_Erstellen = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Kugel_Erstellen, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Kugel_Erstellen, Condition( function Trig_Kugel_Erstellen_Conditions ) )
call TriggerAddAction( gg_trg_Kugel_Erstellen, function Trig_Kugel_Erstellen_Actions )
endfunction
//TESH.scrollpos=5
//TESH.alwaysfold=0
function Trig_Begin_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A01L' ) ) then
return false
endif
return true
endfunction
function Trig_Begin_Func012C takes nothing returns boolean
if ( not ( udg_SaugerInteger == 0 ) ) then
return false
endif
return true
endfunction
function Trig_Begin_Actions takes nothing returns nothing
local unit Ansauger
set Ansauger = GetSpellAbilityUnit()
call SetUnitMoveSpeed( GetSpellAbilityUnit(), 0.00 )
call CreateNUnitsAtLoc( 1, 'e010', GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(GetTriggerUnit()), bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 13.00, 'BTLF', GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "move", GetSpellAbilityUnit() )
set udg_SaugerInteger = ( udg_SaugerInteger + 1 )
call PolledWait( 10.00 )
call SetUnitMoveSpeed( Ansauger, GetUnitDefaultMoveSpeed(Ansauger) )
set udg_SaugerInteger = ( udg_SaugerInteger - 1 )
if ( Trig_Begin_Func012C() ) then
call DisableTrigger( gg_trg_Blast )
else
endif
set Ansauger = null
endfunction
//===========================================================================
function InitTrig_Begin takes nothing returns nothing
set gg_trg_Begin = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Begin, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Begin, Condition( function Trig_Begin_Conditions ) )
call TriggerAddAction( gg_trg_Begin, function Trig_Begin_Actions )
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope Bladestorm
// Spell made by Mr.Malte
globals
private constant real Duration = 10.00
private constant real SPEED = 10.
private constant real Percentage = 0.31
private constant real AoE = 1400.
private constant real Min_Range = 225.
private constant string Effect = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
blade array Blade
private unit Temp
endglobals
struct blade
integer up = 0
unit caster
endstruct
function Trig_Begin_Kopieren_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A01L' ) ) then
return false
endif
return true
endfunction
private function Distance takes real xA, real yA, real xB, real yB returns real
local real dx = xB-xA
local real dy = yB-yA
return SquareRoot(dx * dx + dy * dy)
endfunction
private function FilterS takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false ) and ( GetOwningPlayer(Temp) != GetOwningPlayer(GetFilterUnit()) ) and ( GetWidgetLife(GetFilterUnit()) > 1.500 )
endfunction
private function Suck takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g = CreateGroup()
local unit lo
local real angle
local real dist
local blade b = Blade[GetTimerData(t)]
set b.up = b.up + 1
set Temp = b.caster
call GroupEnumUnitsInRange(g,GetUnitX(b.caster),GetUnitY(b.caster),AoE,Filter(function FilterS))
loop
exitwhen FirstOfGroup(g) == null
set lo = FirstOfGroup(g)
set angle = Atan2(GetUnitY(lo) - GetUnitY(b.caster), GetUnitX(lo) - GetUnitX(b.caster))
set dist = Distance(GetUnitX(b.caster),GetUnitY(b.caster),GetUnitX(lo),GetUnitY(lo))
//debug call Debug("Distance: "+R2S(dist))
if ( dist > Min_Range ) then
call SetUnitY(lo,GetUnitY(lo)-(SPEED*udg_Interval+((AoE-dist)*udg_Interval*Percentage))*Sin(angle))
call SetUnitX(lo,GetUnitX(lo)-(SPEED*udg_Interval+((AoE-dist)*udg_Interval*Percentage))*Cos(angle))
//call SetUnitPosition(lo,GetUnitX(lo)-(SPEED*udg_Interval+((AoE-dist)*udg_Interval*Percentage))*Cos(angle),GetUnitY(lo)-(SPEED*udg_Interval+((AoE-dist)*udg_Interval*Percentage))*Sin(angle))
endif
//call SetUnitY(lo,GetUnitY(lo)-(SPEED*Update+((AoE-dist)*Update*Percentage))*Sin(angle))
call GroupRemoveUnit(g,lo)
endloop
call DestroyGroup(g)
if b.up == (Duration/udg_Interval) then
call ReleaseTimer(t)
call b.destroy()
endif
//set t = null
set lo = null
set g = null
endfunction
function Trig_Begin_Kopieren_Actions takes nothing returns nothing
local unit cast = GetTriggerUnit()
local timer t = NewTimer()
local blade b = blade.create()
set b.caster = cast
set Blade[integer(b)] = b
call SetTimerData(t,integer(b))
call TimerStart(t,udg_Interval,true,function Suck)
set cast = null
endfunction
//===========================================================================
function InitTrig_Begin_Kopieren takes nothing returns nothing
set gg_trg_Begin_Kopieren = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Begin_Kopieren, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Begin_Kopieren, Condition( function Trig_Begin_Kopieren_Conditions ) )
call TriggerAddAction( gg_trg_Begin_Kopieren, function Trig_Begin_Kopieren_Actions )
endfunction
endscope
//TESH.scrollpos=10
//TESH.alwaysfold=0
function Trig_Finishing_stroke_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A01N' ) ) then
return false
endif
return true
endfunction
function Trig_Finishing_stroke_Func006C takes nothing returns boolean
if ( not ( udg_TempVar > 380.00 ) ) then
return false
endif
return true
endfunction
function Trig_Finishing_stroke_Func007C takes nothing returns boolean
if ( not ( udg_TempVar < 60.00 ) ) then
return false
endif
return true
endfunction
function Trig_Finishing_stroke_Actions takes nothing returns nothing
local effect TempEffect
call SetUnitManaBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_MANA, GetTriggerUnit()) - 70.00 ) )
call AddSpecialEffectTargetUnitBJ( "weapon", GetTriggerUnit(), "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl" )
set TempEffect = GetLastCreatedEffectBJ()
set udg_TempVar = ( ( GetUnitStateSwap(UNIT_STATE_MAX_LIFE, GetSpellTargetUnit()) - GetUnitStateSwap(UNIT_STATE_LIFE, GetSpellTargetUnit()) ) * 0.50 )
if ( Trig_Finishing_stroke_Func006C() ) then
set udg_TempVar = 380.00
else
endif
if ( Trig_Finishing_stroke_Func007C() ) then
set udg_TempVar = 60.00
else
endif
call UnitDamageTargetBJ( GetSpellAbilityUnit(), GetSpellTargetUnit(), udg_TempVar, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
set udg_TempPoint = GetUnitLoc(GetSpellTargetUnit())
call AddSpecialEffectLocBJ( udg_TempPoint, "Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl" )
set udg_Effekte_Zaehler = ( udg_Effekte_Zaehler + 1 )
set udg_Effekt[udg_Effekte_Zaehler] = GetLastCreatedEffectBJ()
call AddSpecialEffectLocBJ( udg_TempPoint, "war3mapImported\\ArcaneExplosion.mdx" )
set udg_Effekte_Zaehler = ( udg_Effekte_Zaehler + 1 )
set udg_Effekt[udg_Effekte_Zaehler] = GetLastCreatedEffectBJ()
call SetUnitPositionLoc( GetSpellAbilityUnit(), udg_TempPoint )
call RemoveLocation ( udg_TempPoint )
call TriggerSleepAction( 0.50 )
call DestroyEffectBJ( TempEffect )
endfunction
//===========================================================================
function InitTrig_Finishing_stroke takes nothing returns nothing
set gg_trg_Finishing_stroke = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Finishing_stroke, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Finishing_stroke, Condition( function Trig_Finishing_stroke_Conditions ) )
call TriggerAddAction( gg_trg_Finishing_stroke, function Trig_Finishing_stroke_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Ability_Trigger_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A03Q' ) ) then
return false
endif
return true
endfunction
function Trig_Ability_Trigger_Func032C takes nothing returns boolean
if ( not ( udg_Leaping_Strike_Counter == 0 ) ) then
return false
endif
return true
endfunction
function Trig_Ability_Trigger_Actions takes nothing returns nothing
local unit TempStrike
set udg_Leaping_Strike_Counter = ( udg_Leaping_Strike_Counter + 1 )
call EnableTrigger( gg_trg_Leap_basic )
set TempStrike = GetSpellAbilityUnit()
call PauseUnitBJ( true, TempStrike )
call SetUnitPathing( TempStrike, false )
call SetUnitTimeScalePercent( TempStrike, 70.00 )
call SetUnitAnimation( TempStrike, "attack slam" )
call UnitAddAbilityBJ( 'Amrf', TempStrike )
call UnitRemoveAbilityBJ( 'Amrf', TempStrike )
call SetUnitFlyHeightBJ( TempStrike, 300.00, 900.00 )
call TriggerSleepAction( 0.30 )
call SetUnitFlyHeightBJ( TempStrike, 0.00, 900.00 )
call TriggerSleepAction( 0.40 )
call SetUnitPathing( TempStrike, true )
call SetUnitTimeScalePercent( TempStrike, 100.00 )
call PauseUnitBJ( false, TempStrike )
set udg_TempPoint = PolarProjectionBJ(GetUnitLoc(TempStrike), 50.00, GetUnitFacing(TempStrike))
call CreateNUnitsAtLoc( 1, 'e00Y', GetOwningPlayer(TempStrike), udg_TempPoint, bj_UNIT_FACING )
call AddSpecialEffectLocBJ( udg_TempPoint, "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl" )
call RemoveLocation( udg_TempPoint )
call UnitAddAbilityBJ( 'A03R', GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( 'A03R', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A03Q', TempStrike) )
call IssueImmediateOrderBJ( GetLastCreatedUnit(), "stomp" )
call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
set udg_Leap_Strike[GetConvertedPlayerId(GetOwningPlayer(TempStrike))] = null
set udg_Leap_Strike_MoveCalculator[GetConvertedPlayerId(GetOwningPlayer(TempStrike))] = 0
set TempStrike = null
set udg_Leaping_Strike_Counter = ( udg_Leaping_Strike_Counter - 1 )
if ( Trig_Ability_Trigger_Func032C() ) then
call DisableTrigger( gg_trg_Leap_basic )
else
endif
endfunction
//===========================================================================
function InitTrig_Ability_Trigger takes nothing returns nothing
set gg_trg_Ability_Trigger = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ability_Trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ability_Trigger, Condition( function Trig_Ability_Trigger_Conditions ) )
call TriggerAddAction( gg_trg_Ability_Trigger, function Trig_Ability_Trigger_Actions )
endfunction
//TESH.scrollpos=65
//TESH.alwaysfold=0
library GroupEnumUnitsOnLine
globals
//upper bound for the collision size of units
private constant real MAX_COLLISSION = 128.
//---
private rect temprect = Rect(0,0,0,0)
private group tempenumgroup = CreateGroup()
private group tempgroup
private real temppx
private real temppy
private real tempdnx
private real tempdny
private real tempwidth
private real tempd
endglobals
private function Add takes nothing returns boolean
//position of unit
local real x = GetUnitX(GetFilterUnit())
local real y = GetUnitY(GetFilterUnit())
//vector from the beginning of the line to the unit
local real dx = x - temppx
local real dy = y - temppy
//distance from the beginning of the line to that point on the line which is closest to the unit (uses dot-product)
local real d = dx * tempdnx + dy * tempdny
local real cx
local real cy
//cut off points outside the line
if d <= 0 then
set d = 0
elseif d >= tempd then
set d = tempd
endif
//the closest point to the unit on the line
set cx = temppx + d * tempdnx
set cy = temppy + d * tempdny
if IsUnitInRangeXY(GetFilterUnit(), cx, cy, tempwidth) then
call GroupAddUnit(tempgroup, GetFilterUnit())
endif
return false
endfunction
function GroupEnumUnitsOnLine takes group g, real px, real py, real qx, real qy, real width returns nothing
//d = from p to q
local real dx = qx - px
local real dy = qy - py
local real dlen = SquareRoot(dx*dx + dy*dy)
//normalized d
local real dxn = dx / dlen
local real dyn = dy / dlen
//bonus so that the whole line is covered
local real bonus = width + MAX_COLLISSION
//move rect to right position
if dx > 0 then
if dy > 0 then
call SetRect(temprect, px - bonus, py - bonus, qx + bonus, qy + bonus)
else
call SetRect(temprect, px - bonus, qy - bonus, qx + bonus, py + bonus)
endif
else
if dy > 0 then
call SetRect(temprect, qx - bonus, py - bonus, px + bonus, qy + bonus)
else
call SetRect(temprect, qx - bonus, qy - bonus, px + bonus, py + bonus)
endif
endif
//set temp vars for groupenum
set tempgroup = g
set temppx = px
set temppy = py
set tempdnx = dxn
set tempdny = dyn
set tempwidth = width
set tempd = dlen
//enum units in rect
call GroupEnumUnitsInRect(tempenumgroup, temprect, Condition(function Add))
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Collector
module Collector
integer position
static thistype array Data
static integer Instances = 0
method onDestroy takes nothing returns nothing
set .Data[.position] = .Data[.Instances]
set .Instances = .Instances - 1
endmethod
static method create takes nothing returns thistype
local thistype w = thistype.allocate()
set .Instances = .Instances + 1
set w.position = .Instances
set .Data[.Instances] = w
return w
endmethod
endmodule
endlibrary
//TESH.scrollpos=0
//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 ClearTextMessages()
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)
//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=0
//TESH.alwaysfold=0
library dead
//returns true if the unit is alive. requires JassHelper
// to declare the AI native "UnitAlive" as a JASS native, so that
// we can use it in the trigger editor. If you trigger in vJASS,
// you should DEFINITELY use this since it is the only way to be
// sure that a unit is alive.
native UnitAlive takes unit id returns boolean
//returns true if the unit is dead. inline friendly.
function UnitDead takes unit u returns boolean
return not UnitAlive(u)
endfunction
//returns true if the unit exists in the game. inline friendly.
function DoesUnitExist takes unit u returns boolean
return GetUnitTypeId(u) != 0
endfunction
endlibrary
//TESH.scrollpos=122
//TESH.alwaysfold=0
// Made by Mr.Malte
// Give credits to Vexorian for TimerUtils and Table and to peq for GroupEnum and Mr.Malte for the rest when used.
library Disintegrate initializer Init requires Collector, TimedLife, dead, SimError, GroupEnumUnitsOnLine, Table
globals
private constant integer SPELL_ID = 'A02S'
private constant integer DUMMY_ID = 'e011'
private constant string LIGHTNING = "AFOD" //"AFOD" "CLPB" "DRAM" "MFPB" "DRAM"
private constant real LIGHTNING_HEIGHT = 150.
private constant real FPS = 60.
private constant real RADIUS = 90.
endglobals
globals
private trigger RegisterCast = CreateTrigger()
private trigger RegisterOrder = CreateTrigger()
private group Temp = CreateGroup()
private integer DamageInt = 20
private location zloc
private timer TT = CreateTimer()
private HandleTable USD
endglobals
private constant function BufferMana takes integer lvl returns real
return 40.
endfunction
private constant function DamagePerSecond takes integer lvl returns real
return 110.
endfunction
private constant function ManaPerSecond takes integer lvl returns real
return 40.
endfunction
private constant function Range takes integer lvl returns real
return 1300.
endfunction
private function GetZ takes real x, real y returns real
call MoveLocation(zloc,x,y)
return GetLocationZ(zloc)
endfunction
private function EyeCandy takes unit u returns nothing
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl",u,"origin"))
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl",u,"origin"))
set u = null
endfunction
struct Disintegrate
implement Collector
unit caster
unit dummy
integer lvl
integer up
static method operator [] takes unit for returns thistype
return USD[for]
endmethod
static method operator []= takes unit for, thistype what returns nothing
set USD[for] = what
endmethod
method doDestroy takes nothing returns nothing
if this != 0 then
call SetUnitTurnSpeed(.caster, 1.)
call SetUnitMoveSpeed(.caster,GetUnitDefaultMoveSpeed(.caster))
call RemoveUnit(.dummy)
call .destroy()
endif
if Disintegrate.Instances == 0 then
call PauseTimer(TT)
endif
endmethod
endstruct
private function DealDamage takes nothing returns nothing
local integer i = 0
local unit u
local real dmg
local integer lvl
local real angle
local real x
local real y
local real x2
local real y2
local integer ID = 0
local Disintegrate TD
loop
set i = i + 1
exitwhen i > Disintegrate.Instances
set TD = Disintegrate.Data[i]
set lvl = GetUnitAbilityLevel(TD.caster,SPELL_ID)
set TD.up = TD.up + 1
if TD.up == DamageInt then
set TD.up = 0
set dmg = DamagePerSecond(lvl)/FPS*DamageInt
call GroupEnumUnitsOnLine(Temp,GetUnitX(TD.caster),GetUnitY(TD.caster),GetUnitX(TD.dummy),GetUnitY(TD.dummy),RADIUS)
call GroupRemoveUnit(Temp,TD.caster)
call SetUnitState(TD.caster,UNIT_STATE_MANA,GetUnitState(TD.caster,UNIT_STATE_MANA)-(ManaPerSecond(lvl)/FPS*DamageInt))
loop
set u = FirstOfGroup(Temp)
exitwhen u == null
if UnitDead(u) == false then
call UnitDamageTarget(TD.caster,u,dmg,true,false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_FIRE,WEAPON_TYPE_WHOKNOWS)
call EyeCandy(u)
endif
call GroupRemoveUnit(Temp,u)
endloop
endif
set x = GetUnitX(TD.caster)
set y = GetUnitY(TD.caster)
set x2 = x + Range(lvl) * Cos(GetUnitFacing(TD.caster)*bj_DEGTORAD)
set y2 = y + Range(lvl) * Sin(GetUnitFacing(TD.caster)*bj_DEGTORAD)
call SetUnitX(TD.dummy,x2)
call SetUnitY(TD.dummy,y2)
call SetLightningTime(AddLightningEx(LIGHTNING,true,x,y,GetZ(x,y)+LIGHTNING_HEIGHT,x2,y2,GetZ(x2,y2)+LIGHTNING_HEIGHT),0.1)
if ( GetUnitState(TD.caster,UNIT_STATE_MANA) < 10. or GetUnitState(TD.caster,UNIT_STATE_LIFE) < 0.405 ) then
call TD.doDestroy()
endif
endloop
endfunction
private function checkID takes nothing returns boolean
if GetSpellAbilityId() == SPELL_ID then
return true
endif
return false
endfunction
public function StopDisintegrate takes unit u returns nothing
local Disintegrate aaa = Disintegrate[u]
call aaa.doDestroy()
endfunction
private function onCast takes nothing returns nothing
local Disintegrate a //= Disintegrate.create()
local location lb// = GetSpellTargetLoc()
if GetUnitState(GetTriggerUnit(),UNIT_STATE_MANA) < BufferMana(GetUnitAbilityLevel(GetTriggerUnit(),SPELL_ID)) then
call SimError(GetOwningPlayer(GetTriggerUnit()),"You need more buffer Mana.")
return
endif
set a = Disintegrate.create()
set lb = GetSpellTargetLoc()
if Disintegrate.Instances == 1 then
call TimerStart(TT,1./FPS,true,function DealDamage)
endif
set a.caster = GetTriggerUnit()
set a.lvl = GetUnitAbilityLevel(a.caster,SPELL_ID)
set a.dummy = CreateUnit(GetOwningPlayer(a.caster),DUMMY_ID,GetLocationX(lb),GetLocationY(lb),0.)
call SetUnitTurnSpeed(a.caster, 0.007)
call SetUnitMoveSpeed(a.caster,10)
set Disintegrate[a.caster] = a
call RemoveLocation(lb)
endfunction
private function Init takes nothing returns nothing
call TriggerAddAction(RegisterCast,function onCast)
call TriggerAddCondition(RegisterCast,Condition(function checkID))
call TriggerRegisterAnyUnitEventBJ( RegisterCast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
set zloc = Location(0,0)
set USD = Table.create()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library TimedLife requires TimerUtils
//! textmacro Timer takes CASENAME, NAME, DESTROY
struct Destroy$NAME$
$NAME$ i
static method create takes $NAME$ ab returns Destroy$NAME$
local Destroy$NAME$ a = Destroy$NAME$.allocate()
set a.i = ab
return a
endmethod
method onDestroy takes nothing returns nothing
set .i = null
endmethod
endstruct
private function $NAME$Kill takes nothing returns nothing
local timer t = GetExpiredTimer()
local Destroy$NAME$ a = GetTimerData(t)
if a.i != null then
call $DESTROY$(a.i)
endif
call a.destroy()
call ReleaseTimer(t)
endfunction
function Set$CASENAME$Time takes $NAME$ u, real time returns nothing
local timer t = NewTimer()
call SetTimerData(t,Destroy$NAME$.create(u))
call TimerStart(t,time,false,function $NAME$Kill)
endfunction
//! endtextmacro
// runtextmacro Timer("Unit","unit","RemoveUnit")
// runtextmacro Timer("Effect","effect","DestroyEffect")
//! runtextmacro Timer("Lightning","lightning","DestroyLightning")
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
* ================================ *
* P R O S A N D C O N T R A S *
* ================================ *
compared to other knockback-systems
[+]
1. This knockback system is very userfriendly. You cant make any other knockback-system fit your
needs as easily as with this.
2. This knockback system is also very userfriendly for only GUI-users, because there are unique options
which make it easy with GUI-triggers to knockback units.
You dont need any custom scripts.
3. This system has a great performance.
It uses structs, clears them up, uses coordinates, rects to kill trees, nulls local variables,
creates only two dummies and keeps them, uses fast Attachment Systems (3 systems choosable.
All made by me) and so on.
4. The implemantion is very easy, because of the used libraries.
5. This system is clear of bugs.
When units hit trees, the trees get killed.
When units hit water, the knockback stops.
Units cant slide out of the map.
[+/-]
1. The system creates for each knockback a single timer. I dont think
that is too bad, but it is not the fastest way possible.
But it could also be useful, because you can use different intervals
for knockbacks. If you want to make really fast knockbacks, you could
lower the timer expiration time for that knockback and keep it for
the other ones. This could make the performance compared to the prettiness
much better.
[-]
1. You have to create two dummy-units to use the knockback-system
//TESH.scrollpos=0
//TESH.alwaysfold=0
1. This Knockback System requires the JassNewGenPack.
The JassNewGenPack is a special editor created by a guy
named Vexorian.
2. You have to create two dummy units;
These dummies may not be able to block units.
The first dummy must be able to fly.
The second dummy must be able to swim.
==Tip==
In this map there are already two fitting dummy units.
Its the best, if you copy both or one of the dummy units.
You need two dummies. If you just want to copy one, change
the Movement Type of the other dummy to Flying or Swimming.
3. Copy all the Text from the trigger 'Code for the Header' to the
header* of your map.
4. Go to the header and make the Knockback System fit your needs.
All the things you can edit are written down and documentated clearly
there. The most important thing is to change the rawcode** of the integers
Dummy_Type1 and Dummy_Type2 to the rawcode of your new dummy units.
5. !Give credits to "Mr.Malte"! and if you want to Cedi and Vexorian.
6. Have fun with using this System ;-)
*Header is the little scroll on top of all trigger folders with the name of your map.
**If you go into the Object Editor and press Alt + D there, the rawcodes of units,
abilities and so on are shown.
//TESH.scrollpos=0
//TESH.alwaysfold=0
The Parameters of the Knockback functions;
call Knockback(unit WhichUnitTarget, unit ByWhichUnit, real HowFast, real HowWide, real BreakValue, boolean ShowDustEffect)
//TESH.scrollpos=0
//TESH.alwaysfold=0
==== E N G L I S H ====
I prepared some GUI-functions for people who dont understand JASS.
These GUI-functions are found beneath 'Additional Service'.
In the trigger 'Global Knockback Parameters' there is a list with units.
If you want a unit to knockback another unit, you can put that unit
that shall knockback in the list and set Speed, Range and Friction
to the values you want.
Alternatively you can declare the variables with the prefix Glob
and run the trigger 'GlobalKnockBack' then.
==== D E U T S C H ====
Für Diejenigen, die kein JASS können, habe ich einige GUI-Funktionen
vorbereitet, welche unter 'Additional Service' gefunden werden können.
In dem Auslöser 'Global Knockback Parameters' befindet sich eine Liste mit
Einheiten. Wenn du willst, dass eine Einheit eine andere zurückschleudert,
kannst du diese Einheit in die dortige Liste eintragen, inklusive der Daten
'Speed', 'Range' und 'Friction'.
Alternativ kannst du auch die Variablen mit dem Präfix Glob bestimmen
und den Auslöser 'GlobalKnockBack' starten.
==== You should check the header* of the map and configure the Knockback_System ====
==== Du solltest unbedingt in den Header* der map schauen und das System konfigurieren ====
*header is the little scroll on top of all trigger folders with the name of your map.
*Der Header ist die kleine Rolle über allen Auslöser-Ordnern und hat den Namen deiner Map.
PLEASE GIVE CREDITS WHEN YOU USE THIS KNOCKBACK SYSTEM
BITTE GIB MIR CREDITS, WENN DU DIESES SYSTEM BENUTZT.
//TESH.scrollpos=0
//TESH.alwaysfold=0
//***************************************************************************************************************
//* *
//* K N O C K B A C K *
//* Actual Code *
//* v1.25 *
//* *
//* By: Mr.Malte *
//* *
//***************************************************************************************************************
// ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//¤ Requires JassNewGenPack Editor!
//¤ Knockback System v1.24
//¤ Requires swimming dummy
//¤ Requires non-swimming dummy
//¤
//¤¤ USED SYSTEMS:
//¤
//¤ - My TSA System; Timer Struct Attachment.
//¤ - My HA System; Handle Attachment.
//¤ - My GCSA System; Game Cache Struct Attachment.
//¤ SPECIAL THANKS TO:
//¤
//¤ - Vexorian for JassNewGenPack
//¤ - Cedi for SetUnitXY function
// ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//! Note!
// If you want one of my systems, TimerStructAttachment or HandleAttachment, give credits!
//! GIVE CREDITS WHEN YOU USE THE KNOCKBACK SYSTEM!
// If you want to edit the knockback System, change the values of the section
// "Configurable Data".
function GlobalKnockBack takes nothing returns nothing
call Knockback(udg_GlobOpfer, udg_GlobAtk, udg_GlobSpeed, udg_GlobDistanz, udg_GlobFriction, udg_GlobShowEffects)
endfunction
library KnockBackFunctions initializer KnockBackInit
globals
// * ================================== *
// * C O N F I G U R A B L E D A T A *
// * ================================== *
//! ====TIMER_INTERVAL====
// A higher number will increase the performance
// A lower number will make the knockback smoother
// !Note!- if you increase the speed of the timer, the units wont slide faster.
// The speed will be kept.
//! ====DUST_DENSITY====
// Every TIMER_INTERVAL * DUST_DENSITY seconds a dust effect is shown.
// Decrease DUST_DENSITY to create more densitive dust (recommended for fast-speed-knockbacks)
// Increase DUST_DENSITY to increase the performance ( recommended, when many units at the same time are knocked back)
//! ====DUST_MODEL====
// This Model is the dust that is shown. If you want to know the string of another model, go
// to the object-editor, chose your model somewhere and press ok.
// If you click on your model-field again, the string of the model is shown
// at 'Own'.
// Important: You must replace '\' in the string with '\\'
//! ====REQUIRES_UNBLOCKED=====
// If this boolean is true, the unit gets only moved if the new location of the unit is not blocked.
// That would prevent that units slide into water, but they can still slide on cliffs.
// If the new position of the unit is blocked and the boolean is true, the knockback stops instantly.
//! ====DUMMY_TYPE[1]=====
// If RETQUIRES_UNBLOCKED is true, you need two dummy units;
// DUMMY_TYPE[1] must be able to swim.
// DUMMY_TYPE[2] mustn't be able to swim.
//! ====DUMMY_TYPE[2]=====
// If RETQUIRES_UNBLOCKED is true, you need two dummy units;
// DUMMY_TYPE[1] must be able to swim.
// DUMMY_TYPE[2] mustn't be able to swim.
//! ====ATTACHMENT_SYSTEM=====
// This is the system which is used to attach the parameters
// of the knockback to the timer that works with them.
// ===Possible options===
// "TimerStructAttachment"
// "HandleAttachment"
// "Game Cache"
// If ATTACHMENT_SYSTEM is "TimerStructAttachment",
// the Knockback-System is not as fast as with "HandleAttachment", but you can run 500 knockbacks (configurable)
// at the same time without any bugs.
// If ATTACHMENT_SYSTEM is "HandleAttachment",
// the system is faster, that means less lag, but if
// your map contains a lot of units and timers and blablabla. Handles.
// Then bugs could appear.
// Actually this system is the best choice, because of the speed and bugs are very rare.
// But if the system says "HandleAttachment System is too full." somewhen,
// you should swap to the TimerStructAttachment or Game Cache
// If ATTACHMENT_SYSTEM is "Game Cache",
// you use the savest, but also the slowest Attachment System.
// You should only use this, if both systems, TSA and HA give error
// messages.
//! ====KILLTREE_RADIUS=====
// Units destroy trees in this radius.
// You can also use the function Precise_Knockback to make an individual KILLTRE_RADIUS for each knockback.
//! ====PERCENTAGE_KNOCKBACK=====
// This number should be 1.00
// 1.00 means, that the speed and friction of all Knockbacks is
// Speed*1.00 and Friction*1.00
//! =====MOVEBACK=====
// If a unit hits water, it gets moved back by this amount.
// Choose a higher number if units stuck in water often.
private constant real TIMER_INTERVAL = 0.03
private constant integer DUST_DENSITY = 11
private constant string DUST_MODEL = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
private constant boolean REQUIRES_UNBLOCKED = true
private constant integer DUMMY_TYPE1 = 'e000'
private constant integer DUMMY_TYPE2 = 'e001'
private constant string ATTACHMENT_SYSTEM = "TimerStructAttachment"
private constant real KILLTREE_RADIUS = 110.
private constant real PERCENTAGE_KNOCKBACK = 2.00
private constant real MOVEBACK = 30.
endglobals
// ==============================================================
// T I M E R S T R U C T A T T A C H M E N T S Y S T E M
// ==============================================================
// TSA; TimerStructAttachment
// Description:
// Attaches an integer to a timer
// This could be used for global struct arrays.
// So attach the number of the struct to the timer.
// WARNING: Do not attach more than one integer to a timer.
// This would make the function break.
// If you want to attach a struct number, you do not even
// need to to this.
// Made by Mr.Malte
//library TimerStructAttachment initializer inline
private function h2i takes handle h returns integer
return h
return 0
endfunction
private function Debug takes string s returns nothing
call DisplayTextToForce(GetPlayersAll(),s)
endfunction
globals
//integer Glob_HC
integer array Glob_DAT[500]
integer array Glob_GETHASH_DAT[500]
// The size of the system. 500 can attach 500 integers to 500 timers.
// If you want, you can also delete the prefix 'private constant ' and increase the integer
// DAT_SIZE dynamically. This will also make a better performance if you use it smartly.
// But with the prefix, the integer gets inlined.
constant integer DAT_SIZE = 500
endglobals
// set Glob_HC = Glob_HC + 1
// set Glob_DAT[Glob_HC] = b
// set Glob_GETHASH_DAT[Glob_HC] = a
// Tackert den integer b an den integer a.
// WARNUNG: Integer a darf nur ein h2i sein!
private function SetTimerInteger takes timer whichTimer, integer b returns nothing
local integer i = 0
local integer a = h2i(whichTimer)
loop
set i = i + 1
exitwhen i > DAT_SIZE
if ( i > DAT_SIZE ) then // <== If you want more performance in the system, erase this If-Then-Else function.
call DisplayTextToForce(GetPlayersAll(),"Function SetTimerInteger is too full")
endif
if ( Glob_GETHASH_DAT[i] == 0 and Glob_DAT[i] == 0 ) then
set Glob_DAT[i] = b
set Glob_GETHASH_DAT[i] = a
set i = DAT_SIZE
endif
endloop
endfunction
// Mithilfe von integer a, bekommt man nun den integer b
private function GetTimerInteger takes timer whichTimer returns integer
local integer i = 0
local integer a = h2i(whichTimer)
loop
set i = i + 1
exitwhen i > DAT_SIZE
if ( a == Glob_GETHASH_DAT[i] ) then
return Glob_DAT[i]
endif
endloop
call DisplayTextToForce(GetPlayersAll(),"Function GetTimerInteger couldn't get stored integer")
return -1
endfunction
// Entfernt eine getackerten integer um Platz für einen neuen zu machen.
private function RemoveTimerInteger takes timer whichTimer returns nothing
local integer i = 0
local integer a = h2i(whichTimer)
loop
set i = i + 1
exitwhen i > DAT_SIZE
if ( a == Glob_GETHASH_DAT[i] ) then
set Glob_GETHASH_DAT[i] = 0
set Glob_DAT[i] = 0
set i = DAT_SIZE
endif
endloop
endfunction
function inline takes nothing returns nothing
endfunction
//endlibrary
// =================================================
// H A N D L E A T T A C H M E N T S Y S T E M
// =================================================
// HAS; Handle Attachment System
// WARNING: Do only attach one integer to a handle!
// Othwerwise the system will crash!//
//
//J U S T F O R A U T H O R
// Die ID eines handles ist 0x100000 + Zähler groß.
// wenn ich 0x100000 subtrahiere, passt das handle
// in den index eines arrays.
// Index[handleid-0x100000] = integer to attach.
// Dann ist der integer, den ich antackern will in
// dem array mit der Größe des IDs des handles minus 0x100000
// gespeichert und ich kann ihn wiedergeben.
// Damit die Größe der handles die Arraygröße nicht sprengen,
// gibt es 6 verschiedene integers, jeder kann 8192 handles speichern.
// Das heißt, mein System unterstützt 6*8192 handles.
// Das sind 49152 handles.
// Made by Mr.Malte
//! Debug Scripts:
//call Debug("handle has size " + I2S(hashnumber) + "+0x100000")
//call Debug("Stored to [" + I2S(index) + "][" + I2S(hashnumber) + "]")
//library HandleAttachment
globals
integer array HandleAttachArray
integer array HandleAttachArrayA
integer array HandleAttachArrayB
integer array HandleAttachArrayC
integer array HandleAttachArrayD
integer array HandleAttachArrayE
endglobals
private function SetHandleInteger takes handle h, integer i returns nothing
local integer hashnumber = h2i(h)-0x100000
local integer index = R2I(hashnumber/8192)
set hashnumber = hashnumber - index*8192
if ( index == 0 ) then
set HandleAttachArray[hashnumber] = i
elseif ( index == 1 ) then
set HandleAttachArrayA[hashnumber] = i
elseif ( index == 2 ) then
set HandleAttachArrayB[hashnumber] = i
elseif ( index == 3 ) then
set HandleAttachArrayC[hashnumber] = i
elseif ( index == 4 ) then
set HandleAttachArrayD[hashnumber] = i
elseif ( index == 5 ) then
set HandleAttachArrayE[hashnumber] = i
else
call Debug ("HandleAttachment System is too full.")
endif
endfunction
private function GetHandleInteger takes handle h returns integer
local integer hashnumber = h2i(h)-0x100000
local integer index = R2I(hashnumber/8192)
set hashnumber = hashnumber - index*8192
if ( index == 0 ) then
return HandleAttachArray[hashnumber]
elseif ( index == 1 ) then
return HandleAttachArrayA[hashnumber]
elseif ( index == 2 ) then
return HandleAttachArrayB[hashnumber]
elseif ( index == 3 ) then
return HandleAttachArrayC[hashnumber]
elseif ( index == 4 ) then
return HandleAttachArrayD[hashnumber]
elseif ( index == 5 ) then
return HandleAttachArrayE[hashnumber]
else
call Debug ("HandleAttachment System is too full.")
endif
return -1
endfunction
private function RemoveHandleInteger takes handle h returns nothing
local integer hashnumber = h2i(h)-0x100000
local integer index = R2I(hashnumber/8192)
set hashnumber = hashnumber - index*8192
if ( index == 0 ) then
set HandleAttachArray[hashnumber] = 0
elseif ( index == 1 ) then
set HandleAttachArrayA[hashnumber] = 0
elseif ( index == 2 ) then
set HandleAttachArrayB[hashnumber] = 0
elseif ( index == 3 ) then
set HandleAttachArrayC[hashnumber] = 0
elseif ( index == 4 ) then
set HandleAttachArrayD[hashnumber] = 0
elseif ( index == 5 ) then
set HandleAttachArrayE[hashnumber] = 0
else
call Debug ("HandleAttachment System is too full.")
endif
endfunction
//endlibrary
// End of Handle Attachment System
function SetUnitXY takes unit u, real x, real y returns boolean
local real minx = GetRectMinX(bj_mapInitialPlayableArea)
local real maxx = GetRectMaxX(bj_mapInitialPlayableArea)
local real miny = GetRectMinY(bj_mapInitialPlayableArea)
local real maxy = GetRectMaxY(bj_mapInitialPlayableArea)
if x < minx then
return false
elseif x > maxx then
return false
else
call SetUnitX(u, x)
endif
if y < miny then
return false
elseif y > maxy then
return false
else
call SetUnitY (u, y)
endif
return false
endfunction
private function IsWaterLoc takes real x, real y returns boolean
call SetUnitPosition(udg_Knockback_Dummy1,x,y)
call SetUnitPosition(udg_Knockback_Dummy2,x,y)
if ( GetUnitX(udg_Knockback_Dummy1) == GetUnitX(udg_Knockback_Dummy2) and GetUnitY(udg_Knockback_Dummy1) == GetUnitY(udg_Knockback_Dummy2)) then
return false
endif
return true
endfunction
public struct KB
boolean bool
integer kbi
integer up
real speed
real distanz
real friction
real slidet
real killtreerange
timer knockbacktimer
unit atk
unit opfer
endstruct
globals
gamecache Cache = InitGameCache("GCRB.w3v")
private integer Total = 0
private KB array Knockbackdata
private boolexpr Treekillcondition = null
endglobals
// These functions were used to attach the struct to my timer,
// before I implemented the Timer Struct Attachment System made by me.
// I don't know, how effective the new system is. But it is bugfree
// and a lot more effective than game cache.
// I also have an alternative system which is also made by me but
// fast like hell. The bad thing about that system is, that it's susceptible
// to bugs.
function AttachStruct takes handle u, integer value returns nothing
local integer id = h2i(u)
call StoreInteger(Cache,"Struct",I2S(id),value)
endfunction
function GetStruct takes handle u returns integer
local integer id = h2i(u)
return GetStoredInteger(Cache,"Struct",I2S(id))
endfunction
public function TreeFilter takes nothing returns boolean
local integer d = GetDestructableTypeId(GetFilterDestructable())
return d == 'ATtr' or d == 'BTtw' or d == 'KTtw' or d == 'YTft' or d == 'JTct' or d == 'YTst' or d == 'YTct' or d == 'YTwt' or d == 'JTwt' or d == 'JTwt' or d == 'FTtw' or d == 'CTtr' or d == 'ITtw' or d == 'NTtw' or d == 'OTtw' or d == 'ZTtw' or d == 'WTst' or d == 'LTlt' or d == 'GTsh' or d == 'Xtlt' or d == 'WTtw' or d == 'Attc' or d == 'BTtc' or d == 'CTtc' or d == 'ITtc' or d == 'NTtc' or d == 'ZTtc'
endfunction
function UpdateTotal takes nothing returns nothing
local integer i = 201
loop
exitwhen i == 0
set i = i - 1
if ( Knockbackdata[i] != null ) then
set Total = i
set i = 200
return
endif
endloop
endfunction
private function KillTree takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
private function KnockbackCreate takes nothing returns nothing
local timer expired = GetExpiredTimer() // Used for the system - means not important for you
local integer structNR //= GetTimerInteger(expired)
local KB knock //= Knockbackdata[structNR]
local integer i = 0 // Used for the system
local real x = 0. // Used for the system
local real y = 0. // Used for the system
local real newx = 0. // Used for the system
local real newy = 0. // Used for the system
local effect e = null // Used for the system
local real angle = 0. // Used for the system
local real speed //= knock.speed // The speed the target slides with
local real distanz //= knock.distanz // Distance the target unit slides
local boolean bool //= knock.bool // Show effects? True and the effect is shown.
local rect killtrees
if ( ATTACHMENT_SYSTEM == "Game Cache" ) then
set structNR = GetStruct(expired)
elseif ( ATTACHMENT_SYSTEM == "TimerStructAttachment" ) then
set structNR = GetTimerInteger(expired)
elseif ( ATTACHMENT_SYSTEM == "HandleAttachment" ) then
set structNR = GetHandleInteger(expired)
endif
set knock = Knockbackdata[structNR]
set speed = knock.speed
set distanz = knock.distanz
set bool = knock.bool
set x = GetUnitX(knock.opfer)
set y = GetUnitY(knock.opfer)
set angle = Atan2(y - GetUnitY(knock.atk), x - GetUnitX(knock.atk))
set killtrees = Rect(x - knock.killtreerange, y - knock.killtreerange, x + knock.killtreerange, y + knock.killtreerange)
set speed = speed - knock.friction
set knock.speed = speed
set knock.slidet = knock.slidet + speed
set newx = x + speed * Cos(angle)
set newy = y + speed * Sin(angle)
call EnumDestructablesInRect(killtrees, Treekillcondition, function KillTree)
call RemoveRect(killtrees)
if ( REQUIRES_UNBLOCKED == true ) then
if ( IsWaterLoc(newx,newy) ) then
call RemoveTimerInteger(expired)
if ( ATTACHMENT_SYSTEM == "TimerStructAttachment" ) then
call RemoveTimerInteger(expired)
elseif (ATTACHMENT_SYSTEM == "HandleAttachment" ) then
call RemoveHandleInteger(expired)
endif
set newx = x - MOVEBACK * Cos(angle)
set newy = y - MOVEBACK * Sin(angle)
call SetUnitXY(knock.opfer, newx, newy)
call PauseUnit(knock.opfer,false)
call PauseTimer(expired)
call DestroyTimer(expired)
call knock.destroy()
set Total = Total - 1
set expired = null
endif
endif
call SetUnitXY(knock.opfer, newx, newy)
call RemoveRect(killtrees)
set killtrees = null
if (knock.up == DUST_DENSITY) then // up is used to count up an integer. When the integer hits the constant integer DUST_DENSITY (basic 7), the dust is shown - to decrease lagg
set knock.up = 0
if ( knock.bool == true ) then
call DestroyEffect(AddSpecialEffect(DUST_MODEL, x, y))
endif
endif
if ( speed < 0.1 ) then
if ( ATTACHMENT_SYSTEM == "TimerStructAttachment" ) then
call RemoveTimerInteger(expired)
elseif (ATTACHMENT_SYSTEM == "HandleAttachment" ) then
call RemoveHandleInteger(expired)
endif
call PauseUnit(knock.opfer,false)
call PauseTimer(expired)
call DestroyTimer(expired)
call knock.destroy()
set Total = Total - 1
set expired = null
endif
if ( knock.slidet > distanz ) then
if ( ATTACHMENT_SYSTEM == "TimerStructAttachment" ) then
call RemoveTimerInteger(expired)
elseif (ATTACHMENT_SYSTEM == "HandleAttachment" ) then
call RemoveHandleInteger(expired)
endif
call PauseUnit(knock.opfer,false)
call PauseTimer(expired)
call DestroyTimer(expired)
call knock.destroy()
set Total = Total - 1
set expired = null
endif
set knock.up = knock.up + 1
// === NULL LOCAL VARIABLES to decrease laggs === \\
set expired = null
endfunction
function Knockback takes unit opfer, unit atk, real speed, real distanz, real friction, boolean b returns nothing
local timer t = CreateTimer()
local KB knock = KB.create()
set speed = (speed * (TIMER_INTERVAL*25)) * PERCENTAGE_KNOCKBACK
set friction = (friction * (TIMER_INTERVAL*25)) * PERCENTAGE_KNOCKBACK
set knock.opfer = opfer
set knock.atk = atk
set knock.speed = speed
set knock.distanz = distanz
set knock.slidet = 10.
set knock.friction = friction
set knock.up = 0
set knock.bool = b
set knock.killtreerange = KILLTREE_RADIUS
set Total = Total + 1
if ( Total > 200 ) then
call UpdateTotal()
endif
set Knockbackdata[Total] = knock
if ( ATTACHMENT_SYSTEM == "Game Cache" ) then
call AttachStruct(t,Total)
elseif ( ATTACHMENT_SYSTEM == "TimerStructAttachment" ) then
call SetTimerInteger(t,Total)
elseif ( ATTACHMENT_SYSTEM == "HandleAttachment" ) then
call SetHandleInteger(t,Total)
endif
call TimerStart(t, TIMER_INTERVAL, true, function KnockbackCreate)
set opfer = null
set b = false
endfunction
// Precise Knockback additional functions:
// setime* Changes the interval === setime*0.01
// stun stuns the target while it is knocked back === stun
// stunsetime*0.03
function PreciseKnockback takes unit opfer, unit atk, real speed, real distanz, real friction, real killtreerange, boolean b, string command returns nothing
local timer t = CreateTimer()
local KB knock = KB.create()
local real interval = 0.04
set knock.opfer = opfer
set knock.atk = atk
set knock.speed = speed
set knock.distanz = distanz
set knock.friction = friction
set knock.up = 0
set knock.bool = b
set knock.killtreerange = killtreerange
set Total = Total + 1
if ( Total > 200 ) then
call UpdateTotal()
endif
set Knockbackdata[Total] = knock
call AttachStruct(t,Total)
call TimerStart(t, interval, true, function KnockbackCreate)
set opfer = null
set b = false
set command = ""
endfunction
private function KnockBackInit takes nothing returns nothing
local location temppoint = null
call Debug("Knockback System by Mr.Malte")
if ( REQUIRES_UNBLOCKED ) then
set temppoint = GetRectCenter(GetPlayableMapRect())
call CreateUnitAtLoc(Player(15),DUMMY_TYPE1,temppoint,270.)
set udg_Knockback_Dummy1 = GetLastCreatedUnit()
call CreateUnitAtLoc(Player(15),DUMMY_TYPE2,temppoint,270.)
set udg_Knockback_Dummy2 = GetLastCreatedUnit()
call RemoveLocation(temppoint)
endif
set Treekillcondition = Filter(function TreeFilter)
endfunction
endlibrary
// End of Knockback System by Mr.Malte
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ListContainer
module List
private static thistype array Data
private static integer DataCounter = 0
integer DataPlace
integer Stored
method include takes nothing returns nothing
set thistype.DataCounter = thistype.DataCounter + 1
set .DataPlace = thistype.DataCounter
set thistype.Data[thistype.DataCounter] = this
endmethod
method exclude takes nothing returns nothing
set thistype.Data[.DataPlace] = thistype.Data[thistype.DataCounter]
set thistype.Data[.DataPlace].DataPlace = .DataPlace
set .DataPlace = 0
set thistype.DataCounter = thistype.DataCounter - 1
endmethod
static method forList takes nothing returns nothing
local integer iterator = 0
loop
set iterator = iterator + 1
exitwhen iterator > thistype.DataCounter
call thistype.Data[iterator].onLoop()
endloop
endmethod
static method searchFor takes integer i returns thistype
local integer iterator = 0
loop
set iterator = iterator + 1
exitwhen iterator > thistype.DataCounter
if thistype.Data[iterator].Stored == i then
return thistype.Data[iterator]
endif
endloop
return 0
endmethod
endmodule
endlibrary
//TESH.scrollpos=21
//TESH.alwaysfold=0
library TP requires TimerUtils
globals
private constant real INTERVAL = 0.01
endglobals
struct Fade
string FadeType = "Rolling"
string All
integer current = 0
real Stay
real MaxInterval
real Interval
player p = null
method onDestroy takes nothing returns nothing
set .FadeType = ""
endmethod
method onLoop takes nothing returns nothing
if .DataPlace == 1 then
call ClearTextMessages()
endif
set .Interval = .Interval + INTERVAL
if .MaxInterval <= .Interval then
set .Interval = 0.
set .current = .current + 1
if ( .current == StringLength(.All)+R2I((.Stay/.MaxInterval)) ) then
call .exclude()
endif
//call DisplayTextToPlayer(GetLocalPlayer(),0,0,SubString(.All,0,.current))
endif
if .p == null then
call DisplayTextToPlayer(GetLocalPlayer(),0,0,SubString(.All,0,.current))
else
call DisplayTextToPlayer(.p,0,0,SubString(.All,0,.current))
endif
endmethod
implement List
static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(),INTERVAL,true,function Fade.forList)
endmethod
endstruct
function FadeText takes string Text, real Interval, real Stay returns nothing
local Fade a = Fade.create()
//call TimerStart(CreateTimer(),INTERVAL,true,function Fade.forList)
set a.All = Text
set a.Stay = Stay
set a.MaxInterval = Interval
call a.include()
endfunction
function FadeTextPlayer takes string Text, real Interval, real Stay, player p returns nothing
local Fade a = Fade.create()
//call TimerStart(CreateTimer(),INTERVAL,true,function Fade.forList)
set a.All = Text
set a.Stay = Stay
set a.MaxInterval = Interval
set a.p = p
call a.include()
endfunction
endlibrary
//TESH.scrollpos=341
//TESH.alwaysfold=0
library Embasic requires DAebugG
//*********************************************************************
//* Embasic
//* ----------
//! [Attachment] [Recycling] [Coloring] [H2I] [GameTime]
//*
//*
//* To implement it , create a custom text trigger called Embasic
//* and paste the contents of this script there.
//* If you want to use it, don't forget to call InitEmbasic() at the map start.
//*
//* To copy from a map to another, copy the trigger holding this
//* library to your map.
//*
//* (requires vJass) More scripts: htt://www.wc3campaigns.net
//*
//! TimerUtils [by Vesxorian]
//! HandleIndexing [by Mr.Malte]
//! AID [by Mr.Malt]
//! GroupUtils [by Rising_Dusk]
//! ColorFunctions [by Mr.Malte]
// ======= What is Embasic ? =======
// Embasic is a collection of useful stuff that should go into any map.
// Embasic inclues mainly HandleAttachment functions.
// There are many attachment systems, but these are the two which I
// recommend.
// ======= Functions of Embasic =======
// NewTimer() : Recycles an old timer, to keep the HandleID size small.
// ReleaseTimer(timer) : Timers created with NewTimer() must be deleten like this.
// SetTimerData(timer,integer) : Attach Data to a timer created with NewTimer()
// GetTimerData(timer) : Get the attached Data
// Index(handle) : Creates a unique integer between 1 and 8190 for a handle.
// ReleaseIndex(integer) : Release the index of a unit. Very important! Call this, when you don't need the Index anymore, like if a unit dies.
// GameTimeString() : Returns in a string the elapsed game time.
// NewGroup() : Simliar to NewTimer(), just with groups. Create a new group with this.
// ReleaseGroup(group) : Use this instead of DestroyGroup(g), but ONLY on groups created with NewGroup()
// GroupRefresh(group) : Removes for example dead units from a group. Destroys 'Shadow References'
// PrintAID() : Prints the number of handles that will probably be created in your game.
// GameTimeString() : Returns the gametime as a string ( when GameTimeWanted is true ). Example: 01:05:36 => 1 hour, 5 minutes, 36 seconds.
// GetElapsedGameTime(string) : Returns the elapsed game time in a device (hours, minutes, seconds)
// ColorPlayer(player) : Returns the name of a player coloured.
// H2I, h2i, i2e, i2u, i2t : Basic returnbug functions. You don't have to create tons of private h2i() functions then.
// ======= Constants of Embasic =======
// Pi : The thing you need to handle with circles. Maybe Useful.
// ColorBlue/Green/Red[PlayerId]: The Color of players in integers between 0 and 255
// ======= What else should I know? =======
// This supports AID. MAX_HANDLE_ID_COUNT is very important for attachment systems.
// If you create more handles than this value is big, attachment systems fail.
// AID stores the number of created handles and the biggest Handle ID.
// Then it calculates this value up to MAX_GAME_DURATION.
// Example: After 10 minutes, 5000 handles were created.
// MAX_GAME_DURATION is 40.
// So it calculates how many handles might be created after 40 minutes.
// This needs performance! To disabled AID, set AID to false
// ======= About the Systems =======
//! [HandleIndexing]
// Fast, save, doesn't need Unit User Data.
// This is not the fastest! But it doesn't use UnitUserData.
//! [TimerUtils]
// Fast, save, recycles timers
//! [AID]
// Slow system. Should be disabled for final games.
//! [GroupUtils]
// Recycles groups in order to keep the Handle ID size small.
// ======= For speed Freaks =======
// To increase the speed of embasic:
// [x] Replace TimerUtils(Red) with TimerUtils(DarkRed)
// [x] Replace HandleIndexing with UnitIndexing
// [x] Disable AID
// [x] Disable GameTimeWanted
//*
//********************************************************************
globals
private constant integer MAX_HANDLE_ID_COUNT = 50000 //: Very important. Tip: Play a whole game with AID enabled and if AID recommends a higher value, increase it.
private constant integer tosub = 0x100000 //: Subtracts this integer from handles. Keep it!
private constant integer QUANTITY = 1 //: The number of timers you can use at the same time created with NewTimer()
private constant integer ARRAY_SIZE = 8191 //: Increase this; Make safer, cripple performance
private constant integer HELD = 0x28829022 //: Use a totally random number. The best: Don't change it.
private boolean GameTimeWanted = false //: Starts a timer that counts the Game Time.
private constant integer MAX_GAME_DURATION = 100 //: What do you think, how long will your game last? In minutes, please
constant boolean AID = true //: Disable AID?
private constant boolean ColorsWanted = true //: Color Codes for players. false will disable 'ColorPlayer' and PlayerColorConstants
endglobals
globals
integer BIGGEST = 0
integer SMALLEST = 0
//integer HandlesNeeded = 0
integer seconds = 0
integer hours = 0
integer minutes = 0
integer ElapsedMinutes = 0
integer GameTime = 0
endglobals
private function h2i takes handle h returns integer
return GetHandleId(h)
endfunction
private function H2I takes handle h returns integer
return GetHandleId(h)
endfunction
function startAID takes handle h returns nothing
local integer i = h2i(h)-tosub
if ( i > BIGGEST ) then
set BIGGEST = i
endif
endfunction
function Gametime takes nothing returns nothing
set seconds = seconds + 1
set GameTime = GameTime + 1
if ( seconds == 60 ) then
set seconds = 0
set minutes = minutes + 1
set ElapsedMinutes = ElapsedMinutes + 1
if ( minutes == 60 ) then
set hours = hours + 1
set minutes = 0
endif
endif
endfunction
function GetElapsedGameTime takes string device returns integer
if ( device == "minutes" ) then
return ElapsedMinutes
elseif ( device == "seconds" ) then
return ElapsedMinutes*60
elseif ( device == "hours" ) then
return R2I(I2R(ElapsedMinutes/60))
endif
return -1
endfunction
function GameTimeString takes nothing returns string
local string toreturn = ""
if ( hours < 10 ) then
set toreturn = toreturn + "0" + I2S(hours)
else
set toreturn = toreturn + I2S(hours)
endif
if ( minutes < 10 ) then
set toreturn = toreturn + ":"+"0"+I2S(minutes)
else
set toreturn = toreturn + ":"+I2S(minutes)
endif
if ( seconds < 10 ) then
set toreturn = toreturn + ":"+"0"+I2S(seconds)
else
set toreturn = toreturn + ":"+I2S(seconds)
endif
return toreturn
endfunction
function PrintAID takes nothing returns nothing
local real HandlesNeeded = GameTime/(BIGGEST-SMALLEST)*(MAX_GAME_DURATION*60)+SMALLEST+5000
call DisplayTextToForce(GetPlayersAll(),I2S(R2I(HandlesNeeded))+" is probably gonna be the biggest handle Index in your map. Now "+I2S(BIGGEST) +" was the biggest Index.")
endfunction
function HAID takes nothing returns nothing
local unit t = CreateUnit(Player(13),'hpea',0.,0.,0.)
call startAID(t)
call RemoveUnit(t)
endfunction
// ***************************************
//! S T A R T O F C O L O R F U N C T I O N S
// ***************************************
globals
integer array ColorRed
integer array ColorGreen
integer array ColorBlue
string array ColorString
endglobals
function ColorPlayer takes player p returns string
if ( ColorsWanted ) then
return ColorString[GetPlayerId(p)]+GetPlayerName(p)+"|r"
endif
return "Embasic: Enable ColorsWanted"
endfunction
function InitColor takes nothing returns nothing
local integer nIndex = 0
set ColorRed[nIndex] = 255
set ColorGreen[nIndex] = 0
set ColorBlue[nIndex] = 0
set ColorString[nIndex] = "|cffff0000" //red
set nIndex = nIndex + 1
set ColorRed[nIndex] = 0
set ColorGreen[nIndex] = 0
set ColorBlue[nIndex] = 255
set ColorString[nIndex] = "|cff0000ff" //blue
set nIndex = nIndex + 1
set ColorRed[nIndex] = 0
set ColorGreen[nIndex] = 245
set ColorBlue[nIndex] = 255
set ColorString[nIndex] = "|cff00f5ff" //Teal
set nIndex = nIndex + 1
set ColorRed[nIndex] = 85
set ColorGreen[nIndex] = 26
set ColorBlue[nIndex] = 139
set ColorString[nIndex] = "|cff551A8B" //Purple
set nIndex = nIndex + 1
set ColorRed[nIndex] = 255
set ColorGreen[nIndex] = 255
set ColorBlue[nIndex] = 0
set ColorString[nIndex] = "|cffffff00" //Yellow
set nIndex = nIndex + 1
set ColorRed[nIndex] = 248
set ColorGreen[nIndex] = 154
set ColorBlue[nIndex] = 0
set ColorString[nIndex] = "|cffEE9A00" //Orange
set nIndex = nIndex + 1
set ColorRed[nIndex] = 0
set ColorGreen[nIndex] = 255
set ColorBlue[nIndex] = 0
set ColorString[nIndex] = "|cff00CD00" //Green
set nIndex = nIndex + 1
set ColorRed[nIndex] = 255
set ColorGreen[nIndex] = 105
set ColorBlue[nIndex] = 180
set ColorString[nIndex] = "|cffFF69B4" //Pink
set nIndex = nIndex + 1
set ColorRed[nIndex] = 192
set ColorGreen[nIndex] = 192
set ColorBlue[nIndex] = 192
set ColorString[nIndex] = "|cffC0C0C0" //Gray
set nIndex = nIndex + 1
set ColorRed[nIndex] = 176
set ColorGreen[nIndex] = 226
set ColorBlue[nIndex] = 255
set ColorString[nIndex] = "|cffB0E2FF" //Light Blue
set nIndex = nIndex + 1
set ColorRed[nIndex] = 0
set ColorGreen[nIndex] = 100
set ColorBlue[nIndex] = 0
set ColorString[nIndex] = "|cff006400" //Dark Green
set nIndex = nIndex + 1
set ColorRed[nIndex] = 139
set ColorGreen[nIndex] = 69
set ColorBlue[nIndex] = 19
set ColorString[nIndex] = "|cff8B4513" //Brown
endfunction
// ***************************************
//! S T A R T O F G R O U P U T I L S
// ***************************************
globals
//* Group for use with all instant enumerations
group ENUM_GROUP = CreateGroup()
//* Temporary references for GroupRefresh
private boolean Flag = false
private group Refr = null
//* Assorted constants
private constant integer MAX_HANDLE_COUNT = MAX_HANDLE_ID_COUNT
private constant integer MIN_HANDLE_ID = tosub
//* Arrays and counter for the group stack
private group array Groups
private integer array Status[MAX_HANDLE_COUNT]
private integer Count = 0
endglobals
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
set Status[H2I(Groups[Count])-MIN_HANDLE_ID] = 1
return Groups[Count]
endfunction
function ReleaseGroup takes group g returns boolean
local integer stat = Status[H2I(g)-MIN_HANDLE_ID]
if g == null then
debug call BJDebugMsg(SCOPE_PREFIX+" Error: Null groups cannot be released")
return false
elseif stat == 0 then
debug call BJDebugMsg(SCOPE_PREFIX+" Error: Group not part of stack")
return false
elseif stat == 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
else
call GroupClear(g)
set Groups[Count] = g
set Count = Count + 1
set Status[H2I(g)-MIN_HANDLE_ID] = 2
endif
return true
endfunction
// ***************************************
//! S T A R T O F I N I T I A L I Z E R
// ***************************************
function InitEmbasic takes nothing returns nothing
local timer t
if ( AID ) then
set GameTimeWanted = true
set t = CreateTimer()
set SMALLEST = h2i(t)-tosub
call TimerStart(CreateTimer(),90.,true,function HAID)
call DestroyTimer(t)
endif
if ( GameTimeWanted ) then
call TimerStart(CreateTimer(),1.,true,function Gametime)
endif
if ( ColorsWanted ) then
call InitColor()
endif
endfunction
endlibrary
library EmbasicChild initializer AutoAID requires Embasic
globals
private constant real TIMEOUT = (60.*90.)
private constant boolean PERIODIC = false
endglobals
function AutoAID takes nothing returns nothing
if ( AID ) then
call TimerStart(CreateTimer(),TIMEOUT,PERIODIC,function PrintAID)
endif
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library AntiSpam initializer Init requires Embasic
globals
private constant real SPAM_INTERVAL = 3.00
private constant integer SPAM_AMOUNT = 3
private constant real BAN_DURATION = 2.50
private constant integer KICK_AFTER = 4
private constant real CACHE_DECREASE_AFTER = 120.
//: Upper: 5 Messages in 1 second = Spam.
private trigger trig
private integer array chats
private integer array spams
endglobals
private struct UserMethods
static method onSpam takes player Spammer returns nothing
local dialog d = DialogCreate()
set spams[GetPlayerId(Spammer)] = spams[GetPlayerId(Spammer)] + 1
if spams[GetPlayerId(Spammer)] > KICK_AFTER then
call DisplayTextToForce(GetPlayersAll(),ColorPlayer(Spammer) + " was kicked because of spamming.")
if GetLocalPlayer() == Spammer then
call EndGame( false )
return
endif
endif
call DialogSetMessage(d,"Please stop spamming.|nIf you keep spam-|n-ming, you are kicked|nfrom the game.")
call DialogDisplay(Spammer,d,true)
call TriggerSleepAction(BAN_DURATION)
call DialogDisplay(Spammer,d,false)
call DialogDestroy(d)
endmethod
endstruct
private function SpamChecker takes nothing returns nothing
local integer ID = GetPlayerId(GetTriggerPlayer())
set chats[ID] = chats[ID] + 1
if chats[ID] > SPAM_AMOUNT then
call UserMethods.onSpam(GetTriggerPlayer())
endif
call TriggerSleepAction(SPAM_INTERVAL)
set chats[ID] = chats[ID] - 1
endfunction
private function DecreaseSpamInt takes nothing returns nothing
local integer i = 0
loop
set spams[i] = spams[i] - 1
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
endfunction
private function Init takes nothing returns nothing
local integer index
set trig = CreateTrigger()
set index = 0
loop
call TriggerRegisterPlayerChatEvent( trig, Player(index), "", false )
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddAction(trig,function SpamChecker)
call TimerStart(CreateTimer(),CACHE_DECREASE_AFTER,true,function DecreaseSpamInt)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library WC initializer Init requires Embasic //By Mr.Malte
globals
public string array Color
endglobals
private function Init takes nothing returns nothing
set Color[1] = "red"
set Color[2] = "blue"
set Color[3] = "teal"
set Color[4] = "purple"
set Color[5] = "yellow"
set Color[6] = "orange"
set Color[7] = "green"
set Color[8] = "pink"
set Color[9] = "grey"
set Color[10] = "lightblue"
set Color[11] = "dark green"
set Color[12] = "brown"
endfunction
function ColornameToPlayer takes string Colorname returns player
local integer i = 0
loop
set i = i + 1
exitwhen i > bj_MAX_PLAYER_SLOTS
if Colorname == Color[i] then
return Player(i-1)
elseif i == 9 then
if Colorname == "gray" then
return Player(8)
endif
endif
endloop
call Debug("Invalid Argument in ColornameToPlayer("+Colorname+").")
return null
endfunction
endlibrary
library Votekick initializer Init requires Embasic, WC //:Also by me. Embasic can be replaced by TimerUtils
//: indexOf function by Mueslirocker.
globals
private constant integer MAX_VOTEKICKS = 1
private constant real VOTING_TIME = 45.
private constant string VOTE_YES = "-yes"
private constant string VOTE_NO = "-no"
private constant string VOTE_NOTHING = "-abstention"
private constant string START_VOTEKICK = "-votekick"
private constant string COLOR_YES = "|cff00B000"
private constant string COLOR_NO = "|cffff0000"
private constant string COLOR_ERROR = "|cffFF8000"
public integer array VoteKicks
private player toKick
private player fromWho
private boolean Voting = false
private integer YES = 0
private integer NO = 0
private integer ABSTENTIONS = 0
private trigger Votekick
integer PlayerCount = 0
private boolean array Voted
private timer t
endglobals
public struct UserMethods
static method onStart takes nothing returns nothing
call Debug(ColorPlayer(fromWho)+" has started a Votekick against "+ColorPlayer(toKick)+".")
call Debug("You have " +COLOR_ERROR+I2S(R2I(VOTING_TIME))+"|r seconds to vote for or against a votekick.")
call Debug("You can vote with '"+VOTE_YES+"', '"+VOTE_NO+"' or '"+VOTE_NOTHING+"'.")
endmethod
static method onEnd takes nothing returns nothing
call Debug(COLOR_ERROR+" --- Votekick ended.")
call Debug(COLOR_YES+I2S(YES)+"|r players are for a kick.")
call Debug(COLOR_NO+I2S(NO)+"|r players are against a kick.")
endmethod
endstruct
private function indexOf takes string text, string searchtext returns integer
local integer i = 0
if ( StringLength(text) >= StringLength ( searchtext ) ) then
loop
exitwhen i > ( StringLength ( text ) - StringLength ( searchtext ) )
if ( SubString (text, i, i + StringLength ( searchtext ) ) == searchtext ) then
return i
endif
set i = i + 1
endloop
endif
return -1
endfunction
private function ExecuteVoting takes nothing returns nothing
local integer i = 0
call PauseTimer(t)
call UserMethods.onEnd()
set Voting = false
if YES > NO then
call Debug("The majority is "+COLOR_YES+"for|r kicking "+ColorPlayer(toKick)+".")
call Debug(ColorPlayer(toKick)+" was kicked.")
if GetLocalPlayer() == toKick then
call EndGame( false )
endif
else
call Debug("The majority is "+COLOR_NO+"against|r kicking "+ColorPlayer(toKick)+".")
call Debug(ColorPlayer(toKick)+" was not kicked.")
endif
loop
set Voted[i] = false
set i = i + 1
exitwhen i > bj_MAX_PLAYERS
endloop
set toKick = null
set fromWho = null
set YES = 0
set NO = 0
set ABSTENTIONS = 0
endfunction
function StartVotekick takes player tovotekick, player bywho returns nothing
local integer ID = GetPlayerId(bywho)
if VoteKicks[ID] >= MAX_VOTEKICKS then
call DisplayTextToPlayer(bywho,0,0,COLOR_ERROR+"You have already used all Votekicks.|r")
return
endif
if Voting then
call DisplayTextToPlayer(bywho,0,0,COLOR_ERROR+"You can't start a Votekick during another one.|r")
return
endif
set YES = 0
set NO = 0
set ABSTENTIONS = 0
set Voting = true
set toKick = tovotekick
set fromWho = bywho
set VoteKicks[ID] = VoteKicks[ID] + 1
call UserMethods.onStart()
call TimerStart(t,VOTING_TIME,false,function ExecuteVoting)
endfunction
private function Vote takes nothing returns nothing
local string s = GetEventPlayerChatString()
if indexOf(s,START_VOTEKICK) != -1 then
call StartVotekick(ColornameToPlayer(SubStringBJ(s,StringLength(START_VOTEKICK)+2,StringLength(s))),GetTriggerPlayer())
return
endif
if Voting == false then
return
endif
if Voted[GetPlayerId(GetTriggerPlayer())] == true then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have already voted.")
elseif s == VOTE_YES then
set YES = YES + 1
elseif s == VOTE_NO then
set NO = NO + 1
elseif s == VOTE_NOTHING then
set ABSTENTIONS = ABSTENTIONS + 1
endif
set Voted[GetPlayerId(GetTriggerPlayer())] = true
if YES + NO + ABSTENTIONS == PlayerCount then
call ExecuteVoting()
endif
endfunction
private function Init takes nothing returns nothing
local integer index
local integer iterator = -1
set t = CreateTimer()
set Votekick = CreateTrigger()
call TriggerAddAction(Votekick, function Vote)
//: Register Chat Events
set index = 0
loop
call TriggerRegisterPlayerChatEvent( Votekick, Player(index), "", false )
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
loop
set iterator = iterator + 1
exitwhen iterator == bj_MAX_PLAYER_SLOTS
if GetPlayerSlotState(Player(iterator)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(iterator)) == MAP_CONTROL_USER then
set PlayerCount = PlayerCount + 1
endif
endloop
endfunction
endlibrary
//TESH.scrollpos=9
//TESH.alwaysfold=0
library Afk initializer Init requires I2T
//! Explicity
//: This is, how many different things are checked by the AFK System
//: 1 - Unit Orders are checked
//: 2 - The Chat is checked, too
//: 3 - Keyboard Events are registered, too.
//: 4 - Registers, if a unit is selected.
//: I recommend 2! Or 3. But 4 creates a lot of code stuff, becase I have to use a workaround
//! Note
//: This is non optimized! So.. if you want to use it :-)
//: Ok. It works.
//: But the code looks like Spaghetti. I2T and AfK System by Mr.Malte.
globals
private constant integer Explicity = 4
private constant string AfkStringType = "Highest Device" // possible: "Mathematical", "Highest Device" and "Linguar"
private constant string StatePrefix = ""
private constant integer START_AT = 0 //: 0 - variables use the first place of arrays.
private constant real UPDATE_INTERVAL = 1. //: Higher: More explicit AFK-Time Lower: Better Performance
private constant integer MAX_PLAYERS = 12 //: How many players can play your map?
private constant real AFK_AFTER = 65. //: Register AFK, when the Player didn't do anything for 30 seconds.
public boolean array AFK
private timer AfkTimer
private player array Playing_Players
private trigger UnitController
private trigger ChatController
private trigger KeyboardController
private trigger SelectionController
private trigger SelectionAdder
public real array AfkFor
endglobals
globals
public real array LastAfkTime
endglobals
struct UserMethods
static method onReturn takes player p, real AfKtime returns nothing
set AFK[GetPlayerId(p)+START_AT] = false
call DisplayTextToForce(GetPlayersAll(),ColorPlayer(p)+ " has returned.")
call DisplayTextToPlayer(p, 0, 0, "Welcome back, "+ColorPlayer(p)+". You have been Afk for "+I2T_SF(R2I(LastAfkTime[GetPlayerId(p)+START_AT]),3))
endmethod
static method onAfk takes player p, real AfKtime returns nothing
call DisplayTextToForce(GetPlayersAll(),ColorPlayer(p)+ " has gone Afk.")
endmethod
endstruct
function IsPlayerAfk takes player p returns boolean
local integer num = GetPlayerId(p)+START_AT
set p = null
return AFK[num]
endfunction
function GetPlayerAfkTime takes player p returns real
local integer num = GetPlayerId(p)+START_AT
set p = null
return AfkFor[num]
endfunction
function GetPlayerAfkString takes player p returns string
if ( IsPlayerAfk(p) ) then
//! First return: Returns the time in the highest Device (Not 2 minutes 4 seconds, but 2 Minutes or 2 seconds)
//! Second return: Returns the time in hours ( 00:00:04 = 4 seconds)
//! Third return: Returns the time in text devices (2 Minutes, 4 Seconds.)
if AfkStringType == "Highest Device" then
return StatePrefix+I2T_HD(R2I(GetPlayerAfkTime(p)))+" "+GetStringShortcut(I2T_Temp_Device)
elseif AfkStringType == "Mathematical" then
return StatePrefix+I2T(R2I(GetPlayerAfkTime(p)),3)
else
return StatePrefix+I2T_SF(R2I(GetPlayerAfkTime(p)),3)
endif
else
return StatePrefix
endif
endfunction
private function UpdateAfkState takes nothing returns nothing
local integer iterator = START_AT - 1
loop
set iterator = iterator + 1
exitwhen iterator > START_AT+MAX_PLAYERS
if GetPlayerSlotState(Player(iterator)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(iterator)) == MAP_CONTROL_USER then
set AfkFor[iterator] = AfkFor[iterator] + UPDATE_INTERVAL
if AfkFor[iterator] > AFK_AFTER then
if AFK[iterator] == false then
call UserMethods.onAfk(Player(iterator),AfkFor[iterator])
endif
set AFK[iterator] = true
else
set AFK[iterator] = false
endif
endif
endloop
endfunction
// The Rest is ugly code!
// And not interesting. Just creates the triggers that reset the Afk Values for players.
private function RegisterAfkReset takes player p returns nothing
local integer num = GetPlayerId(p)+START_AT
set LastAfkTime[num] = AfkFor[num]
if AFK[num] == true then
call UserMethods.onReturn(Player(num),AfkFor[num])
endif
set AfkFor[num] = 0.
endfunction
private function RegisterAfk takes nothing returns nothing
if ( IsUnitSelected(GetTriggerUnit(),GetOwningPlayer(GetTriggerUnit()) ) ) then
call RegisterAfkReset(GetOwningPlayer(GetTriggerUnit()))
endif
endfunction
private function RegisterAfkOnSelect takes nothing returns nothing
call RegisterAfkReset(GetOwningPlayer(GetTriggerUnit()))
endfunction
private function resetAfk takes nothing returns nothing
call RegisterAfkReset(GetTriggerPlayer())
endfunction
private function TriggerRegisterPlayerChat takes trigger t, string what, boolean case returns nothing
local integer index
set index = 0
loop
call TriggerRegisterPlayerChatEvent( t, Player(index), what, case )
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
endfunction
private function TriggerRegisterKeyboardEvent takes trigger trig returns nothing
local integer index
set index = 0
loop
call TriggerRegisterPlayerEvent(trig, Player(index), EVENT_PLAYER_ARROW_LEFT_DOWN)
call TriggerRegisterPlayerEvent(trig, Player(index), EVENT_PLAYER_ARROW_RIGHT_DOWN)
call TriggerRegisterPlayerEvent(trig, Player(index), EVENT_PLAYER_ARROW_UP_DOWN)
call TriggerRegisterPlayerEvent(trig, Player(index), EVENT_PLAYER_ARROW_DOWN_DOWN)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
endfunction
private function Selected takes nothing returns boolean
call TriggerRegisterUnitEvent( SelectionController, GetFilterUnit(), EVENT_UNIT_SELECTED )
return true
endfunction
// =================================================================================
// =================================================================================
private function Init takes nothing returns nothing
local group TempGroup
call TimerStart(CreateTimer(),UPDATE_INTERVAL,true,function UpdateAfkState)
if Explicity > 0 then
set UnitController = CreateTrigger()
call TriggerAddAction(UnitController,function RegisterAfk)
call TriggerRegisterAnyUnitEventBJ( UnitController, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerRegisterAnyUnitEventBJ( UnitController, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterAnyUnitEventBJ( UnitController, EVENT_PLAYER_UNIT_ISSUED_ORDER )
endif
if Explicity > 1 then
set ChatController = CreateTrigger()
call TriggerAddAction(ChatController,function resetAfk)
call TriggerRegisterPlayerChat ( ChatController, "", false )
endif
if Explicity > 2 then
set KeyboardController = CreateTrigger()
call TriggerAddAction(KeyboardController,function resetAfk)
call TriggerRegisterKeyboardEvent ( KeyboardController )
endif
if Explicity > 3 then
set SelectionController = CreateTrigger()
call TriggerAddAction(SelectionController,function RegisterAfkOnSelect)
set TempGroup = GetUnitsInRectMatching(GetPlayableMapRect(),Filter(function Selected))
call DestroyGroup(TempGroup)
set SelectionAdder = CreateTrigger()
call TriggerAddCondition(SelectionAdder,Filter(function Selected))
call TriggerRegisterEnterRectSimple( SelectionAdder, GetPlayableMapRect() )
endif
//call TriggerRegisterPlayerChatEvent(ChatController,Player(0),"",false)
endfunction
endlibrary
library I2T initializer Init requires Embasic // IntegerToTime - Converts a second integer to a time string.
// Device is, how many devices you want.
// Example:
// I2T(127,3) would return
// 00:02:07
// 3 devices: Hours, minutes, seconds
globals
private integer array Convertions
private string array ConvertionName
public string Temp_Device
endglobals
function GetStringShortcut takes string s returns string
return SubStringBJ(s,1,3)+"."
endfunction
function ConvertDevice takes integer Count returns integer
local integer device = 1
loop
exitwhen Count < 1
set device = device * Convertions[Count]
set Count = Count - 1
endloop
return device
endfunction
function I2T takes integer time, integer Devices returns string
local integer TempTime = 0
local integer Power
local string timeret = ""
loop
exitwhen Devices < 1
set Power = ConvertDevice(Devices)
set TempTime = time/Power // Hours
set time = time - (TempTime*Power)
if TempTime < 10 then
set timeret = timeret + "0"+I2S(TempTime)
else
set timeret = timeret + I2S(TempTime)
endif
if Devices > 1 then
set timeret = timeret+":"
endif
set Devices = Devices - 1
endloop
return timeret
endfunction
function I2T_SF takes integer time, integer Devices returns string
local integer TempTime = 0
local integer Power
local string timeret = ""
loop
exitwhen Devices < 1
set Power = ConvertDevice(Devices)
set TempTime = time/Power // Hours
set time = time - (TempTime*Power)
set timeret = timeret +I2S(TempTime)+" "+ConvertionName[Devices]
if Devices > 1 then
set timeret = timeret + ", "
endif
set Devices = Devices - 1
endloop
return timeret
endfunction
function I2T_HD takes integer time returns string
local integer i = 5
local integer dev
if time < 0 then
return "Error: Neagtive Time as Parameter"
endif
loop
set i = i - 1
set dev = ConvertDevice(i)
exitwhen dev < time
endloop
set time = time/dev
set Temp_Device = ConvertionName[i]
return I2S(time)
endfunction
private function Init takes nothing returns nothing
set Convertions [1] = 1
set ConvertionName[1] = "seconds"
set Convertions [2] = 60
set ConvertionName[2] = "minutes"
set Convertions [3] = 60
set ConvertionName[3] = "hours"
set Convertions [4] = 24
set ConvertionName[4] = "days"
set Convertions [5] = 30
set ConvertionName[5] = "month"
set Convertions [6] = 364
set ConvertionName[6] = "years"
endfunction
endlibrary
//TESH.scrollpos=139
//TESH.alwaysfold=0
library Debug initializer Irr
globals
constant integer MEMORY_MAXVALUES = 5
integer C = 0
string array String_A
string array String_B
boolean array Debug_D
integer array Integer_C
integer debugs = 0
//!
string array memString
string array memTypes
string array MemoryS
string array Memory_B
integer memc = 0
integer array mem
endglobals
function FindStringPartner takes string s returns integer
local integer i = 0
loop
set i = i + 1
exitwhen i > 150
if ( String_A[i] == s ) then
return i
//return udg_String_B
endif
endloop
return -1
endfunction
private function Debug takes string s returns nothing
call DisplayTextToForce(GetPlayersAll(),s)
endfunction
function Index2Debug takes integer sized, integer b returns integer
return sized+b*MEMORY_MAXVALUES
endfunction
function FindMemoryPartner takes string Identifier returns integer
local integer i = 0
loop
set i = i + 1
exitwhen i > 150
if ( MemoryS[i] == Identifier ) then
return i
endif
endloop
return -1
endfunction
function Irr takes nothing returns nothing
local integer i = 0
loop
set i = i + 1
exitwhen i > 150
set mem[i] = 0
set Integer_C[i] = 0
endloop
endfunction
function CreateDebug takes string identifier, string replace returns nothing
set C = C + 1
set String_A[C] = identifier
set String_B[C] = replace
endfunction
// Ersetzt identifier durch den String_Partner
function ReplaceDebug takes string Identifier, string s returns nothing
local integer H = FindStringPartner(Identifier)
if ( Debug_D[H] ) == false then
return
endif
set s = String_B[H] + s
call DisplayTextToForce(GetPlayersAll(),s)
endfunction
function MemoryDebug takes string Identifier, string s returns nothing
local integer H = FindMemoryPartner(Identifier)
set s = Memory_B[H] + s
call DisplayTextToForce(GetPlayersAll(),s)
endfunction
// Wenn ein Debug Identifier false ist, wird nichts geschrieben
function SetDebug takes string Identifier, boolean bool returns nothing
set Debug_D[FindStringPartner(Identifier)] = bool
endfunction
// Zählt einen integer für einen Identifier hoch
function NumDebug takes string Identifier returns nothing
local integer H = FindStringPartner(Identifier)
if ( Debug_D[H] ) == false then
return
endif
set Integer_C[H] = Integer_C[H] + 1
call DisplayTextToForce(GetPlayersAll(),String_B[H] + I2S(Integer_C[H]))
endfunction
function RPNumDebug takes string Identifier, string addstring returns nothing
local integer H = FindStringPartner(Identifier)
if ( Debug_D[H] ) == false then
return
endif
set Integer_C[H] = Integer_C[H] + 1
call DisplayTextToForce(GetPlayersAll(),String_B[H] + addstring + I2S(Integer_C[H]))
endfunction
// Setzt den Integer für einen Identifier auf 0
function ResetDebug takes string Identifier returns nothing
local integer H = FindStringPartner(Identifier)
if ( Debug_D[H] ) == false then
return
endif
call Debug("Reset_Debug for " + String_B[H])
set Integer_C[H] = 0
endfunction
function ClearMemory takes string Identifier returns nothing
local integer H = FindMemoryPartner(Identifier)
local integer i = 0
loop
set i = i + 1
exitwhen i > mem[H]
set memString[Index2Debug(H,i)] = ""
endloop
set mem[H] = 0
endfunction
function CreateMemory takes string Identifier, string replace returns nothing
set memc = memc + 1
set MemoryS[memc] = Identifier
set Memory_B[memc] = replace
endfunction
function Memory takes string Identifier, string store returns nothing
local integer H = FindMemoryPartner(Identifier)
set mem[H] = mem[H] + 1
set memString[Index2Debug(H,mem[H])] = store
if ( H > MEMORY_MAXVALUES ) then
call Debug("Error: Erhoehe MEMORY_MAXVALUES in der Debug library")
endif
endfunction
function CheckMemory takes string Identifier, string toCheck, boolean displayErrors returns nothing
local integer i = 0
local integer H = FindMemoryPartner(Identifier)
local integer AbCount = 0
local string firststore = memString[Index2Debug(H,1)]
local string array errors
local integer errorcount = 0
set firststore = toCheck
call Debug("FIRST:"+firststore)
loop
set i = i + 1
exitwhen i > mem[H]
call Debug(memString[Index2Debug(H,i)])
if ( firststore != memString[Index2Debug(H,i)] ) then
set AbCount = AbCount + 1
set errorcount = errorcount + 1
set errors[errorcount] = memString[Index2Debug(H,i)]
endif
endloop
call MemoryDebug(Identifier,"Memory checked. Values changed " +I2S(AbCount)+" Times")
if (displayErrors) then
set i = 0
loop
set i = i + 1
exitwhen i > errorcount
call Debug("Changed: " + errors[i])
endloop
endif
endfunction
endlibrary
//TESH.scrollpos=154
//TESH.alwaysfold=0
// ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//¤ *****************
//¤ - Multifunctional Knockback System -
//¤ *****************
//¤
//¤ By: Mr.Malte
//¤ Requires JassNewGen Editor!
//¤ Multifunctional Knockback System v1.00
//¤
//¤
//¤¤ CREDITS:
//¤
//¤ - Vexorian for JassNewGenPack
//¤
//¤
// ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
function GlobalKnockBack takes nothing returns nothing
call Knockback(udg_GlobOpfer, udg_GlobAtk, udg_GlobSpeed, udg_GlobDistanz, udg_GlobFriction, udg_GlobShowEffects)
endfunction
library KnockBackFunctions initializer KnockBackInit
constant function KnockbackSpeed takes nothing returns real
return 0.04 // The speed which defines the Interval when
// the target gets knocked back
endfunction
constant function DustModel takes nothing returns string
return " Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
endfunction
function h2i takes handle h returns integer
return h
return 0
endfunction
public struct KB
boolean bool
integer kbi
integer up
real speed
real distanz
real friction
real slidet
real killtreerange
timer knockbacktimer
unit atk
unit opfer
endstruct
globals
gamecache Cache = InitGameCache("GCRB.w3v")
private integer Total = 0
private KB array Knockbackdata
private boolexpr Treekillcondition = null
endglobals
function AttachStruct takes handle u, integer value returns nothing
local integer id = h2i(u)
call StoreInteger(Cache,"Struct",I2S(id),value)
endfunction
function GetStruct takes handle u returns integer
local integer id = h2i(u)
return GetStoredInteger(Cache,"Struct",I2S(id))
endfunction
public function TreeFilter takes nothing returns boolean
local integer d = GetDestructableTypeId(GetFilterDestructable())
return d == 'ATtr' or d == 'BTtw' or d == 'KTtw' or d == 'YTft' or d == 'JTct' or d == 'YTst' or d == 'YTct' or d == 'YTwt' or d == 'JTwt' or d == 'JTwt' or d == 'FTtw' or d == 'CTtr' or d == 'ITtw' or d == 'NTtw' or d == 'OTtw' or d == 'ZTtw' or d == 'WTst' or d == 'LTlt' or d == 'GTsh' or d == 'Xtlt' or d == 'WTtw' or d == 'Attc' or d == 'BTtc' or d == 'CTtc' or d == 'ITtc' or d == 'NTtc' or d == 'ZTtc'
endfunction
function UpdateTotal takes nothing returns nothing
local integer i = 201
loop
exitwhen i == 0
set i = i - 1
if ( Knockbackdata[i] != null ) then
set Total = i
set i = 200
return
endif
endloop
endfunction
private function KillTree takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
private function KnockbackCreate takes nothing returns nothing
local KB knock
local timer expired = GetExpiredTimer() // Used for the system - means not important for you
local integer i = 0 // Used for the system
local real x = 0. // Used for the system
local real y = 0. // Used for the system
local integer structNR = GetStruct(expired) // The struct is saved in an array. I attach the array number of a struct to a timer and get it with this function.
local effect e = null // Used for the system
local real angle = 0. // Used for the system
local real speed = knock.speed // The speed the target slides with
local real friction = knock.friction // Decrease the slide speed by this number
local real distanz = knock.distanz // Distance the target unit slides
local real slidet = knock.slidet // The distance which the target has already slidet
local unit opfer = knock.opfer // The target
local unit atk = knock.atk // The attacker
local integer up = knock.up // An upcounter integer to decrease laggs
local boolean bool = knock.bool // Show effects? True and the effect is shown.
local rect killtrees
set knock = Knockbackdata[structNR]
set x = GetUnitX(knock.opfer)
set y = GetUnitY(knock.opfer)
set angle = Atan2(y - GetUnitY(atk), x - GetUnitX(atk))
set killtrees = Rect(x - knock.killtreerange, y - knock.killtreerange, x + knock.killtreerange, y + knock.killtreerange)
set speed = speed - friction
set knock.speed = speed
set knock.slidet = slidet + speed
call EnumDestructablesInRect(killtrees, Treekillcondition, function KillTree)
call RemoveRect(killtrees)
call SetUnitX(opfer, x + speed * Cos(angle))
call SetUnitY(opfer, y + speed * Sin(angle))
call RemoveRect(killtrees)
set killtrees = null
if (up == 4) then // up is used to count up an integer. When the integer hits 4, the dust is shown - to decrease lagg
set up = 0
if ( bool == true ) then
call DestroyEffect(AddSpecialEffect(DustModel(), x, y))
endif
endif
if ( slidet >= distanz ) then
call knock.destroy()
set Total = Total - 1
endif
set up = up + 1
set knock.up = up
// === NULL LOCAL VARIABLES to decrease laggs === \\
set expired = null
set opfer = null
set friction = 0
set bool = false
set atk = null
endfunction
function Knockback takes unit opfer, unit atk, real speed, real distanz, real friction, boolean b returns nothing
local timer t = CreateTimer()
local KB knock = KB.create()
set knock.opfer = opfer
set knock.atk = atk
set knock.speed = speed
set knock.distanz = distanz
set knock.friction = friction
set knock.up = 0
set knock.bool = b
set knock.killtreerange = 110.
set Total = Total + 1
if ( Total > 200 ) then
call UpdateTotal()
endif
set Knockbackdata[Total - 1] = knock
call AttachStruct(t,Total - 1)
call TimerStart(t, KnockbackSpeed(), true, function KnockbackCreate)
endfunction
function PreciseKnockback takes unit opfer, unit atk, real speed, real distanz, real friction, real killtreerange, boolean b returns nothing
local timer t = CreateTimer()
local KB knock = KB.create()
set knock.opfer = opfer
set knock.atk = atk
set knock.speed = speed
set knock.distanz = distanz
set knock.friction = friction
set knock.up = 0
set knock.bool = b
set knock.killtreerange = killtreerange
set Total = Total + 1
if ( Total > 200 ) then
call UpdateTotal()
endif
set Knockbackdata[Total - 1] = knock
call AttachStruct(t,Total - 1)
call TimerStart(t, KnockbackSpeed(), true, function KnockbackCreate)
endfunction
private function KnockBackInit takes nothing returns nothing
set Treekillcondition = Filter(function TreeFilter)
endfunction
endlibrary
// End of Knockback System by Mr.Malte