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
.
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