Why I can't store my global into a local? (location)

Frozenwind

System maker
Reaction score
99
This is the trigger:
Code:
TB Cast It
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Triangle Beam 
    Actions
        Custom script:   local location array loc
        Custom script:   local unit cast = GetSpellAbilityUnit ()
        Custom script:   local real array angle
        Custom script:   local real offset = 0.00
        Custom script:   local integer array A
        Custom script:   local integer array B
        Custom script:   local lightning array light
        Custom script:   set udg_Temp_point1 = GetUnitLoc (cast)
        Set Temp_point2 = (Temp_point1 offset by 50.00 towards 0.00 degrees)
        Custom script:   set A[0] = 0
        Custom script:   set A[1] = 2
        Custom script:   loop
        Custom script:       exitwhen A[0]>A[1]
        Custom script:       set angle[A[0]] = I2R( A[0] * 120)
        Custom script:       set loc[A[0]] = GetUnitLoc (cast)
        Custom script:       set A[0] = A[0] + 1
        Custom script:   endloop
        -------- END INITATION --------
        Custom script:   set A[0] = 0
        Custom script:   set A[1] = 150
        Custom script:   set B[1] = 2
        Custom script:   loop
        Custom script:       exitwhen A[0]>A[1]
[COLOR="DarkOrange"]        Custom script:       set offset = offset + 5[/COLOR]
        Custom script:       set udg_Temp_real1 = offset
        Custom script:       set B[0] = 0
        Custom script:       loop
        Custom script:           exitwhen B[0]>B[1]
[COLOR="DarkOrange"]        Custom script:           set angle[B[0]] = angle[B[0]] + 4[/COLOR]
        Custom script:           set udg_Temp_point1 = loc[B[0]]
        Custom script:           set udg_Temp_real2 = angle[B[0]]
        Set Temp_point2 = (Temp_point1 offset by Temp_real1 towards Temp_real2 degrees)
        Custom script:           set loc[[COLOR="Blue"]0[/COLOR]] = udg_Temp_point2
[COLOR="Lime"]        Special Effect - Create a special effect at Temp_point2 using Abilities\Spells\NightElf\Taunt\TauntCaster.mdl[/COLOR]
        Custom script:           call RemoveLocation (udg_Temp_point2)
[COLOR="Red"]        Custom script:           set udg_Temp_point2 = loc[[COLOR="Blue"]0[/COLOR]]
        Special Effect - Create a special effect at Temp_point2 using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl[/COLOR]
[COLOR="Lime"]        Game - Display to (All players) the text: thunderclap?[/COLOR]
        Custom script:           call RemoveLocation (udg_Temp_point2)
        Custom script:           set B[0] = B[0] + 1
        Custom script:       endloop
        Custom script:       call RemoveLocation (udg_Temp_point1)
        Custom script:       set A[0] = A[0] + 1
        Wait 0.01 game-time seconds
        Custom script:   endloop
        Game - Display to (All players) the text: endfunction
I DO see the Green collored special effect, but
I DONT see the Red collored special effect, with other words, my global isn't stored into my local.

Is anyone able to explain me why not?

frozenwind (confused).

EDIT:
Another fact:
When I repalce the blue "0" for "B[0]", then it happens at "center of playable map area", instead of around my hero. (The taunt effect, not the thunderclap)

EDIT2:
It seems like the Orange parts get set just like I want them to be set. (it spins while getting bigger all the time)
 
It becomes an ability and I want people that know 0% JASS to be able to use it.

For example the abilitycondition:
People that know 0% JASS don't know "Oh, let's set it to 'A000'", but I think they're able to set their ability into a GUI condition.

frozenwind.
 
Custom script: call RemoveLocation (udg_Temp_point2)
That actually removes the location, so loc[0] and udg_Temp_point2 will no longer point to a location.
 
But udg_Temp_point2 is set to a location when I try to store it into my local,
doesn't it pass over the location be4 I remove udg_Temp_point2?

frozenwind.
 
yes but this doesnt kill the variable like set loc = null.
it removes the point and all variables storing this point are then empty
 
But if I don't do that I got a memory leak?

frozenwind.

EDIT:
You're right though o_O
Removed that "call RemoveLocation", and the bug dissapeared....
 
Setting loc[0] = udg_Temp_point2 does not create a new location, it simply makes loc[0] refer to the same location as udg_Temp_point2 does. I.E:

JASS:
set LocA = Location(123,456) // New location at 123,456
set LocB = LocA // The same location as LocA (Like C++ LocA = *LocB)
call RemoveLocation(LocA) // Removes the location that LocA and LocB point to


You're thinking of nulling variables. (Of which you didn't do in this trigger, everything that isn't an integer, real, boolean, or string must be set = null at the end of the function.)
 
Should I also try "call RemoveLocation", when I'm sure that location isn't used anymore, else I still got a leak, don't I?

frozenwind.
 
you still have to remove the location, but you should do that later when you dont need it ;)
/edit: thats right :)
 
I doubt wether u actually saw my post since reply in same minute,
but thanks, that answered me:p

frozenwind.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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