• 🏆 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!

[Solved] Center of Region/Position of Unit

Status
Not open for further replies.
Level 7
Joined
May 26, 2017
Messages
127
Hello everybody, this is my first thread here.
I'm having a weird problem I've never had with the Action "Move (unit) instantly to (Center of Region/Position of Unit)" The thing is that the (unit) is never on the center of the Region or the Unit (a circle of power, for example).

I attach the images on the post because I don't know how to add triggers on the forum.

Here you can see the trigger:
eumzxs.png

Here you can see the position of the region and the circle of power:
NPJL7R5.jpg

Here you can see that the unit is not on the center:
xDnfuii.jpg

PD: Please excuse my limited English, I'm spanish.
 
Level 7
Joined
May 26, 2017
Messages
127
That purple block is probably acting as a pathing blocker. When you try to move a unit somewhere it can't go, the engine chooses the next closest location (or something like that).

Also, to post triggers, take a look at this: How To Post Your Trigger

Thanks for the triggers post!

I've try again in a clear map and the problem is still here.
Maybe it's a bug?

HyRNdCb.png
 
Level 22
Joined
Sep 7, 2013
Messages
235
I have always had this kind of problem, I believe it's a lack of accuracy in the game programming.
Also apparently the offset is always the same at a given point, but differs accross the map.
So if you want perfect positioning for this location only, I suggest you just add an offset in your trigger to compensate.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Without running any tests I can think of 3 possible causes.
  • The GetRectCenter function and its internal workings does not return the mid point of a rect, but rather some cell aligned point near the mid point. This can be checked by manually measuring the mid point of a rect and comparing it with the output of the function.
  • The CreateUnit functions spawn units with some kind of alignment mechanics near the requested location. This can be tested by checking if the unit position after creation has an approximately identical value to the position used to create the unit.
  • The unit origin is not the same as the centre of the unit selection circle or the model origin. This would be the logical conclusion if the above fail, and unfortunately many people have reported this to be the case.
 
Level 7
Joined
May 26, 2017
Messages
127
Thanks for all the answers dudes, I'm sorry I didn't answer sooner, I've tried it following Freddyk's way and it worked, so the thread is solved.

I have always had this kind of problem, I believe it's a lack of accuracy in the game programming.
Also apparently the offset is always the same at a given point, but differs accross the map.
So if you want perfect positioning for this location only, I suggest you just add an offset in your trigger to compensate.


  • Acciones
    • Unidad - Move PiedraRunicaSurCaster instantly to ((Position of CÃrculo de poder 0010 <gen>) offset by (10.00, 10.00)), facing (Position of Piedra Rúnica (orientado hacia el sureste) 0021 <gen>
(There are some words in spanish but I think you can understand it)
 
Status
Not open for further replies.
Top