Undeclared variable problem

Exide

I am amazingly focused right now!
Reaction score
448
Try lowering the TriggerSleepAction value to 1 sec or something.


Also try changing this part:

JASS:
            if (IsUnitType(fog, UNIT_TYPE_MAGIC_IMMUNE) == false) and (IsUnitAlly(fog, GetOwningPlayer(caster)) == false) then
                if (GetUnitTypeId(fog) == 'h002') then
                    call UnitDamageTarget(fog, caster, 100, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS)
                    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", xx, yy))
                else
                    call UnitDamageTarget(fog, caster, 100, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS)
                    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl", xx, yy))
                endif
            endif


into this:

JASS:
            if (IsUnitType(fog, UNIT_TYPE_MAGIC_IMMUNE) == false) and (IsUnitAlly(fog, GetOwningPlayer(caster)) == false) then
                if (GetUnitTypeId(Dummy<i>) == &#039;h002&#039;) then   //Changed this line
                    call UnitDamageTarget(fog, caster, 100, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS)
                    call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl&quot;, xx, yy))
                else
                    call UnitDamageTarget(fog, caster, 100, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS)
                    call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl&quot;, xx, yy))
                endif
            endif
</i>


EDIT: In order for DestroyEffect(AddSpecialEffect()) to work the effect that you're using must have a birth animation, else it won't show up.
 

tooltiperror

Super Moderator
Reaction score
231
It gives greater control over the event, though.
Like if there are max 4 players in the game he could change it to loop only 4 times. -No need to do it 16 times.

Yes, but if you are creating a spell for a site like for thehelper or thehive, you should use the BJ.
 

killingdyl

Active Member
Reaction score
6
ok here, no special effects are showing up(but this one incident it did), no damage are applied to enemys, but i got damaged once in a while!

i fixed everything and i even tried to reduce the wait time.
 

Exide

I am amazingly focused right now!
Reaction score
448
ok here, no special effects are showing up(but this one incident it did), no damage are applied to enemys, but i got damaged once in a while!

i fixed everything and i even tried to reduce the wait time.

I suggest you post the complete trigger you're using.
It makes it easier for me (and others) to troubleshoot, then.


Yes, but if you are creating a spell for a site like for thehelper or thehive, you should use the BJ.

What? lol.
What kind of argument is that? :p
 

tooltiperror

Super Moderator
Reaction score
231
Because you should assume that the map has max players. They can change it if they need it.
 

killingdyl

Active Member
Reaction score
6
this is the trigger for my spell
JASS:
function Trig_Elemental_Vortex_Conditions takes nothing returns boolean
    return (GetSpellAbilityId() == &#039;A000&#039;)
endfunction

function Trig_Elemental_Vortex_Actions takes nothing returns nothing
    local unit array Dummy
    local unit caster = GetTriggerUnit()
    local player p = GetOwningPlayer(caster)
    local real x = GetUnitX(caster)
    local real y = GetUnitY(caster)
    local real xx
    local real yy
    local real Real = 0
    local integer i = 0
    local unit fog = null
    local group g = CreateGroup()

    loop
        exitwhen i &gt; 7
        set Dummy<i> = CreateUnit(p, &#039;h003&#039;, x, y, 270)
        set xx = x + 700 * Cos(Real * bj_DEGTORAD)
        set yy = y + 700 * Sin(Real * bj_DEGTORAD)
        call UnitApplyTimedLife(Dummy<i>, &#039;BTLF&#039;, 3.5)
        call IssuePointOrder(Dummy<i>, &quot;move&quot;, xx, yy)
        set Real = (Real + (360/8))
        set i = i + 1
    endloop
    
    set Real = (360/16)

    loop
        exitwhen i &gt; 15
        set Dummy<i> = CreateUnit(p, &#039;h002&#039;, x, y, 270)
        set xx = x + 500 * Cos(Real * bj_DEGTORAD)
        set yy = y + 500 * Sin(Real * bj_DEGTORAD)        
        call UnitApplyTimedLife(Dummy<i>, &#039;BTLF&#039;, 3.5)
        call IssuePointOrder(Dummy<i>, &quot;move&quot;, xx, yy)
        set Real = (Real + (360/8))
        set i = i + 1
    endloop
    
    call TriggerSleepAction(3.45)   //This will probably cause trouble..

    loop
        exitwhen i &lt; 0
        set xx = GetUnitX(Dummy<i>)
        set yy = GetUnitY(Dummy<i>)
        call GroupEnumUnitsInRange(g, xx, yy, 50, null)

        loop
            set fog = FirstOfGroup(g)
            exitwhen fog == null

            if (IsUnitType(fog, UNIT_TYPE_MAGIC_IMMUNE) == false) and (IsUnitAlly(fog, GetOwningPlayer(caster)) == false) then
                if (GetUnitTypeId(Dummy<i>) == &#039;h002&#039;) then
                    call UnitDamageTarget(fog, caster, 100, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS)
                    call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl&quot;, xx, yy))
                else
                    call UnitDamageTarget(fog, caster, 100, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS)
                    call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl&quot;, xx, yy))
                endif
            endif

            call GroupRemoveUnit(g, fog)
        endloop
        
        set Dummy[(i)] = null
        set i = i - 1
    endloop
    
    call DestroyGroup(g)
    set caster = null
    set g = null
    set p = null           //I couldn&#039;t remember which had to be nulled and not, so I nulled them all. =)
endfunction

//===========================================================================
function InitTrig_Elemental_Vortex takes nothing returns nothing
    local trigger Elemental_Vortex = CreateTrigger()
    local integer i = 0
    
    loop
        exitwhen i == 16
        call TriggerRegisterPlayerUnitEvent(Elemental_Vortex, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
        set i = i + 1
    endloop
    
    call TriggerAddCondition( Elemental_Vortex, Condition( function Trig_Elemental_Vortex_Conditions ) )
    call TriggerAddAction( Elemental_Vortex, function Trig_Elemental_Vortex_Actions )
endfunction</i></i></i></i></i></i></i></i></i>
 

Exide

I am amazingly focused right now!
Reaction score
448
You should add a couple of Debug Messages.
For example, after this line:

JASS:

        call GroupEnumUnitsInRange(g, xx, yy, 50, null)


-Add a message that displays the amount of units in that group (g).
If that message always shows up as 0 then you know that that line is the problem.
If not you have to keep troubleshooting.
 

Exide

I am amazingly focused right now!
Reaction score
448
I did that, and it keeps showing "1" which im guessing means the hero i am controlling

I'd guess it's the dummy unit.
Not sure if you intended this or not, but I'm going to explain it anyway:

This spell spawns a couple of dummy units, which all moves (somewhere) around the caster.
When they are done moving they will each create a group in 50 radius (tiny) around themselves. -Any enemies of the caster in this group will be damaged and "special effected".

I suggest you increase the radius a bit and see if anything happens:
JASS:

call GroupEnumUnitsInRange(g, xx, yy, 50, null)   //Increase &#039;50&#039;



[LJASS]if ( not ( GetUnitTypeId(Dummy[(bj_forLoopAIndex)]) == 'h002' ) ) then[/LJASS]

Wont work.

What?
Where is he using that condition and what makes you think it won't work?
 

killingdyl

Active Member
Reaction score
6
ok i increased it to 500 to see what would happen and... I KILLED MY OWN HERO WTF! there were also enemy units around and they didnt get damaged!
 

Exide

I am amazingly focused right now!
Reaction score
448
ok i increased it to 500 to see what would happen and... I KILLED MY OWN HERO WTF! there were also enemy units around and they didnt get damaged!

JASS:
and (IsUnitAlly(fog, GetOwningPlayer(caster)) == false) then

should prevent that..

Try changing into:
JASS:
and (IsUnitAlly(fog, GetOwningPlayer(caster)) == true) then

just to see what happens.


How many units were there in the group?
 

killingdyl

Active Member
Reaction score
6
lmao figured it out, the firstofgroup was working fine it was the damage part, somehow we mixed up the "damager" and the "unit getting damaged" Thanks for all ur help!
 

Exide

I am amazingly focused right now!
Reaction score
448
lmao figured it out, the firstofgroup was working fine it was the damage part, somehow we mixed up the "damager" and the "unit getting damaged" Thanks for all ur help!

Oh.
My bad. :p
Well glad it works for ya.
I hope you learnt something.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top