Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → IsThingCrouching() ?
IsThingCrouching() ?
2000-11-10, 2:43 PM #1
I have worked on weap_saber.cog to make it so when you are crouching, you use a certain move. I have declared the key in the symbols section. I only modifed the fire message. When you take out the saber, it plays the "putting bryar away" animation, as that is the one I am switching from, over and over. The fire message follows:
Code:
fire:

	// SendMessage( kyleCog, user0 );
	// Always Autoblock
	// Underwater saber attacks.
	if (GetMajorMode(player) == 5)
	{
		jkEnableSaber( player, 50, 0.15, 0.25 );
		
		if (nextAttack == 0)
		{
			PlayMode( player, 8);
			jkPlayPOVKey( player, povFireAnimR1, 2, 0x38 );
			nextAttack = 1;
		}
		else
		{
			PlayMode( player, 18);
			jkPlayPOVKey( player, povFireAnimL1, 2, 0x38 );
			nextAttack = 0;
		}

		shakePos = VectorScale(RandVec(),.001);
		shakeAngle = VectorScale(RandVec(),.5);
		SetPOVShake(shakePos, shakeAngle, .05, 80.0);
		
		SetFireWait(player, 1.0);
		
		slashSound = Rand()*7;
		PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
	}
	else
	{
# The following if statement was inserted by me.
	if(!(IsThingCrouching(player)))
	{
		mode = GetSenderRef();
		if (mode == 0)
		{
			// If we do another attack, reset the quick slash counter.
			thrust = GetThingThrust( player );
	
			// RIGHT Regular Strike
			if (VectorX(thrust) > 0)
			{
				jkEnableSaber( player, 50, 0.15, 0.25 );
	
				jkPlayPOVKey( player, povFireAnimR1, 2, 0x38 );
				PlayKey(player, fireAnimR1, 1, 0x38);
	
				shakePos = VectorScale(RandVec(),.001);
				shakeAngle = VectorScale(RandVec(),.5);
				SetPOVShake(shakePos, shakeAngle, .05, 80.0);
	
//				PlaySoundThing(swingSound02, player, 1.0, -1, -1, 0x80);
				slashSound = Rand()*7;
				PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
				SetFireWait(player, 0.8);
			}
			else
			// LEFT Regular Strike
			if (VectorX(thrust) < 0)
			{
				jkEnableSaber( player, 50, 0.15, 0.25 );
	
				jkPlayPOVKey( player, povFireAnimL1, 2, 0x38 );
				PlayKey(player, fireAnimL1, 1, 0x38);
	
				shakePos = VectorScale(RandVec(),.001);
				shakeAngle = VectorScale(RandVec(),.5);
				SetPOVShake(shakePos, shakeAngle, .05, 80.0);
	
//				PlaySoundThing(swingSound02, player, 1.0, -1, -1, 0x80);
				slashSound = Rand()*7;
				PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
				SetFireWait(player, 0.8);
			}
			else
			// BACKWARDS Strike
			if (VectorY(thrust) < -0.1)
			{
				jkEnableSaber( player, 50, 0.15, 0.25 );
	
				if (nextAttack == 0)
				{
					jkPlayPOVKey( player, povFireAnimB1, 2, 0x38 );
					PlayKey(player, fireAnimB1, 2, 0x38);
					nextAttack = 1;
				}
				else
				{
					jkPlayPOVKey( player, povFireAnimB2, 2, 0x38 );
					PlayKey(player, fireAnimB2, 2, 0x38);
					nextAttack = 0;
				}
				shakePos = VectorScale(RandVec(),.001);
				shakeAngle = VectorScale(RandVec(),.5);
				SetPOVShake(shakePos, shakeAngle, .05, 80.0);
	
				slashSound = Rand()*7;
				PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
				SetFireWait(player, 0.8);
			}
			else
			// STANDING Strike
			if (VectorY(thrust) < 0.1)
			{
				jkEnableSaber( player, 50, 0.25, 0.7 );
	
				if (nextAttack == 0)
				{
					jkPlayPOVKey( player, povFireAnimF1, 2, 0x38 );
					PlayKey(player, fireAnimF1, 2, 0x38);
					nextAttack = 1;
				}
				else
				{
					jkPlayPOVKey( player, povFireAnimF2, 2, 0x38 );
					PlayKey(player, fireAnimF2, 2, 0x38);
					nextAttack = 0;
				}
	
				shakePos = VectorScale(RandVec(),.001);
				shakeAngle = VectorScale(RandVec(),.5);
				SetPOVShake(shakePos, shakeAngle, .05, 80.0);
	
//				PlaySoundThing(swingSound02, player, 1.0, -1, -1, 0x80);
				slashSound = Rand()*7;
				PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
				SetFireWait(player, 0.8);
			}
			else
			{
				// QUICK slash.
				if (slash == 0)
				{
					// If after a second, we haven't attacked again, reset slash to 0.
					jkEnableSaber( player, 40, 0.15, 0.25 );
		
					povSlashAnimID = jkPlayPOVKey( player, povSnapAnim1, 2, 0x38);
					slashAnimID = PlayKey(player, snapAnim1, 1, 0x38);
					PlaySoundThing(swingSound01, player, 1.0, -1, -1, 0x80);
		
					shakePos = VectorScale(RandVec(),.001);
					shakeAngle = VectorScale(RandVec(),.5);
					SetPOVShake(shakePos, shakeAngle, .05, 80.0);
		
					SetFireWait(player, 0.25);
					slash = 1;
				}
				else
				if (slash == 1)
				{
					// Allow another second for the 3rd attack.
					jkEnableSaber( player, 40, 0.15, 0.25 );
		
					povSlashAnimID = jkPlayPOVKey( player, povSnapAnim2, 2, 0x38 );
					slashAnimID = PlayKey(player, snapAnim2, 1, 0x38);
					PlaySoundThing(swingSound03, player, 1.0, -1, -1, 0x80);
		
					shakePos = VectorScale(RandVec(),.001);
					shakeAngle = VectorScale(RandVec(),.5);
					SetPOVShake(shakePos, shakeAngle, .05, 80.0);
		
					SetFireWait(player, 0.25);
					slash = 2;
				}
				else
				if (slash == 2)
				{
					jkEnableSaber( player, 60, 0.2, 0.25 );
		
					povSlashAnimID = jkPlayPOVKey( player, povSnapAnim3, 2, 0x38 );
					slashAnimID = PlayKey(player, snapAnim3, 1, 0x38);
					PlaySoundThing(swingSound02, player, 1.0, -1, -1, 0x80);
		
					shakePos = VectorScale(RandVec(),.001);
					shakeAngle = VectorScale(RandVec(),.5);
					SetPOVShake(shakePos, shakeAngle, .05, 80.0);
		
					SetFireWait(player, 1.0);
					slash = 0;
				}
			}
		}
		// mode == 1
		else
		{
			// HEAVY slash.
			{
				jkEnableSaber( player, 160, 0.3, 1.2 );
				jkPlayPOVKey( player, povChargeAnim, 2, 0x38 );
				PlayKey(player, chargeAnim, 2, 0x38);
	
				shakePos = VectorScale(RandVec(),.001);
				shakeAngle = VectorScale(RandVec(),.5);
				SetPOVShake(shakePos, shakeAngle, .05, 80.0);
	
				PlaySoundThing(swingSoundDbl01, player, 1.0, -1, -1, 0x80);
				SetFireWait(player, 2.0);
			}
		}
	}
# All the rest of the code is mine too. upSlash was defined in symbols.
	} else {
	jkEnableSaber(player, 100, 0.3, 1.2);
	slashAnimID=PlayKey(player, upSlash, 1, 0x38);
	PlaySoundThing(swingSound01, player, 1.0, -1, -1, 0x80);
	SetFireWait(player, 0.5);
	}
	
   return;

Any suggestions?
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2000-11-11, 2:24 AM #2
if(IsThingCrouching(player) == 1)
{
// YOUR SABER MOVE
}

IsThingCrouching() returns 0 or 1 depending on if your crouching.
- Wisdom is 99% experience, 1% knowledge. -
2000-11-11, 3:16 AM #3
/me humbles before your presence. Thanks! [http://forums.massassi.net/html/biggrin.gif]
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2000-11-11, 4:10 AM #4
Heyyyy. Wait a minute! That still doesn't work. It's not the key (I have tested it), and it worked before I used the if statements. Any ideas?
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2000-11-11, 7:25 AM #5
Help?
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2000-11-11, 8:37 AM #6
IsThingCrouching() can be used as If(IsThingCrouching()) or If(!IsThingCrouching()) as well..

however the prob you have is a syntax thing..i know b/c the same sorta thing happens when i mess up syntax..that means ie a missing/extra bracket/paranthesis/semicolon usually..

however in this case it appears the error is not actually in the fire message[just did a syntax check in cogwriter]

you wanna send me the cog and i'll look at it?

peace.
-Dormouse
Also, I can kill you with my brain.
2000-11-12, 1:04 AM #7
Probably syntax, not the cog verbs.
But you can also test

if(IsCrouching(player))
{
doMove;
}
else
{
doAnother;
}

------------------
http://millennium.massassi.net/ - Millennium
2000-11-12, 7:15 AM #8
Yay! It works! Thanks Hideki! But, aargh! My key is screwed up.
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words

↑ Up to the top!