11-01-2011, 21:59
Hi guys,
I'm a new modder and wantet to make my first own mod.
I read the .gsc modding tut and the tut to import SP weapons.
Then i started working on a modified gungame. I got now 80 weapons in the gungame list and this worked perfect... since i wantet to start my gungame with the SOG knife. I modified it in Asset Manager so that it kills with one hit and added it to the first position on my gun-list.
When I start gungame with my mod, I get really get the SOG Knife, but i cant kill someone by hitting the left mousebutton (set to "fire"). I just can use it as a knife (with key "V"), that would't be a problem for me, but if I kill someone that way, I dont get promoted to next level. Instead my enemie gets humilated =(
Is there a way, to modify it that way, that the SOG Knife don't humiliate and i get promoted to the next weapon?
Thank you very much
iMaster
Here is the code of my ".../maps/mp/gametype/gun.gsc":
I'm a new modder and wantet to make my first own mod.
I read the .gsc modding tut and the tut to import SP weapons.
Then i started working on a modified gungame. I got now 80 weapons in the gungame list and this worked perfect... since i wantet to start my gungame with the SOG knife. I modified it in Asset Manager so that it kills with one hit and added it to the first position on my gun-list.
When I start gungame with my mod, I get really get the SOG Knife, but i cant kill someone by hitting the left mousebutton (set to "fire"). I just can use it as a knife (with key "V"), that would't be a problem for me, but if I kill someone that way, I dont get promoted to next level. Instead my enemie gets humilated =(
Is there a way, to modify it that way, that the SOG Knife don't humiliate and i get promoted to the next weapon?
Thank you very much
iMaster
Here is the code of my ".../maps/mp/gametype/gun.gsc":
Code:
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
main()
{
maps\mp\gametypes\_globallogic::init();
maps\mp\gametypes\_callbacksetup::SetupCallbacks();
maps\mp\gametypes\_globallogic::SetupCallbacks();
level.onStartGameType = ::onStartGameType;
level.onSpawnPlayer = ::onSpawnPlayer;
level.onSpawnPlayerUnified = ::onSpawnPlayerUnified;
level.onPlayerKilled = ::onPlayerKilled;
level.onWagerAwards = ::onWagerAwards;
game["dialog"]["gametype"] = "gg_start_00";
game["dialog"]["wm_promoted"] = "gg_promote";
game["dialog"]["wm_humiliation"] = "boost_gen_08";
game["dialog"]["wm_humiliated"] = "boost_gen_09";
level.giveCustomLoadout = ::giveCustomLoadout;
if( !isPregameEnabled() )
{
PrecacheItem( "m202_flash_wager_mp" );
}
PrecacheString( &"MPUI_PLAYER_KILLED" );
PrecacheString( &"MP_GUN_NEXT_LEVEL" );
PrecacheString( &"MP_GUN_PREV_LEVEL" );
PrecacheString( &"MP_GUN_PREV_LEVEL_OTHER" );
PrecacheString( &"MP_HUMILIATION" );
PrecacheString( &"MP_HUMILIATED" );
precacheItem("mosin_scope_sp");
precacheItem("mosin_sp");
precacheItem("tokarevtt30_sp");
precacheItem("sten_sp");
precacheItem("stg44_sp");
precacheItem("vorkuta_motorcycle_shotgun_sp");
precacheItem("mp40_mp");
precacheItem("m2_flamethrower_mp");
precacheItem("crossbow_sp");
precacheItem("crossbow_vzoom_sp");
precacheItem("ks23_sp");
precacheItem("molotov_sp");
precacheItem("panzerschreck_sp");
precacheItem("ppsh_sp");
precacheItem("spas_db_sp");
PrecacheItem( "m202_flash_wager_mp" );
PrecacheItem( "m220_tow_wager_mp" );
PrecacheItem( "minigun_wager_mp" );
PrecacheItem( "ray_gun_zm" );
PrecacheItem( "tesla_gun_zm" );
PrecacheItem( "thundergun_zm" );
PrecacheItem( "creek_knife_sp" );
PrecacheItem( "shovel_sp" );
PrecacheItem( "vorkuta_knife_sp" );
PrecacheItem( "waltherp38_sp" );
PrecacheItem( "m16_upgraded_zm" );
addGunToProgression( "creek_knife_sp" );
addGunToProgression( "shovel_sp" );
addGunToProgression( "vorkuta_knife_sp" );
addGunToProgression( "waltherp38_sp" );
addGunToProgression( "m16_upgraded_zm" );
addGunToProgression( "m1911_upgradesight_extclip_silencer_mp" );
addGunToProgression( "aspdw_mp" );
addGunToProgression( "python_acog_mp" );
addGunToProgression( "makarovdw_mp" );
addGunToProgression( "cz75_mp" );
addGunToProgression( "cz75_auto_mp" );
addGunToProgression( "tokarevtt30_sp" );
addGunToProgression( "knife_ballistic_mp" );
addGunToProgression( "rottweil72_mp" );
addGunToProgression( "ithaca_mp" );
addGunToProgression( "spas_silencer_mp" );
addGunToProgression( "hs10dw_mp" );
addGunToProgression( "spas_db_sp" );
addGunToProgression( "vorkuta_motorcycle_shotgun_sp" );
addGunToProgression( "ks23_sp" );
addGunToProgression( "crossbow_sp" );
addGunToProgression( "skorpion_grip_mp" );
addGunToProgression( "mp5k_silencer_mp" );
addGunToProgression( "mac11dw_mp" );
addGunToProgression( "ak74u_elbit_mp" );
addGunToProgression( "mp40_mp" );
addGunToProgression( "uzi_mp" );
addGunToProgression( "pm63_mp" );
addGunToProgression( "mpl_reflex_mp" );
addGunToProgression( "spectre_mp" );
addGunToProgression( "ppsh_sp" );
addGunToProgression( "kiparisdw_mp" );
addGunToProgression( "knife_ballistic_mp" );
addGunToProgression( "enfield_reflex_mp" );
addGunToProgression( "m14_acog_mp" );
addGunToProgression( "m16_mp" );
addGunToProgression( "mosin_sp" );
addGunToProgression( "famas_mp" );
addGunToProgression( "stoner63_mp" );
addGunToProgression( "galil_silencer_mp" );
addGunToProgression( "aug_mp" );
addGunToProgression( "sten_sp" );
addGunToProgression( "fnfal_acog_mp" );
addGunToProgression( "ak47_mp" );
addGunToProgression( "g11_vzoom_mp" );
addGunToProgression( "commando_mp" );
addGunToProgression( "crossbow_sp" );
addGunToProgression( "hk21_mp" );
addGunToProgression( "stg44_sp" );
addGunToProgression( "rpk_mp" );
addGunToProgression( "m60_ir_mp" );
addGunToProgression( "knife_ballistic_mp" );
addGunToProgression( "dragunov_mp" );
addGunToProgression( "wa2000_acog_mp" );
addGunToProgression( "l96a1_vzoom_mp" );
addGunToProgression( "psg1_mp" );
addGunToProgression( "mosin_scope_sp" );
addGunToProgression( "crossbow_vzoom_sp" );
addGunToProgression( "knife_ballistic_mp" );
addGunToProgression( "m72_law_mp" );
addGunToProgression( "rpg_mp" );
addGunToProgression( "panzerschreck_sp" );
addGunToProgression( "m202_flash_wager_mp" );
addGunToProgression( "china_lake_mp" );
addGunToProgression( "minigun_wager_mp" );
addGunToProgression( "m2_flamethrower_mp" );
addGunToProgression( "crossbow_sp" );
addGunToProgression( "crossbow_vzoom_sp" );
addGunToProgression( "crossbow_explosive_mp", "explosive_bolt_mp" );
addGunToProgression( "claymore_mp" );
addGunToProgression( "frag_grenade_mp" );
addGunToProgression( "sticky_grenade_mp" );
addGunToProgression( "molotov_sp" );
addGunToProgression( "hatchet_mp" );
addGunToProgression( "crossbow_vzoom_sp", "explosive_bolt_mp" );
addGunToProgression( "ray_gun_zm" );
addGunToProgression( "thundergun_zm" );
addGunToProgression( "tesla_gun_zm" );
maps\mp\gametypes\_globallogic_utils::registerTimeLimitDvar( level.gameType, 10, 0, 1440 );
maps\mp\gametypes\_globallogic_utils::registerScoreLimitDvar( level.gameType, level.gunProgression.size, 0, 5000 );
maps\mp\gametypes\_globallogic_utils::registerRoundLimitDvar( level.gameType, 1, 0, 10 );
maps\mp\gametypes\_globallogic_utils::registerRoundWinLimitDvar( level.gameType, 0, 0, 10 );
maps\mp\gametypes\_globallogic_utils::registerNumLivesDvar( level.gameType, 0, 0, 10 );
setscoreboardcolumns( "kills", "deaths", "stabs", "humiliated" );
}
addGunToProgression( gunName, altName )
{
if ( !IsDefined( level.gunProgression ) )
level.gunProgression = [];
newWeapon = SpawnStruct();
newWeapon.names = [];
newWeapon.names[newWeapon.names.size] = gunName;
if ( IsDefined( altName ) )
newWeapon.names[newWeapon.names.size] = altName;
level.gunProgression[level.gunProgression.size] = newWeapon;
}
giveCustomLoadout( takeAllWeapons, alreadySpawned )
{
chooseRandomBody = false;
if ( !IsDefined( alreadySpawned ) || !alreadySpawned )
chooseRandomBody = true;
self maps\mp\gametypes\_wager::setupBlankRandomPlayer( takeAllWeapons, chooseRandomBody );
self DisableWeaponCycling();
if ( !IsDefined( self.gunProgress ) )
self.gunProgress = 0;
currentWeapon = level.gunProgression[self.gunProgress].names[0];
self giveWeapon( currentWeapon );
self switchToWeapon( currentWeapon );
self giveWeapon( "knife_mp" );
if ( !IsDefined( alreadySpawned ) || !alreadySpawned )
self setSpawnWeapon( currentWeapon );
if ( IsDefined( takeAllWeapons ) && !takeAllWeapons )
self thread takeOldWeapons( currentWeapon );
else
self EnableWeaponCycling();
return currentWeapon;
}
takeOldWeapons( currentWeapon )
{
self endon( "disconnect" );
self endon( "death" );
for ( ;; )
{
self waittill( "weapon_change", newWeapon );
if ( newWeapon != "none" )
break;
}
weaponsList = self GetWeaponsList();
for ( i = 0 ; i < weaponsList.size ; i++ )
{
if ( ( weaponsList[i] != currentWeapon ) && ( weaponsList[i] != "knife_mp" ) )
self TakeWeapon( weaponsList[i] );
}
self EnableWeaponCycling();
}
promotePlayer( weaponUsed )
{
self endon( "disconnect" );
self endon( "cancel_promotion" );
level endon( "game_ended" );
wait 0.05;
for ( i = 0 ; i < level.gunProgression[self.gunProgress].names.size ; i++ )
{
if ( weaponUsed == level.gunProgression[self.gunProgress].names[i] )
{
if ( self.gunProgress < level.gunProgression.size-1 )
{
self.gunProgress++;
if ( IsAlive( self ) )
self thread giveCustomLoadout( false, true );
self thread maps\mp\gametypes\_wager::queueWagerPopup( &"MPUI_PLAYER_KILLED", 0, &"MP_GUN_NEXT_LEVEL" );
}
score = maps\mp\gametypes\_globallogic_score::_getPlayerScore( self );
if ( score < level.gunProgression.size )
maps\mp\gametypes\_globallogic_score::_setPlayerScore( self, score + 1 );
return;
}
}
}
demotePlayer()
{
self endon( "disconnect" );
self notify( "cancel_promotion" );
if ( self.gunProgress > 0 )
{
score = maps\mp\gametypes\_globallogic_score::_getPlayerScore( self );
maps\mp\gametypes\_globallogic_score::_setPlayerScore( self, score - 1 );
self.gunProgress--;
if ( IsAlive( self ) )
self thread giveCustomLoadout( false, true );
}
self.pers["humiliated"]++;
self.humiliated = self.pers["humiliated"];
self thread maps\mp\gametypes\_wager::queueWagerPopup( &"MP_HUMILIATED", 0, &"MP_GUN_PREV_LEVEL", "wm_humiliated" );
}
onPlayerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration )
{
if ( sMeansOfDeath == "MOD_SUICIDE" )
{
self thread demotePlayer();
return;
}
if ( IsDefined( attacker ) && IsPlayer( attacker ) )
{
if ( attacker == self )
{
self thread demotePlayer();
return;
}
if ( sMeansOfDeath == "MOD_MELEE" )
{
self thread demotePlayer();
attacker thread maps\mp\gametypes\_wager::queueWagerPopup( &"MP_HUMILIATION", 0, &"MP_GUN_PREV_LEVEL_OTHER", "wm_humiliation" );
return;
}
attacker thread promotePlayer( sWeapon );
}
}
onStartGameType()
{
setDvar("scr_gun_timelimit", 0);
setDvar( "scr_disable_cac", 1 );
makedvarserverinfo( "scr_disable_cac", 1 );
setDvar( "scr_disable_weapondrop", 1 );
setdvar( "scr_game_perks", 0 );
level.killstreaksenabled = 0;
level.hardpointsenabled = 0;
setDvar( "scr_xpscale", 0 );
setDvar( "ui_allow_teamchange", 0 );
makedvarserverinfo( "ui_allow_teamchange", 0 );
setDvar( "ui_weapon_tiers", level.gunProgression.size );
makedvarserverinfo( "ui_weapon_tiers", level.gunProgression.size );
setClientNameMode("auto_change");
maps\mp\gametypes\_globallogic_ui::setObjectiveText( "allies", &"OBJECTIVES_GUN" );
maps\mp\gametypes\_globallogic_ui::setObjectiveText( "axis", &"OBJECTIVES_GUN" );
if ( level.splitscreen )
{
maps\mp\gametypes\_globallogic_ui::setObjectiveScoreText( "allies", &"OBJECTIVES_GUN" );
maps\mp\gametypes\_globallogic_ui::setObjectiveScoreText( "axis", &"OBJECTIVES_GUN" );
}
else
{
maps\mp\gametypes\_globallogic_ui::setObjectiveScoreText( "allies", &"OBJECTIVES_GUN_SCORE" );
maps\mp\gametypes\_globallogic_ui::setObjectiveScoreText( "axis", &"OBJECTIVES_GUN_SCORE" );
}
maps\mp\gametypes\_globallogic_ui::setObjectiveHintText( "allies", &"OBJECTIVES_GUN_HINT" );
maps\mp\gametypes\_globallogic_ui::setObjectiveHintText( "axis", &"OBJECTIVES_GUN_HINT" );
level.spawnMins = ( 0, 0, 0 );
level.spawnMaxs = ( 0, 0, 0 );
newSpawns = GetEntArray( "mp_wager_spawn", "classname" );
if (newSpawns.size > 0)
{
maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_wager_spawn" );
maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_wager_spawn" );
}
else
{
maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_dm_spawn" );
maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_dm_spawn" );
}
maps\mp\gametypes\_spawning::updateAllSpawnPoints();
level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
setMapCenter( level.mapCenter );
spawnpoint = maps\mp\gametypes\_spawnlogic::getRandomIntermissionPoint();
setDemoIntermissionPoint( spawnpoint.origin, spawnpoint.angles );
level.useStartSpawns = false;
allowed[0] = "gun";
maps\mp\gametypes\_gameobjects::main(allowed);
maps\mp\gametypes\_spawning::create_map_placed_influencers();
maps\mp\gametypes\_rank::registerScoreInfo( "kill", 0 );
maps\mp\gametypes\_rank::registerScoreInfo( "headshot", 0 );
maps\mp\gametypes\_rank::registerScoreInfo( "assist_75", 0 );
maps\mp\gametypes\_rank::registerScoreInfo( "assist_50", 0 );
maps\mp\gametypes\_rank::registerScoreInfo( "assist_25", 0 );
maps\mp\gametypes\_rank::registerScoreInfo( "assist", 0 );
maps\mp\gametypes\_rank::registerScoreInfo( "suicide", 0 );
maps\mp\gametypes\_rank::registerScoreInfo( "teamkill", 0 );
level.displayRoundEndText = false;
level.QuickMessageToAll = true;
}
onSpawnPlayerUnified()
{
maps\mp\gametypes\_spawning::onSpawnPlayer_Unified();
self thread infiniteAmmo();
}
onSpawnPlayer()
{
spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( self.pers["team"] );
spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_DM( spawnPoints );
self spawn( spawnPoint.origin, spawnPoint.angles, "gun" );
self thread infiniteAmmo();
}
infiniteAmmo()
{
self endon( "death" );
self endon( "disconnect" );
for ( ;; )
{
wait( 0.1 );
weapon = self GetCurrentWeapon();
self GiveMaxAmmo( weapon );
}
}
onWagerAwards()
{
stabs = self maps\mp\gametypes\_globallogic_score::getPersStat( "stabs" );
if ( !IsDefined( stabs ) )
stabs = 0;
self maps\mp\gametypes\_persistence::setAfterActionReportStat( "wagerAwards", stabs, 0 );
headshots = self maps\mp\gametypes\_globallogic_score::getPersStat( "headshots" );
if ( !IsDefined( headshots ) )
headshots = 0;
self maps\mp\gametypes\_persistence::setAfterActionReportStat( "wagerAwards", headshots, 1 );
bestKillstreak = self maps\mp\gametypes\_globallogic_score::getPersStat( "best_kill_streak" );
if ( !IsDefined( bestKillstreak ) )
bestKillstreak = 0;
self maps\mp\gametypes\_persistence::setAfterActionReportStat( "wagerAwards", bestKillstreak, 2 );
}