BoneCraft
This Community Hub is marked as 'Adult Only'. You are seeing this hub because you have set your preferences to allow this content.

BoneCraft

Not enough ratings
How to add custom scripts to Bonecraft
By Codeman02Fr
so we will see in this guide how to make the game do the same as bonetown:second edition using the 'Mods' Magic folder to load and execute custom scripts ,datablocks etc..

   
Award
Favorite
Favorited
Unfavorite
well ....
- first create a folder named 'Mods' in your 'bonecraft/game/' folder
- then in your bonecraft folder find the file called main.cs and open it with a text editor
- delete all and paste this inside :

// Torque Shader Engine // Copyright (C) GarageGames.com, Inc. $defaultGame = "game"; $displayHelp = false; // Support functions used to manage the mod string function pushFront(%list, %token, %delim) { if (%list !$= "") return %token @ %delim @ %list; return %token; } function pushBack(%list, %token, %delim) { if (%list !$= "") return %list @ %delim @ %token; return %token; } function popFront(%list, %delim) { return nextToken(%list, unused, %delim); } // Executes startup scripts for each mod, starting at base and working up function loadDir(%dir) { setModPaths(pushback($userMods, %dir, ";")); exec(%dir @ "/main.cs"); } // Process command line arguments $gLoadCreator = !$Torque::isDemo && !$Torque::isShipping; for ($i = 1; $i < $Game::argc ; $i++) { $arg = $Game::argv[$i]; $nextArg = $Game::argv[$i+1]; $hasNextArg = $Game::argc - $i > 1; $logModeSpecified = false; switch$ ($arg) { case "-log": $argUsed[$i]++; if ($hasNextArg) { // Turn on console logging if ($nextArg != 0) { // Dump existing console to logfile first. $nextArg += 4; } setLogMode($nextArg); $logModeSpecified = true; $argUsed[$i+1]++; $i++; } else error("Error: Missing Command Line argument. Usage: -log <Mode: 0,1,2>"); case "-console": enableWinConsole(true); $argUsed[$i]++; default: $argUsed[$i]++; if($userMods $= "") $userMods = $arg; } } if( $modcount == 0 ) { $userMods = $defaultGame; $modcount = 1; } // DO NOT Run the Torque Creator mod if a dedicated server. // Note: this fails if -dedicated not first parameter. if($gLoadCreator && ($platform !$= "xenon" || $platform !$= "xbox")) { $modcount++; $userMods = "creator;" @ $userMods; } // The displayHelp, onStart, onExit and parseArgs function are overriden // by mod packages to get hooked into initialization and cleanup. function onStart() { // Default startup function } function onExit() { // OnExit is called directly from C++ code, whereas onStart is // invoked at the end of this file. } function parseArgs() { // Here for mod override, the arguments have already // been parsed. } package Help { function onExit() { // Override onExit when displaying help } }; function execUserModsFiles() { %filespec = "game/mods/*.cs"; for(%file = findFirstFile(%filespec); %file !$= ""; %file = findNextFile(%filespec)) { %fileName = fileBase(%file); if(compile(%file)) exec(%file); } } // Activates the help package (which overrides onExit) function displayHelp() { activatePackage(Help); // Notes on logmode: console logging is written to console.log. // -log 0 disables console logging. // -log 1 appends to existing logfile; it also closes the file // (flushing the write buffer) after every write. // -log 2 overwrites any existing logfile; it also only closes // the logfile when the application shuts down. (default) error( "BoneTown command line options:\n"@ " -log <logmode> Logging behavior; see main.cs comments for details\n"@ " -console Open a separate console\n"@ " -help Display this help message\n" ); } // Default to a new logfile each session. if( !$logModeSpecified ) { if( $platform !$= "xbox" && $platform !$= "xenon" ) setLogMode(6); } // Set the mod path which dictates which directories will be visible // to the scripts and the resource engine. setModPaths($userMods); echo("\n--------- Loading MODS ---------"); function loadMods(%modPath) { %modPath = nextToken(%modPath, token, ";"); if (%modPath !$= "") loadMods(%modPath); if(exec(%token @ "/main.cs") != true) { error("Error: Unable to find specified mod: " @ %token ); $modcount--; } } // Load up common script base loadDir("common"); loadMods($userMods); echo(""); if ($modcount == 0) { enableWinConsole(true); error("Error: Unable to load any specified mods"); quit(); } // Parse the command line arguments echo("--------- Parsing Arguments ---------"); parseArgs(); // Either display the help message or startup the app. if ($displayHelp) { enableWinConsole(true); displayHelp(); quit(); } else { onStart(); echo("\nEngine initialized...\n"); echo("\nLoading User Mod Scripts by Codeman02Fr...\n"); execUserModsFiles(); } // Display an error message for unused arguments for ($i = 1; $i < $Game::argc; $i++) { if (!$argUsed[$i]) error("Error: Unknown command line argument: " @ $Game::argv[$i]); }

And save it, this now enabled the 'mods' folder to load and execute the scripts in it.

then go to the mods folder and create a file called whatiwant.cs
and paste this inside :

function superplayer() { %tChar = ServerConnection.GameCharacter; %tChar.modifyStamina(999, 1); // Or you can activate infinite stamina using cheat by uncommenting the next line: //goodTimes(); // uncomment for activating cheat. } GlobalActionMap.bind(keyboard, "numpad0", superplayer, "");

save it and when you are ingame each time you hit numpad 0 it will make your stamina to 999 (not infinite)