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

Members Online

»
0 Active | 17 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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
Category: CoD Mapping
CoD mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page
subscribe
Author Topic: beginners guide to CoD1 Mod Scripting?
Duckster22
General Member
Since: Aug 22, 2011
Posts: 6
Last: Aug 23, 2011
[view latest posts]
Level 0
Category: CoD Mapping
Posted: Tuesday, Aug. 23, 2011 06:18 pm
So does anybody happen toknow how to explain what this means?

level.mrc_firstaid = cvardef("mrc_firstaid",0,0,1,"int")

Ok so we are setting a global variable I figure but what is the array of values mean?

mrc_firstaid is the name right?
but whats 0
then 0
then 1
Ok type is int I get that.
Please if someone could explain this would be awesome!
Share |
BrainStorm
General Member
Since: Aug 26, 2009
Posts: 24
Last: Jan 20, 2014
[view latest posts]
Level 1
Category: CoD Mapping
Posted: Tuesday, Aug. 23, 2011 06:27 pm
check in one of the .gsc. you'll find what the cvardef(.....) handles

yes mrc_firstaid is the name of the cvar being set

default
min
max
type

If I remember correctly.
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD Mapping
Posted: Tuesday, Aug. 23, 2011 06:36 pm
Duckster22 writes...
Quote:
So does anybody happen toknow how to explain what this means?

level.mrc_firstaid = cvardef("mrc_firstaid",0,0,1,"int")

Ok so we are setting a global variable I figure but what is the array of values mean?

mrc_firstaid is the name right?
but whats 0
then 0
then 1
Ok type is int I get that.
Please if someone could explain this would be awesome!


cvardef() is a custom function invented by a modder by the name of Ravir (Clifton Cline), who created Demolition gametype/mod for COD1. It's purpose is to parse a cvar according to its type (sting, int, or float), according to how it is to be executed for a map, or a gametype, or both. It sets a minimum, a maximum, and a default value:

Code:
cvardef( varname, vardefault, min, max, type )
{
	mapname = getcvar( "mapname" );

	gametype = getcvar( "g_gametype" );

	tempvar = varname + "_" + gametype;
	if( getcvar( tempvar ) != "" ) 
		varname = tempvar; 	

	tempvar = varname + "_" + mapname;
	if( getcvar( tempvar ) != "" )
		varname = tempvar;

	switch( type )
	{
		case "int":
			if( getcvar( varname ) == "" )
				definition = vardefault;
			else
				definition = getcvarint( varname );
			break;
		case "float":
			if( getcvar( varname ) == "" )
				definition = vardefault;
			else
				definition = getcvarfloat( varname );
			break;
		case "string":
		default:
			if( getcvar( varname ) == "" )
				definition = vardefault;
			else
				definition = getcvar( varname );
			break;
	}

	if( ( type == "int" || type == "float" ) && definition < min )
		definition = min;

	if( ( type == "int" || type == "float" ) && definition > max )
		definition = max;

	return definition;
}


edited on Aug. 23, 2011 02:36 pm by Tally
Share |
Duckster22
General Member
Since: Aug 22, 2011
Posts: 6
Last: Aug 23, 2011
[view latest posts]
Level 0
Category: CoD Mapping
Posted: Tuesday, Aug. 23, 2011 06:54 pm
Awesome guys thanks for the help. I actually had basically just figured it out on my own when I checked and saw your replies so it awesome to have confirmed my suspicions.
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty : CoD 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

»