Results 1 to 10 of 12

Thread: Headicon

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    In maps/mp/gametypes/sd.gsc you can find an example:

    PHP Code:

    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:

    PHP Code:
    Callback_PlayerKilled(eInflictorattackeriDamagesMeansOfDeathsWeaponvDirsHitLocpsOffsetTimedeathAnimDuration)
    {
        
    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(selfattackersWeaponsMeansOfDeath);

        
    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:

    PHP Code:
    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"]); 
    PHP Code:
    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:

    PHP Code:
    precacheStatusIcon("hud_status_dead");
    self.statusicon "hud_status_dead"
    PHP Code:
    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.
    timescale 0.01

  2. The Following User Says Thank You to kung foo man For This Useful Post:

    Rocky (19th November 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •