I need the player character to change view everytime he draws a gun. But when I click the gun on the character, he changes into Roger.
Here's my script.
// script for character1: Use inventory on character
if (player.activeinv == 3) {
if (gun == 0) {
gun = 1;
SetCharacterView(JACK, 18);
AnimateCharacter(JACK, 1, 3, 0);
ReleaseCharacterView(JACK);
}
if (gun == 1) {
gun = 0;
AnimateCharacter(JACK, 2, 3, 0);
ChangeCharacterView(JACK, 1);
ReleaseCharacterView(JACK);
}
}
Thanks strazer, solved it with only tiny changes to what you gave me.
Without knowing how you've set up your views, but here's probably what you want:
// script for character1: Use inventory on character
if (player.activeinv == 3) { // if used gun item on character
if (gun == 0) { // if character is in no-gun mode
gun = 1; // turn gun mode on
SetCharacterView(JACK, 18); // set view for animation
AnimateCharacterEx(JACK, 1, 3, 0, 0, 1); // play animation blocking (whipping out gun)
ReleaseCharacterView(JACK); // revert to normal view
}
else if (gun == 1) { // if character is in gun mode
gun = 0; // gun mode off
SetCharacterView(JACK, 18); // set view for animation
AnimateCharacterEx(JACK, 2, 3, 0, 0, 1); // play animation blocking (putting away gun)
// ChangeCharacterView(JACK, 1); // <-- View 1 is Roger, no?
ReleaseCharacterView(JACK); // when you don't block the animation, this gets run immediately afterwards
}
}