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

Members Online

»
0 Active | 9 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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Script gives an error, please help
Nyth
General Member
Since: Dec 24, 2005
Posts: 48
Last: May 6, 2008
[view latest posts]
Level 2
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 [biggrin]

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] ERROR LINE BELOW wait untill trigger is used [exclamation]
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
Share |
babycop
General Member
Since: Feb 18, 2006
Posts: 488
Last: Feb 27, 2010
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Wednesday, Jun. 27, 2007 12:21 pm
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
Share |
Nyth
General Member
Since: Dec 24, 2005
Posts: 48
Last: May 6, 2008
[view latest posts]
Level 2
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 ;)
Share |
nedgerblansky
General Member
Since: Jan 28, 2005
Posts: 57
Last: Nov 9, 2007
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Wednesday, Jun. 27, 2007 01:43 pm
trig = getent ("wall_trig", "targetname");

trig is still undefined after this call.
Check if you have the proper object in your map.
Share |
Nyth
General Member
Since: Dec 24, 2005
Posts: 48
Last: May 6, 2008
[view latest posts]
Level 2
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
Share |
StrYdeR
General Member
Since: May 11, 2004
Posts: 11671
Last: Oct 7, 2021
[view latest posts]
Level 10
Admin
Forum Moderator
Im a HOST of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Jun. 27, 2007 03:29 pm
the error is saying you do not have a trigger with the targetname of wall_trig

[angryalien]
Share |
Nyth
General Member
Since: Dec 24, 2005
Posts: 48
Last: May 6, 2008
[view latest posts]
Level 2
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]


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)
Share |
OLD_MAN_WITH_GUN
General Member
Since: May 13, 2006
Posts: 754
Last: Jan 23, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Wednesday, Jun. 27, 2007 05:08 pm
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)?
Share |
Nyth
General Member
Since: Dec 24, 2005
Posts: 48
Last: May 6, 2008
[view latest posts]
Level 2
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 :(
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Thursday, Jun. 28, 2007 01:49 am
LOL you wankers! [moon][lol]

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.
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

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

»