- Joined
- Jul 17, 2013
- Messages
- 90
JASS:
scope Entrangling Roots initializer Init
// +-------------------------------------------------------------------------------------------------------------------------+
// | Entrangling Roots - Created by dotieris123. Requires a vJass preprocessor! |
// +-------------------------------------------------------------------------------------------------------------------------+
// | Gives a great chance to entrangle the targetet unit |
// | to the owner of the attacker. |
// +-------------------------------------------------------------------------------------------------------------------------+
// | How to Import: |
// | - Create a new trigger |
// | - Convert it to Custom text (Edit > Convert to Custom Text) |
// | - Replace everything there with this code |
// | - Change the constants to suit yourself |
// | - Enjoy! |
// +-------------------------------------------------------------------------------------------------------------------------+
// |-------------|
// | Constants: |
// |-------------|
globals
// The effect created on the target when it is being entrangled:
private constant string EFFECT "Abilities\Spells\NightElf\EntanglingRoots\EntanglingRootsTarget.mdl"
// Which is attached to the targets:
private constant string EFFECT_POSITION "origin"
// The Raw code of the ability
private constant integer ID = 'A600'
endglobals
private constant function CHANCE takes integer level returns integer
// The chance of a unit being possessed. "level" is the level of the ability
return level * 1
endfunction
// |------------------|
// | End of Constants |
// |------------------|
// DO NOT EDIT BELOW THIS LINE!
private function True takes nothing returns boolean
return true
endfunction
private function Cons takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetAttacker())) and GetRandomInt(0, 100) <= 35(GetUnitAbilityLevel(GetAttacker(), 'A600')) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true and GetUnitAbillityLevel(GetAttacker(), 'A600') > 0
endfunction
private function Entrangling Roots takes nothing returns nothing
local unit u = GetAttacker()
local unit t = GetTriggerUnit()
call DestroyEffect(AddSpecialEffectTarget("Abilities\Spells\NightElf\EntanglingRoots\EntanglingRootsTarget.mdl", t, "origin"))
call SetUnitOwner(t, GetOwningPlayer(u), true)
set u = null
set t = null
endfunction
private function Init takes nothing returns nothing
local Tirgger t = CreateTrigger()
local integer i = 0
loop
exitwhen i > 15
call TriggerRegisterPlayerUnitEvent(t, Player (i) EVENT_PLAYER_UNIT_ATTACKED, Filter(function True))
set i = i + 1
endloop
call TriggerAddCondition(t, Filter(function Cons))
call TriggerAddAction(t, function Entrangling Roots)
endfunction
Last edited by a moderator: