Scaleforms

What are scaleforms?

Scaleforms are an amazing part of GTA V, and make up nearly any display used in the game. For example, the entire web browser and pages themselves are done using scaleforms, which in this little guide, I will show you how to obtain their wonderful powers!

Well that sounds pretty neat, so how do we go about using them?

First of all, like most things, we will need to request the scaleform. This can be done using something such as:

local scaleform = RequestScaleformMovie("SCALEFORM")
while not HasScaleformMovieLoaded(scaleform) do
	Citizen.Wait(0)
end

Once this is done, we now can go onto pushing scaleform functions! This is the part where having the decompiled scaleforms comes in real handy.
To start off with, we will use the scaleform "mp_big_message_freemode", so make sure to request that scaleform if following along! Now, here comes the tedious part, looking at the decompiled script for this scaleform, we can see that one of the functions are "SHOW_SHARD_WASTED_MP_MESSAGE", this means that we can push this function, and maybe get something that looks neat from it, so lets try it!

Now, to begin with, we first push the scaleform function (Make sure to request the scaleform before doing this!) :

BeginScaleformMovieMethod(scaleform, "SHOW_SHARD_WASTED_MP_MESSAGE")

As you can see, we pass it the handle of the requested scaleform, and then push the function. So far, this isnt that complex is it? Who knew something so cool and neat can be done so simply!

Now, we need to feed it the parameters it wants, but wait, whats this? The function itself looks like it doesnt want any params, how strange? Don’t worry though, its not the end of the world! It just means we have to dig a bit deeper! So, looking at the function, it seems to take the 3rd argument (as it starts at index 0) and then pass that along with the other arguments to a variable called DO_SHARD

Now, looking at this function, we can see a lot more useful information!

DO_SHARD(args, isCenter, colID, shardColID, useLargeShard)

It actually has arguments there! So, “SHOW_SHARD_WASTED_MP_MESSAGE” passes arguments,true,_loc3_,undefined,true to DO_SHARD, and looking closer, uses the first two parameters as the large text and small text below. And now we can also see that the 3rd parameter it took is used for the colID (This seems to be what the large text colour starts as then transitions to the default text colour)! Neat, huh? Now, all this information means nothing without putting it to use, so lets do just that!

So we currently request the scaleform, and push one of the functions, now, we need to give it parameters to use. This can be accomplished like so:

BeginScaleformMovieMethod(scaleform, "SHOW_SHARD_WASTED_MP_MESSAGE")
PushScaleformMovieMethodParameterString("SOME TEXT")
PushScaleformMovieMethodParameterString("SOME MORE TEXT")
PushScaleformMovieMethodParameterInt(5)

This will now push the parameters that the scaleform requires (Make sure that you push the right type as some scaleforms wont work if you push the wrong type of data), however, there is one last step we need to do before we can start drawing, which is to end it! This can be achieved by using two different natives, which should be used depending on the situation:

EndScaleformMovieMethod()

And:

EndScaleformMovieMethodReturn()

The only difference between these two, are that one will not return anything (EndScaleformMovieMethod) while the other will return something, which wont be useful unless the function pushed actually have a return in it.

Right, we have all this, now, can we set it all up and get drawing?

Sure! Now its time to sandwich it all together, the end result will look something like:

local scaleform = RequestScaleformMovie("mp_big_message_freemode")
while not HasScaleformMovieLoaded(scaleform) do
	Citizen.Wait(0)
end

BeginScaleformMovieMethod(scaleform, "SHOW_SHARD_WASTED_MP_MESSAGE")
PushScaleformMovieMethodParameterString("SOME TEXT")
PushScaleformMovieMethodParameterString("SOME MORE TEXT")
PushScaleformMovieMethodParameterInt(5)
EndScaleformMovieMethod()

We’re getting so close! Now all that’s left to do is to draw it! There are quite a few different ways of drawing, however, for this one we will be drawing it 2D and fullscreen, therefore we will be using the native DrawScaleformMovieFullscreen, as we dont want anything funky with the drawing, we will just pass it 255 for r,g,b and a, while also giving it the scaleform handle, like so:

DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)

Make sure to draw it in a loop too! And dont push the parameters in the loop unless necessary, as that can also cause issues with the scaleform!

Useful links:

Some uses for scaleforms:

46 Likes

great thanks! ^^ :genie:

1 Like

Thank u for THIS!!..

One example of scaleforms can be:

Which will give you buttons like:
76ed876c492fbe1b155b1131221c8911d7d3a50b

Neat stuff! It even changes depending on if youre using a controller too!

6 Likes

So is their multiples I can make it activate that pooping up, If so how?
:sneezing_face::nerd_face:

How to export all scaleforms.


What you will need:

  • JPEXS Flash Decompiler - I’d reccomend this version as it seems any later will not export the entire selection and instead only one at a time, which is no fun.
  • A brain (Essential!!!)

Now, lets get started!

  1. So what you will need to do is open up your game files in whatever program of choice (OpenIV or CW or whatever)
  2. Search all files for .gfx so you get every scaleform present.
  3. Export all of these found results into a folder.
  4. Now, JPEXS time. Open up JPEXS, click open, find the folder where all of these scaleforms are, and select all and select open.
  5. Have fun pressing No to all many times. It’s a little minigame to this.
  6. After this, select all again, and click export selection. Choose a folder where you would like these to be placed.
  7. Ensure that when you reach

Make sure that everything but ActionScript is off, else you will probably have to wait hours to export everything, and most isnt even needed.

  1. That should be it now, head over to the folder and you will see every scaleform turned into a folder, which you can find all the ActionScript files for. The main ones you need are located in __Packages, then browsing through more. Usually the “main” file is the one with the same name as the actual .gfx folder.

Have fun :balance_scale:ing!

8 Likes

Hello I am using the "SHOW_POPUP_WARNING " scaleform and its working I just don’t know how to remove it from the screen

This is my code:

Citizen.CreateThread(function()
                function drawscaleform(scaleform)
                    scaleform = RequestScaleformMovie(scaleform)
                    while not HasScaleformMovieLoaded(scaleform) do
                        Citizen.Wait(0)
                    end
                    PushScaleformMovieFunction(scaleform, "SHOW_POPUP_WARNING")
                    PushScaleformMovieFunctionParameterFloat(500.0)
                    PushScaleformMovieFunctionParameterString("ALERT")
                    PushScaleformMovieFunctionParameterString("~b~Peacetime Active")
                    PushScaleformMovieFunctionParameterString("This Means No Priority Calls")
                    PushScaleformMovieFunctionParameterBool(true)
                    PushScaleformMovieFunctionParameterInt(0)
                    PopScaleformMovieFunctionVoid()
            
                    DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255, 0)
                end
                while true do
                    Citizen.Wait(0)
                    drawscaleform("POPUP_WARNING")
                end
            end)
3 Likes

Break out of your while true loop or use other things like a simple boolean toggle with a variable.

1 Like

@d0p3t I don’t under stand, can you make it simpler

Is it possible to set font for scaleforms or blip?

Only a few scaleforms allow fonts to be changed, the only other way I can think of doing it is building your own scaleforms which I would love to know how as I have seen this done in other communities outside of FiveM.

That would be awesome! I want to build my own too!

There is not much information about building your own scaleform for GTA in special, but there is a boilerplate provided at the FiveM Documentation to get you started. Beside Flash (I tested it with CS6), you will need at least the gfxexport.exe binary to make the .swf game-ready, but as Scaleform Gfx seems to be legacy(?) now there is no easy way to get the actual SDK that used to be shipped. An alternative is to use the gfxexport.exe that comes with UDK (Unreal Development Kit). There is ton of information/tutorials about Scaleform Gfx at the UDK Documentation, too :slight_smile:

1 Like

export all gfx,batch ren all gfx to swf, “yes to all” editing,after that change name back to gfx and stream

That sounds like the “throw it at the wall and see if it sticks” approach and not really any helpful information on how…

From all I know is that you cannot use Animate CC to do it but a very outdated version of Flash.

Uhh, is there a way to do it without?

need more information for minimap scaleform and website scaleform.
because of them so ‘BIG’

1 Like

I just found that how to use that function :blush: : GetScaleformMovieMethodReturnValueString
example :

local a = RequestScaleformMovie("translate")  --scaleform gfx
while not HasScaleformMovieLoaded(a) do 
    Citizen.Wait(0)
end 
BeginScaleformMovieMethod(a,"EnglishToChinese") --call function
ScaleformMovieMethodAddParamPlayerNameString("Good")  --input
local b = EndScaleformMovieMethodReturnValue()
while true do 
if IsScaleformMovieMethodReturnValueReady(b) then 
   local c = GetScaleformMovieMethodReturnValueString(b)  --output
   print(c)
   break 
end 
Citizen.Wait(0)
end

by me

1 Like

Idk if this is known but you can also make them clickable with cursor https://pastebin.com/2FqKqfex

yeah, that’s how they’re used typically in frontend menus or so