Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Yoke

Pages: 1 ... 3 4 5 6 7 [8] 9 10 11 12 13 ... 15
106
Modification Help / Re: Custom SpeedKart Gamemode (Code Help!)
« on: September 29, 2014, 12:34:59 PM »
Quote
if($pref::Server::SpeedKart::RoundLimit $= "")
{
   $pref::Server::SpeedKart::RoundLimit = 8;
}

$SK::Initialized = false;


function SK_ResetSelf DeleteGambling()
{
   //scramble the Self Delete prevention timer, so people can't game it with client scripts
   $SK::Self DeleteBufferTime = 6000 + getRandom() * 4000;
   //clear Self Delete gambling winner
   $SK::LastSelf Deleter = 0;

   if(isEventPending($SK::Self DeleteGamblingEvent))
      cancel($SK::Self DeleteGamblingEvent);
   $SK::Self DeleteGamblingEvent = 0;
}

function SK_BuildTrackList()
{
   //
   %pattern = "Add-Ons/SpeedKart_*/save.bls";
   
   $SK::numTracks = 0;
   
   %file = findFirstFile(%pattern);
   while(%file !$= "")
   {
      $SK::Track[$SK::numTracks] = %file;
      $SK::numTracks++;

      %file = findNextFile(%pattern);
   }
}

function SK_DumpTrackList()
{
   echo("");
   if($SK::numTracks == 1)
      echo("1 track");
   else
      echo($SK::numTracks @ " tracks");
   for(%i = 0; %i < $SK::numTracks; %i++)
   {
      %displayName = $SK::Track[%i];
      %displayName = strReplace(%displayName, "Add-Ons/SpeedKart_", "");
      %displayName = strReplace(%displayName, "/save.bls", "");
      %displayName = strReplace(%displayName, "_", " ");

      if(%i == $SK::CurrentTrack)
         echo(" >" @ %displayName);
      else
         echo("  " @ %displayName);
   }
   echo("");
}

function SK_NextTrack()
{
   $SK::CurrentTrack = mFloor($SK::CurrentTrack);
   $SK::CurrentTrack++;
   $SK::CurrentTrack = $SK::CurrentTrack % $SK::numTracks;

   $SK::ResetCount = 0;

   SK_LoadTrack_Phase1($SK::Track[$SK::CurrentTrack]);
}

function SK_LoadTrack_Phase1(%filename)
{
   //suspend minigame resets
   $SK::MapChange = 1;

   //put everyone in observer mode
   %mg = $DefaultMiniGame;
   if(!isObject(%mg))
   {
      error("ERROR: SK_LoadTrack( " @ %filename  @ " ) - default minigame does not exist");
      return;
   }
   for(%i = 0; %i < %mg.numMembers; %i++)
   {
      %client = %mg.member[%i];
      %player = %client.player;
      if(isObject(%player))
         %player.delete();

      %camera = %client.camera;
      %camera.setFlyMode();
      %camera.mode = "Observer";
      %client.setControlObject(%camera);
   }
   
   //clear all bricks
   // note: this function is deferred, so we'll have to set a callback to be triggered when it's done
   BrickGroup_888888.chaindelete callback = "SK_LoadTrack_Phase2(\"" @ %filename @ "\");";
   BrickGroup_888888.chaindelete all();
}

function SK_LoadTrack_Phase2(%filename)
{
   echo("Loading speedkart track " @ %filename);

   %displayName = %filename;
   %displayName = strReplace(%displayName, "Add-Ons/SpeedKart_", "");
   %displayName = strReplace(%displayName, "/save.bls", "");
   %displayName = strReplace(%displayName, "_", " ");
   
   %loadMsg = "\c5Now loading \c6" @ %displayName;

   //read and display credits file, if it exists
   // limited to one line
   %creditsFilename = filePath(%fileName) @ "/credits.txt";
   if(isFile(%creditsFilename))
   {
      %file = new FileObject();
      %file.openforRead(%creditsFilename);

      %line = %file.readLine();
      %line = stripMLControlChars(%line);
      %loadMsg = %loadMsg @ "\c5, created by \c3" @ %line;

      %file.close();
      %file.delete();
   }

   messageAll('', %loadMsg);

   //load environment if it exists
   %envFile = filePath(%fileName) @ "/environment.txt";
   if(isFile(%envFile))
   { 
      //echo("parsing env file " @ %envFile);
      //usage: GameModeGuiServer::ParseGameModeFile(%filename, %append);
      //if %append == 0, all minigame variables will be cleared
      %res = GameModeGuiServer::ParseGameModeFile(%envFile, 1);

      EnvGuiServer::getIdxFromFilenames();
      EnvGuiServer::SetSimpleMode();

      if(!$EnvGuiServer::SimpleMode)     
      {
         EnvGuiServer::fillAdvancedVarsFromSimple();
         EnvGuiServer::SetAdvancedMode();
      }
   }
   
   //load save file
   schedule(10, 0, serverDirectSaveFileLoad, %fileName, 3, "", 2, 1);
}


//some horrible /commands to change tracks and such
function serverCmdTrackList(%client)
{
   for(%i = 0; %i < $SK::numTracks; %i++)
   {
      %displayName = $SK::Track[%i];
      %displayName = strReplace(%displayName, "Add-Ons/SpeedKart_", "");
      %displayName = strReplace(%displayName, "/save.bls", "");
      %displayName = strReplace(%displayName, "_", " ");

      if(%i == $SK::CurrentTrack)
         messageClient(%client, '', " >" @ %i @ ". \c6" @ %displayName);
      else
         messageClient(%client, '', "  " @ %i @ ". \c6" @ %displayName);
   }
}
function serverCmdSetTrack(%client, %i)
{
   if(!%client.isAdmin)
      return;

   if(mFloor(%i) !$= %i)
   {
      messageClient(%client, '', "Usage: /setTrack <number>");
      return;
   }

   if(%i < 0 || %i > $SK::numTracks)
   {
      messageClient(%client, '', "serverCmdSetTrack() - out of range index");
      return;
   }

   messageAll( 'MsgAdminForce', '\c3%1\c2 changed the track', %client.getPlayerName());
   
   $SK::CurrentTrack = %i - 1;
   SK_NextTrack();
}

function serverCmdNextTrack(%client, %i)
{
   if(!%client.isAdmin)
      return;

   messageAll( 'MsgAdminForce', '\c3%1\c2 changed the track', %client.getPlayerName());
   
   SK_NextTrack();
}

package GameModeSpeedKartPackage
{
   //this is called when save loading finishes
   function GameModeInitialResetCheck()
   {
      Parent::GameModeInitialResetCheck();

      //if there is no track list, attempt to create it
      if($SK::numTracks == 0)
         SK_BuildTrackList();
     
      //if tracklist is still empty, there are no tracks
      if($SK::numTracks == 0)
      {
         messageAll('', "\c5No SpeedKart tracks available!");
         return;
      }

      if($SK::Initialized)
         return;

      $SK::Initialized = true;
      $SK::CurrentTrack = -1;
           
      SK_NextTrack();
   }

   //when we're done loading a new track, reset the minigame
   function ServerLoadSaveFile_End()
   {
      Parent::ServerLoadSaveFile_End();

      //new track has loaded, reset minigame
      if($DefaultMiniGame.numMembers > 0) //don't bother if no one is here (this also prevents starting at round 2 on server creation)
         $DefaultMiniGame.scheduleReset(); //don't do it instantly, to give people a little bit of time to ghost

      SK_ResetSelf DeleteGambling();
   }
   
   //vehicles should explode in water
   function VehicleData::onEnterLiquid(%data, %obj, %coverage, %type)
   {
      Parent::onEnterLiquid(%data, %obj, %coverage, %type);

      %obj.damage(%obj, %obj.getPosition(), 10000, $DamageType::Lava);
      %obj.finalExplosion();
   }

   //players should die in water
   function Armor::onEnterLiquid(%data, %obj, %coverage, %type)
   {
      Parent::onEnterLiquid(%data, %obj, %coverage, %type);
      %obj.hasShotOnce = true;
      %obj.invulnerable = false;
      %obj.damage(%obj, %obj.getPosition(), 10000, $DamageType::Lava);
   }

   //when vehicle spawns, it cannot move (event must enable it)
   //this solves the driving through the garage problem
   function WheeledVehicleData::onAdd(%data,%obj)
   {
      Parent::onAdd(%data, %obj);

      for(%i = 0; %i < %data.numWheels; %i++)
         %obj.setWheelPowered(%i, %on);
   }

   //also you cannot click-push a vehicle while it is in non-moving mode
   function vehicle::OnActivate(%vehicle, %activatingObj, %activatingClient, %pos, %vec)
   {
      //just check a wheel
      if(!%vehicle.getWheelPowered(2))
         return;

      Parent::OnActivate(%vehicle, %activatingObj, %activatingClient, %pos, %vec);
   }

   function SK_Self DeleteGamblingCheck()
   {
      //check for duplicate schedules
      if(isEventPending($SK::Self DeleteGambleEvent)) 
         cancel($SK::Self DeleteGambleEvent);
      $SK::Self DeleteGambleEvent = 0;

      if(!isObject($SK::LastSelf Deleter))
         return;

      if($SK::LastSelf Deleter.getClassName() !$= "GameConnection")
         return;
     
      %player = $SK::LastSelf Deleter.player;
      if(!isObject(%player))
         return;

      //last Self Deleter is valid, give them a win emote
      %player.emote(winStarProjectile, 1);
      %player.playAudio(0, rewardSound);
   }

   //if you kill yourself in a vehicle, kill the vehicle
   function serverCmdSelf Delete(%client)
   {
      %player = %client.player;
      if(!isObject(%player))
         return;
     
      %vehicle = %player.getObjectMount();

      //kill the vehicle we're in
      if(isObject(%vehicle))
      {
         //if wheels are not powered, we're probably at the start of the race, so don't allow Self Delete in a vehicle
         %elapsedTime = getSimTime() - %vehicle.poweredTime;
         %doBuzzer = false;
         if(%vehicle.getClassName() $= "AIPlayer")
            %doBuzzer = true;
         else if(!%vehicle.getWheelPowered(2) || %elapsedTime <  $SK::Self DeleteBufferTime )
            %doBuzzer = true;

         if(%doBuzzer)
         {
            //if it isn't running already, start the Self Delete gambling check
            //we don't have a "start race" function, so we're shoe-horning it in here
            if(!isEventPending($SK::Self DeleteGamblingEvent) && (%vehicle.poweredTime > 0))
            { 
               //10 seconds is maximum time of Self Delete prevention
               if(%elapsedTime < $SK::Self DeleteBufferTime)
               {
                  $SK::Self DeleteGamblingEvent = schedule(11000 - %elapsedTime, 0, SK_Self DeleteGamblingCheck);
               }
            }
           
            //remember last person to hit the Self Delete buzzer
            $SK::LastSelf Deleter = %client;

            //spam protect the buzzer enough to prevent serious problems
            if(getSimTime() - %player.lastSelf DeleteBuzzerTime > 200)
            {
               %player.lastSelf DeleteBuzzerTime = getSimTime();
               %player.playAudio(0, "Beep_No_Sound");
            }
            return;
         }

         //special reward for Self Delete gambling winner
         if($SK::LastSelf Deleter == %client && !isEventPending($SK::Self DeleteGamblingEvent))
         {
            %player.playAudio(0, SK_gwScream);
            $SK::LastSelf Deleter = 0;
            return;
         }

         //if vehicle is on fire, do final explosion
         //otherwise kill vehicle
         if(%vehicle.getDamagePercent() >= 1.0)
            %vehicle.finalExplosion();
         else
         {
            %vehicle.damage(%vehicle, %vehicle.getPosition(), 10000, $DamageType::Default);       
            %player.burnPlayer(5);
         }
      }
      else
      {         
         //no vehicle, normal Self Delete

         //special reward for Self Delete gambling winner
         if($SK::LastSelf Deleter == %client && !isEventPending($SK::Self DeleteGamblingEvent))
         {
            %player.playAudio(0, SK_gwScream);
            $SK::LastSelf Deleter = 0;
            return;
         }

         Parent::ServerCmdSelf Delete(%client);
         return;
      }

   }
     
   //resume death animation after corpse is booted out of burning vehicle
   function Armor::onUnmount(%data, %obj, %slot)
   {
      Parent::onUnmount(%data, %obj, %slot);

      if(%obj.getDamagePercent() >= 1)
      {
         %obj.playthread(3, "death1");
      }
   }
   
   //if smoeone gets back into a garage after the game starts, we don't want them to be able to press a button and respawn someone's cart from under them
   function fxDTSBrick::setVehicle(%obj, %data, %client)
   {
      if(isObject(%obj.vehicle))
      {
         //vehicle exists, if it is far from spawn, don't do this event
         %vec = vectorSub(%obj.vehicle.getPosition(), %obj.getPosition());
         %dist = vectorLen(%vec);
         if(%dist > 10)
         {
            return;
         }
      }

      Parent::setVehicle(%obj, %data, %client);
   }
   
   //total hack: when a vehicle is turned on record the start-of-race time
   // other options would be to make another event or add in a time offset
   function fxDTSBrick::setVehiclePowered(%obj, %on, %client)
   {
      Parent::setVehiclePowered(%obj, %on, %client);

      if(%on)
      {
         if(isObject($DefaultMiniGame))
         {
            if($DefaultMiniGame.raceStartTime <= 0)
               $DefaultMiniGame.raceStartTime = getSimTime();
         }
      }
   }

   function MiniGameSO::Reset(%obj, %client)
   {
      //make sure this value is an number
      $pref::Server::SpeedKart::RoundLimit = mFloor($pref::Server::SpeedKart::RoundLimit);

      //handle our race time hack
      %obj.raceStartTime = 0;

      //count number of minigame resets, when we reach the limit, go to next track
      if(%obj.numMembers >= 0)
      {
         $SK::ResetCount++;
      }

      if($SK::ResetCount > $pref::Server::SpeedKart::RoundLimit)
      {
         $SK::ResetCount = 0;
         SK_NextTrack();
      }
      else
      {
         messageAll('', "\c5Beginning round " @ $SK::ResetCount @ " of " @ $pref::Server::SpeedKart::RoundLimit);
         Parent::Reset(%obj, %client);
      }

      SK_ResetSelf DeleteGambling();
   } 
};

if($GameModeArg $= "Add-Ons/GameMode_SpeedKart/gamemode.txt")
   activatePackage(GameModeSpeedKartPackage);

// more time to fly out of a burning car
$CorpseTimeoutValue = 7000;

//special event to explode vehicles that are left in the garage
registerOutputEvent("fxDTSBrick", "explodeNearVehicle", "");
function fxDTSBrick::explodeNearVehicle(%obj)
{
   %vehicle = %obj.vehicle;
   if(!isObject(%vehicle))
      return;

   %delta = vectorSub(%vehicle.getPosition(), %obj.getPosition());
   //echo("len = " @ vectorLen(%delta));
   if(vectorLen(%delta) < 5) //7.5)
      %vehicle.finalExplosion(); //damage(%vehicle, %vehicle.getPosition(), 10000, $DamageType::Default);
}


//special event to win the race, displays race time
registerOutputEvent("GameConnection", "winRace", "");
function GameConnection::winRace(%client)
{
   %mg = %client.miniGame;

   if(!isObject(%mg))
      %mg = $DefaultMiniGame;

   if(!isObject(%mg))
      return;

   //if race start time is not available, use time since last reset
   %startTime = %mg.raceStartTime;
   if(%startTime <= 0)
      %startTime = %mg.lastResetTime;

   %elapsedTime = getSimTime() - %startTime;
   %elapsedTime = mFloor(%elapsedTime / 1000);
   
   %mg.chatMessageAll(0,  "\c3" @ %client.getPlayerName() @ " \c5WON THE RACE IN \c6" @ getTimeString(%elapsedTime) @ "\c3!");
   %mg.scheduleReset(7000);

   //do achievements
   if(%client.isLocal())
   {
      //if this is a local client, give stuffty achievement
      steamGetAchievement("ACH_SPEEDKART_PROBABLY_CHEATE D", "speedKartAchievement");     
   }
   else
   {
      //remote client, send them an achievement message
      if(clientGroup.getCount() > 1)
      {
         commandToClient(%client, 'GetAchievement', "ACH_SPEEDKART_WIN");
      }
   }



//highly important sound effect
datablock AudioProfile(SK_gwScream)
{
   filename    = "./gw_scream.wav";
   description = AudioDefault3d;
   preload = true;
};


//load the actual karts
// these are a feature locked version of the karts from a while ago
exec("./karts/speedKart.cs");


This is the original code.

107
Modification Help / Re: Custom SpeedKart Gamemode (Code Help!)
« on: September 29, 2014, 12:33:09 PM »
That is a solution because some idiot has forgeted over the code by altering %pattern and trying to manually define all the speedkart tracks within a function that automagically does it all for you. So whoever messed with your Speedkart files there really forgeted up. Solution: Re-download the gamemode and then don't forget with the files.
No one screwed up the file, I was attempting to make a custom SpeedKart gamemode. I have all the files necessary. I'm not sure how to put it together, that's all. Yes, I do have the original file with the original code. But the purpose of this topic was to see if anyone could help me fix the code wherever the errors may lie. I'm new to coding, yet you cannot learn if you do not try. But I do understand what you're trying to point out.

108
Modification Help / Re: Custom SpeedKart Gamemode (Code Help!)
« on: September 29, 2014, 12:26:34 PM »
Solution: Re-download the SpeedKart Gamemode then don't forget with the code.
That's not a solution. But I do appreciate your 0% effort.

109
Add-Ons / Re: Gold Wrench V.1 (UPDATED)
« on: September 29, 2014, 09:18:53 AM »
So what does it do?
Is it just a cool looking melee or does it has an effect

If you want a sparkle, I know how to make it sparkle.
Change the file location for the ring to Blockland/base/lighting/flare
That was a major help, thank you.
Had to cut off the Blockland part.

110
Add-Ons / Re: Gold Wrench V.2 (Updated)
« on: September 29, 2014, 08:25:23 AM »
Fixed a few things. "Overload" renamed to "Sparkle".
GoldWrench now has a more realistic sparkle effect.
There ARE custom sounds with both weapons, but they are not working. Not sure how to fix that.

111
Modification Help / Custom SpeedKart Gamemode (Code Help!)
« on: September 29, 2014, 05:21:24 AM »
Hey!

Just make a quick custom SpeedKart gamemode. Everything is in place, Add-On's ready for start up. I start the gamemode, I'm floating on water. This is the code for the gamemode, I would GREATLY appreciate it if anyone can help me solve this issue. I have every single track that has been released on the forums. I need the tracks to rotate like normal SpeedKart, basically just load because nothing is loading.
Here is the code..
Quote
if($pref::Server::SpeedKart::RoundLimit $= "")
{
   $pref::Server::SpeedKart::RoundLimit = 8;
}

$SK::Initialized = false;

function SK_BuildTrackList()
{
   //
   %pattern = "Add-Ons/SpeedKart_Glacial_Run/save.bls";
   %pattern = "Add-Ons/SpeedKart_Lighthouse/save.bls";
   %pattern = "Add-Ons/SpeedKart_Red_Raceway/save.bls";
   %pattern = "Add-Ons/SpeedKart_Sand_Castle/save.bls";
   %pattern = "Add-Ons/SpeedKart_North_Pole/save.bls";
   %pattern = "Add-Ons/SpeedKart_GreenHills/save.bls";
   %pattern = "Add-Ons/SpeedKart_Descent/save.bls";
   %pattern = "Add-Ons/SpeedKart_Harbor/save.bls";
   %pattern = "Add-Ons/SpeedKart_PacTrax_Curvature/save.bls";
   %pattern = "Add-Ons/SpeedKart_Hydro_Plant/save.bls";
   %pattern = "Add-Ons/SpeedKart_Sierra_Island/save.bls";
   %pattern = "Add-Ons/SpeedKart_Volcano/save.bls";
  
   $SK::numTracks = 12;
  
   %file = findFirstFile(%pattern);
   while(%file !$= "Add-Ons/SpeedKart_Glacial_Run/save.bls")
   {
      $SK::Track[$SK::numTracks] = %file;
      $SK::numTracks++;

      %file = findNextFile(%pattern);
   }
}

function SK_DumpTrackList()
{
   echo("");
   if($SK::numTracks == 1)
      echo("1 track");
   else
      echo($SK::numTracks @ " tracks");
   for(%i = 0; %i < $SK::numTracks; %i++)
   {
      %displayName = $SK::Track[%i];
      %displayName = strReplace(%displayName, "Add-Ons/SpeedKart_", "");
      %displayName = strReplace(%displayName, "/save.bls", "");
      %displayName = strReplace(%displayName, "_", " ");

      if(%i == $SK::CurrentTrack)
         echo(" >" @ %displayName);
      else
         echo("  " @ %displayName);
   }
   echo("");
}

function SK_NextTrack()
{
   $SK::CurrentTrack = mFloor($SK::CurrentTrack);
   $SK::CurrentTrack++;
   $SK::CurrentTrack = $SK::CurrentTrack % $SK::numTracks;

   $SK::ResetCount = 0;

   SK_LoadTrack_Phase1($SK::Track[$SK::CurrentTrack]);
}

function SK_LoadTrack_Phase1(%filename)
{
   //suspend minigame resets
   $SK::MapChange = 1;

   //put everyone in observer mode
   %mg = $DefaultMiniGame;
   if(!isObject(%mg))
   {
      error("ERROR: SK_LoadTrack( " @ %filename  @ " ) - default minigame does not exist");
      return;
   }
   for(%i = 0; %i < %mg.numMembers; %i++)
   {
      %client = %mg.member[%i];
      %player = %client.player;
      if(isObject(%player))
         %player.delete();

      %camera = %client.camera;
      %camera.setFlyMode();
      %camera.mode = "Observer";
      %client.setControlObject(%camera);
   }
  
   //clear all bricks
   // note: this function is deferred, so we'll have to set a callback to be triggered when it's done
   BrickGroup_888888.chaindelete callback = "SK_LoadTrack_Phase2(\"" @ %filename @ "\");";
   BrickGroup_888888.chaindelete all();
}

function SK_LoadTrack_Phase2(%filename)
{
   echo("Loading speedkart track " @ %filename);

   %displayName = %filename;
   %displayName = strReplace(%displayName, "Add-Ons/SpeedKart_", "");
   %displayName = strReplace(%displayName, "/save.bls", "");
   %displayName = strReplace(%displayName, "_", " ");
  
   %loadMsg = "\c5Now loading \c6" @ %displayName;

   //read and display credits file, if it exists
   // limited to one line
   %creditsFilename = filePath(%fileName) @ "/credits.txt";
   if(isFile(%creditsFilename))
   {
      %file = new FileObject();
      %file.openforRead(%creditsFilename);

      %line = %file.readLine();
      %line = stripMLControlChars(%line);
      %loadMsg = %loadMsg @ "\c5, created by \c3" @ %line;

      %file.close();
      %file.delete();
   }

   messageAll('', %loadMsg);

   //load environment if it exists
   %envFile = filePath(%fileName) @ "/environment.txt";
   if(isFile(%envFile))
   {  
      //echo("parsing env file " @ %envFile);
      //usage: GameModeGuiServer::ParseGameModeFile(%filename, %append);
      //if %append == 0, all minigame variables will be cleared
      %res = GameModeGuiServer::ParseGameModeFile(%envFile, 1);

      EnvGuiServer::getIdxFromFilenames();
      EnvGuiServer::SetSimpleMode();

      if(!$EnvGuiServer::SimpleMode)    
      {
         EnvGuiServer::fillAdvancedVarsFromSimple();
         EnvGuiServer::SetAdvancedMode();
      }
   }
  
   //load save file
   schedule(10, 0, serverDirectSaveFileLoad, %fileName, 3, "", 2, 1);
}


//some horrible /commands to change tracks and such
function serverCmdTrackList(%client)
{
   for(%i = 0; %i < $SK::numTracks; %i++)
   {
      %displayName = $SK::Track[%i];
      %displayName = strReplace(%displayName, "Add-Ons/SpeedKart_", "");
      %displayName = strReplace(%displayName, "/save.bls", "");
      %displayName = strReplace(%displayName, "_", " ");

      if(%i == $SK::CurrentTrack)
         messageClient(%client, '', " >" @ %i @ ". \c6" @ %displayName);
      else
         messageClient(%client, '', "  " @ %i @ ". \c6" @ %displayName);
   }
}
function serverCmdSetTrack(%client, %i)
{
   if(!%client.isAdmin)
      return;

   if(mFloor(%i) !$= %i)
   {
      messageClient(%client, '', "Usage: /setTrack <number>");
      return;
   }

   if(%i < 0 || %i > $SK::numTracks)
   {
      messageClient(%client, '', "serverCmdSetTrack() - out of range index");
      return;
   }

   messageAll( 'MsgAdminForce', '\c3%1\c2 changed the track', %client.getPlayerName());
  
   $SK::CurrentTrack = %i - 1;
   SK_NextTrack();
}

function serverCmdNextTrack(%client, %i)
{
   if(!%client.isAdmin)
      return;

   messageAll( 'MsgAdminForce', '\c3%1\c2 changed the track', %client.getPlayerName());
  
   SK_NextTrack();
}

package GameModeSpeedKartPackage
{
   //this is called when save loading finishes
   function GameModeInitialResetCheck()
   {
      Parent::GameModeInitialResetCheck();

      //if there is no track list, attempt to create it
      if($SK::numTracks == 0)
         SK_BuildTrackList();
      
      //if tracklist is still empty, there are no tracks
      if($SK::numTracks == 0)
      {
         messageAll('', "\c5No SpeedKart tracks available!");
         return;
      }

      if($SK::Initialized)
         return;

      $SK::Initialized = true;
      $SK::CurrentTrack = -1;
            
      SK_NextTrack();
   }

   //when we're done loading a new track, reset the minigame
   function ServerLoadSaveFile_End()
   {
      Parent::ServerLoadSaveFile_End();

      //new track has loaded, reset minigame
      if($DefaultMiniGame.numMembers > 0) //don't bother if no one is here (this also prevents starting at round 2 on server creation)
         $DefaultMiniGame.scheduleReset(); //don't do it instantly, to give people a little bit of time to ghost
   }
  
   //vehicles should explode in water
   function VehicleData::onEnterLiquid(%data, %obj, %coverage, %type)
   {
      Parent::onEnterLiquid(%data, %obj, %coverage, %type);

      %obj.damage(%obj, %obj.getPosition(), 10000, $DamageType::Lava);
      %obj.finalExplosion();
   }

   //players should die in water
   function Armor::onEnterLiquid(%data, %obj, %coverage, %type)
   {
      Parent::onEnterLiquid(%data, %obj, %coverage, %type);
      %obj.hasShotOnce = true;
      %obj.invulnerable = false;
      %obj.damage(%obj, %obj.getPosition(), 10000, $DamageType::Lava);
   }

   //when vehicle spawns, it cannot move (event must enable it)
   //this solves the driving through the garage problem
   function WheeledVehicleData::onAdd(%data,%obj)
   {
      Parent::onAdd(%data, %obj);

      for(%i = 0; %i < %data.numWheels; %i++)
         %obj.setWheelPowered(%i, %on);
   }

   //also you cannot click-push a vehicle while it is in non-moving mode
   function vehicle::OnActivate(%vehicle, %activatingObj, %activatingClient, %pos, %vec)
   {
      //just check a wheel
      if(!%vehicle.getWheelPowered(2))
         return;

      Parent::OnActivate(%vehicle, %activatingObj, %activatingClient, %pos, %vec);
   }


   //if you kill yourself in a vehicle, kill the vehicle
   function serverCmdSelf Delete(%client)
   {
      %player = %client.player;
      if(!isObject(%player))
         return;
      
      %vehicle = %player.getObjectMount();

      //kill the vehicle we're in
      if(isObject(%vehicle))
      {
         //if wheels are not powered, we're probably at the start of the race, so don't allow Self Delete in a vehicle
         %poweredTime = getSimTime() - %vehicle.poweredTime;
         %doBuzzer = false;
         if(%vehicle.getClassName() $= "AIPlayer")
            %doBuzzer = true;
         else if(!%vehicle.getWheelPowered(2) || %poweredTime < 8000)
            %doBuzzer = true;

         if(%doBuzzer)
         {
            //spam protect the buzzer enough to prevent serious problems
            if(getSimTime() - %player.lastSelf DeleteBuzzerTime > 200)
            {
               %player.lastSelf DeleteBuzzerTime = getSimTime();
               serverPlay3d("Beep_No_Sound", %vehicle.getPosition());
            }
            return;
         }

         //if vehicle is on fire, do final explosion
         //otherwise kill vehicle
         if(%vehicle.getDamagePercent() >= 1.0)
            %vehicle.finalExplosion();
         else
         {
            %vehicle.damage(%vehicle, %vehicle.getPosition(), 10000, $DamageType::Default);        
            %player.burnPlayer(5);
         }
      }
      else
      {        
         //no vehicle, normal Self Delete
         Parent::ServerCmdSelf Delete(%client);
         return;
      }

   }
      
   //resume death animation after corpse is booted out of burning vehicle
   function Armor::onUnmount(%data, %obj, %slot)
   {
      Parent::onUnmount(%data, %obj, %slot);

      if(%obj.getDamagePercent() >= 1)
      {
         %obj.playthread(3, "death1");
      }
   }
  
   //if smoeone gets back into a garage after the game starts, we don't want them to be able to press a button and respawn someone's cart from under them
   function fxDTSBrick::setVehicle(%obj, %data, %client)
   {
      if(isObject(%obj.vehicle))
      {
         //vehicle exists, if it is far from spawn, don't do this event
         %vec = vectorSub(%obj.vehicle.getPosition(), %obj.getPosition());
         %dist = vectorLen(%vec);
         if(%dist > 10)
         {
            return;
         }
      }

      Parent::setVehicle(%obj, %data, %client);
   }
  
   //total hack: when a vehicle is turned on record the start-of-race time
   // other options would be to make another event or add in a time offset
   function fxDTSBrick::setVehiclePowered(%obj, %on, %client)
   {
      Parent::setVehiclePowered(%obj, %on, %client);

      if(%on)
      {
         if(isObject($DefaultMiniGame))
         {
            if($DefaultMiniGame.raceStartTime <= 0)
               $DefaultMiniGame.raceStartTime = getSimTime();
         }
      }
   }

   function MiniGameSO::Reset(%obj, %client)
   {
      //make sure this value is an number
      $pref::Server::SpeedKart::RoundLimit = mFloor($pref::Server::SpeedKart::RoundLimit);

      //handle our race time hack
      %obj.raceStartTime = 0;

      //count number of minigame resets, when we reach the limit, go to next track
      if(%obj.numMembers >= 0)
      {
         $SK::ResetCount++;
      }

      if($SK::ResetCount > $pref::Server::SpeedKart::RoundLimit)
      {
         $SK::ResetCount = 0;
         SK_NextTrack();
      }
      else
      {
         messageAll('', "\c5Beginning round " @ $SK::ResetCount @ " of " @ $pref::Server::SpeedKart::RoundLimit);
         Parent::Reset(%obj, %client);
      }
   }  
};
activatePackage(GameModeSpeedKartPackage);

// more time to fly out of a burning car
$CorpseTimeoutValue = 7000;

//special event to explode vehicles that are left in the garage
registerOutputEvent("fxDTSBrick", "explodeNearVehicle", "");
function fxDTSBrick::explodeNearVehicle(%obj)
{
   %vehicle = %obj.vehicle;
   if(!isObject(%vehicle))
      return;

   %delta = vectorSub(%vehicle.getPosition(), %obj.getPosition());
   //echo("len = " @ vectorLen(%delta));
   if(vectorLen(%delta) < 5) //7.5)
      %vehicle.finalExplosion(); //damage(%vehicle, %vehicle.getPosition(), 10000, $DamageType::Default);
}


//special event to win the race, displays race time
registerOutputEvent("GameConnection", "winRace", "");
function GameConnection::winRace(%client)
{
   %mg = %client.miniGame;

   if(!isObject(%mg))
      %mg = $DefaultMiniGame;

   if(!isObject(%mg))
      return;

   //if race start time is not available, use time since last reset
   %startTime = %mg.raceStartTime;
   if(%startTime <= 0)
      %startTime = %mg.lastResetTime;

   %elapsedTime = getSimTime() - %startTime;
   %elapsedTime = mFloor(%elapsedTime / 1000);
  
   %mg.chatMessageAll(0,  "\c3" @ %client.getPlayerName() @ " \c5WON THE RACE IN \c6" @ getTimeString(%elapsedTime) @ "\c3!");
   %mg.scheduleReset(7000);
}  

Heres the gamemode .txt
Quote
//Default stuff...
ADDON Brick_Arch
ADDON Brick_Large_Cubes

ADDON Support_Player_Persistence
ADDON Brick_Treasure_Chest

ADDON Brick_V15
ADDON Emote_Alarm
ADDON Emote_Confusion
ADDON Emote_Hate
ADDON Emote_Love
ADDON Light_Animated
ADDON Light_Basic
ADDON Particle_Basic
ADDON Particle_FX_Cans
ADDON Particle_Player
ADDON Particle_Tools
ADDON Particle_Grass
ADDON Player_No_Jet
ADDON Print_1x2f_Default
ADDON Print_2x2f_Default
ADDON Print_2x2r_Default
ADDON Print_Letters_Default
ADDON Sound_Beeps
ADDON Sound_Phone
ADDON Sound_Synth4
ADDON Script_AdvanceLight
ADDON Server_SloMoDeath
ADDON Script_VehicleStereo

ADDON Vehicle_Pirate_Cannon
ADDON Vehicle_Tank
ADDON Weapon_Rocket_Launcher
ADDON Projectile_GravityRocket
ADDON Vehicle_Jeep
ADDON Vehicle_Horse
ADDON Vehicle_Rowboat
ADDON Weapon_Bow
ADDON Weapon_Spear
ADDON Weapon_Sword

ADDON Support_Doors
ADDON Brick_Doors

ADDON Brick_Halloween
ADDON Brick_Teledoor
ADDON Brick_Christmas_Tree


//Kart racing stuff...
ADDON Brick_ModTer_BasicPack
ADDON Brick_ModTer_InvertedPack
ADDON Print_ModTer_Default
ADDON GameMode_SpeedKart
ADDON Server_VehicleGore
ADDON Event_Camera_Control
ADDON Vehicle_Speedkart
ADDON SpeedKart_Glacial_Run
ADDON SpeedKart_Lighthouse
ADDON Speedkart_Red_Raceway
ADDON SpeedKart_Sand_Castle
ADDON SpeedKart_North_Pole
ADDON SpeedKart_GreenHills
ADDON SpeedKart_Descent
ADDON SpeedKart_Harbor
ADDON SpeedKart_PacTrax_Curvature
ADDON SpeedKart_Frozer
ADDON SpeedKart_Hydro_Plant
ADDON SpeedKart_Sierra_Island
ADDON SpeedKart_Volcano


//bots
ADDON Bot_Hole
ADDON Bot_Blockhead
ADDON Bot_Horse
ADDON Bot_Shark
ADDON Bot_Zombie

//for bandito
ADDON Weapon_Gun
ADDON Weapon_Guns_Akimbo

MUSIC Rainbow_MK64
MUSIC Mountain_MK64
MUSIC Jungle_MK64
MUSIC Highway_MK64
MUSIC Desert_MK64
MUSIC Beach_MK64
MUSIC Circut_MK64
MUSIC Snow_MK64

//environment
$EnvGuiServer::SimpleMode 0
$EnvGuiServer::SkyFile Add-Ons/Sky_Skylands/Skylands.dml
$EnvGuiServer::WaterFile Add-Ons/Water_Brick/brick.water
$EnvGuiServer::GroundFile Add-Ons/Ground_Plate/plate.ground
$EnvGuiServer::SunFlareTopTexture base/lighting/flare2.png
$EnvGuiServer::SunFlareBottomTexture base/lighting/corona2.png
$EnvGuiServer::DayOffset 0
$EnvGuiServer::DayLength 300
$EnvGuiServer::DayCycleEnabled 0
$EnvGuiServer::DayCycle Add-Ons/DayCycle_Default/default.daycycle
$EnvGuiServer::Sunational socialistmuth 238
$EnvGuiServer::SunElevation 21
$EnvGuiServer::DirectLightColor 1.000000 0.915888 0.836449 1.000000
$EnvGuiServer::AmbientLightColor 0.612150 0.592126 0.592126 1.000000
$EnvGuiServer::ShadowColor 0.000000 0.498211 0.579439 1.000000
$EnvGuiServer::SunFlareColor 0.200000 0.200000 0.200000 1.000000
$EnvGuiServer::SunFlareSize 2.25641
$EnvGuiServer::VisibleDistance 753.744
$EnvGuiServer::FogDistance 471.795
$EnvGuiServer::FogHeight
$EnvGuiServer::FogColor 0.771028 0.826666 1.000000 1.000000
$EnvGuiServer::WaterColor 0.172897 0.630841 1.000000 0.827103
$EnvGuiServer::WaterHeight 5
$EnvGuiServer::UnderWaterColor 140 178 255 134
$EnvGuiServer::SkyColor 1.000000 1.000000 0.785047 1.000000
$EnvGuiServer::WaterScrollX 0
$EnvGuiServer::WaterScrollY 0
$EnvGuiServer::GroundColor 1.000000 0.816578 0.607477 1.000000
$EnvGuiServer::GroundScrollX 0
$EnvGuiServer::GroundScrollY 0
$EnvGuiServer::VignetteMultiply 0
$EnvGuiServer::VignetteColor 0.000000 0.000000 0.000000 0.392157



//minigame rules
$MiniGame::Enabled 1
$MiniGame::GameColor 0
$MiniGame::InviteOnly 0
$MiniGame::IncludeAllPlayersBricks 1
$MiniGame::PlayersUseOwnBricks 0

$MiniGame::Points_BreakBrick 0
$MiniGame::Points_PlantBrick 0
$MiniGame::Points_KillPlayer 1
$MiniGame::Points_KillBot 0
$MiniGame::Points_KillSelf   -1
$MiniGame::Points_Die 0
   
$MiniGame::RespawnTime -1
$MiniGame::VehicleRespawnTime -1
$MiniGame::BrickRespawnTime 60
$MiniGame::BotRespawnTime 5

$MiniGame::UseSpawnBricks 1
$MiniGame::FallingDamage 1
$MiniGame::WeaponDamage 1
$MiniGame::SelfDamage 1
$MiniGame::VehicleDamage 1
$MiniGame::BrickDamage 1
$MiniGame::BotDamage 1
$MiniGame::EnableWand 0
$MiniGame::EnableBuilding 0
$MiniGame::EnablePainting 0

$MiniGame::PlayerDataBlockName No-Jet Player

$MiniGame::StartEquipName0 0
$MiniGame::StartEquipName1 0
$MiniGame::StartEquipName2 0
$MiniGame::StartEquipName3 0
$MiniGame::StartEquipName4 0

$MiniGame::TimeLimit 240




$Server::Quota::Schedules 9999
$Server::Quota::Misc 999
$Server::Quota::Projectile 999
$Server::Quota::Item 999
$Server::Quota::Environment 9999
$Server::Quota::Player 100
$Server::Quota::Vehicle 50
$Server::MaxPhysVehicles_Total 20

112
Add-Ons / Re: Gold Wrench V.1 (UPDATED)
« on: September 29, 2014, 02:17:26 AM »
I forgot to mention the Titanium Wand, and the Plutonium Horse Ray (It fires a damaging projectile instead of turning you into a horse)
Haha, how about a Titanium Time-Bomb?
I'm still waiting on zombekillz. Trying to get the code completed.

113
Add-Ons / Re: Gold Wrench V.1 (UPDATED)
« on: September 28, 2014, 10:50:26 PM »
How about the Thorium Spraycan?
Haha, going down the element list now I see?

114
Add-Ons / Re: Gold Wrench V.1 (UPDATED)
« on: September 28, 2014, 10:49:55 PM »
Give me the Platinum Wrench, Orange Transparent Printer, and the Chrome Hammer.
Lmao.

115
Help / Re: Blockland Forums Avatar NOT updating
« on: September 28, 2014, 10:04:33 PM »
I think it may be the file size, even though it's the right size. How do I reduce the file size?

116
Help / Re: Blockland Forums Avatar NOT updating
« on: September 28, 2014, 09:52:00 PM »
Max size is 75x75.
I cropped the photo to 75x75 Pixels and it told me this again.
"Your attachment couldn't be saved. This might happen because it took too long to upload or the file is bigger than the server will allow.

Please consult your server administrator for more information."
My connection speed is above average, I'm not sure what's going on.
This issue has reoccurred for the past 2 years now.

117
Help / Re: Blockland Forums Avatar NOT updating
« on: September 28, 2014, 07:49:51 PM »
Okay, so I changed the size to 100 by 100. It went through, but my avatar still has not changed.

118
Help / Re: Blockland Forums Avatar NOT updating
« on: September 28, 2014, 07:39:07 PM »
It's a regular .png file. Orignally 500 by 500.

119
Help / Re: Blockland Forums Avatar NOT updating
« on: September 28, 2014, 07:36:26 PM »
Like I said I'm probably wrong I set my avatr and was lucky it was small enough
I cropped it down to a 64 by 64 and it told me this..
"Your attachment couldn't be saved. This might happen because it took too long to upload or the file is bigger than the server will allow.

Please consult your server administrator for more information."

120
Help / Re: Blockland Forums Avatar NOT updating
« on: September 28, 2014, 07:14:56 PM »
Make sure it's the right size which I'm probably wrong but I believe is 64x64

Someone correct me if I'm wrong
Are you sure? I'll try.
I thought it was 500 by 500?

Pages: 1 ... 3 4 5 6 7 [8] 9 10 11 12 13 ... 15