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

Showing the pictures

Status
Not open for further replies.
Level 10
Joined
Oct 28, 2012
Messages
228
Hey, so according to these: How to: Display Images in-game & [Solved] - create image trigger

GUI function for image creating is buggy. I edited the picture, so it's in BLP, in proper resolution and overall ready to go.

Can some good soul help me with the JASS functions in the first tutorial and teach me how to create an image at the location in the map?

My knowledge of JASS is really terrible, so I would love if someone would just create a demo map for me or just fill in all the variables. I would also love to storage the picture as a variable, as I want to show and hide multiple pictures :)

Oh and I also believe that this might be a useful tutorial if someone would be willing to create it ^^
 
What is buggy with the GUI Function?
Hints say:
"Use 'Image - Change Render Always State' to toggle display of this image. By default, images are not rendered. The point specified is used as the bottom-left corner of the image. Images need an alpha channel in order to be displayed properly."​

  • Mouse Click
    • Events
      • Player - Player 1 (Red) issues Drückt MausTaste event
    • Conditions
      • (Mouse Position X for Triggered Mouse Event) Not equal to 0.00
      • (Mouse Position Y for Triggered Mouse Event) Not equal to 0.00
    • Actions
      • Set Size = 300.00
      • Set Offset = (-0.50 x Size)
      • Set Loc = (Mouse Position for Triggered Mouse Event)
      • Set LocDraw = (Loc offset by (Offset, Offset))
      • Image - Create an image using ReplaceableTextures\Splats\AuraRune9b.blp of size Size at LocDraw with Z offset 0.00 using image type Indicator
      • Image - Change (Last created image): Enable render always state
      • Custom script: call RemoveLocation(udg_Loc)
      • Custom script: call RemoveLocation(udg_LocDraw)
 
Is the rect the center?
Or is the rect the space the image shall take?
In Case 2 you can only use the GUI cration function for square Rects (a = b).


Edit: I did some more testing with images and the (often) not used values origin. Now I have to say the GUI Image creation and the known way to create images are wrong. It becomes worser as bigger the image is.

The not used origin values are the reason for big images beeing displayed only when you see the bottom left corner of the image.
If one is using originsValues beeing size/2, the image will be drawn at the given cordinates as wanted. Also ingame the image will display when the center of the image is on the screen.

I wrote this functions and they work super.
I simply could repos an image ever 1/32 s to current position of an unit when using function CreateUnitImage without further offset inputs.
JASS:
function CreateRectImageOld takes string file, rect r returns nothing
//Often recommented to do this way, but it is kinda bad for big images, cause images only display when the origin is on the screen.
//Cause OriginValues  are 0,0,0 the Origin is at bottom Left corner of the image.
   set bj_lastCreatedImage = CreateImage(file, GetRectMaxX(r) - GetRectMinX(r), GetRectMaxY(r) - GetRectMinY(r), 0, GetRectMinX(r), GetRectMinY(r), 0, 0, 0, 0, 2)
endfunction

function CreateRectImage takes string file, rect r returns nothing
   local real a = GetRectMaxX(r) - GetRectMinX(r)
   local real b = GetRectMaxY(r) - GetRectMinY(r)
   //Draw the image at the center and adjust the images center by a/2 & b/2.
   //Without The origin adjustment images will only display if the bottom Left cornor is on the screen.
   //the origin adjustment is also good for moving images: For example you can now just take over frequently an units position without doing x y offsets frequently
   set bj_lastCreatedImage = CreateImage(file, a, b, 0, GetRectCenterX(r), GetRectCenterY(r), 0, a/2, b/2, 0, 2)
endfunction
function CreateImageBetterRect takes string file, location loc, real a, real b returns nothing
   set bj_lastCreatedImage = CreateImage(file, a, b, 0, GetLocationX(loc), GetLocationY(loc), 0, a/2, b/2, 0, 2)
endfunction
function CreateImageBetter takes string file, location loc, real size returns nothing
   set bj_lastCreatedImage = CreateImage(file, size, size, 0, GetLocationX(loc), GetLocationY(loc), 0, size/2, size/2, 0, 2)
endfunction
function CreateUnitImage takes string file, unit u, real size returns nothing
   set bj_lastCreatedImage = CreateImage(file, size, size, 0, GetUnitX(u), GetUnitY(u), 0, size/2, size/2, 0, 2)
endfunction
function CreateUnitImageRect takes string file, unit u, real a, real b returns nothing
   set bj_lastCreatedImage = CreateImage(file, a, b, 0, GetUnitX(u), GetUnitY(u), 0, a/2, b/2, 0, 2)
endfunction
 
Last edited:
Level 10
Joined
Oct 28, 2012
Messages
228
Ok, gotta open this once more; keep getting this error. Any idea why? On your map, everything works just fine.

upload_2018-12-20_12-52-41.png


(Deleted my last comment in order to avoid double-posting)
 
that is a custom written function, it is in the map header, if you want to use it is has to be copied to your map's head.

Here is a new version also containing GUI versions (except for Removelocation), if you are fine with that origin thing I said in the other post you can do it with GUI Actions only.

Create an Image using the space of the rect, (only works for squares correct side a = side b)
  • RectImageGUI
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Set Rect = Gebiet 000 <gen>
      • Set Loc = (Point((Min X of Rect), (Min Y of Rect)))
      • Bild - Create an image using ReplaceableTextures\Splats\AuraRune9b.blp of size ((Max X of Rect) - (Min X of Rect)) at Loc with Z offset 0.00 using image type Indikator
      • Bild - Change (Last created image): Aktivieren render always state
      • Custom script: call RemoveLocation(udg_Loc)
Create an Image at the center of Rect (Rect is treated as a cordinate holder) with Size.
  • RectCenterImageGUI
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Set Rect = Gebiet 000 <gen>
      • Set Size = 300.00
      • -------- Auto --------
      • Set Offset = (-0.50 x Size)
      • Set Loc = (Center of Rect)
      • Set Loc2 = (Loc offset by (Offset, Offset))
      • Bild - Create an image using ReplaceableTextures\Splats\AuraRune9b.blp of size Size at Loc2 with Z offset 0.00 using image type Indikator
      • Custom script: call RemoveLocation(udg_Loc)
      • Custom script: call RemoveLocation(udg_Loc2)
      • Bild - Change (Last created image): Aktivieren render always state
 

Attachments

  • Images.w3x
    19.9 KB · Views: 37
Last edited:
Status
Not open for further replies.
Top