GetLocalPlayer in order to hide unit

BlueMirage

Trust, but doubt.
Reaction score
39
GetLocalPlayer in order to "hide" unit

In my map, I have 12 specific shops of the same type. I need them to be able to sell 3 different items depending on the state of the unit that is buying from it. However, since different units should only be able to buy different stuff, I think I can't use the same shop.

So I've been thinking, maybe I create 3 shops ontop of eachother with no pathing, and use GetLocalPlayer() to either make the building invisible by giving it insane fly height a la Crow Form (possible at all with buildings?) or by just manipulating the item table locally.

Is this possible?
 

Nestharus

o-o
Reaction score
84
either ugly shadow or desync

SetUnitX/SetUnitY locally is better

put invis ones outside of playable area or w/e
 

Jedi

New Member
Reaction score
63
Hide will desync as far as I know, maybe you can try change vertex color or scale.
 

Nestharus

o-o
Reaction score
84
Using the method I just told you won't desync.

Well, actually when the shop sells the item, I'm not sure ; D.


If it desyncs on sell, then your only option is through height, which will give a fugly shadow : D.
 

BlueMirage

Trust, but doubt.
Reaction score
39
"Hiding" a unit will desync, that much I know.
Height changes shadows? Good to know.
Well, it's a building so it hardly needs one. Changing height seems like a plausible idea.

What about changing the actual item table? I think there's an action for that...

Also, setting their X/Y outside of the map seems like a bad idea, since it's referenced in other triggers.

I might as well explain what it does.

It's a "shop" that acts as the control unit of a base. I have 12 captureable bases in my map, and the shop acts as a way to capture / uncapture by selling (for free) triggered items.
The shop has 3 variants. It can either be a base you own, a base your opponents own or a base that no team owns.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
I highly think that it would desync, even if we care about such things like enter/leave region event fire, GroupEnumUnitsInRange and so one (talking about the SetUnitX/Y way).

Because if on Player1's pc the hero X can buy in the Shop A but not on Player2's pc, then it's a different case, and when this hero buy on Player1's pc it would desync with Player2.
Same for the hide thing.

So i think the only good way is to make a dummy object and replace it with the good one on buying event.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
When it is interacted with, it will most likely desync. AFAIK, the best way is vertex coloring and set unit scale to minimum. (to get rid of the shadow) But even then it is probably still dangerous.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
When it is interacted with, it will most likely desync. AFAIK, the best way is vertex coloring and set unit scale to minimum. (to get rid of the shadow) But even then it is probably still dangerous.
But the unit would still be able to buy in this shop, no ?
At least with hotkeys i think.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Set Unit Z then?
Z doesn't matter in the range of an unit, wc3 is a pseudo 3D game in many things, like the range.
And anyway let's imagine the height of an unit does matter for the possibility of buy an item or not (which is absolutely wrong), it would desync like i said before.

But i'm not totally sure about the desync, you can try the SetUnitXY thing, or even the hide stuff to be sure.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Hmm..
For Z-height + Range..

Pythagoras' Theorem on Pythagoras' Theorem?

01) Get the distance between shop and patron using Pythagoras' Theorem.
02) Get the Z-height of the shop
03) SquareRoot((Z-Height of shop)^2 + (Distance between)^2)

I duno, lol
That way, you can pretty much get the proper range (in pixels or whatever unit of measurement WC3 uses)
 

Nestharus

o-o
Reaction score
84
Yea, for SetUnitX/Y, as i said before, I wasn't sure if it would desync or not when the shop would sell an item. I do know if that you were to do that with a unit and the unit got a move order, you'd get an immediate desync.

So as you see, it might not desync on a sell order. Hold Position and Stop did not desync the game with the units when the unit had a different x/y position for each player in the game.


Actually you might be able to pull it off... if you were to sell an item and then give the item to a unit or set item x/y for all of the players, I bet it will work. The item will initially be desynced, but it'll sync up afterwards ; D.

in pixels or whatever unit of measurement WC3 uses

Warcraft 3 is measured in pixels. Of this I am 100% certain. Why? Tiles are 128x128 pixel images. When they go into wc3, they fit over a 128x128 spot. This means that images and what not are measured in pixels.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Seriously, Pythagore won't save us here, unless he come back to life and edit the wc3 engine.
 

Nestharus

o-o
Reaction score
84
Oh yea, here's another possibility. Have it so when you select a shop, it auto selects the appropriate shop for the player. Shops are somewhere far off or w/e. When the player buys an item, it'll auto put that item on to the local shop's selected unit ; D.
 

BlueMirage

Trust, but doubt.
Reaction score
39
Oh yea, here's another possibility. Have it so when you select a shop, it auto selects the appropriate shop for the player. Shops are somewhere far off or w/e. When the player buys an item, it'll auto put that item on to the local shop's selected unit ; D.
This seems like a good idea, as it will not require local triggering at all. Only problem is that the event "Unit Selection" is somewhat slow if I remember correctly, but it should not be a problem really.

But you guys are sure that setting Z locally is not an option? From my understanding, it has no direct impact on the game and thus it should not desync, but maybe it does?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
It shouldn't desync but it also simply shouldn't work as intended, because it would still be clickable, and anyway the shop would still select the hero.
 

BlueMirage

Trust, but doubt.
Reaction score
39
A unit with 20000 Z offset can't be clicked.
Even if it selects the hero, it would not matter since the hero cannot buy from it since it cannot select it, correct?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
A unit with 20000 Z offset can't be clicked.
Ok, if you say it.

Even if it selects the hero, it would not matter since the hero cannot buy from it since it cannot select it, correct?
Wrong i think, because of hotkeys, or you can remove/disable in some way hotkeys ?

EDIT : Ok you can delete an hotkey for an item inside the object editor, nevermind.
But i'm wondering now an hero can "be selected by a shop" only one at a time, right ?
 

BlueMirage

Trust, but doubt.
Reaction score
39
Only one unit that one player controls at a time. There is no issue as long as each unit is controlled by a different player.
Wrong i think, because of hotkeys, or you can remove/disable in some way hotkeys ?
The hotkeys of a hero can in no way affect those of a shop.

Well, I've gotten some good answer so far, so I'll just say that I'm satisfied. Thanks for the ideas everyone!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top