Jump to content

MOOSE: Create a Coordinate from a point on the map


Recommended Posts

Posted

Hi guys,

 

I cannot believe that I cannot figure this one out ... but searching this thing around brought me close to madness.

 

I usually get the MOOSE coordinate of an object like this:

 

unitPlayer = UNIT:FindByName( "Player" )

playerCoord = unitPlayer:GetCoordinate()

Then the player coordinate are in the variable. No issue here.

 

Now I am trying to create a coordinate from a point on the map (displayed in the mission editor).

 

I am trying without success for a while. So let's say the coordinate on the map (while using ATL-Y few times to see the X and Z coordinate) are X=-00032476 and Z=-00129714. I am simply trying to create a COORDINATE object from this.

 

coord = Coordinate:New(-00032476,0,-00129714)

 

I tried this, but cannot get it working. I looked for example but none available...

 

Thanks guys!

 

Frag

Posted (edited)

Is there an object on that map coordinate?

 

Perhaps I'm mistaken, but I don't think you can create coordinates out of thin air, there must be a reachable object on that map spot (a zone would do, I guess).

 

Actually, I'm going to test it, see what happens.

 

EDIT: Ok, looks like I was mistaken, coordinates can totally be created "out of thin air".

Now I've just noticed your problem...you are using the wrong syntax for coordinate class, it must be written in all caps (all MOOSE classes are written in caps, remember):

 

coord = COORDINATE:New(-00032476,0,-00129714)

 

In order to avoid such problems, always check the MOOSE documentation.

 

Cheers :thumbup:

Edited by Hardcard
Posted
Is there an object on that map coordinate?

 

Perhaps I'm mistaken, but I don't think you can create coordinates out of thin air, there must be a reachable object on that map spot (a zone would do, I guess).

 

Actually, I'm going to test it, see what happens.

 

EDIT: Ok, looks like I was mistaken, coordinates can totally be created "out of thin air".

Now I've just noticed your problem...you are using the wrong syntax for coordinate class, it must be written in all caps (all MOOSE classes are written in caps, remember):

 

coord = COORDINATE:New(-00032476,0,-00129714)

 

In order to avoid such problems, always check the MOOSE documentation.

 

Cheers :thumbup:

 

:doh:

 

...

 

:doh:

 

...

 

Damn I feel like an idiot. That was my issue Hardcard! Everything works perfectly now. I am writing quite big scripts those days ... cannot believe I got stuck on such a small thing. The error message was not that intuitive though, felt more like the coordinate was nul.

 

Thanks man! I owe you one!

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...