PDA

View Full Version : Headicon



Rocky
17th November 2013, 15:16
How i can change headicons?
Bigger rank=other icon and when you press tab there show icons.
Regards.

Peterlankton
17th November 2013, 16:08
Making it short.

player.statusicon = rankicon; //this makes the rankicon show up in the scoreboard
player.headicon = rankicon; //changes the headicon

That's how you do it.

Rocky
17th November 2013, 18:36
Thanks for this...Where to put it?

malyczolg
17th November 2013, 18:51
on spawnplayer

Rocky
18th November 2013, 18:41
unitititalied variable 'rankicon' script error.

Ni3ls
18th November 2013, 18:47
omg stop scripting... u need to precache ur headicon rankicon and they need to be real material files

IzNoGoD
18th November 2013, 20:25
unitititalied variable 'rankicon' script error.

Thread closed.

kung foo man
18th November 2013, 20:50
In maps/mp/gametypes/sd.gsc you can find an example:




Callback_StartGameType()
{
level.splitscreen = isSplitScreen();

// if this is a fresh map start, set nationalities based on cvars, otherwise leave game variable nationalities as set in the level script
if(!isdefined(game["gamestarted"]))
{
// defaults if not defined in level script
if(!isdefined(game["allies"]))
game["allies"] = "american";
if(!isdefined(game["axis"]))
game["axis"] = "german";
if(!isdefined(game["attackers"]))
game["attackers"] = "allies";
if(!isdefined(game["defenders"]))
game["defenders"] = "axis";

// server cvar overrides
if(getCvar("scr_allies") != "")
game["allies"] = getCvar("scr_allies");
if(getCvar("scr_axis") != "")
game["axis"] = getCvar("scr_axis");

precacheStatusIcon("hud_status_dead");
precacheStatusIcon("hud_status_connecting");



Setting an icon is:



Callback_PlayerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration)
{
self endon("spawned");
self notify("killed_player");

if(self.sessionteam == "spectator")
return;

// If the player was killed by a head shot, let players know it was a head shot kill
if(sHitLoc == "head" && sMeansOfDeath != "MOD_MELEE")
sMeansOfDeath = "MOD_HEAD_SHOT";

// send out an obituary message to all clients about the kill
obituary(self, attacker, sWeapon, sMeansOfDeath);

self maps\mp\gametypes\_weapons::dropWeapon();
self maps\mp\gametypes\_weapons::dropOffhand();

self.sessionstate = "dead";
self.statusicon = "hud_status_dead";


Headicons, example in maps\mp\gametypes\_friendicons.gsc:



init()
{
// Draws a team icon over teammates
if(getCvar("scr_drawfriend") == "")
setCvar("scr_drawfriend", "1");
level.drawfriend = getCvarInt("scr_drawfriend");

switch(game["allies"])
{
case "american":
game["headicon_allies"] = "headicon_american";
precacheHeadIcon(game["headicon_allies"]);




showFriendIcon()
{
if(level.drawfriend)
{
if(self.pers["team"] == "allies")
{
self.headicon = game["headicon_allies"];
self.headiconteam = "allies";
}
else
{
self.headicon = game["headicon_axis"];
self.headiconteam = "axis";
}
}
}



So, in short:



precacheStatusIcon("hud_status_dead");
self.statusicon = "hud_status_dead";




precacheHeadIcon("headicon_american");
self.headicon = "headicon_american";


I don't know whats to hard on answering a straight question, no need for rage and closing.

thOuMta
18th November 2013, 21:07
Just put this:

On connect


precacheHeadIcon("something");
precacheStatusIcon("something");


On spawn


self.headicon = "something";
self.statusicon = "something";


Its very easy !

IzNoGoD
18th November 2013, 21:40
Just put this:

On connect


precacheHeadIcon("something");
precacheStatusIcon("something");

Its very easy !


Do not put your precaches on connect, put them on gamestart.

Rocky
19th November 2013, 08:22
i did it..not need this other relplyes but thanks :P

thOuMta
19th November 2013, 19:50
@Izno yeah sorry :)