Answered The claw Help

Status
Not open for further replies.

ponymodz

Veteran
Messages
40
Reaction score
33
Points
803
Yo can someone tell me whats wrong with the code other players can attach to it but the host cant and idk why any help is appreciated :tonguewink:

Code:
spawn_claw()
{
    if( self ishost() )
    {
        if( !(IsDefined( level.theclaw )) )
        {
            level.theclaw = "Active";
            self thread build_theclaw();
            self iprintln( "The Claw ^5is being built..." );
        }
        else
        {
            level notify( "Destroy_Claw" );
            level.theclaw = undefined;
            level.rotate delete();
            level.topblockers delete();
            level.topblockers1 delete();
            foreach( extinct in level.theclaw_seats )
            {
                if( IsDefined( extinct ) )
                {
                    extinct delete();
                }
            }
            foreach( extinct in level.theclaw_legs )
            {
                if( IsDefined( extinct ) )
                {
                    extinct delete();
                }
            }
            foreach( extinct in level.theclaw_arm )
            {
                if( IsDefined( extinct ) )
                {
                    extinct delete();
                }
            }
            self iprintln( "The Claw ^4destroyed" );
        }
    }
    else
    {
        self iprintln( "You must be ^2Host^7 to do that" );
    }

}

build_theclaw()
{
    level endon( "game_ended" );
    self endon( "disconnect" );
    level endon( "Destroy_Claw" );
    level.theclaw_legs = [];
    level.theclaw_arm = [];
    level.theclaw_seats = [];
    startpos = self.origin;
    legspos = strtok( "0;500;0;500", ";" );
    legsposmid = strtok( "0;0;700;700", ";" );
    legxpos = strtok( "16;-16;16;-16", ";" );
    legypos = strtok( "26;26;-26;-26", ";" );
    leganglesmid = strtok( "-30;30;30;-30", ";" );
    legangleslast = strtok( "60;60;-60;-60", ";" );
    xpos = 0;
    ypos = 0;
    hpos = 0;
    ext = 0;
    while( ext < 4 )
    {
        i = 0;
        while( i < 13 )
        {
            level.theclaw_legs[level.theclaw_legs.size] = modelspawner( startpos + ( ( float( legspos[ ext] ), float( legsposmid[ ext] ), 0 ) + ( xpos * float( legxpos[ ext] ), ypos * float( legypos[ ext] ), hpos * 54 ) ), "t6_wpn_supply_drop_ally", ( 0, float( leganglesmid[ ext] ), float( legangleslast[ ext] ) ) );
            hpos++;
            xpos++;
            ypos++;
            wait 0.01;
            i++;
        }
        xpos = 0;
        ypos = 0;
        hpos = 0;
        ext++;
    }
    xpos = 0;
    ypos = 0;
    hpos = 0;
    i = 0;
    while( i < 9 )
    {
        ext = 0;
        while( ext < 4 )
        {
            level.theclaw_arm[level.theclaw_arm.size] = modelspawner( startpos + ( ( 250, 350, 120 ) + ( cos( ext * 90 ) * 20, sin( ext * 90 ) * 20, hpos * 66 ) ), "t6_wpn_supply_drop_ally", ( 0, 0, 90 ) );
            wait 0.01;
            ext++;
        }
        hpos++;
        i++;
    }
    xpos = 0;
    ypos = 0;
    hpos = 0;
    ext = 0;
    while( ext < 8 )
    {
        level.theclaw_seats[level.theclaw_seats.size] = modelspawner( startpos + ( ( 250, 350, 35 ) + ( cos( ext * 45 ) * 70, sin( ext * 45 ) * 70, hpos * 66 ) ), "t6_wpn_supply_drop_ally", ( 0, ext * 45, 0 ) );
        wait 0.01;
        ext++;
    }
    xpos = 0;
    ypos = 0;
    hpos = 0;
    ext = 0;
    while( ext < 4 )
    {
        level.theclaw_arm[level.theclaw_arm.size] = modelspawner( startpos + ( ( 250, 350, 680 ) + ( cos( ext * 90 ) * 20, sin( ext * 90 ) * 20, hpos * 66 ) ), "t6_wpn_supply_drop_ally", ( 0, 90, 0 ) );
        wait 0.01;
        ext++;
    }
    level.topblockers = modelspawner( startpos + ( 200, 350, 680 ), "t6_wpn_supply_drop_ally", ( 0, 0, 0 ) );
    level.topblockers1 = modelspawner( startpos + ( 300, 350, 680 ), "t6_wpn_supply_drop_ally", ( 0, 0, 0 ) );
    level.rotate = modelspawner( startpos + ( 250, 350, 680 ), "t6_wpn_supply_drop_ally", ( 0, 0, 0 ) );
    toppos0 = strtok( "250;250;250;270;230", ";" );
    toppos1 = strtok( "350;370;330;350;350", ";" );
    toppos2 = strtok( "70;30;30;30;30", ";" );
    topangle2 = strtok( "90;0;0;0;0", ";" );
    topangle1 = strtok( "0;0;90;90;90", ";" );
    ext = 0;
    while( ext < 5 )
    {
        level.theclaw_arm[level.theclaw_arm.size] = modelspawner( startpos + ( float( toppos0[ ext] ), float( toppos1[ ext] ), float( toppos2[ ext] ) ), "t6_wpn_supply_drop_ally", ( 0, float( topangle1[ ext] ), float( topangle2[ ext] ) ) );
        ext++;
    }
    ext = 0;
    while( ext < level.theclaw_arm.size )
    {
        level.theclaw_arm[ ext] linkto( level.rotate );
        ext++;
    }
    ext = 0;
    while( ext < level.theclaw_seats.size )
    {
        level.theclaw_seats[ ext] linkto( level.rotate );
        ext++;
    }
    wait 2;
    level.rotate thread move_think();
    self thread clawseats_attach();

}

move_think()
{
    level endon( "game_ended" );
    self endon( "disconnect" );
    level endon( "Destroy_Claw" );
    while( IsDefined( self ) )
    {
        ext = 0;
        while( ext >= -40 )
        {
            self rotateto( ( 0, self.angles[ 1], ext ), 0.7 );
            wait 0.1;
            ext = ext - 2;
        }
        ext = ext;
        while( ext <= 70 )
        {
            self rotateto( ( 0, self.angles[ 1], ext ), 0.7 );
            wait 0.1;
            ext = ext + 3;
        }
        ext = ext;
        while( ext >= -100 )
        {
            self rotateto( ( 0, self.angles[ 1], ext ), 0.7 );
            wait 0.05;
            ext = ext - 3;
        }
        ext = ext;
        while( ext <= 120 )
        {
            self rotateto( ( 0, self.angles[ 1], ext ), 0.7 );
            wait 0.05;
            ext = ext + 4;
        }
        while( 1 )
        {
            ext = ext;
            while( ext >= -120 )
            {
                self rotateto( ( 0, self.angles[ 1], ext ), 0.7 );
                wait 0.05;
                ext = ext - 5;
            }
            ext = ext;
            while( ext <= 120 )
            {
                self rotateto( ( 0, self.angles[ 1], ext ), 0.7 );
                wait 0.05;
                ext = ext + 5;
            }
            wait 0.05;
        }
    }

}

ClawSeats_Attach()
{
    level endon("Destroy_Claw");
    for(;;)
    {
        foreach(Rider in level.players)
        {
            if(!isDefined(Rider.OnRide))
            {
                for(Ext = 0; Ext < level.TheClaw_Seats.size; Ext++)
                {
                    if(distance(level.TheClaw_Seats[Ext].origin, Rider.origin) < 100)
                    {
                        Rider iprintlnbold("Hold [{+usereload}] To Ride The Claw!");
                        if(Rider useButtonPressed())
                        {
                            Rider.SavePos = Rider.origin;
                            Rider playerLinkTo(level.TheClaw_Seats[Ext-1]);
                            Rider.OnRide = true;
                            Rider EnableInvulnerability();
                        }
                    }
                }
            } 
            else if(isDefined(Rider.OnRide) && Rider meleeButtonPressed())
            {
                Rider Unlink();
                Rider setOrigin(self.SavePos);
                Rider DisableInvulnerability();
                Rider.OnRide = undefined;
            }
        }
        wait .05;
    }
}
 
Destroy_TheClaw()
{
    if(isDefined(self))
        self physicsLaunch();
    wait 6;
    if(isDefined(self))
        self delete();
}
 

Markf2015

Veteran
Messages
14
Reaction score
9
Points
793
i used this one and it worked for me
Code:
Spawn_Claw()
{
    if(!isDefined(level.TheClaw))
    {
        level.TheClaw = "Active";
        self thread Build_TheClaw();
    }
    else
    {
        level notify("Destroy_Claw");
        level.TheClaw = undefined;
        level.Rotate delete();
        level.TopBlockers delete();
        level.TopBlockers1 delete();
        foreach(Extinct in level.TheClaw_Seats)
            Extinct thread Destroy_TheClaw();
        foreach(Extinct in level.TheClaw_Legs)
            Extinct thread Destroy_TheClaw();   
        foreach(Extinct in level.TheClaw_Arm)
            Extinct thread Destroy_TheClaw();   
    }
}

Build_TheClaw()
{
    level endon("Destroy_Claw");
    level.TheClaw_Legs = [];
    level.TheClaw_Arm = [];
    level.TheClaw_Seats = [];
    startPos = self.origin;
    LegsPos = strtok("0;500;0;500", ";");
    LegsPosMid = strtok("0;0;700;700", ";");
    LegxPos = strtok("16;-16;16;-16", ";");
    LegyPos = strtok("26;26;-26;-26", ";");
    LegAnglesMid = strtok("-30;30;30;-30", ";");
    LegAnglesLast = strtok("60;60;-60;-60", ";");
    xPos = 0;
    yPos = 0;
    hPos = 0;
    for(Ext = 0; Ext < 4; Ext++)
    {
          for(i=0;i<13;i++)
          {
              level.TheClaw_Legs[level.TheClaw_Legs.size] = modelSpawner(startPos+(float(LegsPos[Ext]), float(LegsPosMid[Ext]), 0)+(xPos * float(LegxPos[Ext]), yPos * float(LegyPos[Ext]), hPos * 54), "t6_wpn_supply_drop_ally", (0, float(LegAnglesMid[Ext]), float(LegAnglesLast[Ext])));
            hPos++;
            xPos++;
            yPos++;
            wait .01;
        }
        xPos = 0;
        yPos = 0;
        hPos = 0;
    }   
    xPos = 0;
    yPos = 0;
    hPos = 0;
    for(i = 0; i < 9; i++)
      {
        for(Ext = 0; Ext < 4; Ext++)
          {
              level.TheClaw_Arm[level.TheClaw_Arm.size] = modelSpawner(startPos + (250,350,120) + (cos(Ext*90)*20, sin(Ext*90)*20, hPos * 66), "t6_wpn_supply_drop_ally", (0,0,90));
            wait .01;
        }
        hPos++;
    }   
    xPos = 0;
    yPos = 0;
    hPos = 0;
    for(Ext = 0; Ext < 8; Ext++)
      {
          level.TheClaw_Seats[level.TheClaw_Seats.size] = modelSpawner(startPos + (250,350,35) + (cos(Ext*45)*70, sin(Ext*45)*70, hPos * 66), "t6_wpn_supply_drop_ally", (0,Ext*45,0));
        wait .01;
    }
    xPos = 0;
    yPos = 0;
    hPos = 0;
    for(Ext = 0; Ext < 4; Ext++)
      {
          level.TheClaw_Arm[level.TheClaw_Arm.size] = modelSpawner(startPos + (250,350,680) + (cos(Ext*90)*20, sin(Ext*90)*20, hPos * 66), "t6_wpn_supply_drop_ally", (0,90,0));
        wait .01;
    }
    level.TopBlockers = modelSpawner(startPos + (200,350,680), "t6_wpn_supply_drop_ally", (0,0,0));
    level.TopBlockers1 = modelSpawner(startPos + (300,350,680), "t6_wpn_supply_drop_ally", (0,0,0));
    level.Rotate = modelSpawner(startPos + (250,350,680), "t6_wpn_supply_drop_ally", (0,0,0));
    TopPos0 = strtok("250;250;250;270;230", ";");
    TopPos1 = strtok("350;370;330;350;350", ";");
    TopPos2 = strtok("70;30;30;30;30", ";");
    TopAngle2 = strtok("90;0;0;0;0", ";");
    TopAngle1 = strtok("0;0;90;90;90", ";");
    for(Ext = 0; Ext < 5; Ext++)
        level.TheClaw_Arm[level.TheClaw_Arm.size] = modelSpawner(startPos + (float(TopPos0[Ext]),float(TopPos1[Ext]),float(TopPos2[Ext])), "t6_wpn_supply_drop_ally", (0,float(TopAngle1[Ext]),float(TopAngle2[Ext])));
    for(Ext = 0; Ext < level.TheClaw_Arm.size; Ext++)
        level.TheClaw_Arm[Ext] linkTo(level.Rotate);
    for(Ext = 0; Ext < level.TheClaw_Seats.size; Ext++)
        level.TheClaw_Seats[Ext] linkTo(level.Rotate);
    wait 2;
    level.Rotate thread Move_Think();
    self thread ClawSeats_Attach();
}

Move_Think()
{
    level endon("Destroy_Claw");
    while(isDefined(self))
    {
        for(Ext = 0; Ext >= -40; Ext -= 2)
        {
            self rotateTo((0,self.angles[1],Ext),.7);
            wait .1;
        }
        for(Ext = Ext;Ext <= 70; Ext += 3)
        {
            self rotateTo((0,self.angles[1],Ext),.7);
            wait .1;
        }
        for(Ext = Ext; Ext >= -100; Ext -= 3)
        {
            self rotateTo((0,self.angles[1],Ext),.7);
            wait .05;
        }
        for(Ext = Ext; Ext <= 120; Ext += 4)
        {
            self rotateTo((0,self.angles[1],Ext),.7);
            wait .05;
        }
        while(true)
        {
            for(Ext = Ext; Ext >= -120; Ext -= 5)
            {
                self rotateTo((0,self.angles[1],Ext),.7);
                wait .05;
            }
            for(Ext = Ext; Ext <= 120; Ext += 5)
            {
                self rotateTo((0,self.angles[1],Ext),.7);
                wait .05;
            }
            wait .05;
        }
    }
}

ClawSeats_Attach()
{
    level endon("Destroy_Claw");
    for(;;)
    {
        foreach(Rider in level.players)
        {
            if(!isDefined(Rider.OnRide))
            {
                for(Ext = 0; Ext < level.TheClaw_Seats.size; Ext++)
                {
                    if(distance(level.TheClaw_Seats[Ext].origin, Rider.origin) < 100)
                    {
                        Rider iprintlnbold("Hold [{+usereload}] To Ride The Claw!");
                        if(Rider useButtonPressed())
                        {
                            Rider.SavePos = Rider.origin;
                            Rider playerLinkTo(level.TheClaw_Seats[Ext-1]);
                            Rider.OnRide = true;
                            Rider EnableInvulnerability();
                        }
                    }
                }
            }   
            else if(isDefined(Rider.OnRide) && Rider meleeButtonPressed())
            {
                Rider Unlink();
                Rider setOrigin(self.SavePos);
                Rider DisableInvulnerability();
                Rider.OnRide = undefined;
            }
        }
        wait .05;
    }
}

Destroy_TheClaw()
{
    if(isDefined(self))
        self physicsLaunch();
    wait 6;
    if(isDefined(self))
        self delete();
}

modelSpawner(origin, model, angles)
{
    obj = spawn("script_model", origin);
    obj setModel(model);
    if(isDefined(angles))
        obj.angles = angles;
    return obj;
}
 

ponymodz

Veteran
Messages
40
Reaction score
33
Points
803
i used this one and it worked for me
Code:
Spawn_Claw()
{
    if(!isDefined(level.TheClaw))
    {
        level.TheClaw = "Active";
        self thread Build_TheClaw();
    }
    else
    {
        level notify("Destroy_Claw");
        level.TheClaw = undefined;
        level.Rotate delete();
        level.TopBlockers delete();
        level.TopBlockers1 delete();
        foreach(Extinct in level.TheClaw_Seats)
            Extinct thread Destroy_TheClaw();
        foreach(Extinct in level.TheClaw_Legs)
            Extinct thread Destroy_TheClaw();  
        foreach(Extinct in level.TheClaw_Arm)
            Extinct thread Destroy_TheClaw();  
    }
}

Build_TheClaw()
{
    level endon("Destroy_Claw");
    level.TheClaw_Legs = [];
    level.TheClaw_Arm = [];
    level.TheClaw_Seats = [];
    startPos = self.origin;
    LegsPos = strtok("0;500;0;500", ";");
    LegsPosMid = strtok("0;0;700;700", ";");
    LegxPos = strtok("16;-16;16;-16", ";");
    LegyPos = strtok("26;26;-26;-26", ";");
    LegAnglesMid = strtok("-30;30;30;-30", ";");
    LegAnglesLast = strtok("60;60;-60;-60", ";");
    xPos = 0;
    yPos = 0;
    hPos = 0;
    for(Ext = 0; Ext < 4; Ext++)
    {
          for(i=0;i<13;i++)
          {
              level.TheClaw_Legs[level.TheClaw_Legs.size] = modelSpawner(startPos+(float(LegsPos[Ext]), float(LegsPosMid[Ext]), 0)+(xPos * float(LegxPos[Ext]), yPos * float(LegyPos[Ext]), hPos * 54), "t6_wpn_supply_drop_ally", (0, float(LegAnglesMid[Ext]), float(LegAnglesLast[Ext])));
            hPos++;
            xPos++;
            yPos++;
            wait .01;
        }
        xPos = 0;
        yPos = 0;
        hPos = 0;
    }  
    xPos = 0;
    yPos = 0;
    hPos = 0;
    for(i = 0; i < 9; i++)
      {
        for(Ext = 0; Ext < 4; Ext++)
          {
              level.TheClaw_Arm[level.TheClaw_Arm.size] = modelSpawner(startPos + (250,350,120) + (cos(Ext*90)*20, sin(Ext*90)*20, hPos * 66), "t6_wpn_supply_drop_ally", (0,0,90));
            wait .01;
        }
        hPos++;
    }  
    xPos = 0;
    yPos = 0;
    hPos = 0;
    for(Ext = 0; Ext < 8; Ext++)
      {
          level.TheClaw_Seats[level.TheClaw_Seats.size] = modelSpawner(startPos + (250,350,35) + (cos(Ext*45)*70, sin(Ext*45)*70, hPos * 66), "t6_wpn_supply_drop_ally", (0,Ext*45,0));
        wait .01;
    }
    xPos = 0;
    yPos = 0;
    hPos = 0;
    for(Ext = 0; Ext < 4; Ext++)
      {
          level.TheClaw_Arm[level.TheClaw_Arm.size] = modelSpawner(startPos + (250,350,680) + (cos(Ext*90)*20, sin(Ext*90)*20, hPos * 66), "t6_wpn_supply_drop_ally", (0,90,0));
        wait .01;
    }
    level.TopBlockers = modelSpawner(startPos + (200,350,680), "t6_wpn_supply_drop_ally", (0,0,0));
    level.TopBlockers1 = modelSpawner(startPos + (300,350,680), "t6_wpn_supply_drop_ally", (0,0,0));
    level.Rotate = modelSpawner(startPos + (250,350,680), "t6_wpn_supply_drop_ally", (0,0,0));
    TopPos0 = strtok("250;250;250;270;230", ";");
    TopPos1 = strtok("350;370;330;350;350", ";");
    TopPos2 = strtok("70;30;30;30;30", ";");
    TopAngle2 = strtok("90;0;0;0;0", ";");
    TopAngle1 = strtok("0;0;90;90;90", ";");
    for(Ext = 0; Ext < 5; Ext++)
        level.TheClaw_Arm[level.TheClaw_Arm.size] = modelSpawner(startPos + (float(TopPos0[Ext]),float(TopPos1[Ext]),float(TopPos2[Ext])), "t6_wpn_supply_drop_ally", (0,float(TopAngle1[Ext]),float(TopAngle2[Ext])));
    for(Ext = 0; Ext < level.TheClaw_Arm.size; Ext++)
        level.TheClaw_Arm[Ext] linkTo(level.Rotate);
    for(Ext = 0; Ext < level.TheClaw_Seats.size; Ext++)
        level.TheClaw_Seats[Ext] linkTo(level.Rotate);
    wait 2;
    level.Rotate thread Move_Think();
    self thread ClawSeats_Attach();
}

Move_Think()
{
    level endon("Destroy_Claw");
    while(isDefined(self))
    {
        for(Ext = 0; Ext >= -40; Ext -= 2)
        {
            self rotateTo((0,self.angles[1],Ext),.7);
            wait .1;
        }
        for(Ext = Ext;Ext <= 70; Ext += 3)
        {
            self rotateTo((0,self.angles[1],Ext),.7);
            wait .1;
        }
        for(Ext = Ext; Ext >= -100; Ext -= 3)
        {
            self rotateTo((0,self.angles[1],Ext),.7);
            wait .05;
        }
        for(Ext = Ext; Ext <= 120; Ext += 4)
        {
            self rotateTo((0,self.angles[1],Ext),.7);
            wait .05;
        }
        while(true)
        {
            for(Ext = Ext; Ext >= -120; Ext -= 5)
            {
                self rotateTo((0,self.angles[1],Ext),.7);
                wait .05;
            }
            for(Ext = Ext; Ext <= 120; Ext += 5)
            {
                self rotateTo((0,self.angles[1],Ext),.7);
                wait .05;
            }
            wait .05;
        }
    }
}

ClawSeats_Attach()
{
    level endon("Destroy_Claw");
    for(;;)
    {
        foreach(Rider in level.players)
        {
            if(!isDefined(Rider.OnRide))
            {
                for(Ext = 0; Ext < level.TheClaw_Seats.size; Ext++)
                {
                    if(distance(level.TheClaw_Seats[Ext].origin, Rider.origin) < 100)
                    {
                        Rider iprintlnbold("Hold [{+usereload}] To Ride The Claw!");
                        if(Rider useButtonPressed())
                        {
                            Rider.SavePos = Rider.origin;
                            Rider playerLinkTo(level.TheClaw_Seats[Ext-1]);
                            Rider.OnRide = true;
                            Rider EnableInvulnerability();
                        }
                    }
                }
            }  
            else if(isDefined(Rider.OnRide) && Rider meleeButtonPressed())
            {
                Rider Unlink();
                Rider setOrigin(self.SavePos);
                Rider DisableInvulnerability();
                Rider.OnRide = undefined;
            }
        }
        wait .05;
    }
}

Destroy_TheClaw()
{
    if(isDefined(self))
        self physicsLaunch();
    wait 6;
    if(isDefined(self))
        self delete();
}

modelSpawner(origin, model, angles)
{
    obj = spawn("script_model", origin);
    obj setModel(model);
    if(isDefined(angles))
        obj.angles = angles;
    return obj;
}
Ok thx ,ill try it
 
Status
Not open for further replies.
Top