• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Mana Controller Spellpack 1.2

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
This is my first uploads on THW, but not my first spells :)
This is Jass maded spells. I will update them (I think when I will do full spellpack it will contain about 12 spells).
For now spellpack contain 3 spells

Mana controller begin to manipulate targets mana, burning 3/4/5/6/7(Mana controller int - target int) and give u 1/3(of combusted mana). If target mana becomes to 0 it will get stuned for 2 sec. if targets int is biger that caster, then caster instantly tp to the target


JASS:
function Trig_Improved_Mana_drain_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000' //if casted spell is 'A000' then whole spell will work
endfunction

function firstft takes nothing returns boolean
    return GetHeroInt(GetTriggerUnit(), true) > GetHeroInt(GetSpellTargetUnit(), true)// if hero's int bigger then spell target's int then he will drain mana
endfunction

function secondft takes nothing returns boolean
    return ( GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) <= I2R(( ( 2 + GetUnitAbilityLevel(GetTriggerUnit(), GetSpellAbilityId()) ) * GetHeroInt(GetTriggerUnit(), true) - GetHeroInt(GetSpellTargetUnit(), true) ) ))//this condition is to prevent over damaging target or setting his mana to negative value and crashing Wc3
endfunction

function Trig_Improved_Mana_drain_Actions takes nothing returns nothing
    local integer int1 = ( 2 + GetUnitAbilityLevel(GetTriggerUnit(), GetSpellAbilityId()) )//this is multiplier of int(caster) - int(target)
    local location loc1 = GetUnitLoc(GetTriggerUnit())//set locations
    local location loc2 = GetUnitLoc(GetSpellTargetUnit())
    local integer int2 = ( int1 * ( GetHeroInt(GetTriggerUnit(), true)  - GetHeroInt(GetSpellTargetUnit(), true)  ) )// this is int(caster) - int(target) (Change GetHero/Int/ to /Str/ or /Agi/ if u need)
    local real Dmg =  32.00 + ( 32.00 * I2R(GetUnitAbilityLevel(GetTriggerUnit(), GetSpellAbilityId())) )//this is DMG if firstft is false and hero TP to target
    local lightning liEf
//setting locals for Lightning effect
    local real x1 = GetLocationX(loc1)
    local real y1 = GetLocationY(loc1)
    local real z1 = (GetLocationZ(loc1) + 50)
    local real x2 = GetUnitX(GetSpellTargetUnit())
    local real y2 = GetUnitY(GetSpellTargetUnit())
    local real z2 = (GetLocationZ(loc2) + 50)
//end setting locals
    set liEf = AddLightningEx( "MBUR" , false , x1 , y1 , z1 , x2 , y2 , z2)//creating lighning effect
    call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Undead\\Possession\\PossessionMissile.mdl", GetSpellTargetUnit(), "origin" ) )//eye candy
    if ( secondft() ) then
        call UnitDamageTarget( GetTriggerUnit(), GetSpellTargetUnit(), (GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) + 100),true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS )//damage target
        call SetWidgetLife( GetTriggerUnit(), ( GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) + ( GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) / 3.00 ) ) )//heal caster
        call SetUnitState( GetTriggerUnit(),UNIT_STATE_MANA, ( GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) + ( GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) / 3.00 ) ) )//adding mana to caster
        call SetUnitState( GetSpellTargetUnit(),UNIT_STATE_MANA, 0 )//removing mana
        call CastStun(2,GetSpellTargetUnit(),GetTriggerUnit())//stuning target for 2 sec
    else
        if ( firstft() ) then
            call UnitDamageTarget( GetTriggerUnit(), GetSpellTargetUnit(), I2R(int2), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS )//damaging target
            call SetUnitState( GetSpellTargetUnit(),UNIT_STATE_MANA, ( GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) - I2R(int2)  ))//taking of his mana
            call SetUnitState( GetTriggerUnit(),UNIT_STATE_MANA, ( GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) + (I2R(int2) /3 )))//give mana to caster
            call SetWidgetLife( GetTriggerUnit(), (  GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) + (I2R(int2)  / 3.00 ) ))//heal caster
        else
            call SetUnitPosition( GetTriggerUnit(), x2,y2 )//TP unit
            call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", GetTriggerUnit(), "origin" ))//eye candy
            call SetUnitState( GetSpellTargetUnit(), UNIT_STATE_MANA ,( GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) - Dmg))//taking of mana
            call UnitDamageTarget( GetTriggerUnit(), GetSpellTargetUnit(), Dmg,true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS )//damaging target
        endif
    endif
//clearing locals to remove leaks
    call RemoveLocation(loc1)
    call RemoveLocation(loc2)
    call PolledWait2(0.34)//waiting
    call DestroyLightning(liEf)//destroing lightning
    set loc1 = null
    set loc2 = null
    set liEf = null
endfunction



//===========================================================================
function InitTrig_Improved_Mana_drain takes nothing returns nothing
    local trigger gg_trg_Improved_Mana_drain = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Improved_Mana_drain, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Improved_Mana_drain, Condition( function Trig_Improved_Mana_drain_Conditions ) )
    call TriggerAddAction( gg_trg_Improved_Mana_drain, function Trig_Improved_Mana_drain_Actions )
    set gg_trg_Improved_Mana_drain = null
endfunction


and 2nd spell ( it is like kunkka splash from dota)

Mana controller's blade are magicaly sealed, and can blast many enemys in one hit. His blade can splash 90/100/110/125% of dmg in 250/275/300/325 radius in front of him. Magic seal of the blade will drain 25/40/55/70 mana and hp and give it to mana controller. Blade still need to recharge after attack, and his cooldown is 11/10/9/8 sec


JASS:
function Trig_mana_combust_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(), 'A002') > 0//this condition will see if attacker ability level of 'A002' is greater then 0 then whole trigger will work
endfunction

function Trig_mana_combust_Actions takes nothing returns nothing
//setting locals
local integer lvl = GetUnitAbilityLevel(GetAttacker(),'A002')
local unit atacker = GetAttacker()
local unit atacked = GetTriggerUnit()
local real dmg = I2R(10+(15*lvl))//setting damage of attack (and stealing mana, health) to 10+15*lvl (25/40/55/70)
call PolledWait2(0.3)//wait for attack
call UnitRemoveAbility(atacker,'A002')//removing ability from unit (for prevent abusing it)
call SetPlayerAbilityAvailable(GetOwningPlayer(atacker),'A002',false)// remove ability
call UnitDamageTarget(atacker, atacked, dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)//dmg target
call SetWidgetLife(atacker,(GetUnitState(atacker, UNIT_STATE_LIFE)+dmg))//healing attacker
call SetUnitState(atacker,UNIT_STATE_MANA,(GetUnitState(atacker,UNIT_STATE_MANA)+dmg))// giving him mana
call SetUnitState(atacked,UNIT_STATE_MANA,(GetUnitState(atacked,UNIT_STATE_MANA)-dmg))// removing targets mana
call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl" , atacked , "chest" ))//eye candy
call PolledWait2(12-I2R(lvl))//cooldown is 12 sec - 1 sec per level of ability
//adding ability to attacker again
call UnitAddAbility(atacker,'A002') 
call SetUnitAbilityLevel(atacker, 'A002', lvl)
call SetPlayerAbilityAvailable(GetOwningPlayer(atacker),'A002',true)
//nulling locals to prevent leaks
set atacker = null
set atacked = null
endfunction

//===========================================================================
function InitTrig_mana_combust takes nothing returns nothing
    local trigger gg_trg_mana_combust = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_mana_combust, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_mana_combust, Condition( function Trig_mana_combust_Conditions ) )
    call TriggerAddAction( gg_trg_mana_combust, function Trig_mana_combust_Actions )
    set gg_trg_mana_combust = null
endfunction



Ultimate Mana Controller skill that ables him to create instable arcana. Instable Arcana can Stun for random time between 0.5 and 2.5, or Burn 50-250 mana or heal himself for 25-125 hp. Passivly add a critical hit chance 2x. Chance to provoke this ability is 7/9/11%. Cooldown of this abbility is 2 sec (not critical strike)


JASS:
function Trig_Instable_Arcana_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(), 'A003') > 0//this condition will see if attacker ability level of 'A002' is greater then 0 then whole trigger will work
endfunction

function Text takes string text, real size, real colorR, real colorG, real colorB, real alpha returns nothing 
//this func will create textags
local texttag t = CreateTextTagUnitBJ( text, GetTriggerUnit(), 100.00, size, colorR, colorG, colorB, alpha )
call SetTextTagPermanent(t,false)
call SetTextTagFadepoint(t , 2)
call SetTextTagLifespan(t , 4)
endfunction

function Trig_Instable_Arcana_Actions takes nothing returns nothing
//setting locals
local integer lvl = (5+(2*GetUnitAbilityLevel(GetAttacker(),'A003')))//this is chance to provoke dmg heal or stun
local unit atacker = GetAttacker()
local unit atacked = GetTriggerUnit()
local integer random = GetRandomInt(0,4)//this random is for see what it will provoke stun dmg or heal
local real randomr = GetRandomReal(50,250)//this is for stun
local integer randomi = GetRandomInt(50,250)//this is for heal and dmg
if GetRandomReal(0,100) < lvl then//condition
    call PolledWait2(0.3)// waiting for attack
    call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", atacked, "chest"))//eyecandy
    call UnitRemoveAbility(atacker,'A003')//removing ability to prevent abusing it
    call SetPlayerAbilityAvailable(GetOwningPlayer(atacker),'A003',false)//remove it from "+" to prevent bugs
    if random < 1 then//if random is 0 then it will stun
        call Text(R2S(randomr/100) + "sec",(randomr /10), 0,0,100,0)//creating blue text tag with stun sec
        call CastStun((randomr/100), atacked, atacker)//stuning target
    else
        if random < 3 then//if random is less then it will dmg
            call UnitDamageTarget(atacker, atacked, randomr, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)//dmg target
            call SetUnitState(atacked,UNIT_STATE_MANA,(GetUnitState(atacked,UNIT_STATE_MANA)-randomr))//burning his mana
            call Text("-" + (I2S(randomi)) + "hp",I2R(randomi /10), 100,0,0,0)//creating red textag with dmg count
        else// if random is more or = 3 then it will heal
            call SetWidgetLife(atacker,GetUnitState(atacker,UNIT_STATE_LIFE)+randomr/2)//healing
            call Text("+" + (I2S(randomi/2)) + "hp",I2R(randomi /10), 35,100,0,0)//creating green textag with healing count
        endif
    endif
    call PolledWait2(2)//waiting cooldown
    //adding ability again
    call UnitAddAbility(atacker,'A003')
    call SetUnitAbilityLevel(atacker, 'A003', lvl)
    call SetPlayerAbilityAvailable(GetOwningPlayer(atacker),'A003',true)
    //nulling locals to prevent leaks
    set atacker = null
    set atacked = null
endif
endfunction

//===========================================================================
function InitTrig_Instable_Arcana takes nothing returns nothing
    local trigger gg_trg_Instable_Arcana = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Instable_Arcana, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Instable_Arcana, Condition( function Trig_Instable_Arcana_Conditions ) )
    call TriggerAddAction( gg_trg_Instable_Arcana, function Trig_Instable_Arcana_Actions )
    set gg_trg_Instable_Arcana = null
endfunction



Mana controller can see casting of spells, and can protect him self from it, by instant blink to a maximum of 400 yards away, and when he done it, he will throw 2/4/6/8 mana balls that will damage and burn mana for (int/2) each. Mana balls will provoke at any cast at him, and blink provoke is 10/20/30/40% chance. Passivly inscrize ur speed. move 3/6/9/12% and attack 15/20/25/35% speed.


JASS:
function FT takes nothing returns boolean
    return (GetUnitAbilityLevel(GetSpellTargetUnit(), 'B000') > 0) == true and (IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetSpellTargetUnit())) == true)// If target of Caster is enemy and he has Buff 'B000' then whole trigger will work
endfunction


function Trig_Magic_Defence_Actions takes nothing returns nothing
    local unit ST = GetSpellTargetUnit()// Setting the main unit
    local real x1 = GetUnitX(ST)//Get The X of main unit
    local real y1 = GetUnitY(ST)//Get The Y of main unit
    local real x2 = GetUnitX(GetTriggerUnit())// Get The X of caster
    local real y2 = GetUnitY(GetTriggerUnit())// Get The Y of caster
    local integer dmg = (GetHeroInt(ST,true) / 2)//This is damage of each orb. Now it is half of hero INT u can change it to his STR AGI or remaining mana and so on
    local unit last
    local integer AL = GetUnitAbilityLevel(ST,'A004')// Change 'A004' to ur ability code (or if u copy past skill then no need of changing)
    local integer MSHi = AL * 2// u can set this local to GetRandomInt(0,AL*2) this will create random units between 0 and ur level of ability * 2
    local real F = bj_RADTODEG * Atan2((y2 - y1),( x1 - x2))// Get angle between caster and target (main unit)
    set x2 = (x1 + 300 * Cos(F * bj_DEGTORAD))// Setting new X (U can change Range of TP by changing 300 to random number or fixed number what ever u want)
    set y2 = (y1 + 300 * Sin(F * bj_DEGTORAD))// Setting new Y (U can change Range of TP by changing 300 to random number or fixed number what ever u want)
    if GetRandomReal(0,100) >= 10*AL then// Chance of provoke TP 10*Level%
        call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", x1, y1))//creating some eye candy
        call SetUnitX( ST, x2)//Move ST to new X
        call SetUnitY( ST, y2)//Move ST to new Y
        call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", x2 , y2))//creating some eye candy
    endif
    loop
        set MSHi = MSHi - 1
        exitwhen MSHi <= 0
        set last = CreateUnit(GetOwningPlayer(ST),'e001',x2,y2,((F - 180) - GetRandomReal(-10,10)))// creating unit and setting his facing to random number
        call SetUnitPathing(last,false)// seting his pathing to null
        call SetUnitState(last, UNIT_STATE_MANA, dmg)// Mana of this unit will be his damage
        call UnitApplyTimedLife(last,'BTLF', 3)// change last number to inscrize control time or set it to ~ 0.5 sec to remove it
        call AddSpecialEffectTarget("Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl", last, "origin")// adding special effect to dummy
        call GroupAddUnit(udg_UG, last)// add last created unit to move unit group
    endloop
    set last = null// nulling locals to prevent leaks
    set ST = null//nulling locals to prevent leaks
endfunction



Import of the spells are very easy
1) u need to CopyPaste all not standart abilitys and buffs
2) u need to CopyPaste Unit 'e001' that named "dummy" , and export his model.
3) u need to CopyPaste Jass MUI and Jass MPI folders and Jass Systems
4) Set Locals to fit ur needs ( and copy udg_FU, udg_UG, udg_CU)
5) PROFIT!! :)


1.0 First upload
1.1 Added another one spell named "Unstable Arcana" Removed all BJ's (exept PolledWait, and registring event)
1.2 Added another one spell named "Magic Defence". Changed PolledWait. Added Move System. Added more documintation

Keywords:
Mana, controll, jass, MUI, MPI, pew pew, Mana burn, kunkka splash, PROFIT!!!
Contents

Test map (Map)

Reviews
10:25 14th Nov 2015 BPower: Rejecting due to the status of this resource being "needs fix" for years. 15:43, 27th May 2010 TriggerHappy: Nothings Configurable. Uses waits. Use some indentation please. These are also really simple spells...

Moderator

M

Moderator

10:25 14th Nov 2015
BPower: Rejecting due to the status of this resource being "needs fix" for years.

15:43, 27th May 2010
TriggerHappy:

Nothings Configurable.
Uses waits.
Use some indentation please.

These are also really simple spells. I'm not sure if they should be approved regardless of code quality.
 
too much BJ
you can replace them with natives

GetHeroStatBJ(bj_HEROSTAT_INT, GetTriggerUnit(), true) => GetHeroInt(whichHero, includeBonuses)
GetUnitStateSwap => GetUnitState(whichUnit, whichState)
UnitDamageTargetBJ => UnitDamageTarget(whichUnit, target, amount, true, false, whichAttack, whichDamage, WEAPON_TYPE_WHOKNOWS)
__________________________________________________________________________
GetAttackedUnitBJ => GetTriggerUnit()

this is easy to replace
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
dont remake the locations, create at ini and use the "MoveLocation" native.

btw you only need one location to check the Z else you can get the x's and y's from GetUnitX/Y instead, less work

fix the BJs as said above

no need for the effect local just do

call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Weapons\\DragonHawkMissile\\DragonHawkMissile.mdl", GetSpellTargetUnit(),"overhead" )
 
Eh, don't use polled wait. It will get pretty bad efficiency. The only good thing about it is that it is slightly less random than direct TriggerSleepAction(). PolledWait doesn't null the timer, so you generally shouldn't use it. Timers are also much better. But if you insist on a less-random-TSA, then you should use this instead:
JASS:
function PolledWait2 takes real duration returns nothing
    local timer t
    local real  timeRemaining

    if (duration > 0) then
        set t = CreateTimer()
        call TimerStart(t, duration, false, null)
        loop
            set timeRemaining = TimerGetRemaining(t)
            exitwhen timeRemaining <= 0

            // If we have a bit of time left, skip past 10% of the remaining
            // duration instead of checking every interval, to minimize the
            // polling on long waits.
            if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
                call TriggerSleepAction(0.1 * timeRemaining)
            else
                call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
            endif
        endloop
        call DestroyTimer(t)
        set t = null  //simply added this to allow the timer's index to be recycled
    endif
endfunction
 
Level 3
Joined
Jul 19, 2009
Messages
7
Eh, don't use polled wait. It will get pretty bad efficiency. The only good thing about it is that it is slightly less random than direct TriggerSleepAction(). PolledWait doesn't null the timer, so you generally shouldn't use it. Timers are also much better. But if you insist on a less-random-TSA, then you should use this instead:
JASS:
function PolledWait2 takes real duration returns nothing
    local timer t
    local real  timeRemaining

    if (duration > 0) then
        set t = CreateTimer()
        call TimerStart(t, duration, false, null)
        loop
            set timeRemaining = TimerGetRemaining(t)
            exitwhen timeRemaining <= 0

            // If we have a bit of time left, skip past 10% of the remaining
            // duration instead of checking every interval, to minimize the
            // polling on long waits.
            if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
                call TriggerSleepAction(0.1 * timeRemaining)
            else
                call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
            endif
        endloop
        call DestroyTimer(t)
        set t = null  //simply added this to allow the timer's index to be recycled
    endif
endfunction

ok will add it to Custom Code of the map and use as polled wait :D
 
Top