Author Topic: Hud elements but image wise problem  (Read 2649 times)

Offline topg3ar

  • Rank: Private
  • *
  • Posts: 33
Hud elements but image wise problem
« on: June 10, 2009, 04:26:41 am »
righteo hi guys im new to this forum.
so ive got an image ( its an orange square so far ) and i have converted it into a material i think i done it correctly then i put this inot my csv

material,hud_test

then into my makemod.bat i put

xcopy images ..\..\raw\images /SY
xcopy materials ..\..\materials /SY

7za a -r -tzip z_mp_mod.iwd images

so after all this i made a gsc called hud_image.gsc which inside has the following code

init()
{
precacheShader( "hud_test" );
level thread onPlayerConnect();
}

onPlayerConnect()
{
   while(1)
   {
      level waittill("connecting", player);

      player thread onPlayerSpawned();
   }
}

onplayerspawned()
{
   self endon("disconnect");

   while(1)
   {
      self waittill("spawned_player");
         self.hud_image = newHudElem(self);
         self.hud_image.alginX = "center";
         self.hud_image.alignY = "middle";
         self.hud_image.x = 50;
         self.hud_image.y = 200;
         self.hud_image.alpha = 1;
         self.hud_image.fontScale = 1.4;
         self.hud_image.hideWhenInMenu = true;
         self.hud_image setshader("hud_test", 50, 50);



   }
}

so inside this i have precached the hud_test material as i think i should precache it then i made the element to hold it.
The   init()   is called from globallogic under onstartgametype with this     thread scripts\hud_image::init();

but the big problem is when im ingame and spawned my image isnt there it is a green square with little purple squares in it which what i think means no image.
so can anyone help

Offline PatmanSan

  • Administrator
  • Rank: Private
  • *****
  • Posts: 2527
Re: Hud elements but image wise problem
« Reply #1 on: June 10, 2009, 07:28:14 am »
- Make sure you are using the right (COD4) converter for the image.
- Make sure the mod.ff has the material file.
- Make sure the iwd file has the image file.
- Code looks good, except for one thing:

self.hud_image = newHudElem(self);

Should be:

self.hud_image = newClientHudElem(self);

Offline topg3ar

  • Rank: Private
  • *
  • Posts: 33
Re: Hud elements but image wise problem
« Reply #2 on: June 11, 2009, 02:30:11 am »
I used asset manager to convert it. i had no clue how to use it so this is how i did it.

opened asset manager
went new .gdt and called it tester then loaded it and chose the material option then selected new entry and called it hud_test.

then chose 2d under the material type
then these are my settings in order from left to right.

sort  =  default
surfacetype  =  none
usage  =  not in editor
blend func  =  replace
cullface  =  back
polygon offset  =  none
alpha test  =  always
depth test  =  less equal
depth write  =  auto

colour map url    raw\images\hud_test.dds

no tile
nomip bilinear
auto compression
( ive ticked no picmip )
( custom radiant material is unticked )

and last of all show platform  =  none

then i just went pc convert then put the hud_test.iwi in my images folder and then put the hud_test that was in my materials folder in my mod

so have i done anything wrong ?


BTW
- Make sure you are using the right (COD4) converter for the image.            im using asset manager
- Make sure the mod.ff has the material file.           material,hud_test is in my csv and  xcopy materials ..\..\materials /SY thats in my makemod.bat
- Make sure the iwd file has the image file.           ive put it in the IWD with  7za a -r -tzip z_mp_mod.iwd images
- Code looks good, except for one thing:

Offline topg3ar

  • Rank: Private
  • *
  • Posts: 33
Re: Hud elements but image wise problem
« Reply #3 on: June 11, 2009, 07:51:30 pm »
do you know how to properly make a material on cod4 with asset manager ?
or are there any tutorials