Code for fighter
Posted: 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:
The error is something to do with this line:
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);
    }
}
Code: Select all
spacefighter_trig thread waitForPilot();