Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 118 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 MP Mapping
CoD 4 mapping and level design for multiplayer.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Cod4: Scripting Reference
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 MP Mapping
Posted: Monday, Nov. 19, 2007 09:06 pm
Serverside mods are now possible with Cod4. Head over to http://www.modcod4.com/download.php?view.11 to get the stock .gsc rip.

And _spawnlogic.gsc, they got that wrong in the rip above: http://www.modcod4.com/e107_files/public/1195311101_2_FT367__spawnlogic.gsc

NOTE: from what I've tried, the fs_game needs to be set as "mods/modname" and the folder needs to go there. Maybe mods won't be able to run from the main folder...that will be good, no more crap filling up those [devilishgrin]

Apparently, all mods are unranked, or at least they have their own separate ranks. A LOT of this stiff will change once we have the sdk.

Once you have these files, stick the ones you want to modify into an iwd file with a name like: z_svr_mod.iwd, and put the archive in data\mods\
For those who don't know, an iwd is just a zip file with a different extension.

Here is a small example script:

Code:

main()
{
thread RedefinePlayers();
thread killplayer();
}


RedefinePlayers()
{
while (1)
{		
level.pp = getentarray("player","classname");
wait 0.1;
}}

killplayer()
{
	setdvar("scr_killplayer", "-1");
	while(1)
	{
	if(isdefined(level.pp))
	{
		scvar = "scr_killplayer";
		if(gcvsingle(scvar) == "true")
		{
		killPlayerNum = getdvarint("scr_killplayer");
		for(i = 0; i < level.pp.size; i++)
		{
		thisPlayerNum = level.pp[i] getEntityNumber();
		if(thisPlayerNum == killPlayerNum)
		{
		level.pp[i] suicide();
		level.pp[i].score++;
		iprintln(level.pp[i].name + "^7 was killed by the admin");
		}}
		setdvar("scr_killplayer", "-1");
		}

		if(getdvar("scr_killplayer") == "-5")
		{
		for(i = 0; i < level.pp.size; i++)
		{
		level.pp[i] suicide();
		level.pp[i].score++;
		setdvar("scr_killplayer", "-1");		
		}}

		if(getdvar("scr_killplayer") == "-2")
		{
		for(i = 0; i < level.pp.size; i++)
		{
		if (isdefined(level.pp[i].pers["team"]) && level.pp[i].pers["team"] == "allies")
		{
		level.pp[i] suicide();
		level.pp[i].score++;
		setdvar("scr_killplayer", "-1");
		}}}

		if(getdvar("scr_killplayer") == "-3")
		{
		for(i = 0; i < level.pp.size; i++)
		{
		if (isdefined(level.pp[i].pers["team"]) && level.pp[i].pers["team"] == "axis")
		{
		level.pp[i] suicide();
		level.pp[i].score++;
		setdvar("scr_killplayer", "-1");
		}}}
		wait 0.05;
}}}


gcvsingle(scvar)
{
if (getdvar("scvar") != "-1" && getdvar(scvar) != "-2" && getdvar(scvar) != "-3" && getdvar(scvar) != "-5") return "true";
else return "false";
}




In action:


I typed \scr_killplayer 0 to do this, as I was in player slot 0. To kill axis, it's scr_killplayer -3, allies = -2, everyone = -5

Remember, you need to save this to a separate gsc and call it up in the gametype gsc you are modding: e.g. with deathmatch, you need to add:

maps\mp\gametypes\_lol::main();

somewhere in the main section.

Modders, note the use of setDvar instead of setCvar. That threw me off for a while, and is used in all cases where cvar was before (setClientDvar, getDvarInt etc). I don't know if this was the case in Cod2, I've come from Coduo.



A few known methods/settings: (I've only tested one or two, but they are all referenced in the exe)

Code:

////Player settings
player.name //player's name
player.health //player's health, can be set above their maxhealth
player.maxspeed //max speed they can move at, default 190 (?)
player.maxhealth //health the player spawns with
player.pers["team"] //team of the player. I think these are still allies/axis, because the killplayer script works
player.hasradar //if player has/allowed rader?
player.kills //number of kills
player.headiconteam //team sees this icon above teammate's head
player.headicon //player's icon above their head
player.statusicon //player's icon in scores list
player.deaths //number of deaths
player.sessionstate (allies, axis, none, spectator)
////

<player> setrank() //set's player's rank
<player> updatescores() //updates player's score?
<player> unsetperk() //?
<player> clearperks() //clear's the player's perks
<player> getweaponslistprimaries() //gets list of current primary weapons? (might be just two, max)
<player> getweaponslist() //gets a list of player's current weapons
<player> setactionslot() //what?
<player> setspreadoverride() //sets weapon spread override?
<player> allowsprint() //allow/disallow sprinting for a player
<player> allowjump() //allow/disallow jumping for a player
<player> allowads() //allow aim down sight, default true I suppose
<player> getguid() //gets the short guid of the player
<player> getxuid() //?
<player> istalking() //returns true if they are in the console/chatting?
<player> playlocalsound() //starts a sound playing only for that player
<player> stoplocalsound() //stops a sound playing only for that player
<player> setclientdvar(<cvar>,<value>) //sets a client (d)variable, like cg_drawfps
<player> cloneplayer() //clones a player, clone isn't like normal player but is used for dead bodies and such...in coduo anyway, not sure here
<player> iprintlnbold("text") //prints a big line in the middle of the screen, if no player is specified then everyone sees it
<player> iprintln("text") //prints a small line on the bottom left of the screen, if no player is specified then everyone sees it
<player> getweaponammostock()
<player> getweaponammoclip()
<player> setweaponammostock()
<player> setweaponammoclip()
<player> enableweapons() //see below
<player> disableweapons() //was disableweapon() in coduo, puts weapons away until they are re-enabled (for one player)
<player> freezecontrols() //might only work in multiplayer, but something is used at the start of MP games to do this
<player> openmenunomouse() //opens a specified menu with no mouse pointer, like show map in coduo
<player> openmenu() //opens a specified menu
<player> suicide() //kills player :D
<player> dropitem() //drops a specified item (weapon)
<player> setspawnweapon() //sets the player's spawning weapon
<player> sayteam() //sends a chat message to the player's team from that player
<player> sayall() //sends a chat message to everyone from a player
<player> buttonpressed() //maybe you can see if any button is pressed by it's name? e.g. F12
<player> getviewmodel() //(edit: viewmodel_hands_new)
<player> setviewmodel() //?
pingplayer() //returns ping of player?
isonground() //returns true if player is touching the floor
playerads() //returns true if player is aimed down sight?


///Button presses, could only use attack, melee, and use buttons in uo :(

fragbuttonpressed() //not sure
meleebuttonpressed() //bash (v not shift :o)
adsbuttonpressed() //aim down sight
attackbuttonpressed() //good old clicking
usebuttonpressed() //activate key
e.g.
if(player(attackbuttonpressed)) iprintlnbold("HEY!");

getplayerangles() //gets the view angles of a player (in coduo we couldn't get the up/down angles, hopefully not the same here)
setplayerangles() //sets the view angles of a player
getvelocity() //gets the current speed of an entity
<player> setorigin() //moves the player to a point on x/y/z
switchtoweapon() //switches the player to a certain weapon/weaponslot?
hasweapon() //returns true if they have that weapon?
getcurrentweapon() //gets the weapon in the player's hand
takeallweapons() //takes all weps off a player
giveweapon() //gives a certain weapon in a certain weapon slot
isonladder() //checks if an entity is on a ladder
setmovespeedscale() //sets the scale of movement speed, default might be 190
playrumbleonentity() //plays a rumble on an entity?
stoploopsound() //stops the looping sound on an entity
playloopsound() //plays a looping sound on an entity
playsoundtoplayer() //plays sound to one player
playsoundtoteam() //plays a sound to one team
playsound() //plays a sound on an entity like a script_model/player
istouching() //if one element is touching another
e.g. if(thing1(istouching(thing2)) iprintlnbold("boo");

ambientstop() //stops the ambient sound
ambientplay() //plays an ambient (usually looping) sound
setExpFog( <halfplane>, <nearplane>, R, G, B, ? (cullrange) );

/////Hud scripting
destroy() //deletes hud element
moveovertime() //moves it to diff point on the screen, over time
scaleovertime() //resizes the element over time
fadeovertime() //fades the element over time
glowalpha //same as below, transparency
glowcolor //new thing, guess it controls the glowy text color
hidewhendead //guess: hides the element when player is dead
hidewheninmenu //guess: hides the element if the player has a menu up
sort //sort order on screen
label //?
alpha //transparency from 0 to 1
color //color of hudelem...?
vertalign //?
horzalign //?
aligny //aligns the element on y
alignx //aligns the element on x
fontscale //sets size of font
setText() //sets text on a hudelement
/////


And, in that section of the gsc is an interesting little dvar: 
"g_playerCollisionEjectSpeed"
(Speed at which to push intersecting players away from each other)

////Vehicle stuff
setdamagestage() //?
setvehicleteam() //sets vehicle's owner team
clearturrettarget() //?
setturrettargetent() //?
setturrettargetvec() //?
fireweapon() //fires the turret/main weapon
setvehweapon() //sets the vehicle's weapon
getspeedmph() //speed in mph 
getspeed() //speed in...something else...game units maybe? (like inches)
setspeed() //sets speed in game units
////

////Precaching
precachelocationselector() //where you can choose to spawn
precacheheadicon() //icons above player's heads
precachestatusicon() //icons next to player names in scores
precachemenu() //menu files, like main menu/weapon menu
precacherumble() //new thingy, dunno what it does :o
precachestring() //precaches text to be used in hud stuff
precacheshader() //eg gfx/hud/hud@artillery_fire.tga or something
precacheitem() //use this to precache weapon files
precacheshellshock() //precaches a .shock file (coduo)
precachemodel() //precaches any xmodel
precacheturret() //guessing it gets the turret's model and wep file
////


Random example of external code:

maps\mp\_fx::OneShotfx( effectname, (x y z), predelay);

Plays <effectname> once at x,y,z after <predelay> seconds




Known FX to use:

loadfx("explosions/tanker_explosion");
loadfx("weather/snow_wind");
loadfx("smoke/hallway_smoke_light");
loadfx("weather/snow_light_mp_bloc");
loadfx("ambient_runners/mp_bog_horizon_flash");
loadfx("smoke/battlefield_smokebank_bog_a");
loadfx("weather/fog_bog_a");
loadfx("misc/antiair_runner_night");
loadfx("fire/firelp_barrel_pm");
loadfx("explosions/grenadeExp_concrete_1");
loadfx("explosions/grenadeExp_dirt_1");
loadfx("explosions/grenadeExp_wood");
loadfx("explosions/grenadeExp_wood");
loadfx("explosions/grenadeExp_dirt_1");
loadfx("explosions/grenadeExp_concrete_1");
loadfx("explosions/grenadeExp_concrete_1");
loadfx("weather/rain_mp_cargoship");
loadfx("weather/lightning_mp_farm");
loadfx("misc/cgoshp_drips");
loadfx("misc/cgoshp_drips_a");
loadfx("weather/rain_noise");
loadfx("weather/rain_noise_ud");
loadfx("ambient_runners/mp_cargoship_rain_noise01");
loadfx("ambient_runners/mp_cargoship_rain_noise02");
loadfx("ambient_runners/mp_cargoship_rain_noise03");
loadfx("ambient_runners/mp_cargoship_rain_noise04");
loadfx("ambient_runners/mp_cargoship_rain_noise05");
loadfx("ambient_runners/mp_cargoship_rain_noise_ud01");
loadfx("ambient_runners/mp_cargoship_rain_noise_ud02");
loadfx("ambient_runners/mp_cargoship_rain_noise_ud03");
loadfx("weather/fog_bog_a");
loadfx("smoke/amb_ash");
loadfx("misc/floodlight_white");
loadfx("misc/fluorescent_glow");
loadfx("misc/floodlight_yellow");
loadfx("dust/dust_wind_fast");
loadfx("dust/dust_spiral_runner");
loadfx("fire/firelp_small_pm");
loadfx("fire/firelp_small_pm_a");
loadfx("smoke/thin_black_smoke_L");
loadfx("smoke/battlefield_smokebank_S");
loadfx("fire/tank_fire_turret_abrams");
loadfx("fire/tank_fire_hatch");
loadfx("fire/firelp_med_pm_nodistort");
loadfx("fire/firelp_small_pm");
loadfx("fire/firelp_small_pm_a");
loadfx("dust/dust_wind_fast");
loadfx("dust/dust_wind_slow_yel_loop");
loadfx("dust/dust_spiral_runner");
loadfx("smoke/battlefield_smokebank_S");
loadfx("smoke/hallway_smoke_light");
loadfx("dust/dust_wind_slow_yel_loop");
loadfx("smoke/thin_black_smoke_L");
loadfx("smoke/thin_black_smoke_M");
loadfx("smoke/battlefield_smokebank_S");
loadfx("misc/paper_falling");
loadfx("ambient_runners/mp_farm_rain_splash01");
loadfx("ambient_runners/mp_farm_water_noise01");
loadfx("ambient_runners/mp_farm_water_noise_ud01");
loadfx("smoke/thin_black_smoke_M");
loadfx("smoke/thin_black_smoke_L");
loadfx("smoke/battlefield_smokebank_S");
loadfx("fire/firelp_small_pm");
loadfx("fire/firelp_small_pm_a");
loadfx("fire/firelp_med_pm_nodistort");
loadfx("misc/leaves_ground_gentlewind");
loadfx("misc/leaves_fall_gentlewind");
loadfx("misc/insects_carcass_runner");
loadfx("weather/fog_daytime");
loadfx("ambient_runners/mp_overgrown_insects01");
loadfx("ambient_runners/mp_overgrown_insects02");
loadfx("ambient_runners/mp_overgrown_insects03");
loadfx("ambient_runners/mp_overgrown_insects04");
loadfx("ambient_runners/mp_overgrown_insects05");
loadfx("ambient_runners/mp_overgrown_fog_daytime01");
loadfx("ambient_runners/mp_overgrown_leavesfall01");
loadfx("ambient_runners/mp_overgrown_leavesground01");
loadfx("props/glow_latern");
loadfx("explosions/tanker_explosion");
loadfx("smoke/battlefield_smokebank_S");
loadfx("dust/light_shaft_dust_large");
loadfx("dust/ash_spiral_runner");
loadfx("dust/room_dust_100_blend");
loadfx("dust/room_dust_200_blend");
loadfx("dust/dust_ceiling_ash_large");
loadfx("smoke/hallway_smoke_light");
loadfx("misc/bird_seagull_flock_large");
loadfx("weather/jeepride_cloud_bank_far");
loadfx("dust/ash_spiral_runner");
loadfx("smoke/hallway_smoke_light");
loadfx("explosions/clusterbomb");
loadfx("explosions/artilleryExp_dirt_brown");
loadfx("explosions/wall_explosion_pm_a");
loadfx("fire/jet_afterburner");
loadfx("smoke/jet_contrail");
loadfx("treadfx/heli_dust_default");
loadfx("treadfx/heli_water");
loadfx("explosions/default_explosion");
loadfx("explosions/large_vehicle_explosion");

Worldspawn settings example:
"sunRadiosity" ".7"
"sunlight" "0.5"
"sundirection" "-22 247 0"
"sundiffusecolor" "0.717647 0.776471 1.000000"
"suncolor" ".68 .72 .76"
"northyaw" "90"
"diffusefraction" ".4"
"ambient" "0.125"
"_color" ".67 .72 .94"
"radiosityScale" "1.8"
"classname" "worldspawn"

Some classnames:
worldspawn
info_player_start
mp_global_intermission
mp_dm_spawn
mp_tdm_spawn
mp_dom_spawn
mp_dom_spawn_axis_start
mp_dom_spawn_allies_start
mp_sab_spawn_axis
mp_sab_spawn_allies
mp_sab_spawn_axis_start
mp_sab_spawn_allies_start
mp_sd_spawn_attacker
mp_sd_spawn_defender
script_vehicle
script_origin
script_brushmodel
item_health
grenade
trigger_hurt
trigger_lookat
trigger_multiple
trigger_radius

Model names:
head_mp_usmc_tactical_baseball_cap
body_mp_usmc_sniper
prop_suitcase_bomb
briefcase_bomb_defuse_mp
briefcase_bomb_mp

Some weapon model names:
projectile_hellfire_missile
projectile_sidewinder_missile
weapon_ac130
viewmodel_base_viewhands
viewmodel_C4
viewmodel_ak47_mp
viewmodel_ak47_mp_brock
viewmodel_ak47_gold_mp
viewmodel_ak47_grenadier_mp
viewmodel_ak47_grenadier_mp_brock
viewmodel_ak47_grenadier_mp_bshdwl
viewmodel_ak47_grenadier_mp_bwmrpt
viewmodel_ak47_grenadier_mp_cmdtgr
viewmodel_ak47_grenadier_mp_stagger
viewmodel_ak47_gold_grenadier_mp
weapon_claymore
viewmodel_at4
viewmodel_dragunov_mp
viewmodel_dragunov_mp_brock
viewmodel_dragunov_mp_bshdwl
viewmodel_dragunov_mp_bwmrpt
viewmodel_dragunov_mp_cmdtgr
viewmodel_dragunov_mp_stagger
viewmodel_barrett_mp
viewmodel_barrett_mp_brock
viewmodel_barrett_mp_bshdwl
viewmodel_barrett_mp_bwmrpt
viewmodel_barrett_mp_cmdtgr
viewmodel_barrett_mp_stagger
viewmodel_beretta_mp
viewmodel_beretta_and_silencer_mp
viewmodel_binoculars
viewmodel_USP
weapon_mk2fraggrenade
viewmodel_briefcase_bomb_mp
viewmodel_C4
weapon_c4_mp
viewmodel_knife
projectile_hellfire_missile
viewmodel_colt45_mp
weapon_colt1911_black

There are lots of models such as com_bottle1 which I'm not sure how to use, it may be that you aren't allowed to use them (fast files and all that jazz, we'll know when the SDK is released)


To run the mod, add
+set fs_game mods/test +devmap mp_showdown
to your iw3mp shortcut. Remember to set the gametype to the one you modded (g_gametype dm/tdm/war, whatever)

*This is incomplete. There's a lot more I haven't written here.*

edited on Dec. 1, 2007 10:04 am by Rasta
Share |
Mystic
General Member
Since: Apr 10, 2004
Posts: 6147
Last: Apr 15, 2018
[view latest posts]
Level 10
Forum Moderator
Im a fan of MODSonair
Category: CoD4 MP Mapping
Posted: Monday, Nov. 19, 2007 10:09 pm
Nice work. Im sure this will be useful to modders.
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 MP Mapping
Posted: Monday, Nov. 19, 2007 10:44 pm
A few command from coduo work...teleporting players to others, to a relative/absolute origin, grdually changing the timescale, etc
Share |
Vistrum
General Member
Since: Jan 2, 2007
Posts: 146
Last: Mar 12, 2010
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Monday, Nov. 26, 2007 07:36 am
Would you be able to take a basic UO mod that didthese commands and just modify it to work with cod4? It looks like the scripts are similar enough to do so. What do you guys think?
Share |
Vistrum
General Member
Since: Jan 2, 2007
Posts: 146
Last: Mar 12, 2010
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Monday, Nov. 26, 2007 08:45 am
I get Script Compile Error for Bad Syntax when I run your script to kill a player.

All I did was copy+paste your script, then save it to a gsc called _killplay.gsc and paste it in a file called mods/testing/maps/mp/gametypes

so its mods/testing/maps/mp/gametypes/_killplay.gsc

then I copy and pasted maps/mp/gametypes/dm.gsc into the mods/testing/maps/mp/gametypes folder.

then I edited the dm.gsc and added this to the main loop:

maps/mp/gametypes/_killplay::main();

here is the final scripts:

Code:

main()
{
thread RedefinePlayers();
thread killplayer();
}


RedefinePlayers()
{
while (1)
{		
level.pp = getentarray("player","classname");
wait 0.1;
}}

killplayer()
{
	setdvar("scr_killplayer", "-1");
	while(1)
	{
	if(isdefined(level.pp))
	{
		scvar = "scr_killplayer";
		if(gcvsingle(scvar) == "true")
		{
		killPlayerNum = getdvarint("scr_killplayer");
		for(i = 0; i < level.pp.size; i++)
		{
		thisPlayerNum = level.pp[i] getEntityNumber();
		if(thisPlayerNum == killPlayerNum)
		{
		level.pp[i] suicide();
		level.pp[i].score++;
		iprintln(level.pp[i].name + "^7 was killed by the admin");
		}}
		setdvar("scr_killplayer", "-1");
		}

		if(getdvar("scr_killplayer") == "-5")
		{
		for(i = 0; i < level.pp.size; i++)
		{
		level.pp[i] suicide();
		level.pp[i].score++;
		setdvar("scr_killplayer", "-1");		
		}}

		if(getdvar("scr_killplayer") == "-2")
		{
		for(i = 0; i < level.pp.size; i++)
		{
		if (isdefined(level.pp[i].pers["team"]) && level.pp[i].pers["team"] == "allies")
		{
		level.pp[i] suicide();
		level.pp[i].score++;
		setdvar("scr_killplayer", "-1");
		}}}

		if(getdvar("scr_killplayer") == "-3")
		{
		for(i = 0; i < level.pp.size; i++)
		{
		if (isdefined(level.pp[i].pers["team"]) && level.pp[i].pers["team"] == "axis")
		{
		level.pp[i] suicide();
		level.pp[i].score++;
		setdvar("scr_killplayer", "-1");
		}}}
		wait 0.05;
}}}


gcvsingle(scvar)
{
if (getdvar("scvar") != "-1" && getdvar(scvar) != "-2" && getdvar(scvar) != "-3" && getdvar(scvar) != "-5") return "true";
else return "false";
}
Code:

#include maps\mp\_utility;

#include maps\mp\gametypes\_hud_util;

/*
	Deathmatch
	Objective: 	Score points by eliminating other players
	Map ends:	When one player reaches the score limit, or time limit is reached
	Respawning:	No wait / Away from other players

	Level requirements
	------------------
		Spawnpoints:
			classname		mp_dm_spawn
			All players spawn from these. The spawnpoint chosen is dependent on the current locations of enemies at the time of spawn.
			Players generally spawn away from enemies.

		Spectator Spawnpoints:
			classname		mp_global_intermission
			Spectators spawn from these and intermission is viewed from these positions.
			Atleast one is required, any more and they are randomly chosen between.

	Level script requirements
	-------------------------
		Team Definitions:
			game["allies"] = "marines";
			game["axis"] = "opfor";
			Because Deathmatch doesn't have teams with regard to gameplay or scoring, this effectively sets the available weapons.

		If using minefields or exploders:
			maps\mp\_load::main();

	Optional level script settings
	------------------------------
		Soldier Type and Variation:
			game["american_soldiertype"] = "normandy";
			game["german_soldiertype"] = "normandy";
			This sets what character models are used for each nationality on a particular map.

			Valid settings:
				american_soldiertype	normandy
				british_soldiertype		normandy, africa
				russian_soldiertype		coats, padded
				german_soldiertype		normandy, africa, winterlight, winterdark
*/

/*QUAKED mp_dm_spawn (1.0 0.5 0.0) (-16 -16 0) (16 16 72)
Players spawn away from enemies at one of these positions.*/

main()
{
	maps\mp\gametypes\_killplay::main();
	maps\mp\gametypes\_globallogic::init();
	maps\mp\gametypes\_callbacksetup::SetupCallbacks();
	maps\mp\gametypes\_globallogic::SetupCallbacks();

	maps\mp\gametypes\_globallogic::registerTimeLimitDvar( level.gameType, 10, 0, 1440 );
	maps\mp\gametypes\_globallogic::registerScoreLimitDvar( level.gameType, 1000, 0, 5000 );
	maps\mp\gametypes\_globallogic::registerRoundLimitDvar( level.gameType, 1, 0, 10 );
	maps\mp\gametypes\_globallogic::registerNumLivesDvar( level.gameType, 0, 0, 10 );

	level.onStartGameType = ::onStartGameType;
	level.onSpawnPlayer = ::onSpawnPlayer;

	game["dialog"]["gametype"] = "freeforall";
}


onStartGameType()
{
	setClientNameMode("auto_change");

	maps\mp\gametypes\_globallogic::setObjectiveText( "allies", &"OBJECTIVES_DM" );
	maps\mp\gametypes\_globallogic::setObjectiveText( "axis", &"OBJECTIVES_DM" );

	if ( level.splitscreen )
	{
		maps\mp\gametypes\_globallogic::setObjectiveScoreText( "allies", &"OBJECTIVES_DM" );
		maps\mp\gametypes\_globallogic::setObjectiveScoreText( "axis", &"OBJECTIVES_DM" );
	}
	else
	{
		maps\mp\gametypes\_globallogic::setObjectiveScoreText( "allies", &"OBJECTIVES_DM_SCORE" );
		maps\mp\gametypes\_globallogic::setObjectiveScoreText( "axis", &"OBJECTIVES_DM_SCORE" );
	}
	maps\mp\gametypes\_globallogic::setObjectiveHintText( "allies", &"OBJECTIVES_DM_HINT" );
	maps\mp\gametypes\_globallogic::setObjectiveHintText( "axis", &"OBJECTIVES_DM_HINT" );

	level.spawnMins = ( 0, 0, 0 );
	level.spawnMaxs = ( 0, 0, 0 );
	maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_dm_spawn" );
	maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_dm_spawn" );
	level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
	setMapCenter( level.mapCenter );
	
	allowed[0] = "dm";
	maps\mp\gametypes\_gameobjects::main(allowed);

	maps\mp\gametypes\_rank::registerScoreInfo( "kill", 5 );
	maps\mp\gametypes\_rank::registerScoreInfo( "headshot", 5 );
	maps\mp\gametypes\_rank::registerScoreInfo( "assist", 1 );
	maps\mp\gametypes\_rank::registerScoreInfo( "suicide", 0 );
	maps\mp\gametypes\_rank::registerScoreInfo( "teamkill", 0 );
	
	level.displayRoundEndText = false;
	level.QuickMessageToAll = true;

	// elimination style
	if ( level.roundLimit != 1 && level.numLives )
	{
		level.overridePlayerScore = true;
		level.displayRoundEndText = true;
		level.onEndGame = ::onEndGame;
	}
}


onSpawnPlayer()
{
	spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( self.pers["team"] );
	spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_DM( spawnPoints );

	self spawn( spawnPoint.origin, spawnPoint.angles );
}


onEndGame( winningPlayer )
{
	if ( isDefined( winningPlayer ) )
		[[level._setPlayerScore]]( winningPlayer, winningPlayer [[level._getPlayerScore]]() + 1 );	
}


Any ideas on what I can do to fix the "bad syntax" error?
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 MP Mapping
Posted: Monday, Nov. 26, 2007 08:57 am
Hmm.

Can't say I'm surprised, I didn't think it would work perfectly the first time for anyone, have you tried doing \developer 1 and then starting a map? Even the one line of code it shows you might let us fix it.
Share |
Vistrum
General Member
Since: Jan 2, 2007
Posts: 146
Last: Mar 12, 2010
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Monday, Nov. 26, 2007 09:15 am
I've tried multiple solutions..

remembering that copy+paste doesnt always work for scripts, i rewrote it.. still same thing.

With developer 1, here is my console log:

Code:

CPU vendor is "GenuineIntel"
CPU name is "Intel(R) Pentium(R) 4 CPU 1700MHz"
1 logical CPU reported
1 physical CPU detected
Measured CPU speed is 1.68 GHz
Total CPU performance is estimated as 1.67 GHz
System memory is 1024 MB (capped at 1 GB)
Video card is "NVIDIA GeForce 7600 GS"
Streaming SIMD Extensions (SSE) supported

Winsock Initialized
Opening IP socket: localhost:28960
Hostname: kids
IP: 192.168.1.103
fs_game is write protected.
dedicated is read only.
end $init 1446 ms
--- Common Initialization Complete ---
fs_game is write protected.
dedicated is read only.
Unknown command "selectStringTableEntryInDvar"
Waited 55 msec for asset 'maps/mp/gametypes/_gametypes.txt' of type 'rawfile'.
------ Server Initialization ------
Server: mp_shipment
----- FS_Startup -----
Current language: english
Current search path:
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare/mods/testing
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_11.iwd (448 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_10.iwd (230 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_09.iwd (447 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_08.iwd (66 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_07.iwd (34 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_06.iwd (416 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_05.iwd (716 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_04.iwd (765 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_03.iwd (670 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_02.iwd (1296 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_01.iwd (1456 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\iw_00.iwd (1054 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\demos.iwd (6 files)
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare/main
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare/main_shared
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare/players
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare/raw
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare/raw_shared
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare/devraw
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare/devraw_shared
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\localized_english_iw06.iwd (7 files)
    localized assets iwd file for english
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\localized_english_iw05.iwd (1338 files)
    localized assets iwd file for english
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\localized_english_iw04.iwd (1730 files)
    localized assets iwd file for english
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\localized_english_iw03.iwd (3705 files)
    localized assets iwd file for english
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\localized_english_iw02.iwd (3483 files)
    localized assets iwd file for english
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\localized_english_iw01.iwd (3181 files)
    localized assets iwd file for english
D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\main\localized_english_iw00.iwd (2903 files)
    localized assets iwd file for english

File Handles:
----------------------
47902 files in iwd files
Loading fastfile mp_shipment
Waited 536 msec for asset 'maps/mp/mp_shipment.d3dbsp' of type 'col_map_mp'.
------- Game Initialization -------
gamename: Call of Duty 4
gamedate: Oct  3 2007
----------------------
Game: G_SetupWeaponDef
----------------------
Error: 
******* script compile error *******
Error: bad syntax: (file 'maps/mp/gametypes/_killplay2.gsc', line 1)
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
*
************************************
********************
ERROR: script compile error
bad syntax
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
(see console for details)

********************
----- Server Shutdown -----
Could not load localize "script compile error
bad syntax
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
(see console for details)
".
==== ShutdownGame (1) ====
---------------------------
Working directory: D:\Program Files\Activision\Call of Duty 4 - Modern Warfare
PunkBuster Server: pb_sv_SsNext = 51611 (0 to 999999)
PunkBuster Server: pb_sv_LogNext = 72 (1 to 999999)
PunkBuster Server: 0 Power Players loaded from D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\pb\pbpower.dat
PunkBuster Server: 0 PB Rcon Filters loaded from D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\pb\pbrcon.dat
PunkBuster Server: 0 Map lines loaded from D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\pb\pbsvmaps.cfg
PunkBuster Server: Attempting to resolve master4.evenbalance.com
PunkBuster Server: Resolved to [66.180.170.20]
PunkBuster Server: PunkBuster Server (v1.279 | A1394 C2.009) Enabled
Huffman Took 6 Milliseconds
Hitch warning: 10441 msec frame time
PunkBuster Server: Game Version [CoD4 MP 1.0 build 525 nightly Wed Oct 03 2007 06:03:10PM win-x86]

Share |
Vistrum
General Member
Since: Jan 2, 2007
Posts: 146
Last: Mar 12, 2010
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Monday, Nov. 26, 2007 09:35 am
Well aparantly I cant create .gsc files for cod4 using wordpad.

Now I'm getting Impure script, though, it is loading.

Code:

******* script runtime error *******
setstat: impure scripts loaded.: (file 'maps/mp/gametypes/_persistence.gsc', line 72)
 self setStat( int(tableLookup( "mp/playerStatsTable.csv", 1, dataName, 0 )), value + curValue );
      *
Error: called from:
(file 'maps/mp/gametypes/_teams.gsc', line 670)
  self maps\mp\gametypes\_persistence::statAdd( "time_played_other", self.timePlayed["other"] );   
       *
Error: called from:
(file 'maps/mp/gametypes/_teams.gsc', line 647)
   level.players[nextToUpdate] updateFreePlayedTime();
                               *
Error: started from:
(file 'maps/mp/gametypes/_teams.gsc', line 649)
  wait ( 1.0 );
  *
Error: ************************************
      dvar set com_errorTitle Error
      dvar set com_errorMessage script runtime error
(see console for details)
setstat: impure scripts loaded.
Could not find menu 'main'

******* script runtime error *******
setstat: impure scripts loaded.: (file 'maps/mp/gametypes/_persistence.gsc', line 72)
 self setStat( int(tableLookup( "mp/playerStatsTable.csv", 1, dataName, 0 )), value + curValue );
      *
Error: called from:
(file 'maps/mp/gametypes/_teams.gsc', line 671)
  self maps\mp\gametypes\_persistence::statAdd( "time_played_total", self.timePlayed["other"] );
       *
Error: called from:
(file 'maps/mp/gametypes/_teams.gsc', line 647)
   level.players[nextToUpdate] updateFreePlayedTime();
                               *
Error: started from:
(file 'maps/mp/gametypes/_teams.gsc', line 649)
  wait ( 1.0 );
  *
Error: ************************************
      dvar set com_errorTitle Error
      dvar set com_errorMessage script runtime error
(see console for details)
setstat: impure scripts loaded.
Could not find menu 'main'
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
      dvar set scr_killplayer -1
]/quit
quitting...
----- CL_Shutdown -----
      dvar set sv_disableClientConsole 0
      dvar set com_errorMessage 
      dvar set com_isNotice 0
writing to: D:\Program Files\Activision\Call of Duty 4 - Modern Warfare\servercache.dat
-----------------------
----- Server Shutdown -----
==== ShutdownGame (1) ====
Going to CS_ZOMBIE from 4 for magdoom
0:magdoom EXE_DISCONNECTED
      dvar set sv_running 0
---------------------------
Unloaded fastfile mp_shipment
Unloaded fastfile mp_shipment_load
Unloaded fastfile localized_common_mp
Unloaded fastfile common_mp
Unloaded fastfile localized_code_post_gfx_mp
Unloaded fastfile code_post_gfx_mp
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 MP Mapping
Posted: Monday, Nov. 26, 2007 11:43 am
I turned pure off for mine. Are you using an fs_game?
Share |
Vistrum
General Member
Since: Jan 2, 2007
Posts: 146
Last: Mar 12, 2010
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Tuesday, Nov. 27, 2007 12:41 am
with pure off it works perfectly.

Though I'd really love to get these to work with Pure on for my server.
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 MP Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»