I am new to Jass and i can't find problems in my spell

Ostrze

New Member
Reaction score
0
So...
As I said in title I am new to Jass and i have made a group heal spell to test my skills.
When I try to test my map the WE pops out a box with errors.
Here is my Jass spell:
JASS:
function Cond takes nothing returns boolean
    call GetSpellAbilityId() == 'A000'
endfunction

function Group_Heal takes nothing returns nothing
    local group g
    local unit u
    local unit dumb
    local unit cast
    local location p
    
    set cast = GetTriggerUnit()
    set p = GetSpellTargetLoc()
    set g = GetUnitsInRangeOfLocAll(800.00, p)
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        if IsUnitEnemy(u, GetOwningPlayer(cast)) == TRUE then
            call GroupRemoveUnit(g, u)
            set dumb = CreateUnitAtLoc(GetOwningPlayer(cast), 'h000', GetUnitLoc(u), 0.00)
            call IssueTargetOrder(dumb, "Heal", u)
            call UnitApplyTimedLifeBJ(1.50, 'BTLF', dumb)
            set dumb = null
        endif
    endloop
    
    set cast = null
    set g = null
    set u = null
    set p = null
endfunction

function GroupHeal takes nothing returns nothing
    local trigger t
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function Cond))
    call TriggerAddAction(t, function Group_Heal)
endfunction


I have a polish W3 (I am from Poland), so I don't rly know how to translate some the errors and don't know if I should put a screenshot here. However it tells me that here are 31 errors. From what I can actually translate, it says something about awaiting end of line in some of the errors and awaiting name of variable, name and endloop.
 

Exide

I am amazingly focused right now!
Reaction score
448

Jedimindtrixxx

┻━┻ ︵ ¯\(ツ)/¯ ︵ ┻━┻
Reaction score
168

Ostrze

New Member
Reaction score
0
After I get to test it, I found out it doesn't work. It doesn't wantto heal my allies. I changed it a bit, so it targets my allies, but it still doesn't heal.
JASS:
function Cond takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Group_Heal takes nothing returns nothing
    local unit u
    local unit dumb
    local unit cast = GetTriggerUnit()
    local location p = GetSpellTargetLoc()
    local group g = GetUnitsInRangeOfLocAll(500.00, p)
    
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        if IsUnitAlly(u, GetOwningPlayer(cast)) == true then
            call GroupRemoveUnit(g, u)
            set dumb = CreateUnitAtLoc(GetOwningPlayer(cast), 'h000', GetUnitLoc(u), 0.00)
            call IssueTargetOrder(dumb, "Heal", u)
            call UnitApplyTimedLifeBJ(1.50, 'BTLF', dumb)
            set dumb = null
        endif
    endloop
    
    set cast = null
    set g = null
    set u = null
    set p = null
endfunction

function InitTrig_GroupHeal takes nothing returns nothing
    local trigger t
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function Cond))
    call TriggerAddAction(t, function Group_Heal)
endfunction



Any1 knows how to fix it?
 

Ostrze

New Member
Reaction score
0
If it will help, i will give you spells i used to make the spell.
Code:
dummy - h000
Heal(based of holy light) - A001
GroupHeal(based of silence) - A000
 

Ostrze

New Member
Reaction score
0
Now the spell looks like that:
JASS:
function Cond takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Group_Heal takes nothing returns nothing
    local unit u
    local unit dumb
    local unit cast = GetTriggerUnit()
    local location p = GetSpellTargetLoc()
    local group g = GetUnitsInRangeOfLocAll(500.00, p)
    
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        if IsUnitAlly(u, GetOwningPlayer(cast)) == true then
            set dumb = CreateUnitAtLoc(GetOwningPlayer(cast), 'h000', GetUnitLoc(u), 0.00)
            call IssueTargetOrder(dumb, "Heal", u)
            call UnitApplyTimedLifeBJ(1.50, 'BTLF', dumb)
            set dumb = null
        endif
        call GroupRemoveUnit(g, u)
    endloop
    
    set cast = null
    set g = null
    set u = null
    set p = null
endfunction

function InitTrig_GroupHeal takes nothing returns nothing
    local trigger t
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function Cond))
    call TriggerAddAction(t, function Group_Heal)
endfunction


I can't make it work, and I don't realy know where the leaks are :(

----------------------EDIT--------------------

The spell plays the effect of spell on every unit, but it doen't heal the unit.

Maybe i should make the spell damage unit for negative amount of damage? I mean that i would damage it for -200damage, so the spell might heal the unit.
 

Ostrze

New Member
Reaction score
0
The dummy has mana and spell, and it still doesn't work.

----------EDIT----------
If you want i can attach my map here, so you can see what's wrong with it.
 

Attachments

  • Spell Tests.w3x
    18 KB · Views: 106

Jedimindtrixxx

┻━┻ ︵ ¯\(ツ)/¯ ︵ ┻━┻
Reaction score
168
are you sure you gave the dummy the heal itself and not the silence? does silence affect allys? id try making silence effect allys. it might silence em for .01 secs but it might work not sure but worth a try. if it does work and u dont want it to interupt ally spells id try your idea with a -dmg attack on them
 

Ostrze

New Member
Reaction score
0
are you sure you gave the dummy the heal itself and not the silence? does silence affect allys? id try making silence effect allys. it might silence em for .01 secs but it might work not sure but worth a try. if it does work and u dont want it to interupt ally spells id try your idea with a -dmg attack on them

Still doesn't work. Maybe you can try the map i attached to my last post? I changed the targets for silence on the map i have on my comp, but the target aren't changed in the attached map.
 

Sirroelivan

Gunnerkrigg Court
Reaction score
95
Why are you creating a dummy for the healing? Just add the health via the function itself?

If you want to use the dummy, check you have the right order.
 

Ostrze

New Member
Reaction score
0
What's the function and how do you use it?

As i said in the title i am new in Jass. This is my first spell, and i don't know what can be wrong with the order.
 

Ostrze

New Member
Reaction score
0
Thanks man ;]
I left the dummy unit in action cuz of spell effect, and just added the line you told me :D
Now it works perfectly :p
If some1 wants to see the Jass code, here it is:
JASS:
function Cond takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Group_Heal takes nothing returns nothing
    local unit u
    local unit dumb
    local unit cast = GetTriggerUnit()
    local location p = GetSpellTargetLoc()
    local group g = GetUnitsInRangeOfLocAll(500.00, p)
    
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        if IsUnitAlly(u, GetOwningPlayer(cast)) == true then
            set dumb = CreateUnitAtLoc(GetOwningPlayer(cast), 'h000', GetUnitLoc(u), 0.00)
            call IssueTargetOrder(dumb, "Heal", u)
            call UnitApplyTimedLifeBJ(0.01, 'BTLF', dumb)
            call SetUnitLifeBJ( u, ( GetUnitStateSwap(UNIT_STATE_LIFE, u) + 200.00 ) )
            set dumb = null
        endif
        call GroupRemoveUnit(g, u)
    endloop
    
    set cast = null
    set g = null
    set u = null
    set p = null
endfunction

function InitTrig_GroupHeal takes nothing returns nothing
    local trigger t
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function Cond))
    call TriggerAddAction(t, function Group_Heal)
endfunction
 
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