Trackables, how exactly do they work?

dudeim

New Member
Reaction score
22
Hey,

I want to create a full screen hero selection system using trackables, but I really have no idea how to use them. I've read here and there that there is no triggering player when someone clicked a trackable so how would I go around that for example? And what's the best way to place them (I guess you have to place them using triggers) as in how would I place them in the place that's gonna be the hero selection?

Hope you can make sense of it;)

Thanks a bunch!
 

Jedi

New Member
Reaction score
63
http://www.wc3jass.com/viewtopic.php?t=1997

Some functions have changed (old handle vars - new hashtables) but the idea is that^^

You need to change trackable's model with GetLocalPlayer before create it, this means if you want to create 500 trackables, you have to create 500 * (player count) trackable.
 

tooltiperror

Super Moderator
Reaction score
231
Trackables suck. To get the triggering player you have to do a clever GetLocalPlayer hack, or the ever so helpful Trackable2.

You're better off with units and images sometimes.
 

dudeim

New Member
Reaction score
22
How do you mean I'm better off with units and images? How would you use that for a full screen hero selection system? I didn't even know you could use images in wc3?
 

tooltiperror

Super Moderator
Reaction score
231
You give units models that are images, and use selection events instead. Can be more intuitive.

Also, the Image API for your curiosity.
JASS:
//============================================================================
// Image API
//
native CreateImage                  takes string file, real sizeX, real sizeY, real sizeZ, real posX, real posY, real posZ, real originX, real originY, real originZ, integer imageType returns image
native DestroyImage                 takes image whichImage returns nothing
native ShowImage                    takes image whichImage, boolean flag returns nothing
native SetImageConstantHeight       takes image whichImage, boolean flag, real height returns nothing
native SetImagePosition             takes image whichImage, real x, real y, real z returns nothing
native SetImageColor                takes image whichImage, integer red, integer green, integer blue, integer alpha returns nothing
native SetImageRender               takes image whichImage, boolean flag returns nothing
native SetImageRenderAlways         takes image whichImage, boolean flag returns nothing
native SetImageAboveWater           takes image whichImage, boolean flag, boolean useWaterAlpha returns nothing
native SetImageType                 takes image whichImage, integer imageType returns nothing
 

luorax

Invasion in Duskwood
Reaction score
67
If you want to use trackables to do the stuff for you, you need two things:
-a trackable to track click/mouseover events
-a doodad to show the icons to the player.

And on top of that, you can not retrieve the clicking player, so you need tricks to get the triggering player (you'll have to create the whole inventory interface for each player and you have to attach the trackables to the player, you have a lot ot options, like a hashtable, array+index, multiple triggers, anything that you can imagine)

While if you decide to use units, your life becomes simple: the unit has model and proper events.

I suggest you to create a struct. The struct should have some real members (X,Y,Z,Face) a readonly unit member (the dummy unit) and a destructable member (this one is optional; you can use dummy destructables to change the texture of the unit - War Club). Then loop through all the instances using a linked list and check if the unit is selected by the player (another loop). If it is, then clear the selection and fire your custom event (use J4L's library). That way your life will be super simple.
However, you'll have to live without the onhover event - but you can simulate a right click event (on opening the inventory you select a dummy unit. If the dummy unit is ordered to attack an icon, you simply pause/stop/unpause it and fire another event)
 

dudeim

New Member
Reaction score
22
Could be usefull but I prefer to have the hover event.
Thanks for the responses;)
 

luorax

Invasion in Duskwood
Reaction score
67
Well, use Trackable2 then, as tooltiperror has already mentioned.

I've just started to rewrite my fullscreen champion selection system, because I've completely forgot about Trackable 2 :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top