• Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse

Plutonium

[Support] Increase each player's score at the start of each new round in zombie mode !Help

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
14 Posts 3 Posters 359 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    wrote on last edited by Mr. Android
    #1

    Someone to help me how to implement that at each start of a new round each player is added 1000 more in addition to their current score, and so at each start of a new round

    1 Reply Last reply
    0
  • Xerxesundefined Online
    Xerxesundefined Online
    Xerxes Plutonium Staff
    wrote on last edited by
    #2

    self.score+=1000;

    Kalitosundefined 1 Reply Last reply
    0
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    replied to Xerxes on last edited by
    #3

    Xerxes I don't mean how to increase, I mean the end of round event

    Xerxesundefined 1 Reply Last reply
    0
  • Xerxesundefined Online
    Xerxesundefined Online
    Xerxes Plutonium Staff
    replied to Kalitos on last edited by
    #4

    Kalitos You will want to wait for end_of_round.

    level waittill( "end_of_round" );

    Kalitosundefined 1 Reply Last reply
    0
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    replied to Xerxes on last edited by Kalitos
    #5

    Xerxes At the end of the round each player is automatically assigned an additional 1000 points
    I tried this:

    
    init ()
    {
    level.clientid = 0;
    level.perk_purchase_limit = 9;
    level.infoHud = level createServerText ("default", "^ 2TeamSpeak 3: ^ 774.91.112.216", 1.5, "TOPLEFT", "TOPLEFT", 0, 0, (1, 1, 1), undefined, 1, undefined) ;
    level thread onplayerconnect ();
    thread addScore ();
    drawZombiesCounter ();
    thread gscRestart ();
        thread setPlayersToSpectator ();
        for (;;)
        {
            level waittill ("connected", player);
            if (level.scr_zm_ui_gametype_group == "zencounter" || level.scr_zm_ui_gametype_group == "zsurvival")
            {
           player thread give_team_characters (); // the real cause of the invisible player glitch these 2 functions aren't always called on map_restart so call them here
           }
           else
          {
          player thread give_personality_characters (); // this has to commented out when loading nuketown
    // unfortunately nuketown is the only map without this function therefore it can't find it and the server will throw an error
    // the only way to fix this would be to copy both give_team_characters () and give_personality_characters () into this file and account for all maps
    // this would make the fix more cumbersome which is why I haven't done it
          }
        }
    }
    addScore ()
    {
    level endon ("end_of_round");
            // self endon ("disconnect");
    
    for (;;)
    {
    self.score + = 1000;
    }
    }
    
    

    But it does not work, it is no more or load

    1 Reply Last reply
    0
  • Xerxesundefined Online
    Xerxesundefined Online
    Xerxes Plutonium Staff
    wrote on last edited by
    #6

    Well yeah obviously it won't work like that.
    I don't spoonfeed but gave you all the infos you need now you need to write the stuff around it.

    Kalitosundefined 1 Reply Last reply
    0
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    replied to Xerxes on last edited by Kalitos
    #7

    Xerxes I've been trying and can't figure out the syntax or code structure for this to work.
    I'll just say "F"

    init()
    {
    level thread addScore();
    }
    addScore()
    {
    	level waittill ("end_of_round" );
            //self endon( "disconnect" );
    	
    	for(;;)
    	{
    		self.score+=1000;
    	}
    	level notify("end_of_round" );
    }
    

    With this, I kill the last zombie and the round stays there, it never ends.

    H3X1Cundefined 1 Reply Last reply
    0
  • H3X1Cundefined Offline
    H3X1Cundefined Offline
    H3X1C Plutonium Staff
    replied to Kalitos on last edited by
    #8

    Kalitos the for loop?

    Kalitosundefined 1 Reply Last reply
    0
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    replied to H3X1C on last edited by
    #9

    H3X1C i don't understand

    H3X1Cundefined 1 Reply Last reply
    0
  • H3X1Cundefined Offline
    H3X1Cundefined Offline
    H3X1C Plutonium Staff
    replied to Kalitos on last edited by
    #10

    Kalitos Your codeblock basicially says add 1000 score over and over as fast as possible forever... How could it ever reach the statement below the forloop?

    Kalitosundefined 1 Reply Last reply
    0
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    replied to H3X1C on last edited by Kalitos
    #11

    H3X1C

    I fixed it

    init()
    {
    	level.clientid = 0;
            level thread onplayerconnect();
    }
    onplayerconnect()
    {
    	for ( ;; )
    	{
    		level waittill( "connecting", player );
    		player.clientid = level.clientid;
    		player thread onplayerspawned();
    		level.clientid++;
    	}
    }
    onplayerspawned()
    {
    	level endon( "game_ended" );
            self endon( "disconnect" );
    	
    	for(;;)
    	{
    		self welcome();
    		self addScore();
    	}
    }
    addScore()
    {
    	while (1) 
    	{
    	level waittill("between_round_over");
    	//self iprintln("More Score");
    	self.score+=1500;
    	}
    }
    

    I adapted it to the code that I already had implemented, the addScore function is what allows me to increase each round.

    1 Reply Last reply
    0
  • H3X1Cundefined Offline
    H3X1Cundefined Offline
    H3X1C Plutonium Staff
    wrote on last edited by H3X1C
    #12

    I feel your use of loops is unnecessary, wasteful and most definitely not performant. Why not just append x score at the end of the round?

    for(;;)
    {
    	self welcome();
    	self addScore();
    }
    

    This is the part that confuses me. Why loop this? Just call it once on spawn.

    This will execute every time the round ends which is fine:

    while (1) 
    {
    level waittill("between_round_over");
    //self iprintln("More Score");
    self.score+=1500;
    }
    
    Kalitosundefined 1 Reply Last reply
    0
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    replied to H3X1C on last edited by Kalitos
    #13

    H3X1C As the saying goes, if it works don't touch it 😊

    Xerxesundefined 1 Reply Last reply
    0
  • Xerxesundefined Online
    Xerxesundefined Online
    Xerxes Plutonium Staff
    replied to Kalitos on last edited by
    #14

    That doesn't apply to writing code, even if you write proper code you probably revisit at some point to add additional functionality. But yeah do a few more of those mods and your server will be laggy af.

    1 Reply Last reply
    0

  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Login

  • Don't have an account? Register

  • Login or register to search.