OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: TH on 10 Jun 2004, 21:35:39

Title: Custom resource
Post by: TH on 10 Jun 2004, 21:35:39
how do u make a custom resource.. like when you go into a trigger and effects, so a custom logo comes up?
Title: Re:Custom resource
Post by: dmakatra on 10 Jun 2004, 21:38:26
read Vektorbosons Dialog tutorial, then download can't-remember-names dialog creator.

:beat: *Gets Shot* :beat:
Title: Re:Custom resource
Post by: macguba on 10 Jun 2004, 21:45:25
Hmm, not sure he meant dialogues.  I think he just wants a pic.

If so, then you need to create the resource and save it in the mission folder as a jpg or something:  define it in description.ext, then of course call it when you want it.    I think there's a tute on this.

Anyway, here's a working example, cut and paste.

From description.ext

class RscPicture
{
   type=0;
   idc=-1;
   style=48;
   colorBackground[]={0,0,0,0};
   colorText[]={1,1,1,1};
   font="tahomaB24";
   size=0;
};
class RscTitles
{
   class naughty2
   {
      idd=-1;
      movingEnable=0;
      duration=8;
      name="naughty2";
      controls[]={"Title"};
      class Title: RscPicture
      {
         text="naughty2.jpg";
         x=0.300000;
         y=0.000000;
         w=0.400000;
         h=1.000000;
      };
   };
};


Obviously there is a file called naughty2.jpg in the mission folder.

When you want the resource use the code

titleRsc ["naughty2","plain",0.1]
Title: Re:Custom resource
Post by: TH on 10 Jun 2004, 22:21:27
thx thats what i was looking for  ;D
Title: Re:Custom resource
Post by: TH on 11 Jun 2004, 04:26:33
what size does the pic need to be :-\
Title: Re:Custom resource
Post by: macguba on 11 Jun 2004, 11:57:32
The pic sides probably need to be a power of 2 in pixels.     You can make the pic any size you want on the screen, so it's fine to save it distorted if needs be.

There is a tute on this somewhere, I remember reading through the example and trying to relate it to what I was  doing.  Can't remember which one it is though.
Title: Re:Custom resource
Post by: TH on 11 Jun 2004, 15:45:21
it gives me this error Image user/ofp/missions/blablabla dimensions 1714x526 not 2^n
same error i always get sept 1714x526 is replaced by the pixels i had :-\
Title: Re:Custom resource
Post by: h- on 11 Jun 2004, 16:22:41
The pic dimensions need to be in power of two, not dividable by two... So you can't use something like 32x96, or 1724x526....

Don't know how to explain this in english any better, but:
The dimensions need to be dividable by each other, like 32x64, resulting in an integer value of power of two (0,2,4,6,8,10...etc.)...

So you can use 32x32, 32x64, 64x64, 32x128, etc, etc....

If you want a pic that fills the whole screen, first make the pic in the dimensions of the screen, then re-size it something like 1024x1024, and then control it's size in OFP by adjustig the 'w' (width) and 'h' (height) values in class RscTitles...


And of course if I'm sharing mis-information here, please correct me... :P
Title: Re:Custom resource
Post by: Planck on 11 Jun 2004, 20:10:53
Well.......

Code: [Select]
The dimensions need to be dividable by each other, like 32x64, resulting in an integer value of  two (0,2,4,6,8,10...etc.)...
Should read:

Code: [Select]
The dimensions need to be powers of two, like 32x64, resulting in an integer value of power of two (2,4,8,16...etc.)...



 ::)


Planck
Title: Re:Custom resource
Post by: h- on 11 Jun 2004, 20:23:05
 ;D

thnx  :thumbsup: