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

Members Online

»
0 Active | 10 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 4
Category: CoD4 SP Mapping
CoD 4 mapping and level design for single player.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Skips function
Marty22
General Member
Since: Jan 2, 2008
Posts: 42
Last: Sep 17, 2011
[view latest posts]
Level 2
Category: CoD4 SP Mapping
Posted: Monday, Dec. 21, 2009 01:01 am
Hi there.

I have this weird problem with my actors. I've made an array of my 3 enemy actors, and I'm using this to check if they are still alive:

Code:
    for (i=0; i < badguys.size; i++)
    {
     if (isAlive(badguys[i]))
        badguys[i] waittill( "death" );
        continue;
    }


Now, there is no visible errors with this, as far as I can see, but apparently when it is supposed to run, it doesn't.

Here's the whole script part:

Code:
badguys_dead()
{
    badguys = getentarray( "badguys_room2", "targetname" );

    wait 0.01;

    for (i=0; i < badguys.size; i++)
    {
     if (isAlive(badguys[i]))
     {
        badguys[i] waittill( "death" );
        iprintlnbold ( "Badguys dead!" );
     }
        continue;
    }

     wait 2.5;
     
     thread move3();
}


Also, as you can see I'm printing in a message, but it just displays immediately after the thread has started, even when the enemies aren't dead.

I hope someone can help me with this problem. [confused]
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 SP Mapping
Posted: Monday, Dec. 21, 2009 01:15 am
sure you caught the real actors and not their spawners?

you can use the function waittill_dead or waittill_dead_or_dying from _utility.gsc:

waittill_dead(badguys);


Code:
 /* 
 ============= 
///ScriptDocBegin
"Name: waittill_dead( <guys> , <num> , <timeoutLength> )"
"Summary: Waits until all the AI in array < guys > are dead."
"Module: AI"
"CallOn: "
"MandatoryArg: <guys> : Array of actors to wait until dead"
"OptionalArg: <num> : Number of guys that must die for this function to continue"
"OptionalArg: <timeoutLength> : Number of seconds before this function times out and continues"
"Example: waittill_dead( getaiarray( "axis" ) );"
"SPMP: singleplayer"
///ScriptDocEnd
 ============= 
 */ 


Share |
jeannotvb
General Member
Since: Dec 8, 2007
Posts: 620
Last: Feb 1, 2010
[view latest posts]
Level 6
Im a fan of MODSonair
Category: CoD4 SP Mapping
Posted: Monday, Dec. 21, 2009 05:55 am
Yea I think you're calling it on the spawners.
Use a script to spawn an actor through the spawner, then you can call functions on him:

Code:

spawner = getEnt( "my_spawner", "targetname" ); 
guy1 = spawner stalingradSpawn();


Now you can call functions on this actor.
You can also use doSpawn(); but they won't spawn if you can see them, with stalingradSpawn(); they will spawn even if you can see them.

edited on Dec. 21, 2009 12:56 am by jeannotvb
Share |
Marty22
General Member
Since: Jan 2, 2008
Posts: 42
Last: Sep 17, 2011
[view latest posts]
Level 2
Category: CoD4 SP Mapping
Posted: Monday, Dec. 21, 2009 09:57 pm
I'm sure I'm giving the function to the real actors as I have spawned them the normal way earlier on in the script:

Code:
        
badguys = getentarray( "badguys_room2", "targetname" );
covernodes1 = getnodearray( "covernodes1", "targetname" );

wait 0.5;

for (i = 0; i < badguys.size; i++)
{
badguys[i] stalingradSpawn();
badguys[i] setgoalnode( covernodes1 );
continue;
}    


Else I really don't know how this problem can be solved.

Also I tried the waittill_dead function, but it didn't work either.
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 SP Mapping
Posted: Tuesday, Dec. 22, 2009 12:34 am
badguys[ i] setgoalnode( covernodes1 );

covernodes1 is a node array, not sure if you can pass a node array to setgoalnode(). try passing only one node (e.g. covernodes1[0] or covernodes1[ i] )
Share |
Marty22
General Member
Since: Jan 2, 2008
Posts: 42
Last: Sep 17, 2011
[view latest posts]
Level 2
Category: CoD4 SP Mapping
Posted: Tuesday, Dec. 22, 2009 11:57 pm
I changed the goalnode function, but still nothing. I even tried commenting it out, but again it doesn't work.

I've tried a lot of stuff now, but it just won't do the function.

Btw. here's the whole part with the "badguys":

Code:
second_room()
{
    grdoor = getent( "grdoor_trig", "targetname" );
    door = getent( "door2", "targetname" );

    grenade_door waittill( "trigger" );

    wait 0.01;

    thread guy_move_room2();

    door rotateto ( (0, -90, 0), 1.5);
    door waittill( "rotatedone" );

    level.guy2 anim_single_solo( level.guy2, "Someone" );
    wait .2;
    level.guy1 anim_single_solo( level.guy1, "You_know" );
}

guy_move_room2()
{
    thread general_sec_room();

    doorp_node = getnode( "doorp_node", "targetname" );
    door_front_trig = getent( "door_front_trig", "targetname" );
    door = getent( "door2", "targetname" );

    spawner = getent( "sec_guy", "targetname" );
    guy = spawner stalingradSpawn();

    wait 0.01;

    guy.ignoreall = true;
    guy.fixedNode = true;

    wait 0.11;

    door connectpaths();

    guy setgoalnode(doorp_node);

    wait 0.5;

    guy waittill( "death");

    thread move2();
}  

general_sec_room()
{
    badguys = getentarray( "badguys_room2", "targetname" );
    //covernodes1 = getnodearray  "covernodes1", "targetname" );

    wait 0.5;

     for (i = 0; i < badguys.size; i++)
     {
        badguys[i] stalingradSpawn();
        //badguys[i] setgoalnode(covernodes1[i]);
        continue;
     }
}

move2()
{
    thread badguys_dead();

    level.guy1 disable_cqbwalk();
    level.guy2 disable_cqbwalk();
    level.guy3 disable_cqbwalk();

    guy1_cover2 = getnode( "guy1_cover2", "targetname" );
    guy2_cover2 = getnode( "guy2_cover2", "targetname" );
    guy3_cover2 = getnode( "guy3_cover2", "targetname" ); 

    level.guy1 setgoalnode(guy1_cover2);
    level.guy2 setgoalnode(guy2_cover2);
    level.guy3 setgoalnode(guy3_cover2);
}

badguys_dead()
{
    badguys = getentarray( "badguys_room2", "targetname" );

    wait 0.01;

    for (i=0; i < badguys.size; i++)
    {
     if (isAlive(badguys[i]))
     {
        badguys[i] waittill( "death" );
        iprintlnbold ( "Badguys dead!" );
     }
        continue;
    }

     //waittill_dead( badguys );

     wait 1;
     
     thread move3();
}
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 SP Mapping
Posted: Wednesday, Dec. 23, 2009 02:47 am
you get the "grdoor_trig" entity and store it in the variable "grdoor":

grdoor = getent( "grdoor_trig", "targetname" );


but you wait till trigger for "grenade_door" (there is no getent for this entity in your script):

grenade_door waittill( "trigger" )


so you may wanna change it to:

grenade_door = getent( "grdoor_trig", "targetname" );
door = getent( "door2", "targetname" );
grenade_door waittill( "trigger" );


and you should throw that waittill("death") thingy away, it's buggy! use this:

Code:
badguys = getentarray( "badguys_room2", "targetname" );

wait 0.05;

waittill_dead( badguys );
Share |
Marty22
General Member
Since: Jan 2, 2008
Posts: 42
Last: Sep 17, 2011
[view latest posts]
Level 2
Category: CoD4 SP Mapping
Posted: Thursday, Dec. 24, 2009 12:56 am
Oh, the "grenade_door" was a spelling error, as I changed the name of it, right before I posted the script here, so it's not a problem.

Actually, I got it solved. It was because I had an error in the beginning of the level, but only when I had developer 2 on, which I mostly don't, mainly because of some rappel sound errors, but thanks for helping me out anyway [thumbs_up], I still learned something from it.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 SP 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

»