| Author |
Topic: Script gives an error, please help |
|
|
Category: CoD2 Scripting Posted: Wednesday, Jun. 27, 2007 11:57 am |
 |
Heey,
Playername was as free as he can go, and made me a mortar script + prefab for my map! (thanks playername
But, now the problem;
Error is:
Code: ******* script runtime error *******
undefined is not an object: (file 'maps/mp/mortars.gsc', line 18)
trig waittill("trigger",other);
*
called from:
(file 'maps/mp/mortars.gsc', line 8)
thread mortar();
*
called from:
(file 'maps/mp/mp_geilheond.gsc', line 4)
maps\mp\mortars::main();
*
started from:
(file 'maps/mp/mp_geilheond.gsc', line 1)
main()
*
************************************
Map gsc:
Code: main()
{
maps\mp\_load::main(); // standart
maps\mp\mortars::main(); // loading the mortar script
maps\mp\mp_geilheond_drown::main(); // drown in the water
thread wall();
}
wall()
{
wall = getent ("auto1", "targetname");
wall2 = getent ("auto2", "targetname");
wall2 hide();
trig = getent ("wall_trig", "targetname");
trig waittill ("trigger");
wall delete();
wait 0.5;
wall2 show();
orgmove = getent ("mortar_hit", "targetname");
orgmove movez (-168, 1);
}
Script is:
Code: main()
{
// Specify two different explosion effects to randomly play
level._effect["mortar_explosion"][0] = loadfx ("fx/impacts/newimps/dirthit_mortar2day.efx");
level._effect["mortar_explosion"][1] = loadfx ("fx/impacts/newimps/minefield.efx");
level._effect["mortarflash"] = loadfx("fx/muzzleflashes/mortarflash.efx");
// send down the mortars
thread mortar();
}
mortar()
{
//define trigger
trig = getent("trigger_mortar","targetname");
// !!! ERROR LINE BELOW wait untill trigger is used !!!
trig waittill("trigger",other);
thread mortars();
}
mortars()
{
// Get an array of all the mortars in the level
mortar = getentarray ("mortar_hit","targetname");
// Loop over and over while the level is loaded
{
// Wait 5-10 seconds randomly before doing a mortar explosion
wait (7 + randomfloat(7));
// Make sure there are no players close enough to this mortar to kill them
GoodPosition = false;
{
// Pick a random mortar location
rand = randomint(mortar.size);
// Check if any players are within 200 of the randomly picked mortar
GoodPosition = true;
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
if (distance(mortar[rand].origin,players[i].origin) < 200)
{
GoodPosition = false;
break;
}
}
}
// Play the incomming mortar sound effect
mortar[rand] playsound("mortar_incoming");
// Wait 2 seconds while the imcomming sound plays
wait 2;
// Do the explosion effect
origin = mortar[rand] getorigin();
playfx (level._effect["mortar_explosion"][randomint(2)], origin);
// Play the explosion sound
mortar[rand] playsound("mortar_explosion");
// Make the explosion cause damage
radiusDamage(mortar[rand].origin + (0,0,12), 500, 50, 100);
}
thread mortar();
}
CUTOUT:
Error lines:
// ![[exclamation]](images/BBCode/smilies/exclamation.gif) ERROR LINE BELOW wait untill trigger is used ![[exclamation]](images/BBCode/smilies/exclamation.gif)
trig waittill("trigger",other);
Somebody who can fix this problem?
Once again Playername, thanks soo much!
edited on Jun. 27, 2007 07:58 am by Nyth
edited on Jun. 27, 2007 07:59 am by Nyth |
 |
|
|
| babycop |
 |
General Member Since: Feb 18, 2006 Posts: 488 Last: Feb 27, 2010 [view latest posts] |
|
|
|
|
|
|
Category: CoD2 Scripting Posted: Wednesday, Jun. 27, 2007 12:40 pm |
 |
babycop writes...Quote: maybe it's because you have ''other'' in that line.
go from this: trig waittill("trigger",other);
to this: trig waittill("trigger");
edited on Jun. 27, 2007 08:24 am by babycop
Code:
undefined is not an object: (file 'maps/mp/mortars.gsc', line 18)
trig waittill("trigger");
*
called from:
(file 'maps/mp/mortars.gsc', line 8)
thread mortar();
*
called from:
(file 'maps/mp/mp_geilheond.gsc', line 4)
maps\mp\mortars::main();
*
started from:
(file 'maps/mp/mp_geilheond.gsc', line 1)
main()
*
Guess not eh ;) |
 |
|
|
| nedgerblansky |
General Member Since: Jan 28, 2005 Posts: 57 Last: Nov 9, 2007 [view latest posts] |
|
|
|
|
|
|
Category: CoD2 Scripting Posted: Wednesday, Jun. 27, 2007 02:00 pm |
 |
nedgerblansky writes...Quote: trig = getent ("wall_trig", "targetname");
trig is still undefined after this call.
Check if you have the proper object in your map.
Yeah, i have a trigger called wall_trig |
 |
|
|
| StrYdeR |
General Member Since: May 11, 2004 Posts: 11671 Last: Oct 7, 2021 [view latest posts] |
|
|
 |
 |
|
|
|
|
Category: CoD2 Scripting Posted: Wednesday, Jun. 27, 2007 03:47 pm |
 |
StrYdeR writes...Quote: the error is saying you do not have a trigger with the targetname of wall_trig
![[angryalien]](images/BBCode/smilies/angryalien.gif)
Omg dumb ass script, can't see that I have a trigger called wall_trig?!
Classname: trigger_damage
spawnflags: 35
target: auto1
targetname wall_trig
omg! (from Entity) |
 |
|
|
| OLD_MAN_WITH_GUN |
General Member Since: May 13, 2006 Posts: 754 Last: Jan 23, 2010 [view latest posts] |
|
|
|
|
|
|
Category: CoD2 Scripting Posted: Wednesday, Jun. 27, 2007 05:56 pm |
 |
OLD_MAN_WITH_GUN writes...Quote: And you are sure, the map the script is actually run on, is the right one (not and old version in a iwd file without the trigger, or and old one bc. after you've added the trigger the map wasn't compiled due to a leak or anything else)?
Yeah, because when I open it without the mortar thingey it works (without the script, with the ingame things)...
Too bad :( |
 |
|
|
| WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Thursday, Jun. 28, 2007 01:49 am |
 |
LOL you wankers! ![[moon]](images/BBCode/smilies/moon.gif)
Look closely at the error readout:
Quote: undefined is not an object: (file 'maps/mp/mortars.gsc', line 18)
trig waittill("trigger");
*
called from:
(file 'maps/mp/mortars.gsc', line 8)
thread mortar();
*
called from:
(file 'maps/mp/mp_geilheond.gsc', line 4)
maps\mp\mortars::main();
*
started from:
(file 'maps/mp/mp_geilheond.gsc', line 1)
main()
*
The error is in the mortar script, it cant find an entity in the map with a targetname of "trigger_mortar"
This the line it's falling over on.
trig = getent("trigger_mortar","targetname");
Spotted by blind old Uncle Grassy. |
 |
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|