Jump to content
Sign in to follow this  
-KMARNS- Spectre

Image problem

Recommended Posts

maybe this question is already answered on this forums, but searched it today and couldn't find anything.

and I can't load www.ofpec.com since a few days so I'm sorry if I'm interrupting you on your friday eve:).

I have problems with inserting images ingame into the intro of SP/MP missions. I also have a description file, but it won't work.

So the question is: who has a example description file for me?

the file is called: korpswapen01.jpg

atm I use the following description.ext file:

Quote[/b] ]

class RscStdText

{

type=0;

idc=-1;

style=2;

colorBackground[]={0,0,0,0};

colorText[]={1,1,1,1};

font="TahomaB14";

size=1;

};

class RscTitles

{

titles[]={starttext1,starttext2,starttext3};

class starttext1

{

idd=-1;

movingEnable=0;

duration=6;

fadein=2;

fadeout=2;

name="starttext1";

controls[]={"Screen","Titel1",};

class Screen : RscStdText

{

style=48;

text="korpswapen01.jpg";

x=0.2;

y=0.2;

w=0.6;

h=0.1;

};

and when I start the mission there appears:

no entry ... /korpswapen01.jpg

Share this post


Link to post
Share on other sites
Quote[/b] ]First the basics:

OFP can understand two main image formats: .jpg and .paa (plus .pac & .tga) - jpg is easier to prepare then the paa files, but it has no alpha channel - therefore transparency is not possible. Also the engine has to do the jpeg decoding on the fly - which costs a lot more processing power than the native OFP texture format paa. Of course, for a squad logo, a flag or a title picture the latter is not really an issue. In OFP paa and jpg formats can always be used both. So paa files can also be used in the briefing.html or your XML (allows for transparency in squad logos).

Most important: images always have to be 2^n in size for either axis (2^n values are for example 32, 64, 128, 256, 512, 1024, 2048,...). Else they won't show. So 128x128 or 512x256 are ok, but 768x512 would not work. They must NOT be compressed (jpeg at 100% quality, non-progressive).

To create a paa file you need to create a tga file (graphics format - supported by photoshop and other big graphics suites - I use the free GIMP software). The resulting file (remember - no compression!) can then be converted to paa using the tool TexView, available at the official BIS website (www.flashpoint1985.com - look in the editing section) to paa.

How to implement this into your mission?

Well, first you need to copy the images - paa or jpg into your mission's folder. Then, in order to be able to use it later in your mission you need to declare them in the description.ext. No worries, that sounds more complicated than it is.

First make sure your description.ext contains a class definition 'rscpicture'. This is the nescessary part. Just copy it in your description.ext on top of any picture declarations:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class RscPicture

{

type = CT_STATIC;

idc = -1;

style = ST_PICTURE;

colorBackground[] = {0, 0, 0, 0};

colorText[] = {1, 1, 1, 1};

font = FontS;

size = 0;

};

Now we have to declare the pictures. We do this as Title Resources, so we can use them with the CutRsc or TitleRsc commands:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class RscTitles

{

titles[] = {FTCTitle1, FTCTitle2};

class FTCTitle1

{

idd=-1; // ID ... always -1

movingEnable = false; // always false

duration=10; // max time the picture shows (in seconds)

name = "FTCTitle1"; // name in editor

// now we declare the picture

controls[]=

{Picture};

class Picture : RscPicture

{x = 0.25; y = 0.33; w = 0.5; h = 0.33;text = "title1.paa";};

};

class FTCTitle2

{

idd=-1; // ID ... always -1

movingEnable = false; // always false

duration=10; // max time the picture shows (in seconds)

name = "FTCTitle2"; // name in editor

// now we declare the picture

controls[]=

{Picture};

class Picture : RscPicture

{x = 0.25; y = 0.33; w = 0.5; h = 0.33;text = "title2.paa";};

};

};

The above looks complicated, but is actually very easy to understand. First the 'titles' line. The brackets just contain a list of the ingame names we are going to use for the pictures in our scripts. In the above example there are two images - 'FTCTitle1' and 'FTCTitle2'. Then we declare first 'FTCTitle1' and then (after several lines of code) 'FTCTitle2'. What is important for you are just four lines in this declaration:

- the 'class FTCTitle1' tells the game that now the declaration of the first Resource named 'FTCTitle1' starts. Be carefull to use the same names as in the titles line above!

- the 'duration' line tells OFP how long the Resource should shown (after this time it gets removed from the screen - but you can always remove it earlier in your scripts). Time is in seconds.

- the 'name' line declares a name for the editor. When you have declared the resource and the mission is loaded in the editor you can choose the resource under the effects tab of triggers and waypoints to activate it. The best is to use again the same name as above (in this example 'FTCTitle1')

- the most important part is this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class Picture : RscPicture

{x = 0.25; y = 0.33; w = 0.5; h = 0.33;text = "title2.paa";};in the brackets you declare the relative position and size of your image resource and you define the actual filename of your image.

'x' and 'y' are the relative position (measured from the upper left corner with values ranging from 0 to 1.0) - so 'x = 0.25; y = 0.33;' means that the image's upper left corner gets placed 25% of the screen size to the right and 33% down. This allows for correct positioning of your resource without regard for the actual screen resolution used by each player.

'w' and 'h' define width and height of our image - also relative to the screen síze. Note that to center an image the sum of twice the 'x' and once the 'w' has to be 1.0 (same goes for 'y' and 'h').

Remember that computer screens have a relation of width to height of 4:3 - independent of what resolution you use!!! For example the picture called title2.paa has a resolution of 512x256 - by using the above values it fits in the center of the screen without being distorted.

Then the next image follows. You can add as many image resources as needed. Just remember to declare them all in the titles line and to stick with the names you declared there. The rest is mainly cosmetics.

Also keep of the brackets and semicolons - they start/end any declaration, as can be easily seen in the above examle. Just keep care to conserve this structure when you cut&paste new image entries or remove old ones.

Ok, so now we have finished the description ext. OFP knows where to look for the images and how to fit them on the screen. Now we only have to tell the game WHEN to show them. This is very easy. Either we can use a trigger effect, or we can call the resource from a script.

If you use a script you have the commands 'cutRsc' and 'TitleRsc' - analogue to the 'cutText' and 'TitleText' commands.

Example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">TitleRsc ["FTCTitle2","Plain",1]

You see the name of the resource as we declared it in the description.ext? Well, the next thing "plain" just tells it to place it to the center - as we defined the exact position already in the description. ext we ignore it and always use "plain". the numbe after this is the time (in seconds) the image takes to fade in (and out, after it's duration is over).

To remove a resource from the screen even if its duration isn't over yet, just use the corresponding Rsc or Text call. Like if you have TitleRsc displayed, you either do a <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">TitleText [" ", "plain"]or a<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">TitleRsc ["default","plain"]That's it.

from an old tutorial I made long time ago...

Share this post


Link to post
Share on other sites

I am very sorry but it won't work. I read the tutorial a couple of times but when I will load the mission in the editor Flashpoint crashes and I get the following Error:

'Users\Name\missions\mission.cain\description.ext/RscTitles/FTCTitle1.':' ' encountered instead of '='

Do You know what this is?

Thnx:)

Share this post


Link to post
Share on other sites
Spectre @ April 07 2004,20:52)]I am very sorry but it won't work. I read the tutorial a couple of times but when I will load the mission in the editor Flashpoint crashes and I get the following Error:

'Users\Name\missions\mission.cain\description.ext/RscTitles/FTCTitle1.':' ' encountered instead of '='

Do You know what this is?

Thnx:)

Excuse me, but do we know eachother??? smile_o.gif

Probably a typo or oversight in your description.ext. In your first post, there's a bracket missing. Contact me on MSN or email if you keep running into trouble.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×