• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Does this leak?

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
  • Set math_2 = (Angle from (Point(25.00, BarracksEmpireX)) to (Point(55.00, 55.00)))
Math_2 is a real variable.

I'm making 2 points out of coordinates though, so do those two points leak? I know how to get rid of them if they do, so a simple yes or no from someone who knows will be sufficient.

Thank you.
 
Level 14
Joined
Aug 30, 2004
Messages
909
  • -------- There is also: --------
  • Custom script: call MoveLocation(udg_MyLocation, udg_X, udg_Y)
  • -------- Which may interest you --------

I'm worried about processing speed because I'm using a custom movement system that fires ever .03 seconds and moves about 30 units. Is it faster to remove a location and then reassign it to a point or is it faster to just move the location?
 
Level 14
Joined
Aug 30, 2004
Messages
909
Advanced movement systems use MoveLocation and use static a location which never gets removed at any point in the game, it is faster than allocating/deallocating a new one each time and is also easier on the RAM.

Bribe,

Excellent, thank you very much. I do have a question or two if you don't mind.

1. MyLocation, in your example above, is a point variable, correct?

2. If I have a point array MyLocation[1-75], do they need to be initialized? In other words, if my very first trigger sets x = 100, y = 100, and then
custom script: MoveLocation(udg_MyLocation[45], udg_X, udg_Y)
will MyLocation[45] refer to point(100,100)?
 
In GUI, "location" is "point". So if you are declaring your globals in variable editor yeah you would specify it as "point".

Why do you want a location array of size 75? 75 locations take up more space in RAM. I would advise making an x array and a y array (don't bother giving the array a size as arrays automatically get bigger as you have need for more) and then move the location to said coordinates when you need the location to be at that point.

So if you're doing something like a spawn system, instead of:

  • Unit - Create 1 Footman for (Player 1 (Red)) at MyLocation[45] facing Default building facing degrees
It would be:

  • Custom script: call MoveLocation(udg_MyLocation, udg_myX[45], udg_myY[45])
  • Unit - Create 1 Footman for (Player 1 (Red)) at MyLocation facing Default building facing degrees
will MyLocation[45] refer to point(100,100)?

Yes
 
Level 14
Joined
Aug 30, 2004
Messages
909
I'll definitely give that a try. I need to finish debugging something and make a backup in case is ruins everything...this map is getting very complex. But I think it should be doable.

As long as I have your attention, though, Bribe, I've been reading the tutorial you link in your comment and I have a question.

I believe you said that if you used "Triggering unit" more than 2-3 times in a trigger that it is better for your memory to assign it to a variable and use the variable. Did I read that correctly? I have a trigger that fires when any unit dies in my map that uses "triggering unit" about 30 times or so... I like Triggering Unit because I figured I was saving memory and processing speed by not using a lot of variables.

Thanks again for all your help. I'll try to +rep but I'll probably hit that "must spread some rep around first" wall.
 
Status
Not open for further replies.
Top