Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!
Moderator: Core Staff
-
Reality
- CJ Newbie
- Posts: 51
- Joined: May 3rd, 2011, 9:57 pm
Post
by Reality » October 25th, 2011, 11:20 am
I have the code for a spacefighter given to me by a friend, all credits goes to him, but the code doesn't seem to work? he had it working because he has video proof! here's the code:
Code: Select all
main()
{
Â
    level.spaceFighterHealth = 1000;
    thread constant_gravity();
Â
    spacefighter_trigger = getEnt( "spacefighter_trig", "targetname" );
    spacefighter_trig thread waitForPilot();
}
Â
waitForPilot()
{
    fighter = getEnt("fighter", "targetname");
    fighter.isSpaceFighter = true;
    fighter thread preFlight();
Â
    while(1)
    {
        self waittill("trigger", player);
Â
        if(fighter.hasPilot)
            continue;
Â
        if(isDefined(player.isPiloting))
            continue;
Â
        if(player.sessionstate != "playing")
            continue;
Â
        if(!isAlive(player) || !isPlayer(player))
            continue;
Â
        if(isDefined(player.pers["isBot"]))
            continue;
Â
        if(player getStance() == "prone")
            continue;
Â
        fighter.hasPilot = true;
        fighter.owner = player;
        player.isPiloting = true;
        player thread pilotFighter(fighter);
    }
}
The error is something to do with this line:
Code: Select all
spacefighter_trig thread waitForPilot();
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » October 25th, 2011, 3:18 pm
Code: Select all
spacefighter_trigger thread waitForPilot();
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
Reality
- CJ Newbie
- Posts: 51
- Joined: May 3rd, 2011, 9:57 pm
Post
by Reality » October 25th, 2011, 4:20 pm
Drofder2004 wrote:Code: Select all
spacefighter_trigger thread waitForPilot();
didn't work..
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » October 25th, 2011, 5:16 pm
That is either a mapping error (the entity you are trying to reference does not exist) or a scripting erro (the targetname you are asking to find is not correctly spelled).
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
Rezil
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Post
by Rezil » October 25th, 2011, 5:29 pm
Half of your functions seem to be missing(not needed but would help). Also, I'd like to see that video proof.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » October 25th, 2011, 11:12 pm
Rezil wrote:Half of your functions seem to be missing(not needed but would help). Also, I'd like to see that video proof.
I've seen a couple of flight mods (there was the first one, which was posted here a long time ago and was laggy and not very good... but worked and I know there was one used in a Rat Map server.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
Reality
- CJ Newbie
- Posts: 51
- Joined: May 3rd, 2011, 9:57 pm
Post
by Reality » October 25th, 2011, 11:47 pm
Rezil wrote:Half of your functions seem to be missing(not needed but would help). Also, I'd like to see that video proof.
Heres the proof.
http://www.xfire.com/video/152a12/
I've seen a couple of flight mods (there was the first one, which was posted here a long time ago and was laggy and not very good... but worked and I know there was one used in a Rat Map server.
He said it was a very simple fix, but he forgot what it was..and we're still trying to figure it out:/
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » October 26th, 2011, 9:52 pm
I am pretty sure with the full code it would be easy to figure it out, the error is very specific. Are you sure he wrote the code, or did he get the code off someone else...
The error states the "fighter" is NOT an entity (undefined).
So it can be one of TWO things...
1. fighter = getEnt("fighter", "targetname");
That line is wrong, the entity is not called "fighter" within the map.
2. The map does not contain an entity called "fighter", or it is spelled incorrectly.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Users browsing this forum: No registered users and 3 guests