[Spell]: An AoE mana-suck, need trigger help.

BarzahdX

Active Member
Reaction score
18
Either tell me how to get it done in GUI, or just post the code(so I can copy) in JASS. Please explain which are raw values, and which are variables. I know nothing of JASS, so don't expect me to be able to learn from this(however, in GUI would help).

What I need done.

Mana Bomb

The Archon explodes all of his mana to sap enemies within 900 AoE of theirs. The mana drained, will then be asborbed to the Archon.

Level 1: 200 mana.(drained)
Level 2: 400 mana.
Level 3: 600 mana.

Cooldown 1.5 minutes.
_____________________

So it's essentially a thunderclap that deals damage to mana instead of health, no slow, and the mana drained goes to the Archon.

Can it be done? And yes, I do feel inferior that I need to ask somebody to make an entire ability for me. :'(
 

hell_knight

Playing WoW
Reaction score
126
Unit Starts Effect of Ability

Ability being casted equal to ()

Code:
set pos1 = position of casting unit.
Set tempgroup = units within 900 of (pos1) matching conditions is enemy equal to true.

Pick every unit in tempgroup
 Set interger = mana of (Picked unit)
 Set mana to (Mana of (picked unit ) - (level of ability x 200).
   If/then/else
       interger  > (level of ability x 200)
       set mana of (casting unit) to (mana of (casting unit ) + (level of ability x 200)

Else - set mana of (casting unit) to (mana of (casting unit ) + interger

call RemoveLocation (udg_pos1)
call DestroyGroup (udg_tempgroup)

freehand , messy but the concept and math is there. put out mistakes was done in a rush.
 

BarzahdX

Active Member
Reaction score
18
Awesome! That was crazy fast. Thank you so very much.

Now I have a few questions. 1: "interger" Is it supposed to be "Integer"? Because you spelled it that way 3 times, wasn't sure. Edit: Oh wait, is that "interger" a variable?

2: Will this just add to his mana, or will it add to his mana the amount that was taken? Example: If I'm by no unis, will it still fill up 600 mana(I don't want it to)? And if I'm by 10 units, will it still just full 600? Or 6000?

3: Those spaces in "(casting unit )" and "(picked unit )" are those accidents, or are they imperative to the script?

Thank you again.. I look forward to see if it works.
 

hell_knight

Playing WoW
Reaction score
126
Integer.

2. Well ATM , it will suck as much as it can uncapped. By zero units 0 mana. 10 = 0-6000.I don't have time to fix that ATM.

3. No. you don't copy n paste it. You try to recreate it as close as possible in the GUI editor.

Kind of confusing if your new to it. I'll see what I can do till then I need get sleeping =D
 

ReVolver

Mega Super Ultra Cool Member
Reaction score
609
JASS:
function SpellID takes nothing returns integer 
    return 'A000' //Change this to your spell's RAW code.
endfunction

function AoE takes nothing returns integer
    return 900 //Change this to your AoE Amount
endfunction

function spellevel takes integer lvl returns integer 
    return lvl * -200 // Change 200 to w/e you want to increase per level
endfunction

function UnitFilter takes nothing returns boolean
    return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) <= 0 and IsUnitAlly(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction

function Absorb takes nothing returns integer
    local integer level
    set level = GetUnitAbilityLevel(GetTriggerUnit(),SpellID())
    call SetUnitState(GetEnumUnit(),UNIT_STATE_MANA, spellevel(level))
    return spellevel(level)
endfunction

function Trig_Mana_Drain_Actions takes nothing returns nothing
    local unit caster
    local group g
    set g = CreateGroup()
    set caster = GetTriggerUnit()
    call GroupEnumUnitsInRange(g,GetUnitX(caster),GetUnitY(caster), AoE(), Condition(function UnitFilter))
    call ForGroup(g, function Absorb)
    call SetUnitState(caster,UNIT_STATE_MANA, Absorb()*-1) //We want to give mana to him not take
    call DestroyGroup(g)
    set caster = null
    set g = null
endfunction

function Trig_Mana_Drain_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SpellID()
endfunction

//===========================================================================
function InitTrig_Mana_Drain takes nothing returns nothing
    set gg_trg_Mana_Drain = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Mana_Drain, function Trig_Mana_Drain_Actions )
    call TriggerAddCondition(gg_trg_Mana_Drain, Condition(function Trig_Mana_Drain_Conditions))
endfunction


non vJASS version, untested, should work.
 

BarzahdX

Active Member
Reaction score
18
Are the colors just for clarification? Or is there sometype of download I'm missing?

How do you find the spell's raw code? I'm going to use Thunderclap as the base.

There are so many variables in there.. It's confusing, and I don't know which type of variables I should be using where--but I'll try.. This could take awhile. :) I am in your debt. /bow
 

cleeezzz

The Undead Ranger.
Reaction score
268
1. yes colors are for clarification, easier to read.

2. hit Ctrl + D on the object editor

3. you dont need to know what variables are used, the variables are created within the code itself meaning you dont have to do anything except paste it in your header. if you really want to know,

JASS:
local unit caster


it says unit, so its a unit variable named caster.
 

BarzahdX

Active Member
Reaction score
18
The green words, should I remove those? Initially I thought yes, but is it actually just a comment, and will have no effect on the trigger? This question isn't super important, but as typically always, an answer is welcome.
 

Expelliarmus

Where to change the sig?
Reaction score
48
The green words, should I remove those? Initially I thought yes, but is it actually just a comment, and will have no effect on the trigger? This question isn't super important, but as typically always, an answer is welcome.
Comment will in no way interfere with the code, so you may remove them if you want.
 

BarzahdX

Active Member
Reaction score
18
o_O I just made the ability, made the trigger, converted it to custom script, copied, pasted, edited where necessary--and it has 35 compile errors.. As this is my *first* time *ever* using JASS, what's wrong, and how can I fix it?
 

BarzahdX

Active Member
Reaction score
18
So the trigger itself than.. If I properly understand you.

Code:
function Mana Bomb takes nothing returns integer 
    return 'A093:AHtc' 
endfunction

function AoE takes nothing returns integer
    return 900 
endfunction

function spellevel takes integer lvl returns integer 
    return lvl * -200 
endfunction

function UnitFilter takes nothing returns boolean
    return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) <= 0 and IsUnitAlly(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction

function Absorb takes nothing returns integer
    local integer level
    set level = GetUnitAbilityLevel(GetTriggerUnit(),SpellID())
    call SetUnitState(GetEnumUnit(),UNIT_STATE_MANA, spellevel(level))
    return spellevel(level)
endfunction

function Trig_Mana_Drain_Actions takes nothing returns nothing
    local unit caster
    local group g
    set g = CreateGroup()
    set caster = GetTriggerUnit()
    call GroupEnumUnitsInRange(g,GetUnitX(caster),GetUnitY(caster), AoE(), Condition(function UnitFilter))
    call ForGroup(g, function Absorb)
    call SetUnitState(caster,UNIT_STATE_MANA, Absorb()*-1)
    call DestroyGroup(g)
    set caster = null
    set g = null
endfunction

function Trig_Mana_Drain_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Mana Bomb()
endfunction

//===========================================================================
function InitTrig_Mana_Drain takes nothing returns nothing
    set gg_trg_Mana_Drain = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Mana_Drain, function Trig_Mana_Drain_Actions )
    call TriggerAddCondition(gg_trg_Mana_Drain, Condition(function Trig_Mana_Drain_Conditions))
endfunction

Hope that's what you were asking for.
 

Expelliarmus

Where to change the sig?
Reaction score
48
JASS:
//function Mana Bomb takes nothing returns integer // functions can not have spaces
function Mana_Bomb takes nothing returns integer 
    //return &#039;A093:AHtc&#039; 
    return &#039;AHtc&#039; // Raw Codes are 4 characters
endfunction

function AoE takes nothing returns integer
    return 900 
endfunction

function spellevel takes integer lvl returns integer 
    return lvl * -200 
endfunction

function UnitFilter takes nothing returns boolean
    return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) &lt;= 0 and IsUnitAlly(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction

function Absorb takes nothing returns integer
    local integer level
    set level = GetUnitAbilityLevel(GetTriggerUnit(),Mana_Bomb()) // Mana_Bomb was SpellID
    call SetUnitState(GetEnumUnit(),UNIT_STATE_MANA, spellevel(level))
    return spellevel(level)
endfunction

function Trig_Mana_Drain_Actions takes nothing returns nothing
    local unit caster
    local group g
    set g = CreateGroup()
    set caster = GetTriggerUnit()
    call GroupEnumUnitsInRange(g,GetUnitX(caster),GetUnitY(caster), AoE(), Condition(function UnitFilter))
    call ForGroup(g, function Absorb)
    call SetUnitState(caster,UNIT_STATE_MANA, Absorb()*-1)
    call DestroyGroup(g)
    set caster = null
    set g = null
endfunction

function Trig_Mana_Drain_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Mana_Bomb()
endfunction

//===========================================================================
function InitTrig_Mana_Drain takes nothing returns nothing
    set gg_trg_Mana_Drain = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Mana_Drain, function Trig_Mana_Drain_Actions )
    call TriggerAddCondition(gg_trg_Mana_Drain, Condition(function Trig_Mana_Drain_Conditions))
endfunction
 

BarzahdX

Active Member
Reaction score
18
AWESOME! It can be properly enabled now.. Haven't tested it yet, I'll update ya when I do.

How did me editing 4 things, remove 35 errors?
 

saw792

Is known to say things. That is all.
Reaction score
280
JASS:
function Mana_Bomb takes nothing returns integer 
    //return &#039;A093:AHtc&#039; 
    return &#039;A093&#039; // Raw Codes are 4 characters. The second four characters are the raw code of the ability it is based of.
endfunction


Also, your trigger that you posted the code into must be called Mana Drain, in case it isn't already.
 

Crusher

You can change this now in User CP.
Reaction score
121
I wish somethimes that there is mana value on all abilities -.-
Sorry but I Can't help you.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top