/* Load it on a space map like q3dm17 and bind the Hook. * * /bind mouse2 +button5 * * * Use any other maps to execute the syntax examples. **/ config { name = "Sample CFG"; date = "05.06.2009"; author = "easy"; } // only makes sense on space maps if ( in($mapname, "q3dm16", "q3dm17", "q3dm18", "q3dm19", "q3tourney6", "q3ctf4", "q3tourney6_ctf") ) { config->name = "The pulling Death"; if ( $g_gametype == GT_TOURNAMENT ) { // we want to score if the enemy dies, no matter how tournament->deathScore = true; $fraglimit = abs($fraglimit); } else if ( $fraglimit > 0 ) { // need a negative fraglimit $fraglimit *= -1; } startWeapons = WP_RAILGUN; // we want all the items Weapons = WP_ALL; Items = IT_ALL; Ammos = AM_ALL; Powerups = PW_ALL; // but we replace everything with railgun ammo // set respawn time to 5 and amount to 1 modifyItem( 0, "*", "ammo_slugs", 5, 1 ); dmFlags = DM_NO_SELF_DAMAGE | DM_NO_FALLING_DAMAGE | DM_INFINITE_HEALTH; // we use the grapple for rapid and weapon independent jumps grapple { offhand = true; // no damage at all damage = knockback = 0; // but have self knockback selfKnockback = 200; radius = 200; // we use the grapple for jumps, not for pulling time = timeToLive = 0.15; pullSpeed = 0; // green explosion, so the knockback looks real style = WPS_IMPACT_BFG; } railGun { ammo = 5; regen = no; cycle = 1100; // no damage; actually we have small damage to get the hits for statistics damage = 1; // now the funny part, we pull the enemy instead of pushing knockback = -300; // push ourself back when shooting firingKnockback = 100; } } // some syntax examples from here on.. else { // this all might look like php but always keep in mind, this is not php :) // // but you can edit this with your favourite editor supporting php syntax // higlighting as it almost fits perfectly. // access or assign cvars, its the same as "/set sample 0" $sample = 0; // to connect strings use the dot operator $sample = "string1" . " string2"; // accessing or assigning attributes railGun { cycle = 1100; } // is the same as railGun->cycle = 1100; // or Rail Gun -> C y c l e = 1100; // ternary operator.. this $sample = ( $g_gametype == GT_FFA ? 1 : 2 ); // is the same as if ( $g_gametype == GT_FFA ) { $sample = 1; } else { $sample = 2; } // calculations of any kind $sample = railGun->cycle * 0.5; $sample += railGun->cycle / railGun->damage; $sample *= (float)VERSION; // comparsion of any complexity if ( $g_gametype == GT_TEAM || $mapname == "q3dm1" || ($timelimit > 10 && $fraglimit <= 30 && !$capturelimit) || $g_gametype >= GT_FTAG ) { // do something } // there are some "functions" you can call // if you know any others that could be useful, tell me /* debug( message ) */ debug("^1will print this message \n with \"line breaks\" \n to the console including the line number"); /* include( filename ) * * parse the config file and returns 1 if parsing was successful, 0 in case of error * maximum recursion level is 8 **/ if ( include( "default.cfg" ) ) { debug( "default settings loaded again!" ); } /* match( pattern, subject ) * * wildcard matching. * ? - matches one character * * - matches none or any amount of characters * \? - matches a ? * \* - matches a * **/ if ( match("q3dm*", $mapname) ) { } // is the same as if ( $mapname ~= "q3dm*" ) { } /* in( needle, value1 [, value2...] ) * * check against multiple values **/ if ( in($g_gametype, GT_FFA, GT_FTAG, GT_CTF) ) { } /* exec( command ) */ if ( !match("*(sample cfg)", $sv_hostname) ) { // would be more simple without exec() //$sv_hostname .= " (sample cfg)"; exec('set sv_hostname "'. $sv_hostname .' (sample cfg)"'); } /* modifyitem( id, classname, newClassname [ , respawnTime = -1 [ , amount = -1 [ , x, y, z ] ] ] ) * * id - 0 will replace all items that match * classname - case insensitive, can contain wildcards like "weapon_*" * newClassname - case insensitive, will replace the item, use empty string to ignore * respawnTime - time in seconds, default -1, argument is optional * amount - amount given on pickup, default -1, argument is optional * x, y, z - will adjust the items position, only makes sense if id > 0, arguments are optional * * the complete item classname list is the following: * * ARMOR * item_armor_shard item_armor_jacket item_armor_combat * item_armor_body * HEALTH * item_health_small item_health item_health_large * item_health_mega * WEAPONS * weapon_gauntlet weapon_shotgun weapon_machinegun * weapon_grenadelauncher weapon_rocketlauncher weapon_lightning * weapon_railgun weapon_plasmagun weapon_bfg * weapon_grapplinghook * AMMO * ammo_shells ammo_bullets ammo_grenades * ammo_cells ammo_lightning ammo_rockets * ammo_slugs ammo_bfg * HOLDABLE ITEMS * holdable_teleporter holdable_medkit * POWERUPS * item_quad item_enviro item_haste * item_invis item_regen item_flight * FLAGS * team_CTF_redflag team_CTF_blueflag team_CTF_neutralflag **/ // replace all weapons with mega health modifyitem(0, "weapon_*", "item_health_mega"); // replace second rocket launcher with bfg and place it to the given coordinates (100, 125, 520) modifyitem(2, "weapon_rocketlauncher", "weapon_bfg", -1, -1, 100, 125, 520); // change mega health to give +200 modifyitem(0, "item_health_mega", "", -1, 200); // matching is always based on the original item // so the below would just switch the locations, not removing the grenades modifyitem(0, "weapon_shotgun", "weapon_grenadelauncher"); modifyitem(0, "weapon_grenadelauncher", "weapon_shotgun"); /* abs( value ) * min( value1, value2 [, value3...] ) * max( value1, value2 [, value3...] ) * clamp( min, max, value ) **/ $sample = abs(-3); // 3 $sample = min(5, 9, 1, 3); // 1 $sample = max(5, 9, 1, 3); // 9 $sample = clamp(5, 9, 1); // 5 $sample = clamp(5, 9, 45); // 9 // maybe a usefull introduction to the bitwise operators if ( startWeapons & WP_MACHINEGUN ) { debug("we have the machinegun"); } // set all the weapons except grapple startWeapons = WP_ALL & ~WP_GRAPPLING_HOOK; // add rocket launcher to our startweapons // yes, we have it already but unlike the '+' operator, this will not break it startWeapons |= WP_ROCKET_LAUNCHER; // remove it startWeapons &= ~WP_ROCKET_LAUNCHER; /* "switch" syntax * * we have a complex switch syntax which differs from other languages. * * we allow to modify the comparison function for each case (like ==, <, >=, ~= etc) * also our switch has a different fall through behaviour, see the example below **/ $sample = "q3dm3"; switch ( $sample ) { case ~= "q3dm*": debug("^2we loaded settings for all q3dm* maps"); // no break here, we will fall through case ~= "q3ctf*": // we did fall through but this will not match! debug("^2we loaded settings for all q3ctf* maps"); // no break here, we will fall through // now lets have individual settings for some maps case "q3dm17": debug("^3we loaded special settings for q3dm17"); break; case "q3dm1": case "q3dm3": debug("^3we loaded settings for q3dm1 or q3dm3"); break; default: // this will only be reached if none of the above apply, for // example q3dm9 will not match because it already did in // case ~= "q3dm*" // // but q3tourney2 will debug("^1we don't know the map"); } // the above is the same as if ( $sample ~= "q3dm*" ) { //debug("^2we loaded settings for all q3dm* maps"); if ( $sample == "q3dm17" ) { //debug("^3we loaded special settings for q3dm17"); } else if ( $sample == "q3dm1" || $sample == "q3dm3" ) { //debug("^3we loaded settings for q3dm1 or q3dm3"); } } else if ( $sample ~= "q3ctf*" ) { //debug("^2we loaded settings for all q3ctf* maps"); } else { //debug("^1we don't know the map"); } // there are the for, while, do..while loops.. but maybe they will be // removed as i cant think of any use for ( $sample = 1; $sample <= 2; $sample++ ) { //debug("for-loop #". $sample); } while ( ++$sample <= 5 ) { //debug("while-loop #". $sample); } do { //debug("do-while-loop #". $sample); $sample++; } while ( $sample < 8 ); }