[HudBot] Vertical Weapon Hud

Lemon
03-02-2008, 06:12 PM
http://img141.imageshack.us/img141/6497/sshot2441cm8.png

You'll need to be running an events based config with eventLoadPlayGui available. I included it at the bottom of the code. If you need it just uncomment it.

edit: So far it only works in base.

// vertical hudbot weapon hud Version 0.2
// for hudbot > 0.5
// by lemon
// thanks to andrew for hudbot and vhuds (and everything else)
// dynamix for the game
// and deadguy for the idea
// copy the weaponhud folder from hudbot\huds
// and put it in hudbot\scriptgl

// edit below
$weaphudfont="fixedsys";
$weaponhudsize="10% 40%";
$weaponhudposition="5% 20%";
$imagesize="1";
$fontsize="4";
// edit above

$WeaponImage[11] = "WeaponHud.blaster.tga";
$weaponImage[13] = "WeaponHud.chaingun.tga";
$weaponImage[15] = "WeaponHud.plasma.tga";
$WeaponImage[17] = "WeaponHud.grenade.tga";
$WeaponImage[19] = "WeaponHud.mortar.tga";
$WeaponImage[21] = "WeaponHud.disc.tga";
$WeaponImage[22] = "WeaponHud.sniper.tga";
$WeaponImage[24] = "WeaponHud.elf.tga";

$WeaponName[0] = "Blaster";
$WeaponName[1] = "ChainGun";
$WeaponName[2] = "Plasma Gun";
$WeaponName[3] = "Grenade Launcher";
$WeaponName[4] = "Disc Launcher";
$WeaponName[5] = "Mortar";
$WeaponName[6] = "Laser Rifle";
$WeaponName[7] = "ELF Gun";

$WeaponID[0] = 11;
$WeaponID[1] = 13;
$WeaponID[2] = 15;
$WeaponID[3] = 17;
$WeaponID[4] = 21;
$WeaponID[5] = 19;
$WeaponID[6] = 22;
$WeaponID[7] = 24;

$AmmoID[11] = "";
$AmmoID[13] = "Bullet";
$AmmoID[15] = "Plasma Bolt";
$AmmoID[17] = "Grenade Ammo";
$AmmoID[19] = "Mortar Ammo";
$AmmoID[21] = "Disc";
$AmmoID[22] = "";
$AmmoID[24] = "";

$BackpackSlot[27] = "Inventory";
$BackpackSlot[28] = "AmmoStation";
$BackpackSlot[29] = "EnergyPack";
$BackpackSlot[30] = "RepairPack";
$BackpackSlot[31] = "ShieldPack";
$BackpackSlot[32] = "SensorJammerPack";
$BackpackSlot[33] = "Motion";
$BackpackSlot[34] = "AmmoPack";
$BackpackSlot[35] = "Pulse";
$BackpackSlot[36] = "SensorJammer";
$BackpackSlot[37] = "Camera";
$BackpackSlot[38] = "Turret";


function hl2weaponhud(){
vhud::create( "hl2weaponhud", $weaponhudsize, $weaponhudposition, hl2weaponhud::onrender );
vhud::add_item( "pixelsize_numbers", $fontsize@"%" );
vhud::add_item( "imageslot1", "0% 0%" );
vhud::add_item( "imageslot2", "0% 15%" );
vhud::add_item( "imageslot3", "0% 30%" );
vhud::add_item( "imageslot4", "0% 45%" );
vhud::add_item( "imageslot5", "0% 60%" );
vhud::add_item( "imageslot6", "0% 75%" );
vhud::add_item( "valueslot1", "0% 0%" );
vhud::add_item( "valueslot2", "0% 15%" );
vhud::add_item( "valueslot3", "0% 30%" );
vhud::add_item( "valueslot4", "0% 45%" );
vhud::add_item( "valueslot5", "0% 60%" );
vhud::add_item( "valueslot6", "0% 75%" );
}


function hl2weaponhud::onrender( ) {

glBlendFunc( $GL_SRC_ALPHA, $GL_ONE_MINUS_SRC_ALPHA );
glTexEnvi( $GL_MODULATE );

%pos = vhud::render_value( "imageslot1" );
%pos[x] = ( getword( %pos, 0 ) );
%pos[y] = ( getword( %pos, 1 ) );
glColor4ub( 255, 255, 255, $SlotVal[1] );
vhud::render_text( "valueslot1", $weaponhudfont, "pixelsize_numbers", $GLEX_PIXEL, $SlotAmmo[1] );
glDrawTexture( $Slot[1], $GLEX_SCALED, %pos[x], %pos[y], $imagesize, $imagesize );

%pos = vhud::render_value( "imageslot2" );
%pos[x] = ( getword( %pos, 0 ) );
%pos[y] = ( getword( %pos, 1 ) );
glColor4ub( 255, 255, 255, $SlotVal[2] );
vhud::render_text( "valueslot2", $weaponhudfont, "pixelsize_numbers", $GLEX_PIXEL, $SlotAmmo[2] );
glDrawTexture( $Slot[2], $GLEX_SCALED, %pos[x], %pos[y], $imagesize, $imagesize );

%pos = vhud::render_value( "imageslot3" );
%pos[x] = ( getword( %pos, 0 ) );
%pos[y] = ( getword( %pos, 1 ) );
glColor4ub( 255, 255, 255, $SlotVal[3] );
vhud::render_text( "valueslot3", $weaponhudfont, "pixelsize_numbers", $GLEX_PIXEL, $SlotAmmo[3] );
glDrawTexture( $Slot[3], $GLEX_SCALED, %pos[x], %pos[y], $imagesize, $imagesize );

%pos = vhud::render_value( "imageslot4" );
%pos[x] = ( getword( %pos, 0 ) );
%pos[y] = ( getword( %pos, 1 ) );
glColor4ub( 255, 255, 255, $SlotVal[4] );
vhud::render_text( "valueslot4", $weaponhudfont, "pixelsize_numbers", $GLEX_PIXEL, $SlotAmmo[4] );
glDrawTexture( $Slot[4], $GLEX_SCALED, %pos[x], %pos[y], $imagesize, $imagesize );

%pos = vhud::render_value( "imageslot5" );
%pos[x] = ( getword( %pos, 0 ) );
%pos[y] = ( getword( %pos, 1 ) );
glColor4ub( 255, 255, 255, $SlotVal[5] );
vhud::render_text( "valueslot5", $weaponhudfont, "pixelsize_numbers", $GLEX_PIXEL, $SlotAmmo[5] );
glDrawTexture( $Slot[5], $GLEX_SCALED, %pos[x], %pos[y], $imagesize, $imagesize );

%pos = vhud::render_value( "imageslot6" );
%pos[x] = ( getword( %pos, 0 ) );
%pos[y] = ( getword( %pos, 1 ) );
glColor4ub( 255, 255, 255, $SlotVal[6] );
vhud::render_text( "valueslot6", $weaponhudfont, "pixelsize_numbers", $GLEX_PIXEL, $SlotAmmo[6] );
glDrawTexture( $Slot[6], $GLEX_SCALED, %pos[x], %pos[y], $imagesize, $imagesize );


}


function fillslots(){
%c=0;
for(%s=1;%s<=6;%s++){
$Slot[%s]="";
$SlotAmmo[%s]="";
}
for( %i=0; (eval("%item=$WeaponName["@%i@"];") != ""); %i++ ){
if(getItemCount(%item)==1 ){
%c++;
%weap=$weaponID[%i];
%ammo=$AmmoID[%weap];
$SlotAmmo[%c]=getitemcount(%ammo);
if($SlotAmmo[%c]=="0")
$SlotAmmo[%c]="";
$SlotVal[%c]=128;
if( getmounteditem(0) == %weap )
$SlotVal[%c]=255;
$Slot[%c]=$weaponImage[%weap];
}
}
%c++;
$SlotVal[%c]=255;
$Slot[%c]="WeaponHud."@$BackpackSlot[getMountedItem(1)]@".tga";
schedule::add("fillslots();",0.3);
}

hl2weaponhud();

Event::Attach(eventLoadPl ayGui, fillslots);

// function loadPlayGui()
// {

// if(File::FindFirst("play.gui") != "")
// {
// GuiLoadContentCtrl(MainWi ndow, "play.gui");
// }
// else
// {
// GuiLoadContentCtrl(MainWi ndow, "gui\\play.gui");
// }

// if($PlayGUI::isLoaded == 0)
// {
// Event::Trigger(eventLoadP layGui);
// $PlayGUI::isLoaded = 1;
// }
// }

AnubiS
03-05-2008, 03:02 PM
Need help? Next week i'll have enough time to get every mod's weapon name to you, if you want

Snapple
07-27-2008, 01:36 PM
lemon can you send me just your hudbot skins i wanna keep my config the way it is :|

Lemon
07-27-2008, 09:20 PM
Here ya go (http://www.mediafire.com/?kdzjyxmn9ng)

Snapple
07-28-2008, 03:35 PM
hey lemon iam a hudbot newbie (just got a new pc was never able to use it before)

where are the hud skins? iam not seeing them labled

Lemon
07-28-2008, 06:33 PM
The huds are vhuds and there are no skins, just fonts. You can use pretty much any font and make them whatever color you want using script. All the huds are part of my config though. They're not something you can just drop in.

Lemon
08-02-2008, 01:05 PM
Slight code update in first post.