//TESH.scrollpos=0
//TESH.alwaysfold=0
//==========================================================================================
// OneToFive/1-to-5 System by kingking
// v1.0
//==========================================================================================
// This system enables structs being attached to handles
// Up to five structs can be attached.
// (Tell me if you want more handle type.)
//
// Supported handles :
// Timer
// Trigger
// Dialog
// Unit
// Player
// Rect
//
// How to use?
// *(x) is integer from 1 to 5.
// *(y) is the handle.
// *(y2) is the handle's type
// *(z) is the type of value you want to return.
//
// 1) Add Struct
// call AddStruct(x)To(y2)(y, struct you want to attach)-->nothing returned
// call AddInt(x)to(y2)(y, integer you wan to attach)-->nothing returned
// call AddTexttag(x)To(y2)(y, texttag you want to attach)--->nothing returned
//
// 2) Get Struct
// call Get(z)(x)From(y2)(y)-->returns struct
//
// 3) Clear Struct
// call ClearStruct(x)In(y2)(y)-->nothing returned
// call ClearTexttag(x)In(y2)(y)-->nothing returned
// (Use when you want to clear the attached texttag.)
//
// Quick return functions view :
// 1) GetInt(x)From(y2)(y)
// 2) GetUnit(x)From(y2)(y)
// 3) GetEffect(x)From(y2)(y)
// 4) GetLightning(x)From(y2)(y)
// 5) GetLoc(x)From(y2)(y)
// 6) GetTimer(x)From(y2)(y)
// 7) GetTrigger(x)From(y2)(y)
// 8) GetForce(x)From(y2)(y)
// 9) GetDialog(x)From(y2)(y)
// 10) GetGroup(x)From(y2)(y)
// 11) GetTextTag(x)From(y2)(y)
//
// Pros :
// 1) Faster than any game cache-based system.
// 2) Can attach up to 5 structs to a handle.
// (Actually is unlimited, but I think 5 structs is enough.)
// (Tell me if you want more.)
// 3) Can work good also when use together with other systems.
// 4) Better than ABC becauz it can support many handle types.
// 5) Can store texttags.
// 6) Does not cause lag and error if you use Get without Set unlike ABC.
// The system will automatically return 0 or null if this happens.
//
// Cons :
// 1) Does not cause leak because it uses integer.
// 2) Maximum can have 1024 attached handles at a time.
// 3) Cannot store real, you need to convert to integer first.
// 4) Cannot store boolean, you need to use 0 and 1 instead.
// (0 for true and 1 for false or vice versa)
//
// Tips :
// 1) You can attach maximum 1 texttag and 5 structs to a handle,
// since the texttags is stored seperately with structs.
// 2) Remember to clear value especially for texttags. Other types are
// better than texttag because they are converted into integer and
// stored, so Warcraft 3 does not need to use many memory to store it.
//
// How to Implement?
// 1) Copy entire this system's scripts to your map header.
// 2) Enjoy it!
//
// Comments/Suggestions/Contact/Bugs reporting.
// [email protected]
////////////////////////////////////////////////////////////////////////////////////////////
//
globals
//! textmacro OneToFive takes handle, number
integer array StoredOneToFive$handle$$number$//We use text macroes to create multi instanceable system.
//! endtextmacro
//! runtextmacro OneToFive("Timer","1")
//! runtextmacro OneToFive("Timer","2")
//! runtextmacro OneToFive("Timer","3")
//! runtextmacro OneToFive("Timer","4")
//! runtextmacro OneToFive("Timer","5")
//! runtextmacro OneToFive("Trigger","1")
//! runtextmacro OneToFive("Trigger","2")
//! runtextmacro OneToFive("Trigger","3")
//! runtextmacro OneToFive("Trigger","4")
//! runtextmacro OneToFive("Trigger","5")
//! runtextmacro OneToFive("Dialog","1")
//! runtextmacro OneToFive("Dialog","2")
//! runtextmacro OneToFive("Dialog","3")
//! runtextmacro OneToFive("Dialog","4")
//! runtextmacro OneToFive("Dialog","5")
//! runtextmacro OneToFive("Unit","1")
//! runtextmacro OneToFive("Unit","2")
//! runtextmacro OneToFive("Unit","3")
//! runtextmacro OneToFive("Unit","4")
//! runtextmacro OneToFive("Unit","5")
//! runtextmacro OneToFive("Player","1")
//! runtextmacro OneToFive("Player","2")
//! runtextmacro OneToFive("Player","3")
//! runtextmacro OneToFive("Player","4")
//! runtextmacro OneToFive("Player","5")
//! runtextmacro OneToFive("Rect","1")
//! runtextmacro OneToFive("Rect","2")
//! runtextmacro OneToFive("Rect","3")
//! runtextmacro OneToFive("Rect","4")
//! runtextmacro OneToFive("Rect","5")
//! textmacro OneToFiveTexttag takes handle
texttag array StoredTextTagOneToFive$handle$//We create the multi instanceable texttag storing system
//! endtextmacro
//! runtextmacro OneToFiveTexttag("Timer")
//! runtextmacro OneToFiveTexttag("Trigger")
//! runtextmacro OneToFiveTexttag("Dialog")
//! runtextmacro OneToFiveTexttag("Unit")
//! runtextmacro OneToFiveTexttag("Player")
//! runtextmacro OneToFiveTexttag("Rect")
endglobals
function H2INew takes handle h returns integer//H2I is a common function use in converting handle into integer
return h
return 0
endfunction
function I2HNew takes integer i returns handle//I2H is a function use in converting integer back into handle
return i
return null
endfunction
//Below are function that convert integer into multiple types of handle.
function H2T takes handle h returns trigger
return h
return null
endfunction
function H2U takes handle h returns unit
return h
return null
endfunction
function H2E takes handle h returns effect
return h
return null
endfunction
function H2L takes handle h returns lightning
return h
return null
endfunction
function H2G takes handle h returns group
return h
return null
endfunction
function H2Loc takes handle h returns location
return h
return null
endfunction
function H2F takes handle h returns force
return h
return null
endfunction
function H2T2 takes handle h returns timer
return h
return null
endfunction
function H2D takes handle h returns dialog
return h
return null
endfunction
//! textmacro OneToFiveT takes handle, number, handle2
//We use text macro to create multiple function.
function AddStruct$number$To$handle$ takes handle h, handle value returns nothing
if H2INew(h)!=0 then
set StoredOneToFive$handle$$number$[(H2INew(h)*HASH_UP)/HASH_DOWN+HASH_BIAS]=H2INew(value)
endif
endfunction
function AddInt$number$To$handle$ takes handle h, integer value returns nothing
if H2INew(h)!=0 then
set StoredOneToFive$handle$$number$[(H2INew(h)*HASH_UP)/HASH_DOWN+HASH_BIAS]=value
endif
endfunction
function GetInt$number$From$handle$ takes $handle2$ d returns integer
if H2INew(d)!=0 then
return StoredOneToFive$handle$$number$[(H2INew(d)*HASH_UP)/HASH_DOWN+HASH_BIAS]
endif
return 0
endfunction
function GetUnit$number$From$handle$ takes $handle2$ u returns unit
if H2INew(u)!=0 then
return H2U(I2HNew(StoredOneToFive$handle$$number$[(H2INew(u)*HASH_UP)/HASH_DOWN+HASH_BIAS]))
endif
return null
endfunction
function GetEffect$number$From$handle$ takes $handle2$ e returns effect
if H2INew(e)!=0 then
return H2E(I2HNew(StoredOneToFive$handle$$number$[(H2INew(e)*HASH_UP)/HASH_DOWN+HASH_BIAS]))
endif
return null
endfunction
function GetLightning$number$From$handle$ takes $handle2$ l returns lightning
if H2INew(l)!=0 then
return H2L(I2HNew(StoredOneToFive$handle$$number$[(H2INew(l)*HASH_UP)/HASH_DOWN+HASH_BIAS]))
endif
return null
endfunction
function GetGroup$number$From$handle$ takes $handle2$ g returns group
if H2INew(g)!=0 then
return H2G(I2HNew(StoredOneToFive$handle$$number$[(H2INew(g)*HASH_UP)/HASH_DOWN+HASH_BIAS]))
endif
return null
endfunction
function GetLoc$number$From$handle$ takes $handle2$ loc returns location
if H2INew(loc)!=0 then
return H2Loc(I2HNew(StoredOneToFive$handle$$number$[(H2INew(loc)*HASH_UP)/HASH_DOWN+HASH_BIAS]))
endif
return null
endfunction
function GetForce$number$From$handle$ takes $handle2$ f returns force
if H2INew(f)!=0 then
return H2F(I2HNew(StoredOneToFive$handle$$number$[(H2INew(f)*HASH_UP)/HASH_DOWN+HASH_BIAS]))
endif
return null
endfunction
function GetTrigger$number$From$handle$ takes $handle2$ t returns trigger
if H2INew(t)!=0 then
return H2T(I2HNew(StoredOneToFive$handle$$number$[(H2INew(t)*HASH_UP)/HASH_DOWN+HASH_BIAS]))
endif
return null
endfunction
function GetTimer$number$From$handle$ takes $handle2$ t2 returns timer
if H2INew(t2)!=0 then
return H2T2(I2HNew(StoredOneToFive$handle$$number$[(H2INew(t2)*HASH_UP)/HASH_DOWN+HASH_BIAS]))
endif
return null
endfunction
function GetDialog$number$From$handle$ takes $handle2$ d returns dialog
if H2INew(d)!=0 then
return H2D(I2HNew(StoredOneToFive$handle$$number$[(H2INew(d)*HASH_UP)/HASH_DOWN+HASH_BIAS]))
endif
return null
endfunction
function ClearStruct$number$In$handle$ takes $handle2$ h returns nothing
if H2INew(h)!=0 then
set StoredOneToFive$handle$$number$[(H2INew(h)*HASH_UP)/HASH_DOWN+HASH_BIAS]=0
endif
endfunction
//! endtextmacro
//! runtextmacro OneToFiveT("Timer","1","timer")
//! runtextmacro OneToFiveT("Timer","2","timer")
//! runtextmacro OneToFiveT("Timer","3","timer")
//! runtextmacro OneToFiveT("Timer","4","timer")
//! runtextmacro OneToFiveT("Timer","5","timer")
//! runtextmacro OneToFiveT("Trigger","1","trigger")
//! runtextmacro OneToFiveT("Trigger","2","trigger")
//! runtextmacro OneToFiveT("Trigger","3","trigger")
//! runtextmacro OneToFiveT("Trigger","4","trigger")
//! runtextmacro OneToFiveT("Trigger","5","trigger")
//! runtextmacro OneToFiveT("Dialog","1","dialog")
//! runtextmacro OneToFiveT("Dialog","2","dialog")
//! runtextmacro OneToFiveT("Dialog","3","dialog")
//! runtextmacro OneToFiveT("Dialog","4","dialog")
//! runtextmacro OneToFiveT("Dialog","5","dialog")
//! runtextmacro OneToFiveT("Unit","1","unit")
//! runtextmacro OneToFiveT("Unit","2","unit")
//! runtextmacro OneToFiveT("Unit","3","unit")
//! runtextmacro OneToFiveT("Unit","4","unit")
//! runtextmacro OneToFiveT("Unit","5","unit")
//! runtextmacro OneToFiveT("Player","1","player")
//! runtextmacro OneToFiveT("Player","2","player")
//! runtextmacro OneToFiveT("Player","3","player")
//! runtextmacro OneToFiveT("Player","4","player")
//! runtextmacro OneToFiveT("Player","5","player")
//! runtextmacro OneToFiveT("Rect","1","rect")
//! runtextmacro OneToFiveT("Rect","2","rect")
//! runtextmacro OneToFiveT("Rect","3","rect")
//! runtextmacro OneToFiveT("Rect","4","rect")
//! runtextmacro OneToFiveT("Rect","5","rect")
//! textmacro OneToFiveH takes handle, handle2
function AddTexttagTo$handle$ takes handle h,texttag tt returns nothing
if H2INew(h)!=0 then
set StoredTextTagOneToFive$handle$[(H2INew(h)*HASH_UP)/HASH_DOWN+HASH_BIAS]=tt
endif
endfunction
function GetTexttagFrom$handle$ takes $handle2$ th returns texttag
if H2INew(th)!=0 then
return StoredTextTagOneToFive$handle$[(H2INew(th)*HASH_UP)/HASH_DOWN+HASH_BIAS]
endif
return null
endfunction
function ClearTexttagIn$handle$ takes $handle2$ h returns nothing
if H2INew(h)!=0 then
set StoredTextTagOneToFive$handle$[(H2INew(h)*HASH_UP)/HASH_DOWN+HASH_BIAS]=null
endif
endfunction
//! endtextmacro
//! runtextmacro OneToFiveH("Timer","timer")
//! runtextmacro OneToFiveH("Trigger","trigger")
//! runtextmacro OneToFiveH("Dialog","dialog")
//! runtextmacro OneToFiveH("Unit","unit")
//! runtextmacro OneToFiveH("Player","player")
//! runtextmacro OneToFiveH("Rect","rect")
globals
constant integer HASH_DOWN = 524288
constant integer HASH_UP = 2134900736
constant integer HASH_BIAS = 4096
//This sytem use Hash to calculate the integer after converting handles.
endglobals
Name | Type | is_array | initial_value |
//TESH.scrollpos=0
//TESH.alwaysfold=0
////////////////////////////////////////////////////////////////////////////////////////////
// Torrent<-Admiral Proudmoore's 1st skill present by kingking 100%MUI+Work //
// //
// How to implement? //
// 1)Copy this trigger. //
// 2)Copy spells and buff in Object Editor.(has 'Torrent' name) //
// 3)Copy dummy. (Dun need if you prefer to use yours) //
// 4)Change the rawcodes at below to correct one. //
// 5)Change the settings if you want. //
// 6)Enjoy it! //
// //
// Requires : Jass NewGen Pack v5b or above //
// (Because these are vJass syntax) //
// //
// Optional : Tidal Erruption Model(I dun noe who made this model, i get it from //
// DotA map) //
// No need to credit when used. ^_^ //
////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////->Change rawcodes to correct one<-///////////////////////////////
constant function Torrent_Id takes nothing returns integer
return 'A000'//Rawcode of Torrent
endfunction
constant function Torrent_Fly_Id takes nothing returns integer
return 'A001'//Rawcode of the Torrent-Fly(Original is Storm Crow Form)
endfunction
constant function Torrent_Dummy takes nothing returns integer
return 'h000'//Rawcode of dummy(You can use your dummy also)
//This dummy is used to slow enemies
endfunction
constant function Torrent_Slow_Id takes nothing returns integer
return 'A003'//Rawcode of slow(Original is Slow)
endfunction
constant function Torrent_Slow_Order takes nothing returns string
return "slow"//Order String of slow
endfunction
////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////->Spell's settings(Optional to change)<-///////////////////////////
constant function Torrent_BaseDmg takes nothing returns real
return 60.00//Base damage of Torrent
endfunction
constant function Torrent_DamageInc takes nothing returns real
return 60.00//Increases of Damage per level(Lv1-120dmg,Lv2-180dmg)
endfunction
constant function Torrent_Effect takes nothing returns string
return "war3mapImported\\Tidal_Erruption.mdx"//Model
endfunction
constant function Torrent_Effect2 takes nothing returns string
return "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl"//Effect 2
endfunction
constant function Torrent_Bubbles takes nothing returns string
return "Doodads\\Icecrown\\Water\\BubbleGeyserSteam\\BubbleGeyserSteam.mdl"
//Glowing effect
endfunction
//////////////////If you dun wan effects, juz change it to null!!!//////////////////////////
constant function Torrent_AoE takes nothing returns real
return 200.00//How many Area of Effect
endfunction
constant function Torrent_Height takes nothing returns real
return 1440.00//Fly how high
endfunction
constant function Torrent_Speed takes nothing returns real
return 600.00//Fly how fast
endfunction
constant function Torrent_Delay takes nothing returns real
return 2.00//Wait how many seconds before this spell start
endfunction
////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////->I dun recommended you change anything below<-////////////////////////
scope Torrent
private function Trig_Torrent_Conditions takes nothing returns boolean
if GetSpellAbilityId() == Torrent_Id() then//Condition
return true
endif
return false
endfunction
private function Trig_Torrent_Actions takes nothing returns nothing
local unit a=GetTriggerUnit()//Caster
local group b=CreateGroup()//This group of unit that we will splash them up into air
local location c=GetSpellTargetLoc()//Target Loc
local unit e//temp unit
local group f=CreateGroup()//This group of unit that we will fall them down
local unit g//temp unit also
local effect array h//Bubbles
local group i=CreateGroup()//This group of unit that we will slow them.
local integer j=1//This is used for loop
loop
exitwhen j==9//loop ends when loop for 8 times
set h[j]=AddSpecialEffectLoc(Torrent_Bubbles(),PolarProjectionBJ(c,75.00,45*j))
//We create bubble every 45 degree at 75 range of target location.
set j=j+1//set j=j+1 means we loop 1 time
endloop
call TriggerSleepAction(Torrent_Delay())//Wait certain time
set j=1//loop
loop
exitwhen j==9//loop ends when loop for 8 times
call DestroyEffect(h[j])//Destroy the bubbles
set h[j]=null//nullify it.
set j=j+1//set j=j+1 means we loop 1 time
endloop
call GroupEnumUnitsInRangeOfLoc(b,c,Torrent_AoE(),null)//Pick all unit in range
call DestroyEffect(AddSpecialEffectLoc(Torrent_Effect(),c))//Create a eruption effect
loop
set e=FirstOfGroup(b)//now we use temp
exitwhen e==null//loop ends when no more unit in group
if IsUnitEnemy(e,GetOwningPlayer(a))==true and GetUnitState(e,UNIT_STATE_LIFE)>=0.44 and IsUnitType(e,UNIT_TYPE_STRUCTURE)==false and IsUnitType(e,UNIT_TYPE_MAGIC_IMMUNE)==false then
//If temp unit is enemy, it is alive, not structure, and not magic immune
call PauseUnit(e,true)
//Pause the unit
call SetUnitFlyHeight(e,Torrent_Height(),Torrent_Speed())
//Make them fly into sky
call UnitAddAbility(e,Torrent_Fly_Id())
//We need to add the stine crow from ability to help them fly into sky
call UnitRemoveAbility(e,Torrent_Fly_Id())
//Remove it becauz it already start to fly
call GroupAddUnit(f,e)
//Add this unit to other group(for falling them down)
call GroupAddUnit(i,e)
//Add this unit to other group(for slowing them)
endif
call GroupRemoveUnit(b,e)//Remove it to prevent it to be selected again
set e=null//nullify it
endloop
call TriggerSleepAction(Torrent_Height()/Torrent_Speed()-0.4)//Wait the errupt effect gone
loop
set e=FirstOfGroup(f)//use temp unit again
exitwhen e==null//ends when no more unit in the group
call SetUnitFlyHeight(e,0.0,Torrent_Height()*2)//Fall them down
call PauseUnit(e,false)//Unpause them
call GroupRemoveUnit(f,e)//Remove them from group
set e=null//nullify it
set g=null//nullify it
endloop
call TriggerSleepAction(0.5)//After they fall down
loop
set e=FirstOfGroup(i)//use temp unit again
call SetUnitFlyHeight(e,0.0,99999.99)//instantly set them to 0 height if they havent fall down(used for dead units)
call UnitDamageTarget(a,e,Torrent_BaseDmg()+(GetUnitAbilityLevel(a,Torrent_Id())*Torrent_DamageInc()),false,true,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
//(damage them)
set g=CreateUnitAtLoc(GetOwningPlayer(a),Torrent_Dummy(),GetUnitLoc(e),0)
//create a dummy to slow them
call UnitAddAbility(g,Torrent_Slow_Id())
call SetUnitAbilityLevel(g,Torrent_Slow_Id(),GetUnitAbilityLevel(a,Torrent_Id()))
call IssueTargetOrder(g,Torrent_Slow_Order(),e)
call UnitApplyTimedLife(g,'BTLF',0.5)
call GroupRemoveUnit(i,e)
set e=null
endloop
//Remove leaks
call DestroyGroup(b)
call DestroyGroup(f)
call DestroyGroup(i)
set a=null
set b=null
set c=null
set e=null
set f=null
set g=null
set i=null
endfunction
//===========================================================================
function InitTrig_Torrent takes nothing returns nothing
local trigger Torrent = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(Torrent, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition(Torrent, Condition( function Trig_Torrent_Conditions ) )
call TriggerAddAction(Torrent, function Trig_Torrent_Actions )
set Torrent=null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
////////////////////////////////////////////////////////////////////////////////////////////
// Dispersion->Spectre's 3rd skill present by kingking 100%MUI+Work //
// (If you implement properly)//
// How to implement? //
// 1)Copy the map header's scripts and this trigger. //
// 2)Copy the ability from object editor or create yourself. //
// 3)Change the raw code at below to correct 1. //
// 4)Dun forget to save it! ^_^ //
// 5)Enjoy it! //
// //
// Requirement : //
// Jass NewGen Pack v5b or above(because this is vJass syntax) //
// //
// The map header's scripts is a great struct attaching system created by myself. //
// You can change to other system if you want. //
// //
// "Creditless" if you use this spell in your map because I only remade this DotA //
// spell. If you use map header's scripts, give me credits plz. //
////////////////////////////////////////////////////////////////////////////////////////////
constant function Dispersion_Id takes nothing returns integer
return 'A002'//Rawcode of Dispersion
endfunction
constant function Dispersion_Percent takes nothing returns real
return 5.00//How many percent you want to disperse? (Increases per level also)
endfunction
constant function Dispersion_AoE takes nothing returns real
return 1000.00//How many range of you want to disperse?
endfunction
constant function Dispersion_effect takes nothing returns string
return "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl"
//what special effect you wan?
endfunction
///->I dont recommended you edit anything below unless you need to edit to suit your map<-//
///////////If you read tutorial at below, plz start at the seconds lowest function//////////
scope Dispersion
private function Disperse_Check takes nothing returns boolean
if IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))==true and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>=0.45 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false then
//picked unit is enemy and not dead and not a building
return true
endif
return false
endfunction
private function Dispers takes nothing returns nothing
local group a=CreateGroup()//Create a group, will use later
local trigger b=GetTriggeringTrigger()//This trigger
local unit c//Will use later
local unit d=GetTriggerUnit()//Dispersion Caster
local real damage=GetEventDamage()//Damage took
call DisableTrigger(b)//Disable this trigger to prevent lag.(DisableTrigger does not interrupt the execution of function)
call GroupEnumUnitsInRangeOfLoc(a,GetUnitLoc(d),Dispersion_AoE(),Condition(function Disperse_Check))
//Pick units in 1000 range of caster matching condition at function Check
loop
set c=FirstOfGroup(a)//set c to first unit in group that we picked juz now
exitwhen c==null//loop end when c is null(NO more unit in group)
call UnitDamageTarget(d,c,damage*GetUnitAbilityLevel(d,Dispersion_Id())*Dispersion_Percent()/100,false,true,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
//Damage the unit
call DestroyEffect(AddSpecialEffectTarget(Dispersion_effect(),c,"overhead"))
//Add special effect to it
call GroupRemoveUnit(a,c)
//remove it from group to prevent it being picked again
set c=null
//remove leak
endloop
call GroupClear(a)
//Clear the group
call DestroyGroup(a)
//Destroy the group because we dun need it anymore and remove leak
set a=null
set d=null
//Clear leaks
call EnableTrigger(b)
set b=null
endfunction
private function DispersionCond takes nothing returns boolean
if GetLearnedSkill()==Dispersion_Id() then//If learnt skill is Disperse then start this trigger
return true
endif
return false
endfunction
private function Dispersion_Act takes nothing returns nothing
local trigger a=CreateTrigger()//Create a new trigger
local unit caster=GetTriggerUnit()//caster
local trigger b=GetTrigger1FromUnit(caster)//Get attached trigger in caster(used when higher than level 1)
//If we dun use this, the caster will disperse 2 or more times when it has level 2 or above
//because we add the effect when the caster learn or level up Dispersion
//it will stacks up together.
if b!=null then//If b has trigger, then
call TriggerClearActions(b)//Destroy it
call TriggerClearConditions(b)
call DestroyTrigger(b)
call ClearStruct1InUnit(caster)
endif
call TriggerRegisterUnitEvent(a,caster,EVENT_UNIT_DAMAGED)//Trigger start when the caster is damaged(the trigger is created at the uppest of this function)
call TriggerAddAction(a,function Dispers)//Add action to the trigger(action is function Dispers)
call AddStruct1ToUnit(caster,a)//Attach trigger to caster(to prevent disperse 2 or more times after the caster has level 2 or higher of Dispersion)
set caster=null
set a=null
set b=null
//remove leaks
endfunction
function InitTrig_Dispersion takes nothing returns nothing
local trigger Dispersion = CreateTrigger()//Create a trigger
call TriggerRegisterAnyUnitEventBJ(Dispersion, EVENT_PLAYER_HERO_SKILL )//Add event(A unit learnt a skill)
call TriggerAddCondition(Dispersion, Condition( function DispersionCond) )//Add condition(refer to function DispersionCond)
call TriggerAddAction(Dispersion, function Dispersion_Act)//Add action to trigger(refer to function Dispersion_Act)
set Dispersion=null//Remove leak
endfunction
endscope
//TESH.scrollpos=13
//TESH.alwaysfold=0
////////////////////////////////////////////////////////////////////////////////////////////
// X Marks the Spot->Spectre's 3rd skill present by kingking 100%MUI+Work //
// (If you implement properly)//
// How to implement? //
// 1)Copy the map header's scripts and this trigger. //
// 2)Copy the abilities from object editor or create yourself. //
// 3)Change the raw code at below to correct 1. //
// 4)Dun forget to save it! ^_^ //
// 5)Enjoy it! //
// //
// Requirement : //
// Jass NewGen Pack v5b or above(because this is vJass syntax) //
// //
// Optional : //
// Model from Will. //
// //
// The map header's scripts is a great struct attaching system created by myself. //
// You can change to other system if you want. //
// //
// "Creditless" if you use this spell in your map because I only remade this DotA //
// spell. If you use map header's scripts, give me credits plz. //
////////////////////////////////////////////////////////////////////////////////////////////
constant function X_Marks_the_Spot_Id takes nothing returns integer
return 'A004'//Raw code of X Marks the Spot
endfunction
constant function Return_Id takes nothing returns integer
return 'A005'//Raw code of Return
endfunction
scope XMarkstheSpot
private function Return1 takes nothing returns boolean
if GetSpellAbilityId() == Return_Id() then
return true
endif
return false
endfunction
private function Return2 takes nothing returns nothing
local unit caster=GetTriggerUnit()//Caster
local unit a=GetUnit1FromUnit(caster)//Get attached target from caster
local effect c//A special effect's variable
local location d//Return's location
local texttag X
if a!=null then//If attached target returns a unit, then
set c=GetEffect1FromUnit(a)//Get attached effect from target
set d=Location(GetInt2FromUnit(a),GetInt3FromUnit(a))//Get attached location from target
set X=GetTexttagFromUnit(a)//Get attached X from target
call SetUnitPositionLoc(a,d)//teleport the target back
//Removes leaks//
call DestroyEffect(c)
call DestroyEffect(AddSpecialEffectLoc("war3mapImported\\X_Mark_the_Spot.mdx",d))
call RemoveLocation(d)
call DestroyTextTag(X)
call ClearStruct1InUnit(a)
call ClearStruct2InUnit(a)
call ClearStruct3InUnit(a)
call ClearStruct1InUnit(caster)
call AddInt2ToUnit(caster,1)//We give an indicator to script that the caster already casts Retrun
////////////////
endif
//Remove leaks
set caster=null
set a=null
set c=null
set d=null
set X=null
/////////////
endfunction
private function X_Marks_the_Spot_1 takes nothing returns boolean
if GetSpellAbilityId() == X_Marks_the_Spot_Id() then
return true
endif
return false
endfunction
private function X_Marks_the_Spot_2 takes nothing returns nothing
local unit Xcaster=GetTriggerUnit()//Caster
local unit targ=GetSpellTargetUnit()//Target
local effect c=AddSpecialEffectTarget("war3mapImported\\X_Mark_the_Spot.mdx",targ,"overhead")
//Create a special effect
local integer d=R2I(GetLocationX(GetUnitLoc(targ)))// Set the location
local integer e=R2I(GetLocationY(GetUnitLoc(targ)))
local integer Check=0//To check whether return got cast a not.
local texttag X=CreateTextTagLocBJ("X",Location(d,e),0,20,100,10,10,15)//Create "X" on the location
call AddStruct1ToUnit(Xcaster,targ)//Attach target to caster
call AddStruct1ToUnit(targ,c)//Attach special effect to target
call AddInt2ToUnit(targ,d)//Attach location to target
call AddInt3ToUnit(targ,e)//Attach location to target
call AddTexttagToUnit(targ,X)//Attach X to target
call TriggerSleepAction(GetUnitAbilityLevel(Xcaster,X_Marks_the_Spot_Id()))
//Wait
set Check=GetInt2FromUnit(Xcaster)
if Check==0 then//This is used to check whether the caster got cast Return a not.
//If the caster does not cast, it will 0, by turn, it will return 1.
//So these things will triggerred when caster did not cast Return.
call SetUnitPositionLoc(targ,Location(d,e))
//Teleport the unit back
//Remove Leaks//
call DestroyEffect(AddSpecialEffectLoc("war3mapImported\\X_Mark_the_Spot.mdx",Location(d,e)))
call DestroyEffect(c)//This special effect needed to remove if the caster does not cast Return
//If the caster casts Return, this effect will be destroyed.
endif
call RemoveLocation(Location(d,e))
call DestroyTextTag(X)
call ClearStruct1InUnit(Xcaster)
call ClearStruct2InUnit(Xcaster)
call ClearStruct1InUnit(targ)
call ClearStruct1InUnit(targ)
call ClearTexttagInUnit(targ)
set targ=null
set c=null
set Xcaster=null
set X=null
/////////
endfunction
private function X_Marks_the_Spot_Learnt1 takes nothing returns boolean
if GetUnitAbilityLevel(GetTriggerUnit(),X_Marks_the_Spot_Id())==1 then
return true
endif
return false
endfunction
private function X_Marks_the_Spot_Learnt2 takes nothing returns nothing
call UnitAddAbility(GetTriggerUnit(),Return_Id())//Add Return to learning unit that learns X Marks the Spot
endfunction
//===========================================================================
function InitTrig_X_Marks_the_Spot takes nothing returns nothing
local trigger X_Marks_the_Spot = CreateTrigger()
local trigger X_Marks_the_Spot_Learnt=CreateTrigger()
local trigger Return=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(X_Marks_the_Spot, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition(X_Marks_the_Spot, Condition( function X_Marks_the_Spot_1))
call TriggerAddAction(X_Marks_the_Spot, function X_Marks_the_Spot_2)
set X_Marks_the_Spot=null
call TriggerRegisterAnyUnitEventBJ(X_Marks_the_Spot_Learnt, EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(X_Marks_the_Spot_Learnt, Condition( function X_Marks_the_Spot_Learnt1))
call TriggerAddAction(X_Marks_the_Spot_Learnt, function X_Marks_the_Spot_Learnt2)
set X_Marks_the_Spot_Learnt=null
call TriggerRegisterAnyUnitEventBJ(Return,EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition(Return, Condition(function Return1))
call TriggerAddAction(Return,function Return2)
set Return=null
endfunction
endscope
//TESH.scrollpos=66
//TESH.alwaysfold=0
////////////////////////////////////////////////////////////////////////////////////////////
// Powershot->Windrunner's 2nd skill present by kingking 100%MUI+Work //
// (If you implement properly)//
// How to implement? //
// 1)Copy the map header's scripts and this trigger. //
// 2)Copy the abilities from object editor or create yourself. //
// 3)Copy the dummy arrow from object editor or create yourself. //
// 4)Change the raw code at below to correct 1. //
// 5)Dun forget to save it! ^_^ //
// 6)Enjoy it! //
// //
// Requirement : //
// Jass NewGen Pack v5b or above(because this is vJass syntax) //
// // //
// The map header's scripts is a great struct attaching system created by myself. //
// You can change to other system if you want. //
// //
// "Creditless" if you use this spell in your map because I only remade this DotA //
// spell. If you use map header's scripts, give me credits plz. //
////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////->Constant functions start<-///////////////////////////////////
constant function Powershot_Id takes nothing returns integer
return 'A008'//Powershot's ID
endfunction
constant function Powershot_KillTrees_Id takes nothing returns integer
return 'A00A'//Powershot's Kill Tree ID
endfunction
constant function Powershot_KillTrees_OrderId takes nothing returns string
return "eattree"//Powershot's Kill Tree Order String
endfunction
constant function Powershot_KillTrees_Dummy takes nothing returns integer
return 'h000'//This dummy is used to kill trees
endfunction
constant function Powershot_Damage takes nothing returns real
return 90.00//Powershot's Damage
endfunction
constant function Powershot_Damage_Decrease_Percent takes nothing returns real
return 10.00//How much percent of damage decreased per target?
endfunction
constant function Powershot_Dummy takes nothing returns integer
return 'h003'//Dummy Arrow's Id
endfunction
constant function Powershot_Range takes nothing returns real
return 1700.00//How many range you want?
endfunction
constant function Powershot_Speed takes nothing returns real
return 3400.00//How fast the arrow's speed you wan?
endfunction
constant function Powershot_Delay takes nothing returns real
return 0.75//You want how many second delayed before the arrow shot?
endfunction
constant function Powershot_AoE takes nothing returns real
return 150.00//AoE of Powershot
endfunction
//////////////////////////////->Constant functions end<-////////////////////////////////////
//////////////////////Dont edit anything below unless you noe to edit.//////////////////////
scope Powershot
private function Powershot_A takes nothing returns boolean
if GetSpellAbilityId()==Powershot_Id() then//Condition
return true
endif
return false
endfunction
//This function is used to kill trees.
private function Powershot_KillTrees takes nothing returns nothing
local unit a=CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE),Powershot_KillTrees_Dummy(),GetDestructableLoc(GetEnumDestructable()),0)
//Create a neutral passive dummy
call UnitAddAbility(a,Powershot_KillTrees_Id())
//Add eat tree ability to it
call IssueTargetOrder(a,Powershot_KillTrees_OrderId(),GetEnumDestructable())
//Order it to eat tree
call UnitApplyTimedLife(a,'BTLF',0.15)
//Add Expirarion timer to it
set a=null
//Nullify
endfunction
//Read the PowershotAct first, plz...
private function Slide_Arrow takes nothing returns nothing
local timer d=GetExpiredTimer()//Expired Timer
local unit a=GetUnit4FromTimer(d)//Caster
local real b=GetInt1FromTimer(d)//Damage
local unit dummy=GetUnit2FromTimer(d)//Arrow
local group c=CreateGroup()//Used to damage enemies
local group e=GetGroup3FromTimer(d)//Damaged Unit
local unit temp//temp unit
call SetUnitPositionLoc(dummy,PolarProjectionBJ(GetUnitLoc(dummy),Powershot_Speed()/50,GetUnitFacing(dummy)))
//Move dummy
call GroupEnumUnitsInRangeOfLoc(c,GetUnitLoc(dummy),Powershot_AoE(),null)
//Pick every unit near dummy
loop
set temp=FirstOfGroup(c)//set temp=First unit in group
exitwhen temp==null//loop ends when no more unit in group
if IsUnitEnemy(temp,GetOwningPlayer(a))==true and GetUnitState(temp,UNIT_STATE_LIFE)>=0.45 and IsUnitType(temp,UNIT_TYPE_STRUCTURE)==false and IsUnitType(temp,UNIT_TYPE_MAGIC_IMMUNE)==false and IsUnitInGroup(temp,e)==false then
//If temp is enemy of caster and temp is not dead and temp is not structure and temp is not magic immunue and temp is not in damage unit group
call UnitDamageTarget(a,temp,b,false,true,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
//damage it
set b=b*(100-Powershot_Damage_Decrease_Percent())/100
//decrease damage
endif
call GroupRemoveUnit(c,temp)//Remove temp from damage
call GroupAddUnit(e,temp)//Add temp into this group to prevent it to be damaged again
set temp=null//nullify it
endloop
call EnumDestructablesInCircleBJ(Powershot_AoE(),GetUnitLoc(dummy),function Powershot_KillTrees)
//Group and kill trees
call ClearStruct1InTimer(d)
call ClearStruct3InTimer(d)
call AddInt1ToTimer(d,R2I(b))//Set damage to timer
call AddStruct3ToTimer(d,e)//Set damaged unit to timer
call GroupClear(c)//Clear the group to prevent leak
call DestroyGroup(c)
//Remove leaks
set d=null
set a=null
set dummy=null
set c=null
set e=null
set temp=null
endfunction
private function PowershotAct takes nothing returns nothing
local unit a=GetTriggerUnit()//Caster
local location b=GetSpellTargetLoc()//targeted location
local real c=Powershot_Damage()*GetUnitAbilityLevel(a,Powershot_Id())//Count damage
local timer d=CreateTimer()//Create a timer to start moving dummy arrow and damage enemies
local unit dummy//variable for dummy arrow
local group damaged=CreateGroup()//To store damaged enemies
call TriggerSleepAction(Powershot_Delay())//Wait for delay
set dummy=CreateUnitAtLoc(GetOwningPlayer(a),Powershot_Dummy(),PolarProjectionBJ(GetUnitLoc(a),50.00,DistanceBetweenPoints(GetUnitLoc(a),b)),AngleBetweenPoints(GetUnitLoc(a),b))
//Create dummy
call UnitApplyTimedLife(dummy,'BTLF',(Powershot_Range()/Powershot_Speed())-(50.00/Powershot_Speed()))
//Add Expiration Timer to it.
//Store Struct to timer we created juz now.
call AddInt1ToTimer(d,R2I(c))
call AddStruct2ToTimer(d,dummy)
call AddStruct3ToTimer(d,damaged)
call AddStruct4ToTimer(d,a)
//Start timer to move arrow and damage unit, plz read Slide_Arrow now.
call TimerStart(d,0.02,true,function Slide_Arrow)
//Wait for the arrow die
call TriggerSleepAction((Powershot_Range()/Powershot_Speed())-(50.00/Powershot_Speed()))
//Clean leaks
call DestroyTimer(d)
call RemoveLocation(b)
set damaged=GetGroup4FromTimer(d)
call GroupClear(damaged)
call DestroyGroup(damaged)
call ClearStruct1InTimer(d)
call ClearStruct2InTimer(d)
call ClearStruct3InTimer(d)
call ClearStruct4InTimer(d)
set a=null
set b=null
set d=null
set dummy=null
set damaged=null
//Clear leak ends
endfunction
//===========================================================================
function InitTrig_Powershot takes nothing returns nothing
local trigger Powershot = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(Powershot,EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(Powershot, Condition(function Powershot_A))
call TriggerAddAction(Powershot, function PowershotAct)
set Powershot=null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
////////////////////////////////////////////////////////////////////////////////////////////
// Elune's Arrow->Mirana's 2nd skill present by kingking 100%MUI+Work //
// (If you implement properly)//
// How to implement? //
// 1)Copy the map header's scripts and this trigger. //
// 2)Copy the abilities from object editor or create yourself. //
// 3)Copy the dummy arrow from object editor or create yourself. //
// 4)Change the raw code at below to correct 1. //
// 5)Dun forget to save it! ^_^ //
// 6)Enjoy it! //
// //
// Requirement : //
// Jass NewGen Pack v5b or above(because this is vJass syntax) //
// // //
// The map header's scripts is a great struct attaching system created by myself. //
// You can change to other system if you want. //
// //
// "Creditless" if you use this spell in your map because I only remade this DotA //
// spell. If you use map header's scripts, give me credits plz. //
////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////->Constant functions start<-///////////////////////////////////
constant function EA_Id takes nothing returns integer
return 'A006'//Elune's Arrow ID
endfunction
constant function EA_Damage takes nothing returns real
return 90.00//Elune's Arrow Damage
endfunction
constant function EA_Dummy_Arrow takes nothing returns integer
return 'h003'//Dummy Arrow's Id
endfunction
constant function EA_Dummy takes nothing returns integer
return 'h000'//Dummy's Id (This dummy is used to stun)
endfunction
constant function EA_DummyStun takes nothing returns integer
return 'A009'//Stun's ID
endfunction
constant function EA_DummyStunBuff takes nothing returns integer
return 'BPSE'//Stun's Buff ID
endfunction
constant function EA_Stun_Min takes nothing returns real
return .5//Minimum stun duration
endfunction
constant function EA_Stun_Max takes nothing returns real
return 5.00//Maximum stun duration (you have to change the duration in the dummy stun)
endfunction
constant function EA_DummyStunOrder takes nothing returns string
return "thunderbolt"//Stun's Order String
endfunction
constant function EA_Range takes nothing returns real
return 1800.00//How many range you want?
endfunction
constant function EA_Speed takes nothing returns real
return 1800.00//How fast the arrow's speed you wan?
endfunction
constant function EA_AoE takes nothing returns real
return 100.00//AoE
endfunction
//////////////////////////////->Constant functions end<-////////////////////////////////////
//////////////////////Dont edit anything below unless you noe to edit.//////////////////////
scope ElunesArrow//Use scope to enable we use private
globals
private unit temp_cast//We use private to prevent collision (used when pick unit to damage)
endglobals
private function EA_Filter takes nothing returns boolean
if IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(temp_cast))==true and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>=0.45 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false and IsUnitType(GetFilterUnit(),UNIT_TYPE_MAGIC_IMMUNE)==false then
return true//This is used to pick unit to damage
endif
return false
endfunction
private function EA_A takes nothing returns boolean
if GetSpellAbilityId()==EA_Id() then//Condition
return true
endif
return false
endfunction
private function EA_Slide_Arrow takes nothing returns nothing
local timer c=GetExpiredTimer()//Expired timer
local unit a=GetUnit1FromTimer(c)//Caster
local unit dummy=GetUnit2FromTimer(c)//Dummy Arrow
local group damage=CreateGroup()//we use this group to pick enemy
local unit stundummy//we use to stun enemy
local unit b//temp unit
local location d=GetLoc3FromTimer(c)//Caster's Location
call SetUnitPositionLoc(dummy,PolarProjectionBJ(GetUnitLoc(dummy),EA_Speed()/50,GetUnitFacing(dummy)))
//Move dummy arrow
set temp_cast=a//Set the global to caster
call GroupEnumUnitsInRangeOfLocCounted(damage,GetUnitLoc(dummy),EA_AoE(),Condition(function EA_Filter),1)
//Pick enemy
set temp_cast=null
//nullify it becauz we dont use it anymore
set b=FirstOfGroup(damage)//set b equal to first unit in group
if b!=null then//If b is not null(So this is the unit we need stun it)
//Cleans leaks becauz the arrow will die and we dont need to use it anymore
call DestroyTimer(c)
call RemoveLocation(d)
call ClearStruct1InTimer(c)
call ClearStruct2InTimer(c)
call ClearStruct3InTimer(c)
call UnitApplyTimedLife(dummy,'BTLF',.001)//Instant kill arrow
set stundummy=CreateUnitAtLoc(GetOwningPlayer(a),EA_Dummy(),GetUnitLoc(b),0)//Create a dummy
call UnitAddAbility(stundummy,EA_DummyStun())//Add stun to the dummy
call IssueTargetOrder(stundummy,EA_DummyStunOrder(),b)//Order dummy to stun the enemy
call UnitApplyTimedLife(stundummy,'BTLF',1)//Add expiration timer to dummy
call UnitDamageTarget(a,b,EA_Damage()*GetUnitAbilityLevel(a,EA_Id()),false,true,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
//Caster damage the enemy
call TriggerSleepAction((EA_Range()/(EA_Stun_Max()-EA_Stun_Min))*DistanceBetweenPoints(d,GetUnitLoc(b)))
//Wait for certain seconds
call UnitRemoveAbility(b,EA_DummyStunBuff())
//Remove stun buff from the enemy
endif
//Clean Leaks
set c=null
set a=null
set b=null
set dummy=null
set stundummy=null
set damage=null
set d=null
endfunction
private function EAAct takes nothing returns nothing
local unit a=GetTriggerUnit()//Caster
local timer c=CreateTimer()//Create a timer to move arrow and stun enemy
local unit dummy=CreateUnitAtLoc(GetOwningPlayer(a),EA_Dummy_Arrow(),PolarProjectionBJ(GetUnitLoc(a),50.0,AngleBetweenPoints(GetUnitLoc(a),GetSpellTargetLoc())),AngleBetweenPoints(GetUnitLoc(a),GetSpellTargetLoc()))
//create a dummy arrow and set it's facing
local location d=GetUnitLoc(a)//Get caster's location
call UnitApplyTimedLife(dummy,'BTLF',(EA_Range()/EA_Speed())-(50/EA_Speed()))//Add Expiration timer to dummy
//Attach structs to timer
call AddStruct1ToTimer(c,a)
call AddStruct2ToTimer(c,dummy)
call AddStruct3ToTimer(c,d)
call TimerStart(c,0.02,true,function EA_Slide_Arrow)//Start moving dummy and stun enemy
call TriggerSleepAction((EA_Range()/EA_Speed())-(50.00/EA_Speed()))
//Wait until the dummy arrow die
//Clean Leaks
call DestroyTimer(c)
call ClearStruct1InTimer(c)
call ClearStruct2InTimer(c)
call ClearStruct3InTimer(c)
set a=null
set c=null
set dummy=null
endfunction
//===========================================================================
function InitTrig_Elunes_Arrow takes nothing returns nothing
local trigger EA = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(EA,EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(EA, Condition(function EA_A))
call TriggerAddAction(EA, function EAAct)
set EA=null
endfunction
endscope