• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Tips and Tricks

Status
Not open for further replies.
Level 22
Joined
Sep 24, 2005
Messages
4,821
Don't dynamically create the locations, just use a global location and move it when you need to get another unit's location:

native MoveLocation takes location whichLocation, real newX, real newY returns nothing
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Not like that, you create the location on map init, then you use MoveLocation to move the position to that said location.

JASS:
globals
    location L
    // constant location L=Location(0,0) // I forgot if this works?
endglobals

function GetCoordinatesZ takes real x, real y returns real
    call MoveLocation(L,x,y)
    return GetLocationZ(L)
endfunction


// Not needed if allocating locations on map init is possible
function MapInit takes nothing returns nothing
    set L=Location(0,0)
endfunction
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Or that, yes, but mine works too :3 xD
I never said it didn't work, I said it could potentially ruin your game by lagging it because of the overhead when you allocate and deallocate the location...

And i think you need to create the location, constant or not, you're moving a null location, so it's location L = location(0,0)

constant may work, but i'm not sure
It's not a null location, 0,0 is a valid coordinate.

Troll_Brain said:
Tests > Opinion
I'm not moving a null location, where was the null location?
 
Status
Not open for further replies.
Top