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:
Any suggestions?
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?