1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Minor Mod Question on how to limit classes

Discussion in 'Modding Help' started by TheCheeze, Feb 4, 2014.

  1. TheCheeze

    TheCheeze Haxor

    Messages:
    4
    Hey everyone,

    Im new to modding and basically just decided this evening to give it a go. Ive managed to figure out how to modify maps and stuff and some of the minor variables in the rules cfg files but Im curious as to how I would go about creating a rule or limiting the class you can spawn as.

    My mod bases on the CTF rule set. I want to disallow people from choosing the builder after the warm up time runs out. Ideally I would want all players to respawn as a knight or archer (with the ability to switch between them) after the warm up time runs out.

    Is this possible? and if so, where would I look? What files or variables would I need to change?

    Thanks!
     
  2. Aphelion

    Aphelion Wunderkind Donator
    1. Aphelion's Roleplay

    Messages:
    180
    StandardRespawnCommand.as
    ClassSelectMenu.as

    Use CRules -> isWarmup()
     
  3. TheCheeze

    TheCheeze Haxor

    Messages:
    4
    Hmmm...

    My first idea was to try something like:


    if(CRules->isWarmUp()){
    addPlayerClass( this, "Builder", "$builder_class_icon$", "builder", "Build ALL the towers." );
    }

    in the InitClasses() method. But that didnt work at all. Maybe I need a bit more clarification. :P. Do I need to include these files in the CTF files or visa versa?
     
  4. Aphelion

    Aphelion Wunderkind Donator
    1. Aphelion's Roleplay

    Messages:
    180
    Here it is done for you:

    In ClassSelectMenu.as replace the method addClassesMenu with this:
    PHP:
    void addClassesToMenu(CBlobthisCGridMenumenuu16 callerID)
    {
        
    PlayerClass[]@ classes;

        if (
    this.get"playerclasses", @classes ))
        {
            for (
    uint i classes.lengthi++)
            {
                if(!
    getRules().isWarmup() && == 0)
                    continue;
          
                
    PlayerClass @pclass classes[i];
              
                
    CBitStream params;
                
    write_classchange(paramscallerIDpclass.configFilename);
              
                
    CGridButtonbutton menu.AddButtonpclass.iconNamepclass.nameSpawnCmd::changeClassVec2f(CLASS_BUTTON_SIZE,CLASS_BUTTON_SIZE), params );
                
    //button.SetHoverText( pclass.description + "\n" );
            
    }
        }
    }
    Skips the first class (builder, index 0) if not in warmup.
     
    an_obamanation likes this.
  5. Klokinator

    Klokinator Such Beta
    1. Aphelion's Roleplay

    Messages:
    1,443
    So basically, you build, and better hope the defenses hold for the rest of the game? Wow that'd lead to some fast games!

    I hope you also increase the build time to like 300 seconds.
     
  6. TheCheeze

    TheCheeze Haxor

    Messages:
    4
    Thanks @Aphelion3371! Ill give that a try later on tonight. And yes! Fast games is the idea. We play KAG a lot when we have small private LANs and sometimes there is only 6-8 of us playing, TTH and other modes aren't as fun and a lot of the guys are inexperienced. I plan on upping the build time to like 600 seconds actually. The idea is build the best defense you can with traps and such, and then hope it holds while you siege it. That way the guys who don't really play have a better chance of learning the build mechanics and then focusing on the attack mechanics....

    Ill have to see how it goes at the next LAN and tweak it from there :)
     
  7. Aphelion

    Aphelion Wunderkind Donator
    1. Aphelion's Roleplay

    Messages:
    180
    Only problem: You can stay a builder when the warmup ends.
     
  8. TheCheeze

    TheCheeze Haxor

    Messages:
    4
    Yeah its too bad I cant implement a force kill on all when the warm up round ends. Well just have to go on good sportsmanship and faith :D
     
  9. Aphelion

    Aphelion Wunderkind Donator
    1. Aphelion's Roleplay

    Messages:
    180
    You can actually.