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

Members Online

»
0 Active | 67 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
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 subscribe
Author Topic: Exceeded Maximum Number of Script Variables??
rogue722
General Member
Since: Jan 17, 2006
Posts: 175
Last: Mar 29, 2007
[view latest posts]
Level 4
Category: CoD Mapping
Posted: Friday, Mar. 24, 2006 11:44 pm
Hey guys, ran into a problem I have never seen before. I decided to finally make a mp map. Now I am trying to add a thing where the person can go over to a mortar launcher xmodel, press Use, and fire a mortar shell and have it land randomly, do some damage. This will only work 4 times, because there are only 4 shell models on the ground [casanova].

Now, I was loading it and the map loads fine, so I run over to the launcher, press Use, and I get a script compile error that says
Quote:
exceeded maximum number of script variables

pointing to the line that says
Quote:
thread mortar_fire();


Here is my .gsc file, the only one I have for the map:
Code:

main()
{
	maps\mp\_load::main();
	setCullFog(0, 3000, 0.8, 0.8, 0.8, 0);
	ambientPlay("ambient_mp_pavlov");
	
	game["allies"] = "russian";
	game["axis"] = "german";
	
	game["russian_soldiertype"] = "conscript";
	game["russian_soldiervariation"] = "winter";
	game["german_soldiertype"] = "waffen";
	game["german_soldiervariation"] = "winter";
	
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	
	thread precache();
	thread cover();
	thread fires();
	
	level.tshells = 4;
	thread mortars();
}

precache()
{	
	level._effect["fire1"] = loadfx("fx/fire/tank_burn.efx");
	level._effect["mortar_explosion"][0] = 

loadfx("fx/impacts/snow_mortar.efx");
	level._effect["mortar_explosion"][1] = 

loadfx("fx/impacts/snowhit_small.efx");
}

cover()
{
	trigger = getent("cover_trigger","targetname");
	cover = getent("cover","targetname");
	trigger waittill("trigger");
	
	cover movex(136, 2, .5, .5);
	wait(10);
	cover movex(-136, 2, .5, .5);
	
	thread cover();
}

fires()
{
	maps\mp\_fx::loopfx("fire1", (2648,-365,8), 0.2);
}

mortars()
{
	shell1 = getent("shell1","targetname");
	shell2 = getent("shell2","targetname");
	shell3 = getent("shell3","targetname");
	shell4 = getent("shell4","targetname");
	trigger = getent("mortar_trigger","targetname");
	trigger waittill("trigger");
	
	thread mortar_ammo(shell1, shell2, shell3, shell4);
	
	if(level.tshells == 0)
	{
		return;
	}
	while(1)
	{
		if(level.tshells > 0)
		{
			thread mortar_fire();
		}
	}
}

mortar_ammo(shell1, shell2, shell3, shell4)
{
	if(isdefined(shell1))
	{
		shell1 delete();
		level.tshells--;
		return;
	}
	if(!isdefined(shell1))
	{
		if(isdefined(shell2))
		{
			shell2 delete();
			level.tshells--;
			return;
		}
	}
	if(!isdefined(shell1))
	{
		if(!isdefined(shell2))
		{
			if(isdefined(shell3))
			{
				shell3 delete();
				level.tshells--;
				return;
			}
		}
	}
	if(!isdefined(shell1))
	{
		if(!isdefined(shell2))
		{
			if(!isdefined(shell3))
			{
				if(isdefined(shell4))
				{
					shell4 delete();
					level.tshells--;
					return;
				}
			}
		}
	}
}

mortar_fire()
{
	sound = getent("mortar_sound","targetname");
	mortars = getentarray("mortars","targetname");
	
	sound playsound("mortar_launch");
	wait(2);
	mortars[rand] playsound("mortar_incoming");
	mort_org = mortars[rand] getorigin();
	wait(1);
	
	playfx (level._effect["mortar_explosion"][randomint(2)], mort_org);
	mortars[rand] playsound("mortar_explosion");
	radiusDamage(mortar[rand].origin + (0,0,12), 500, 250, 5);
}

I have no idea what the error could mean, so if anyone knows that would be awsome, I'm dying to see if this will actually work. By the way, this is a custom script I made from scratch and I'm trying to see if I can get it to work, so theres no way that I could have copied and pasted wrong from somewhere because its original, unless I just forgot to add something to it.

-Rogue

edited on Mar. 24, 2006 06:45 pm by rogue722
Share |
Slime0
General Member
Since: Aug 25, 2005
Posts: 63
Last: Apr 23, 2006
[view latest posts]
Level 3
Category: CoD Mapping
Posted: Saturday, Mar. 25, 2006 04:29 am
Generally this error means that you have an infinite loop or infinite recursion.

The problem *might* be here:
Code:

	while(1)
	{
		if(level.tshells > 0)
		{
			thread mortar_fire();
		}
	}


the mortar_fire function doesn't change level.tshells, so if level.tshells is greater than zero, the loop will go on forever and you'll keep creating mortar_fire threads, each of which makes a few variables, so eventually (very quickly in real life) you run out.
Share |
Restricted Access Topic is Locked 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

»