| Author |
Topic: Undefind is not an field object |
| All-Killer |
 |
General Member Since: May 26, 2006 Posts: 140 Last: Nov 23, 2008 [view latest posts] |
|
|
|
Category: CoD4 SP Mapping Posted: Tuesday, Sep. 23, 2008 11:27 am |
 |
Because of my other problem couldnt get fixed im trying to get a workaround working.
What i want to do is the following: Add an objective that points to a trigger damage to complete the objective. I used the following code:
Code:
mggardentrigger = getent ("mggardentrigger","targetname");
mggardentrigger waittill("trigger");
///Add Objective: Kill MG Gunner///
mgobjectivetrig = getent ("mgobjectivetrig","targetname");
objective_add(2, "active", &"SPMAP_OBJ2",getent("mgobjectivetrig","mgobjectivetrig").origin);
objective_current(2);
iprintlnbold (&"SPMAP_OBJ2");
//////////////////////////////////////////////////////////
But when i pass the normal trigger to active this script, i get an error message saying:
Undefined is not an field object: objective_add(2, "active", &"SPMAP_OBJ2",getent("mgobjectivetrig","mgobjectivetrig").origin);
The funny thing is im sure the trigger is in the map, but the error says something different.
Anyone can tackle this one?
Thanks again |
 |
|
|
| OLD_MAN_WITH_GUN |
General Member Since: May 13, 2006 Posts: 754 Last: Jan 23, 2010 [view latest posts] |
|
|
|
|
| All-Killer |
 |
General Member Since: May 26, 2006 Posts: 140 Last: Nov 23, 2008 [view latest posts] |
|
|
|
|
| SparkyMcSparks |
 |
General Member Since: Feb 28, 2004 Posts: 1713 Last: Dec 29, 2016 [view latest posts] |
|
|
 |
|
Category: CoD4 SP Mapping Posted: Wednesday, Sep. 24, 2008 06:38 am |
 |
Try putting iPrintLnBolds in between every line in your script there to narrow it down where the script is getting a progression break at.
If only IW released their scriptDebugger.
EDIT: Looking at your script one more time, did you make sure your trigger has the []AI_AXIS checked in the entity window that way it knows to be triggered by an Axis AI?
edited on Sep. 24, 2008 02:43 am by Sparks. |
|
|
|
| All-Killer |
 |
General Member Since: May 26, 2006 Posts: 140 Last: Nov 23, 2008 [view latest posts] |
|
|
|
Category: CoD4 SP Mapping Posted: Wednesday, Sep. 24, 2008 01:46 pm |
 |
Oke sparks, tested it with the lines. Thats a good tip, need to use that in my own workflow.
Then about that []AI_AXIS, it doenst need to be triggered by an Axis, but by a grenade.
Oke this is the code i used:
Code:
mgobjective()
{
iprintln ("1");
mgobjectivetrig = getent ("mgobjectivetrig","targetname");
iprintln ("2");
objective_add(2, "active", &"SPMAP_OBJ2",getent("mgobjectivetrig","targetname").origin);
iprintln ("3");
objective_current(2);
iprintln ("4");
iprintlnbold (&"SPMAP_OBJ2");
iprintln ("5");
mgobjectivetrig waittill("trigger");
iprintln ("6");
objective_state(2, "done");
iprintln ("7");
mgobjectivetrig delete();
iprintln ("8");
objective_current(1);
iprintln ("9");
thread centersquad();
}
The lines get prompt to number 5, and then nothing happens.
Picture of the entity window from the trigger
Any idea's?
edited on Sep. 24, 2008 09:47 am by All-Killer |
 |
|
|
| babycop |
 |
General Member Since: Feb 18, 2006 Posts: 488 Last: Feb 27, 2010 [view latest posts] |
|
|
|
Category: CoD4 SP Mapping Posted: Wednesday, Sep. 24, 2008 02:04 pm |
 |
since you've already defined your trigger like this:
Code: mgobjectivetrig = getent ("mgobjectivetrig","targetname");
you shouldn't be defining it in your objective again:
Code: objective_add(2, "active", &"SPMAP_OBJ2",getent("mgobjectivetrig","targetname").origin);
instead, try it like this:
Code: objective_add( 2, "active", &"SPMAP_OBJ2", mgobjectivetrig.origin ); |
 |
|
|
| All-Killer |
 |
General Member Since: May 26, 2006 Posts: 140 Last: Nov 23, 2008 [view latest posts] |
|
|
|
|
| SparkyMcSparks |
 |
General Member Since: Feb 28, 2004 Posts: 1713 Last: Dec 29, 2016 [view latest posts] |
|
|
 |
|
Category: CoD4 SP Mapping Posted: Wednesday, Sep. 24, 2008 09:52 pm |
 |
You can try replacing the waittill ( "trigger" ) line with this if there's an actual guy on the MG:
Code: aiGuy thread magic_bullet_shield();
while( 1 )
{
aiGuy waittill ( "damage", damage, attacker, direction_vec, point, type )
if( ( attacker == level.player ) && ( type == "MOD_EXPLOSIVE" ) )
{
aiGuy thread stop_magic_bullet_shield();
aiGuy delete();
break;
}
wait ( 0. 2 );
}
edited on Sep. 24, 2008 05:55 pm by Sparks. |
|
|
|
| All-Killer |
 |
General Member Since: May 26, 2006 Posts: 140 Last: Nov 23, 2008 [view latest posts] |
|
|
|
|
| All-Killer |
 |
General Member Since: May 26, 2006 Posts: 140 Last: Nov 23, 2008 [view latest posts] |
|
|
|
Category: CoD4 SP Mapping Posted: Saturday, Sep. 27, 2008 12:37 pm |
 |
Reinstalled CoD and tried it again. Good thing is, is that objective star shows up. But still it wont work the way it needs to work.
I first tried my own way again:
Code:
mgobjective()
{
iprintln ("1");
mgsoldier = getent ("mgsoldier","targetname");
iprintln ("2");
objective_add(2, "active", &"SPMAP_OBJ2",mgsoldier.origin);
iprintln ("3");
objective_current(2);
iprintln ("4");
iprintlnbold (&"SPMAP_OBJ2");
iprintln ("5");
mgsoldier waittill("death");
iprintln ("6");
objective_state(2, "done");
iprintln ("7");
objective_current(1);
iprintln ("8");
thread centersquad();
}
But no succes. Got the problem explained above. Then i tried your code:
Code:
mgobjective()
{
iprintln ("1");
mgsoldier = getent ("mgsoldier","targetname");
iprintln ("2");
objective_add(2, "active", &"SPMAP_OBJ2",mgsoldier.origin);
iprintln ("3");
objective_current(2);
iprintln ("4");
iprintlnbold (&"SPMAP_OBJ2");
iprintln ("5");
mgsoldier thread magic_bullet_shield();
while( 1 )
{
mgsoldier waittill ( "damage", damage, attacker, direction_vec, point, type );
if( ( attacker == level.player ) && ( type == "MOD_EXPLOSIVE" ) )
{
mgsoldier thread stop_magic_bullet_shield();
mgsoldier delete();
break;
}
wait ( 0.2 );
}
iprintln ("6");
objective_state(2, "done");
iprintln ("7");
objective_current(1);
iprintln ("8");
thread centersquad();
}
And that also didnt work. In both problems it only prompts till 5 again, so the waittill is still beeing the problem. Any more idea's? |
 |
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|