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.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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