Wc3C.net (http://www.wc3c.net/forums.php)
-   General Mapping Tutorials (http://www.wc3c.net/forumdisplay.php?f=427)
-   -   Displaying tooltips by hovering (http://www.wc3c.net/showthread.php?t=106715)

darkwulfv 07-10-2009 08:00 PM

Displaying tooltips by hovering
This tutorial was inspired by my need for a hero selection set up. I want to thank Anitarf for introducing me to the idea, Here-b-Trollz for providing links on the subject, and Karukef for finding the original discovery.

This tutorial will teach you how to make displayable tooltips in-game simply by hovering over something. Does not use RtC or Trackables.

You'll need:

1 World editor, however you like it
1 MPQ Browser (I prefer MPQ Master)
1 Map. Obviously.
1 Notepad-like program (or Notepad)
1 Keyboard

MAJOR NOTE: As far as my tests show, you CANNOT use Vex's map optimizer at ALL with a map that uses this method. For some reason, even after disabling every tweak and optimization I could, the information in the .wts still didn't show in-game, even though it existed in the .wts. I've contacted Vex and hopefully we can figure this out.

Now let the fun begin!

STEP 1: The destructible
The first step is really simple. This method works by utilizing the Name box shown by destructibles in-game. Of course, the Name box only allows a small amount of text... in the Object editor.

So first, make a custom destructible. I based mine off of a barrel, though any will do I suppose.

Edit the following fields to match mine:

Text - Name : Testing the tutorial
Pathing - Is Walkable : True
Pathing - Pathing Texture : None
Editor - Show Helper Object for Selection : True (just for simplicity when moving it)
Art - Minimap - Show : False
Art - Model File : Invisible Platform <Base> (it's under destructibles)
Art - Shadow : None

Note: Hit Points MUST be >0 or the destructible won't show.

Good, now that's done. You can place one if you want. Doesn't matter right now.

STEP 2: The MPQ and .wts file
Note: If you can condense what you're saying to the confines of the Name box, you do NOT have to do steps 2 and 3.

Now, this whole method works off using the Name box of our destructible. However, in the Object editor you're only allowed like, 2 sentences worth of text. This MAY be enough for you if it's small (like a sign that says "Go left"), but if you're making tooltips like I was, you'll need more.

So, open up your MPQ Editor of choice and open up your map. Under the master directory (no folders or anything), scroll until you find "war3map.wts". Extract it or open it directly with Notepad.

Once open, scroll to the bottom (since it's the latest string you've made). You'll see something like this:


Originally Posted by .wts file
// Destructibles: B000 (Testing the tutorial), Name (Name)
Testing the tutorial

Obviously, "STRING 1800" and "B000" may be different, but that's what it will look like for the most part.

Now the easy part: See between the { and }? Just edit that to your desired tooltip. No need to use the |n line breaks, just make a new line as needed. You'll need color codes for color though (obviously).
Note: Break your line often so it fits into a neat paragraph (for things like descriptions), or else your tooltip will be really long (horizontally) and ugly.

Note: You will have to edit the .wts file every time you need to modify this tooltip, as it cannot be edited properly in the Object Editor. It'll show up (and the name will be the tooltip), but editing it will cause it to revert to its truncated form, and we don't want that.

Step 3: Back to the map
Note: You will need to have the World Editor closed when replacing the .wts file or else it won't be replaced, and nothing will happen.
Replace the .wts file in the MPQ with the new one with your modified tooltip using your MPQ browser, and then reopen your map in the WE.
IMPORTANT: You MUST save now, or else you'll lose all the work you did in the .wts file. Not good! Also, you may need to have your MPQ browser closed out in order for it to work properly. I'm not sure, but it may interfere with the saving process. Sorry you have to open and close these things 100 times :(

Step 4: The map
So, in order for these to look good, you'll need to place them where players will hover. For something like hero selection, you'll need dummy units with your hero models and locust, so they cannot be selected. Better yet would be special effects, but the method is up to you; as long as the unit cannot be selected in any way (as this will interfere with the player's ability to hover over the destructible).

It may take some tinkering, but move the destructible around (including increasing/decreasing its Z location by using Ctrl + Page Up/Down) until it looks smooth and pretty.
This is the result from my original testing. Works beautiful!

And now you're done!

*All I get is a tiny blank box!
Did the .wts file get imported properly? If you tried replacing it while the map was open in the World Editor/Warcraft 3, nothing will happen.
Also, if you didn't save at step 3 like instructed, it won't work + you'll lose the work you did. It pays to read and obey :P
*The tooltip is wrong!
See above.
*I can't seem to replace the .wts file...
Either the map was open in Wc3/the WE, or you may have to delete the old .wts file from the MPQ and add the new one in its place.
*After optimizing with Vex's map optimizer, all my tooltips are gone!
I went through this error too. To fix it, uncheck "Optimize String Usage". You'll lose some kb of compression, but the problem will be solved.
NOTE: Wrong. Vex's Optimizer makes this method unusable for some reason.

Alternate Ideas
These are just some ideas you can use to make this work better for you.

If you still want the heroes to be selectable, perhaps make the doodad use a model like the Question Mark, and tell users to hover over them for the tooltip, but make the heroes selectable for selection/a closer look. (Recommended method!)

You can use the ObjectMerger as well to take advantage of the Name box. Example of usage is below:
Collapse JASS:
//! textmacro MakeSign takes RAWCODE, TEXT
    //! external ObjectMerger w3b DTlv $RAWCODE$ bnam "$TEXT$" bfil "Doodads\LordaeronSummer\Props\SignPost\SignPost.mdl" bgpm "Doodads\LordaeronSummer\Props\SignPost\SignPost.mdl" bmas 1.5 bmis 1.5
//! endtextmacro
Where TEXT is, obviously, the name of the destructible (in this case, a sign). Thanks azlier for pointing out this alternative.

Anopob 07-10-2009 10:55 PM

You might want to say that the cap for the object editor is 2 sentences (or whatever it was in the other thread), and if the user only needs that much, they don't need to do the confusing parts with the MPQ.

Opossum 07-10-2009 11:10 PM

Wow this is pretty awesome. Might find some use in fullscreen inventories and the like. For hero selection I still prefer selecting the hero and being able to look at his skills though.

Blubb-Tec 07-10-2009 11:13 PM

+rep for this, writing it down although your "problem" was already solved is a cool thing.
Also I find the tutorial really informing and helpful, and its surely a cool method of displaying stuff.
now some points: link to the threads mentioned(those in your original thread, i mean)
and maybe there is some method to still make the heroes clickable?
i mean like, you hover over the hero, see a short description, then, if its interesting, you click on the hero and can take a closer look at the skills, etc. that'd be most cool 8)

darkwulfv 07-11-2009 02:30 AM

Anopob: It's vaguely referenced, but I'll make that more clear.

Opposum: Yeah, being able to click the hero would be cool... Perhaps with experimentation?

Blubb: The thread I was referred to won't help anyone, as it's really just Karukef saying "hey, I found out you could do this. Btw, edit the .wts."
I'm sure you could find a way to make the heroes clickable. For example, give the doodad a model (the question/exclamation mark?) and place it next to it, so you can hover it and get the description, then click the hero to get the skills.

I shall update the tutorial now :D Thanks for the rep and kind words.

darkwulfv 07-11-2009 04:35 AM

Bit of updating with step 3 after I did more testing.

azlier 07-12-2009 11:34 PM

You should also note that you can take advantage of the destructible 'Name' box by using the ObjectMerger. This is a textmacro I use in my map to make signposts:

Collapse JASS:
//! textmacro MakeSign takes RAWCODE, TEXT
    //! external ObjectMerger w3b DTlv $RAWCODE$ bnam "$TEXT$" bfil "Doodads\LordaeronSummer\Props\SignPost\SignPost.mdl" bgpm "Doodads\LordaeronSummer\Props\SignPost\SignPost.mdl" bmas 1.5 bmis 1.5
//! endtextmacro

Shows up in the Object Editor, too.

darkwulfv 07-12-2009 11:42 PM

Will add, thought that is a more advanced method of doing this, as it requires the user to know what those fields are (and how to work it).

Also, found a major issue in regards to Vex's map optimizer, as well as fixed an error on my part (the tooltip does show in the OE, you just can't edit it there)

darkwulfv 07-13-2009 04:43 PM

Okay, so I've found that Vex's map optimizer wreaks havoc on this method and breaks it entirely. I've contacted Vex so hopefully we can fix it. Added a warning.

Captain Griffen 07-14-2009 12:41 PM

Pretty cool. Approved.

shendoo2 07-29-2009 07:08 PM

You should include an example map.

Silvenon 08-20-2009 04:28 PM

Is there a way to remove the health bar?

TotallyAwesome 08-20-2009 05:05 PM

Wow, this is pretty awesome.

Originally Posted by Silvenon
Is there a way to remove the health bar?

Make the unit invulnerable.

Vexorian 08-20-2009 05:17 PM


Originally Posted by darkwulfv
Okay, so I've found that Vex's map optimizer wreaks havoc on this method and breaks it entirely. I've contacted Vex so hopefully we can fix it. Added a warning.

did you? I don't remember...

darkwulfv 08-20-2009 05:34 PM

I PM'd you during your absence (which I was not aware of at the time). If you don't find the PM I'll resend it.


You should include an example map.
I'll get around to that.


Is there a way to remove the health bar?
I'm not sure, with desctructibles. Maybe making it invulnerable? But I don't know how that will effect the system.

All times are GMT. The time now is 06:10 PM.

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services