Arrays

sentrywiz

New Member
Reaction score
25
I've reached a GUI level where I can say how useful arrays are. Before I didn't even understood how or why can someone use them, being so complex and unnecessary. Now, I just find everything made with them easier.


However, I don't know how to destroy arrays.

Example:

If I create a point array (Temp_Point[Player number of ((Triggering Player))] and use it for some MUI spell that has some sort of channeling, how do I remove this point array?

If I create Timer_Cast[Player number of ((Triggering Player))] and use it for MUI spell that has one effect -> timer ends -> second effect, I cannot set the Array Timer in Events, hence the Array. If I make periodic event, and through conditions, IF/ELSE/THEN try to find out which timer expired for which player, trigger doesn't work. And bottom line, how do you remove anything in custom script that has array in it?
 

Jedi

New Member
Reaction score
63
Point > call RemoveLocation(udg_Point)

Point[1] > call RemoveLocation(udg_Point[1])

Point[Player Number of (triggering player)] > call RemoveLocation(udg_Point[GetConvertedPlayerId(GetTriggerPlayer())])

Point[Player Number of (owner of (triggering unit))] > call RemoveLocation(udg_Point[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])



I hope you are not trying to destroy GUI Timer variables.
 

Bogrim

y hello thar
Reaction score
154
Copy your Set Variable action into a new trigger, and convert it into custom text. Then you get the text that's needed in the brackets, like what Jedi posted.
 

Tyman2007

Ya Rly >.
Reaction score
74
Point[Player Number of (triggering player)] > call RemoveLocation(udg_Point[GetConvertedPlayerId(GetTriggerPlayer())])

Point[Player Number of (owner of (triggering unit))] > call RemoveLocation(udg_Point[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])

Oh noes! a Blizzard.j function!

instead of [ljass]GetConvertedPlayerId(whichPlayer)[/ljass] use [ljass]GetPlayerId(whichPlayer) + 1[/ljass]

:p

Simple efficiency tip. And a whole lot easier to write.

Destroying Timers instead of recycling them is bad for your map :p
It's just inefficient and can cause problems.
 

BAkil

New Member
Reaction score
9
This is what I do:

Alrighty I always have the same type of problem when dealing with arrays - that is not knowing how to select the right array to delete when clearing out points and unit groups, and the way I fix 'em is by doing this:

Copy the action that sets the array to whatever it is, and place it into a new trigger. For instance, if you have one that.. lets say.. sets POINT[Player Number of (Owner of (Killing Player))] to whatever. So yeah copy that into a brand new trigger, no event no nothing, just that action.

Then you convert that new trigger into custom text with the Edit button in the Menu Bar at the top of the trigger editor, and look for the action and what it sets the point to.

The result is: set udg_POINT[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] = <Whatever you set the POINT to>
But what you're really looking for is: udg_POINT[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))]
Which then becomes "call RemoveLocation (udg_POINT[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))])" when you want to remove it with Custom Script.

Alrighty, now what's the point in doing this when you can just look at other people's posts? Well instead of always coming back to the forums and checking up, waiting for a reply and such, you can quickly do this yourself and avoid all of the hassle. Keep in mind this should work for just about anything, so long as you can find the action that sets the variable to whatever.

Hope I helped =P
 

hgkjfhfdsj

Active Member
Reaction score
55
Why wouldn't I want to destroy GUI timer variables?
well partially i think its b/c you cant create timers without custom script with GUI (afaik, correct me if im wrong), so to destroy the initialized timer, and the only one the variable will ever reference one (unless you reset it), future codes that use this timer will malfunction..
 
General chit-chat
Help Users

      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