Name | Type | is_array | initial_value |
TK_AttackType | attacktype | No | |
TK_DamageType | damagetype | No | |
TK_FlyingUnits | group | No | |
TK_FSpeed | real | Yes | |
TK_HDmgInPercIncreasement | real | No | |
TK_HDmgInPercStart | real | No | |
TK_Hero | unit | Yes | |
TK_ImpactDmgIncreasement | real | No | |
TK_ImpactDmgStart | real | No | |
TK_ImpactSFX | string | No | |
TK_Integers | integer | Yes | |
TK_Interval | real | Yes | |
TK_Level | integer | Yes | |
TK_LiftSFX | string | No | |
TK_LiftSFXTimer | real | No | |
TK_LsfxT | real | Yes | |
TK_MaxHeight | real | Yes | |
TK_MaxHeightIncreasement | real | No | |
TK_MaxHeightStart | real | No | |
TK_MinHeightIncreasement | real | No | |
TK_MinHeightStart | real | No | |
TK_Pause | boolean | No | |
TK_Speed | real | No | |
TK_SpeedVariationPerc | real | No | |
TK_SpellAoEIncreasement | real | No | |
TK_SpellAoEStart | real | No | |
TK_StartSFX | string | No | |
TK_TempPoint | location | Yes | |
TK_Unit | unit | Yes | |
TK_UnitGroup | group | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
//***************************************************************************
//* *
//* Telekinesis by Paladon *
//* 2.1 *
//* *
//* General Informations *
//* *
//* This map includes my spell 'Telekinesis'. *
//* I created both a vJass and a GUI version, with exactly the same effects.*
//* *
//* To use one of both versions you need a target area based spell. *
//* To use the vJass version, simply copy the trigger 'Telekinesis vJass' *
//* into your map. *
//* You need JassNewGen and Jass Helper enabled to get it work. *
//* *
//* To use the GUI version, copy the whole category called 'GUI' *
//* into your map. *
//* *
//* Before you copy the category, you should enable: *
//* 'Automatically create unknown variables while pasting trigger data' *
//* It is located at File->Presettings->General. *
//* You only need this if you'll use the GUI version. *
//* *
//* You don't need the PGS, it simply handles all the testmap *
//* unit revival, tree revival, message displaying and such stuff. *
//* You are free to use it for your own testmap. *
//* *
//* In each case i'd be glad if you credit me if you use any of my resources*
//* Enjoy ;) *
//* *
//* Paladon *
//***************************************************************************
//TESH.scrollpos=97
//TESH.alwaysfold=0
//*****************************************************************************\\
//! Paladon presents !\\
//* Telekinesis *
//* vJass *
//*******************************************************************************
// Notes: *
// This is my second Jass / vJass spell. *
// This spell is dedicated to all the participants of the *
// 18th Spells & Systems Mini Contest. *
// *
// Requirements: *
// *
// JassNewGenPack *
// A target area based spell *
// To import this spell, just copy the 'Telekinesis vJass' trigger into your *
// very own map and adjust the following values in the 'Settings'. *
//!*******************************SETTINGS************************************!\\
scope Telekinesis initializer GetStarted
globals
private constant integer SpellID = 'A000' // Returns the rawcode of the spell. To get a spell's rawcode, press Ctrl+D in the Object Editor.
private constant real SpellAoEStart = 200.0 // Returns the initial area in which the enemied units are affected by this spell.
private constant real SpellAoEIncreasement = 50.0 // Returns the increasement per level of the previous area.
private constant real MinHeightStart = 100.0 // Returns the initial minimal reachable height.
private constant real MinHeightIncreasement = 100.0 // Returns the increasement of the minimal reachable height per level.
private constant real MaxHeightStart = 200.0 // Returns the initial maximal reachable height.
private constant real MaxHeightIncreasement = 200.0 // Returns the increasement of the maximal reachable height per level.
private constant real Speed = 1.45 // Returns the time in seconds in which the affected units are in the air.
private constant real SpeedVariationPerc = 0.20 // Returns the percentage of the variation between each unit's lifting speed. Default is 0.20 which means 20% variation.
private constant string LiftSFX = "Abilities\\Spells\\Undead\\OrbOfDeath\\OrbOfDeathMissile.mdl" // Returns the path of the special effect displayed periodically at the chest of the lifted targets.
private constant real LiftSFXTimer = 0.30 // Returns the interval in seconds in which the previous effect is displayed.
private constant string StartSFX = "Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl" // Returns the path of the special effect displayed at the targets upon casting this spell.
private constant string ImpactSFX = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl" // Returns the path of the special effect displayed upon impact on earth.
private constant real HDmgInPercStart = 0.08 // Returns the percentage of the height dealt in damage. Default is 0.08 for 8% height dealt in damage to the lifted unit upon impact.
private constant real HDmgInPercIncreasement = 0.02 // Returns increasement per level of the previous value. Default is 0.02 for 2% increasement per level.
private constant real ImpactDmgStart = 20.0 // Returns the direct damage dealt to the target upon impact.
private constant real ImpactDmgIncreasement = 20.0 // Returns increasement per level of the previous value.
private constant attacktype AttackType = ATTACK_TYPE_NORMAL // Returns the attack type in which the damage is dealt. There's actually no need to adjust this value.
private constant damagetype DamageType = DAMAGE_TYPE_NORMAL // Returns the damage type in which the damage is dealt. There's actually no need to adjust this value.
private constant weapontype WeaponType = WEAPON_TYPE_ROCK_HEAVY_BASH // Returns the weapon type with which the damage is dealt. There's actually no need to adjust this value, replace it with 'null' to remove the corresponding sound.
private constant boolean Pause = true // Returns whether the flying unit should be paused.
endglobals
//********************************END OF THE SETTINGS**************************
//**Do not modify anything below this line unless you know what you are doing**
//*****************************************************************************
globals // Declaring the global variables.
private group Fgroup = CreateGroup()
private group FlyG = CreateGroup()
private boolexpr filter = null
private integer i = 0
private unit tempU
private player tempP
endglobals
//! General functions used
private function GetFilter takes nothing returns boolean // Filters the targetable units.
return GetWidgetLife(GetFilterUnit()) > 0 and IsUnitEnemy(GetFilterUnit(),tempP) and IsUnitType(GetFilterUnit(),UNIT_TYPE_FLYING) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
endfunction
private function TeleCondition takes nothing returns boolean // Checks the SpellID in order to trigger this spell, and no other, upon casting.
return GetSpellAbilityId() == SpellID
endfunction
//! The spell itself
private struct Spell // Declaring the struct variables.
unit c
unit t
real int
real maxH
real LsfxT
real speed
integer l
static Spell array indx
static integer counter = 0
static timer time = CreateTimer()
static method TeleLift takes nothing returns nothing // Lifting the targets and handleing all the impact stuff.
local real x
local real y
local Spell d
set i = 0
loop
exitwhen i >= Spell.counter
set d = Spell.indx[i]
if d.int < 180 then
set d.int = d.int + d.speed
set d.LsfxT = d.LsfxT + 0.01
call SetUnitFlyHeight(d.t,(Sin(d.int*bj_DEGTORAD)*d.maxH)+GetUnitDefaultFlyHeight(d.t),0)
if d.LsfxT >= LiftSFXTimer then
call DestroyEffect(AddSpecialEffectTarget(LiftSFX,d.t,"chest"))
set d.LsfxT = 0
endif
else
set tempP = GetOwningPlayer(d.c)
set x = GetUnitX(d.t)
set y = GetUnitY(d.t)
call GroupRemoveUnit (FlyG,d.t)
call DestroyEffect(AddSpecialEffect(ImpactSFX,x,y))
call UnitDamageTarget(d.c,d.t,(d.maxH*(HDmgInPercStart+(d.l-1)*HDmgInPercIncreasement))+(ImpactDmgStart+(d.l-1)*ImpactDmgIncreasement),true,true,AttackType,DamageType,WeaponType)
if Pause == true then
call PauseUnit(d.t,false)
endif
call SetUnitFlyHeight(d.t,GetUnitDefaultFlyHeight(d.t),0)
set d.c = null
set d.t = null
call d.destroy()
set Spell.counter = Spell.counter - 1
set Spell.indx[i] = d.indx[Spell.counter]
set i = i - 1
if Spell.counter == 0 then
call PauseTimer(Spell.time)
endif
endif
set i = i + 1
endloop
set i = 0
endmethod
static method GetValues takes unit c, unit t, integer l returns nothing // Applies the spell values into the struct system.
local Spell d = Spell.allocate()
set d.c = c
set d.t = t
set d.l = l
set d.int = 0
set d.LsfxT = 0
set d.maxH = GetRandomReal(MinHeightStart+(l-1)*MinHeightIncreasement,MaxHeightStart+(l-1)*MaxHeightIncreasement)
set d.speed = 1.8/GetRandomReal(Speed*(1+SpeedVariationPerc),Speed*(1-SpeedVariationPerc))
if Spell.counter == 0 then
call TimerStart(Spell.time,0.01,true, function Spell.TeleLift)
endif
set Spell.indx[Spell.counter] = d
set Spell.counter = Spell.counter + 1
endmethod
endstruct
//! Casting the spell
private function TeleInput takes nothing returns nothing // Gets and initializes the storage of all the spell values.
local unit caster = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(caster,SpellID)
local location loc = GetSpellTargetLoc()
set tempP = GetOwningPlayer(caster)
call GroupEnumUnitsInRange(Fgroup,GetLocationX(loc),GetLocationY(loc),SpellAoEStart+SpellAoEIncreasement*(level-1),filter)
loop
set tempU = FirstOfGroup(Fgroup)
exitwhen tempU == null
if IsUnitInGroup (tempU,FlyG) == false then
call Spell.GetValues(caster,tempU,GetUnitAbilityLevel(caster,SpellID))
call GroupAddUnit (FlyG,tempU)
call UnitAddAbility(tempU,'Amrf')
call UnitRemoveAbility(tempU,'Amrf')
call DestroyEffect(AddSpecialEffect(StartSFX,GetUnitX(tempU),GetUnitY(tempU)))
if Pause == true then
call PauseUnit(tempU,true)
endif
endif
call GroupRemoveUnit(Fgroup,tempU)
endloop
call RemoveLocation(loc)
set loc = null
set caster = null
endfunction
//! Preloading and setting
private function GetStarted takes nothing returns nothing // Preloads effects, adds actions and conditions to the spell's trigger.
local trigger TeleTrig = CreateTrigger()
set filter = Condition(function GetFilter)
loop
call TriggerRegisterPlayerUnitEvent(TeleTrig, Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
set i = 0
call TriggerAddCondition(TeleTrig, Condition(function TeleCondition))
call TriggerAddAction(TeleTrig, function TeleInput)
call Preload(LiftSFX)
call Preload(StartSFX)
call Preload(ImpactSFX)
call PreloadStart()
endfunction
endscope
//TESH.scrollpos=32
//TESH.alwaysfold=0
//************************************************************************
//* *
//* Paladon's General System *
//* [PGS] *
//* Version 1.0 *
//* *
//* This system's purpose is only the support of the featured test map *
//* and does not affect the presented spell(s) or system(s). If you want *
//* to import any of the presented spell(s) or system(s) you don't have *
//* to import this trigger and script. *
//************************************************************************
library PGS
globals
private constant string WMessage = "Telekinesis by Paladon - in GUI and vJass (two heroes)."
//returns the message displayed after starting the map.
private constant integer EnemyPlayer = 1
//returns which player controls your enemies. 0 is red, 1 is blue, etc.
private constant string ReviveEffect = "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl"
//returns the path of the effect displayed upon the rivival of enemies.
private constant real WaitForRevive = 4.00
//returns the time in seconds before the enemy revives again.
private constant boolean FogOn = false
//returns whether the Black Mask and Fog of War is enabled (true) or disabled (false).
private constant real TreeTimer = 10.00
//returns the time in seconds until a fallen tree regrows.
// --- END OF SETTINGS --- DO NOT MODIFY ANYTHING BELOW THIS LINE ---
private unit groupunit
private real array EnemyX
private real array EnemyY
private real array EnemyF
private integer array EnemyI
private filterfunc filter
private destructable Tree
private trigger PGS_TR = CreateTrigger()
private trigger PGS_UR = CreateTrigger()
endglobals
private function TrueFilter takes nothing returns boolean
return true
endfunction
private function W2D takes widget w returns destructable
return null
endfunction
function Message takes string msg returns nothing
local integer i = 0
loop
call DisplayTimedTextToPlayer(Player(i),0,0,60,msg)
set i = i + 1
exitwhen i == bj_MAX_PLAYERS
endloop
endfunction
function PGS_URevive takes nothing returns nothing
local unit u = GetTriggerUnit()
if(not(GetUnitUserData(u)<=0))then
call TriggerSleepAction(WaitForRevive)
set groupunit = CreateUnit(Player(EnemyPlayer),EnemyI[GetUnitUserData(u)],EnemyX[GetUnitUserData(u)],EnemyY[GetUnitUserData(u)],EnemyF[GetUnitUserData(u)])
call SetUnitUserData(groupunit, GetUnitUserData(u) )
call DestroyEffect(AddSpecialEffect(ReviveEffect,GetUnitX(groupunit),GetUnitY(groupunit)))
endif
set u = null
endfunction
function PGS_TRevive takes nothing returns nothing
set Tree = W2D(GetTriggerWidget())
call TriggerSleepAction(TreeTimer)
call DestructableRestoreLife(Tree,GetWidgetLife(Tree), true)
set Tree = null
endfunction
function PGS_TR_Events takes nothing returns nothing
set Tree = GetEnumDestructable()
call TriggerRegisterDeathEvent(PGS_TR,Tree)
set Tree = null
endfunction
function InitTrig_PGSystem takes nothing returns nothing
local integer i
local group gro = CreateGroup()
set filter=Filter(function TrueFilter)
call GroupEnumUnitsOfPlayer(gro, Player(EnemyPlayer),filter)
set i = 0
loop
set groupunit = FirstOfGroup(gro)
exitwhen groupunit==null
call GroupRemoveUnit(gro,groupunit)
set i = (i+1)
call SetUnitUserData(groupunit,i)
set EnemyX[i] = GetUnitX(groupunit)
set EnemyY[i] = GetUnitY(groupunit)
set EnemyF[i] = GetUnitFacing(groupunit)
set EnemyI[i] = GetUnitTypeId(groupunit)
endloop
call FogEnable(FogOn)
call FogMaskEnable(FogOn)
call Message(WMessage)
call TriggerRegisterPlayerUnitEvent(PGS_UR,Player(EnemyPlayer), EVENT_PLAYER_UNIT_DEATH,filter)
call TriggerAddAction(PGS_UR, function PGS_URevive)
call TriggerAddAction(PGS_TR, function PGS_TRevive)
set bj_wantDestroyGroup = true
call EnumDestructablesInRect(bj_mapInitialPlayableArea,filter, function PGS_TR_Events)
set PGS_UR = null
call DestroyGroup(gro)
endfunction
endlibrary