• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[email protected]: Making player spawn with a custom default class.
#1
this is on [email protected] mind you, but I am guessing it works in a similar way, though the CAC DISABLE dvar doesnt do the job.

Basically I want to set a default class so the player spawns, then change its weapons.
  Reply
#2
Why not OnPlayerConnect select the menu for choose class -> default class -> OnPlayerSpawned -> Take all weapons -> Give weapons ??
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
  Reply
#3
I believe the default loadout can be changed in one of the .csv files.
[Image: MaEIQ.png]
[-] The following 1 user says Thank You to Pozzuh for this post:
  • koil
  Reply
#4
i dont want them to have to choose a default class..


and pozz, its not that i dont want them to have a specific default class, its the fact that they just dont spawn until they choose one in the menu.
  Reply
#5
"Basically I want to set a default class so the player spawns, then change its weapons."
so you want to change the classtable.csv? (Well that's the name for it in MW2)
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
  Reply
#6
Just edit the gsc files that are used to open the menus.. Or edit the menus themselves.
[Image: MaEIQ.png]
  Reply
#7
yeah i guess ill try using the script responses from default classes and see how it go's if there is no replys when i get up, thanks pozzuh
  Reply
#8
shouldnt

scriptMenuResponse "specops_mp,0";
scriptMenuResponse "open_gunmenu";


work? it doesnt seem to spawn me.
  Reply
#9
You probably need another scriptMenuResponse after that, to actually spawn you. You can probably find it in _menus.gsc.
[Image: MaEIQ.png]
  Reply
#10
yah i looked for that, there is no spawn onmenuresponses in there.. which is confusing ; /


Code:
init()
{
    game["menu_team"] = "team_marinesopfor";
    game["menu_class_allies"] = "class_marines";
    game["menu_changeclass_allies"] = "changeclass_marines";
    game["menu_initteam_allies"] = "initteam_marines";
    game["menu_class_axis"] = "class_opfor";
    game["menu_changeclass_axis"] = "changeclass_opfor";
    game["menu_initteam_axis"] = "initteam_opfor";
    game["menu_class"] = "class";
    game["menu_changeclass"] = "changeclass";
    game["menu_changeclass_offline"] = "changeclass_offline";

    if ( !level.console )
    {
        game["menu_callvote"] = "callvote";
        game["menu_muteplayer"] = "muteplayer";
        precacheMenu(game["menu_callvote"]);
        precacheMenu(game["menu_muteplayer"]);
        
        // ---- back up one folder to access game_summary.menu ----
        // game summary menu file precache
        game["menu_eog_main"] = "endofgame";
        
        // menu names (do not precache since they are in game_summary_ingame which should be precached
        game["menu_eog_unlock"] = "popup_unlock";
        game["menu_eog_summary"] = "popup_summary";
        game["menu_eog_unlock_page1"] = "popup_unlock_page1";
        game["menu_eog_unlock_page2"] = "popup_unlock_page2";
        
        precacheMenu(game["menu_eog_main"]);
        precacheMenu(game["menu_eog_unlock"]);
        precacheMenu(game["menu_eog_summary"]);
        precacheMenu(game["menu_eog_unlock_page1"]);
        precacheMenu(game["menu_eog_unlock_page2"]);
    
    }
    else
    {
        game["menu_controls"] = "ingame_controls";
        game["menu_options"] = "ingame_options";
        game["menu_leavegame"] = "popup_leavegame";

        if(level.splitscreen)
        {
            game["menu_team"] += "_splitscreen";
            game["menu_class_allies"] += "_splitscreen";
            game["menu_changeclass_allies"] += "_splitscreen";
            game["menu_class_axis"] += "_splitscreen";
            game["menu_changeclass_axis"] += "_splitscreen";
            game["menu_class"] += "_splitscreen";
            game["menu_changeclass"] += "_splitscreen";
            game["menu_controls"] += "_splitscreen";
            game["menu_options"] += "_splitscreen";
            game["menu_leavegame"] += "_splitscreen";
        }

        precacheMenu(game["menu_controls"]);
        precacheMenu(game["menu_options"]);
        precacheMenu(game["menu_leavegame"]);
    }

    precacheMenu("scoreboard");
    precacheMenu(game["menu_team"]);
    precacheMenu(game["menu_class_allies"]);
    precacheMenu(game["menu_changeclass_allies"]);
    precacheMenu(game["menu_initteam_allies"]);
    precacheMenu(game["menu_class_axis"]);
    precacheMenu(game["menu_changeclass_axis"]);
    precacheMenu(game["menu_class"]);
    precacheMenu(game["menu_changeclass"]);
    precacheMenu(game["menu_initteam_axis"]);
    precacheMenu(game["menu_changeclass_offline"]);
    precacheString( &"MP_HOST_ENDED_GAME" );
    precacheString( &"MP_HOST_ENDGAME_RESPONSE" );

    level thread onPlayerConnect();
}

onPlayerConnect()
{
    for(;;)
    {
        level waittill("connecting", player);

        player setClientDvar("ui_3dwaypointtext", "1");
        player.enable3DWaypoints = true;
        player setClientDvar("ui_deathicontext", "1");
        player.enableDeathIcons = true;
        
        player thread onMenuResponse();
    }
}

onMenuResponse()
{
    self endon("disconnect");
    
    for(;;)
    {
        self waittill("menuresponse", menu, response);
        
        //println( self getEntityNumber() + " menuresponse: " + menu + " " + response );
        
        //iprintln("^6", response);
        /*if(response == "open_changeclass_menu" )
        {
            if( getDvarInt( "onlinegame" ) )
                self openMenu( "changeclass" );
            else
                self openMenu( "changeclass_offline" );
        }
        */
            
        if ( response == "back" )
        {
            self closeMenu();
            self closeInGameMenu();

            if ( level.console )
            {
                if( menu == game["menu_changeclass"] || menu == game["menu_changeclass_offline"] || menu == game["menu_team"] || menu == game["menu_controls"] )
                {
//                    assert(self.pers["team"] == "allies" || self.pers["team"] == "axis");
    
                    if( self.pers["team"] == "allies" )
                        self openMenu( game["menu_class_allies"] );
                    if( self.pers["team"] == "axis" )
                        self openMenu( game["menu_class_axis"] );
                }
                else if ( menu == "class" )
                {
                    self [[level.showsquadinfo]]();
                }
            }
            continue;
        }
        
        if(response == "showsquadinfo")
        {
            self [[level.showsquadinfo]]();
        }

        
        if(response == "leavesquad")
        {
            self closeMenu();
            self [[level.leavesquad]]();
        }

        if(response == "joinsquad")
        {
            self [[level.joinsquad]]();
        }
        
        if(response == "createsquad")
        {
            self [[level.createsquad]]();
        }

        if(response == "locksquad")
        {
            self closeMenu();
            self [[level.locksquad]]();
        }
        
        if(response == "unlocksquad")
        {
            self closeMenu();
            self [[level.unlocksquad]]();
        }
        
        if(response == "changeteam")
        {
            self closeMenu();
            self closeInGameMenu();
            self openMenu(game["menu_team"]);
        }
    
        if(response == "changeclass_marines" )
        {
            self closeMenu();
            self closeInGameMenu();
            self openMenu( game["menu_changeclass_allies"] );
            continue;
        }

        if(response == "changeclass_opfor" )
        {
            self closeMenu();
            self closeInGameMenu();
            self openMenu( game["menu_changeclass_axis"] );
            continue;
        }

        if(response == "changeclass_marines_splitscreen" )
            self openMenu( "changeclass_marines_splitscreen" );

        if(response == "changeclass_opfor_splitscreen" )
            self openMenu( "changeclass_opfor_splitscreen" );
                    
        // rank update text options
        if(response == "xpTextToggle")
        {
            self.enableText = !self.enableText;
            if (self.enableText)
                self setClientDvar( "ui_xpText", "1" );
            else
                self setClientDvar( "ui_xpText", "0" );
            continue;
        }

        // 3D Waypoint options
        if(response == "waypointToggle")
        {
            self.enable3DWaypoints = !self.enable3DWaypoints;
            if (self.enable3DWaypoints)
                self setClientDvar( "ui_3dwaypointtext", "1" );
            else
                self setClientDvar( "ui_3dwaypointtext", "0" );
//            self maps\mp\gametypes\_objpoints::updatePlayerObjpoints();
            continue;
        }

        // 3D death icon options
        if(response == "deathIconToggle")
        {
            self.enableDeathIcons = !self.enableDeathIcons;
            if (self.enableDeathIcons)
                self setClientDvar( "ui_deathicontext", "1" );
            else
                self setClientDvar( "ui_deathicontext", "0" );
            self maps\mp\gametypes\_deathicons::updateDeathIconsEnabled();
            continue;
        }
        
        if(response == "endgame")
        {
            // TODO: replace with onSomethingEvent call
            if(level.splitscreen)
            {
                if ( level.console )
                    endparty();
                level.skipVote = true;

                if ( !level.gameEnded )
                {
                    level thread maps\mp\gametypes\_globallogic::forceEnd();
                }
            }
                
            continue;
        }

        if ( response == "endround" && level.console )
        {
            if ( !level.gameEnded )
            {
                level thread maps\mp\gametypes\_globallogic::forceEnd();
            }
            else
            {
                self closeMenu();
                self closeInGameMenu();
                self iprintln( &"MP_HOST_ENDGAME_RESPONSE" );
            }            
            continue;
        }

        if(menu == game["menu_team"])
        {
            switch(response)
            {
            case "allies":
                //self closeMenu();
                //self closeInGameMenu();
                self [[level.leavesquad]]();
                self [[level.allies]]();
                break;

            case "axis":
                //self closeMenu();
                //self closeInGameMenu();
                self [[level.leavesquad]]();
                self [[level.axis]]();
                break;

            case "autoassign":
                //self closeMenu();
                //self closeInGameMenu();
                self [[level.leavesquad]]();
                self [[level.autoassign]]();
                break;

            case "spectator":
                //self closeMenu();
                //self closeInGameMenu();
                self [[level.leavesquad]]();
                self [[level.spectator]]();
                break;
            }
        }    // the only responses remain are change class events
        else if( menu == game["menu_changeclass"] || menu == game["menu_changeclass_offline"] )
        {
            self closeMenu();
            self closeInGameMenu();

            self.selectedClass = true;
            self [[level.class]](response);
        }
        else if ( !level.console )
        {
            if(menu == game["menu_quickcommands"])
                maps\mp\gametypes\_quickmessages::quickcommands(response);
            else if(menu == game["menu_quickstatements"])
                maps\mp\gametypes\_quickmessages::quickstatements(response);
            else if(menu == game["menu_quickresponses"])
                maps\mp\gametypes\_quickmessages::quickresponses(response);
        }
        
        // ======== catching response for create-a-class events ========
        /*
        responseTok = strTok( response, "," );
        
        if( isdefined( responseTok ) && responseTok.size > 1 )
        {
            if( responseTok[0] == "primary" )
            {    
                // primary weapon selection
                assertex( responseTok.size != 2, "Primary weapon selection in create-a-class-ingame is sending bad response:" + response );
                
                stat_offset = cacMenuStatOffset( menu, response );
                self setstat( stat_offset+201, ( int( tableLookup( "mp/statsTable.csv", 4, responseTok[1], 1 ) ) - 3000 ) );
            }
            else if( responseTok[0] == "attachment" )
            {    
                // primary or secondary weapon attachment selection
                assertex( responseTok.size != 3, "Weapon attachment selection in create-a-class-ingame is sending bad response:" + response );
                
                stat_offset = cacMenuStatOffset( menu, response );
                if( responseTok[1] == "primary" )
                    self setstat( stat_offset+202, int( tableLookup( "mp/attachmentTable.csv", 4, responseTok[2], 9 ) ) );
                else if( responseTok[1] == "secondary" )
                    self setstat( stat_offset+204, int( tableLookup( "mp/attachmentTable.csv", 4, responseTok[2], 9 ) ) );
            }
            else if( responseTok[0] == "secondary" )
            {
                // secondary weapon selection
                assertex( responseTok.size != 2, "Secondary weapon selection in create-a-class-ingame is sending bad response:" + response );
                
                stat_offset = cacMenuStatOffset( menu, response );
                self setstat( stat_offset+203, ( int( tableLookup( "mp/statsTable.csv", 4, responseTok[1], 1 ) ) - 3000 ) );
            }
            else if( responseTok[0] == "perk" )
            {
                // all 3 perks selection
                assertex( responseTok.size != 3, "Perks selection in create-a-class-ingame is sending bad response:" + response );
                
                stat_offset = cacMenuStatOffset( menu, response );
                self setstat( stat_offset+200+int(responseTok[1]), int( tableLookup( "mp/statsTable.csv", 4, responseTok[2], 1 ) ) );
            }
            else if( responseTok[0] == "sgrenade" )
            {
                assertex( responseTok.size != 2, "Special grenade selection in create-a-class-ingame is sending bad response:" + response );
                
                stat_offset = cacMenuStatOffset( menu, response );
                self setstat( stat_offset+208, ( int( tableLookup( "mp/statsTable.csv", 4, responseTok[1], 1 ) ) - 3000 ) );
            }
            else if( responseTok[0] == "camo" )
            {
                assertex( responseTok.size != 2, "Primary weapon camo skin selection in create-a-class-ingame is sending bad response:" + response );
                
                stat_offset = cacMenuStatOffset( menu, response );
                self setstat( stat_offset+209, int( tableLookup( "mp/attachmentTable.csv", 4, responseTok[2], 11 ) ) );                    
            }
        }
        */
    }
}

/*
// sort response message from CAC menu
cacMenuStatOffset( menu, response )
{
    stat_offset = -1;
    
    if( menu == "menu_cac_assault" )
        stat_offset = 0;
    else if( menu == "menu_cac_specops" )
        stat_offset = 10;
    else if( menu == "menu_cac_heavygunner" )
        stat_offset = 20;
    else if( menu == "menu_cac_demolitions" )
        stat_offset = 30;
    else if( menu == "menu_cac_sniper" )
        stat_offset = 40;
    
    assertex( stat_offset >= 0, "The response: " + response + " came from non-CAC menu" );    
    
    return stat_offset;
}
*/
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Help Sentry Gun kill = Player kill Snake 8 2,200 11-07-2013, 13:41
Last Post: Nekochan
  Black Ops 2 Custom background? jotape99 10 5,075 10-29-2013, 07:22
Last Post: xInfinity.
  [Release] TeamCounter class 8q4s8 3 2,793 10-15-2013, 18:14
Last Post: [HARD] Tony.
  Player can write Fl0w_.JACKDAN 2 1,068 09-19-2013, 16:36
Last Post: Fl0w_.JACKDAN
  Making an apocalyptic themed Minecraft map AZUMIKKEL 54 9,954 08-31-2013, 02:54
Last Post: AZUMIKKEL
  Custom xanims DidUknowiPwn 8 2,864 08-28-2013, 08:17
Last Post: RaZ
Exclamation [Request] Random Weapon At Spawn Scripts18 3 1,772 07-27-2013, 23:53
Last Post: DidUknowiPwn
  Help Make ac130 shoot custom bullets Ra3shed 0 993 07-23-2013, 13:02
Last Post: Ra3shed
  [Tutorial] Custom gametype HUD iAegle 17 6,733 07-14-2013, 01:16
Last Post: Nekochan
  Help Spawn Message Playing on Respawn? Killjoy 7 1,837 07-11-2013, 14:53
Last Post: Killjoy

Forum Jump:


Users browsing this thread: 1 Guest(s)