Modme Forums

Mario Kart race Help

Game Modding | Call of Duty: Black Ops 3 | Scripting


Thread By: Symbo
I have a map with drivable vehicles and, since i am not a good scripter, I decide to have many trigger multiple around the map for each lap and check if the player trigger them enough time to know when end the game.
But with this system a late players can finish the last lap even if he/she has 1 or more lap to do.
ZoekMeMarr helped me with a script recently that could solved that issue and can display the winner's name on screen. But this script doesn't work at all and I need help to understand why?

function laps()
	level flag::wait_till( "all_players_connected" );

	level.laps_tunnel = GetEnt("laps_tunnel", "targetname");
	level.laps_start = GetEnt("laps_start", "targetname");
	level.inter1 = GetEnt("inter1", "targetname");
	level.inter2 = GetEnt("inter2", "targetname");
	level.inter3 = GetEnt("inter3", "targetname");
	level.inter4 = GetEnt("inter4", "targetname");
	level.inter5 = GetEnt("inter5", "targetname");
	level.mario_model = GetEnt("mario_model", "targetname");

	level.laps_to_ride = 5;//number of laps to ride!

    players = GetPlayers();
	foreach( player in players )  
		thread player_flags(player);

	thread better_print(level.laps_to_ride+" laps to WIN", 0, 0, 3, 3 );

function player_flags(player)
   player endon("disconnect");
   player endon("game_end");
   player.laps = 0;
		level.laps_start waittill("trigger", player);

		if(player.laps == level.laps_to_ride && player IsTouching(level.laps_start))
			player thread winner();
			wait (0.05);
			player thread ending();
        while(player.laps != level.laps_to_ride)
        	level.inter1 waittill("trigger", player);
			level.inter2 waittill("trigger", player);
			level.inter3 waittill("trigger", player);
			level.laps_tunnel waittill("trigger", player);
			level.inter4 waittill("trigger", player);
			level.inter5 waittill("trigger", player);
			level.laps_start waittill("trigger", player);

			if(player.laps == level.laps_to_ride){
				player playsound("final_lap");
				player SetFlashBanged( true, 1 );
				level util::set_lighting_state( 1 );
				level.mario_model MoveZ(4250,2);
				player IPrintLnBold("Final Lap");
				player IPrintLnBold("^3Lap "+player.laps+1 );

function winner()
	iprintlnbold( "^3Winner winner, chicken dinner\n ^7Winner is :[^1" + + "^7]" );