HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Idle Workers

03-18-2010, 06:53 AM#1
Kino
When you select the idle workers button it automatically moves your camera to where that worker is.

Is there a way to prevent or counter this?
03-18-2010, 07:13 AM#2
akolyt0r
you could use an invisible dummy unit as worker icon... and move that unit with the players camera always.

So the camera wont move when the player presses the button, since the unit is already visible.

To still get the normal "idle worker button" event, you could use a trigger registering "unit selected" events of the invisible unit (and select the real unit e.g).

EDIT: This solution has a disadvantage however, you will have to move X units with the screen of the player, where X is the maximum number of Idle workers for which you want to intercept the camera movement.
For great X, this will decrease performance a little bit, since every unit on the screen decreases fps a lil bit (even for invisible units)
03-18-2010, 07:23 AM#3
DioD
you cant, next click will move to other unit.
03-18-2010, 10:00 AM#4
akolyt0r
Quote:
Originally Posted by DioD
you cant, next click will move to other unit.
no?
03-18-2010, 09:32 PM#5
Troll-Brain
@Akolytor :
your solution can desynch players, since the camera could be different for all, the units won't have the same place for each player.

@Kinorhynkar
What do you want exactly, keep the icon when a worker is free, but the camera mustn't move when we click on this icon ?
The user can move the camera with the mouse and the arrows of keyboard ?
03-18-2010, 10:15 PM#6
Hans_Maulwurf
Troll-Brain is right, you can't get the camera position of other players, so this would cause desync.
Better store the camera position in a very short interval and when the player selects an idle worker, move the camera back to the last stored position
03-18-2010, 10:40 PM#7
akolyt0r
hmm true ... you would have to synchronize the camera positions of every player... 0.o sounds like serious overhead.


Maybe it works to simply reset the camera positon to its original position when the "idle worker" button is pressed... wouldnt cause a desync... but the camera will maybe shake for a small moment.

EDIT: oops.. just noticed thats excactly what maulwurf suggested ... ;)
BTW: when you click the idle worker button... does the camera move instantly or continuous to that workers position ?
03-19-2010, 12:00 AM#8
Ammorth
instantly.
03-19-2010, 04:17 AM#9
Kino
Quote:
@Kinorhynkar
What do you want exactly, keep the icon when a worker is free, but the camera mustn't move when we click on this icon ?
The user can move the camera with the mouse and the arrows of keyboard ?

Actually i was designing a "summon bank".
Basically the layer clciks this idle worker button which then brings up a panel of possible companions for the hero.

The camera should be mvable by normal means, all i need is that the camera not move when the idle worker icon is clicked.
03-19-2010, 04:20 AM#10
DioD
click move camera instantly, selection event have 0.250 delay.

you cant do it.
03-19-2010, 05:51 AM#11
Kino
Ah well thanks for the answers anyway
03-19-2010, 07:02 AM#12
akolyt0r
my first idea could still work, but it would require you to sync the camera positions of all players continously
03-19-2010, 08:50 AM#13
Anachron
If you make it on local player level you can do it as I do it in my CustomInventory:

Save the Camera X, Y, Z, Facing and Angle to somewhere.
When selecting, just restore the camera settings.

And by the way, there is no problem with delay, because even the camera gets that delay.
03-19-2010, 02:23 PM#14
Tot
this delay has it's reason in the fps.
before it can be applied, first jass-code must be executed and then a new frame has to be calced
03-19-2010, 04:18 PM#15
Troll-Brain
It wouldn't desync with dummies units which have the locust ability 'Aloc', if you don't enum them.
I've already gave a different position for the same unit without desycn, but ofc you have to figure all cases, inclusion collision and targeting, enter /leave region event, and so one.
Anyway such workers doesn't fire the selection event, only the camera is moved, which is exactly what you don't want :p

And yes selection event have delay, event in a solo game, so the result can't be nice, despite what Anachron said.