dim3 Forum

Full Version: Missile hitting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I can't see the error in this code! can anyone else?

Code:
function damage(obj,tick) {
    
if (obj.hit.projectileName=='Missile') {
    die3();
    } else {
      
        if(crouched!=true) {
    
                switch (obj.hit.hitBoxName) {
    
                case 'Head':
                die2(obj);
                break;
            
                default:
                obj.model.animation.interrupt('Hit');
                break;
                
                } else {
                    obj.model.animation.interrupt('CrouchedHit');
                    return;
            }
        }
    }
}
Doessss the precious-s-s giveses you a line numberses?
(grrr my post didn't post)
What was the error? Did it give an error?
Right off the bat, you're { } are weirdly balanced. You'll need one at the end of the case (to balance the { at the beginning.) The "else" is part of the case right now, which is a syntax error for sure. Then you'll need to remove one of the bottom ones to even everything out.

[>] Brian
Theres no errors! but the missile passes right through him
Try this.
Code:
function damage(obj,tick) {
    
if (obj.hit.projectileName=='Missile') {
    die3();
    } else {
      
        if(crouched!=true) {
    
                switch (obj.hit.hitBoxName) {
    
                    case 'Head':
                    die2(obj);
                    break;
                
                    default:
                    obj.model.animation.interrupt('Hit');
                       break;
                
                }
        } else {
                    obj.model.animation.interrupt('CrouchedHit');
                    return;
            }
    }
}
If that doesn't work, post the whole script.
Reference URL's