Page 1 of 1

headshot problem

Posted: Sat Mar 10, 2007 8:59 pm
by darksmaster923
if i headshot the enemy, it says error near if in monster_run_pain_start
CODE

Code: Select all

	// start of pain while running

	monster_run_pain_start[ ()
	{
		switch(random(1,4)) 					// play one of 4 pain animations
		{
			if(getLastBoneHit() = "BIP01 HEAD")
			{
				HighLevel("Death");
			}
			else 		
			{
				case 1
				{
					Animate(PAIN);
					SetTargetPoint(0,0,25);
					AddExplosion("blood",GetLastBoneHit(),0,0,0);
					FireProjectile("blood",GetLastBoneHit(),0,0,0,DAMAGEATTRIBUTE);
					PlaySound("injury1.wav", 500);
				}
				case 2
				{
					Animate(PAIN1);
					SetTargetPoint(0,0,25);
					AddExplosion("blood",GetLastBoneHit(),0,0,0);
					FireProjectile("blood",GetLastBoneHit(),0,0,0,DAMAGEATTRIBUTE);					PlaySound("uuh.wav", 500);
				}
				case 3
				{
					Animate(PAIN2);
					SetTargetPoint(0,0,25);
					AddExplosion("blood",GetLastBoneHit(),0,0,0);
					FireProjectile("blood",GetLastBoneHit(),0,0,0,DAMAGEATTRIBUTE);
					PlaySound("injury.wav", 500);
				}
				case 4
				{
					Animate(PAIN3);
					SetTargetPoint(0,0,25);
					AddExplosion("blood",GetLastBoneHit(),0,0,0);
					FireProjectile("blood",GetLastBoneHit(),0,0,0,DAMAGEATTRIBUTE);
					PlaySound("uuh.wav", 500);
				}
			}
		}
		SetHoldAtEnd(true);					// set to stop at animation end
		self.ThinkTime = 0;
		self.think = "monster_run_pain";
	} ]

Posted: Sat Mar 10, 2007 9:45 pm
by QuestOfDreams
switch and case belong together!

Code: Select all

   // start of pain while running 

   monster_run_pain_start[ () 
   { 
      if(getLastBoneHit() = "BIP01 HEAD") 
      { 
         HighLevel("Death"); 
      } 
      else        
      {
         switch(random(1,4))                // play one of 4 pain animations 
         {
            case 1 
            { 
               Animate(PAIN); 
               SetTargetPoint(0,0,25); 
               AddExplosion("blood",GetLastBoneHit(),0,0,0); 
               FireProjectile("blood",GetLastBoneHit(),0,0,0,DAMAGEATTRIBUTE); 
               PlaySound("injury1.wav", 500); 
            } 
            case 2 
            { 
               Animate(PAIN1); 
               SetTargetPoint(0,0,25); 
               AddExplosion("blood",GetLastBoneHit(),0,0,0); 
               FireProjectile("blood",GetLastBoneHit(),0,0,0,DAMAGEATTRIBUTE);
               PlaySound("uuh.wav", 500); 
            } 
            case 3 
            { 
               Animate(PAIN2); 
               SetTargetPoint(0,0,25); 
               AddExplosion("blood",GetLastBoneHit(),0,0,0); 
               FireProjectile("blood",GetLastBoneHit(),0,0,0,DAMAGEATTRIBUTE); 
               PlaySound("injury.wav", 500); 
            } 
            case 4 
            { 
               Animate(PAIN3); 
               SetTargetPoint(0,0,25); 
               AddExplosion("blood",GetLastBoneHit(),0,0,0); 
               FireProjectile("blood",GetLastBoneHit(),0,0,0,DAMAGEATTRIBUTE); 
               PlaySound("uuh.wav", 500); 
            } 
         } 
      } 
      SetHoldAtEnd(true);               // set to stop at animation end 
      self.ThinkTime = 0; 
      self.think = "monster_run_pain"; 
   } ]

Posted: Sun Mar 11, 2007 1:11 am
by darksmaster923
now it says method getlastbonehit not found*

Posted: Sun Mar 11, 2007 10:42 am
by Juutis
It should be GetLastBoneHit() - not getLastBoneHit().

Posted: Mon Mar 12, 2007 5:28 am
by darksmaster923
nvm i was on highlevel