Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSS[L4D1 & L4D2] Tank HP Sprite [v1.0.1 | 31-January-2021]


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Description

This plugin shows a sprite at the tank head that goes from green to red based on its HP.

The idea was to make something similar to RPGs.

Note: The width size doesn't change, at least I wasn't able to reduce it. (if anyone knows how to do it, with vanilla sprites, I would be grateful to know how to)

Features
  • Automatically sets the sprite color (from green to red) in a gradient way.
  • Allow setting the Z axis based on the tank position.
  • Allow setting the visibility by team.
  • Allow setting the survivor visibility based sight and in the last hit on tank.
  • Allow setting the sprites model/alpha/scale.
  • Allow setting a dead sprite and its color.

Preview

68747470733a2f2f692e696d6775722e636f6d2f

Some inside info

I did this plugin as a private request back in 2019, but "somehow" the code got "leaked".

And I even have found some people trying to sell it.

So I'm sharing an improved version with more features and bugless.

Cvars

A configuration file named "l4d_tank_hp_sprite.cfg" will automatically be created for you upon the first run in the "\cfg\sourcemod\" folder.

PHP Code:

// Alpha of alive tank sprite.
// 0 = Invisible, 255 = Fully Visible
// -
// Default: "200"
// Minimum: "0.000000"
// Maximum: "255.000000"
l4d_tank_hp_sprite_alive_alpha "200"

// Model of alive tank sprite.
// -
// Default: "materials/vgui/healthbar_white.vmt"
l4d_tank_hp_sprite_alive_model "materials/vgui/healthbar_white.vmt"

// Scale of alive tank sprite (increases both height and width).
// Note: Some range values maintain the same size. (e.g. from 0.0 to 0.38 the size doesn't change).
// -
// Default: "0.25"
// Minimum: "0.000000"
l4d_tank_hp_sprite_alive_scale "0.25"

// Show the sprite to the survivor attacker, by this amount of time in seconds, after hitting the Tank.
// 0 = OFF.
// -
// Default: "0.0"
// Minimum: "0.000000"
l4d_tank_hp_sprite_attack_delay "0.0"

// Alpha of dead tank sprite.
// 0 = Invisible, 255 = Fully Visible
// -
// Default: "200"
// Minimum: "0.000000"
// Maximum: "255.000000"
l4d_tank_hp_sprite_dead_alpha "200"

// Color of dead tank sprite.
// Use three values between 0-255 separated by spaces ("<0-255> <0-255> <0-255>").
// -
// Default: "225 0 0"
l4d_tank_hp_sprite_dead_color "225 0 0"

// Model of dead tank sprite.
// -
// Default: "materials/sprites/death_icon.vmt"
l4d_tank_hp_sprite_dead_model "materials/sprites/death_icon.vmt"

// Scale of dead tank sprite (increases both height and width).
// Some range values maintain the size the same.
// -
// Default: "0.25"
// Minimum: "0.000000"
l4d_tank_hp_sprite_dead_scale "0.25"

// Show a dead sprite when a tank dies.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_tank_hp_sprite_dead_show "1"

// Enable/Disable the plugin.
// 0 = Disable, 1 = Enable.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_tank_hp_sprite_enable "1"

// Minimum distance that a client must be from the tank to see the sprite (both alive and dead sprites).
// -1 = Always visible.
// -
// Default: "-1"
// Minimum: "-1.000000"
// Maximum: "9999.000000"
l4d_tank_hp_sprite_fade_distance "-1"

// Show the sprite to the survivor only if the Tank is on sight.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d_tank_hp_sprite_sight "1"

// Which teams should the sprite be visible.
// 0 = NONE, 1 = SURVIVOR, 2 = INFECTED, 4 = SPECTATOR, 8 = HOLDOUT.
// Add numbers greater than 0 for multiple options.
// Example: "3", enables for SURVIVOR and INFECTED.
// -
// Default: "3"
// Minimum: "0.000000"
// Maximum: "15.000000"
l4d_tank_hp_sprite_team "3"

// Additional Z distance based on the tank position.
// -
// Default: "92"
// Minimum: "0.000000"
l4d_tank_hp_sprite_z_axis "92" 

Other sprite models

Spoiler


Admin Commands
  • sm_print_cvars_l4d_tank_hp_sprite => Print the plugin related cvars and their respective values to the console. (z flag required)

Change Log

Spoiler


Notes
  • I use a TraceRay with MASK_SHOT to determine the sprite visibility on sight. This may not work in all cases (e.g. transparent windows).
  • The width size doesn't change based on tank HP, at least I wasn't able to reduce it.

Thank you!

Post Reply
  • Any feedback, bug reports, fixes, improvements, translations or suggestions for the plugin are welcome.

Installation
  • Put the "l4d_tank_hp_sprite.smx" file (click Get Plugin) in your "\addons\sourcemod\plugins\" folder.

Attached Files
File Type: sp Get Plugin or Get Source (l4d_tank_hp_sprite.sp - 26.5 KB)

Wyświetl pełny artykuł

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...