GTAGaming Forums

GTAGaming Forums (http://www.gtagaming.com/forums/index.php)
-   Grand Theft Auto IV Mods (http://www.gtagaming.com/forums/forumdisplay.php?f=318)
-   -   Playing Multiple Animations (http://www.gtagaming.com/forums/showthread.php?t=118419)

ShadowFox014 08-26-2009 02:51 PM

Playing Multiple Animations
 
Hi, I've been working on a simple asi for movies that will allow machinimators to use the keyboard to play various animations, but I ran into a few problems. I tried to make it possible to use different keys to play different animations, but the same animation played for both keys. I don't have a lot of experience using c++, so any help would be much appreciated.

Here's the SampleCustomFiber.cpp:

Code:

#include "CustomFiberThread.h"
#include "Scripting.h"
#include "../ScriptHook/Log.h"

#include <windows.h>

using namespace Scripting;

CustomFiberThread::CustomFiberThread(){
        SetName("Animation");
        setDefaultValues();
}

Player CustomFiberThread::GetPlayer() {
        Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId());
        return playerIndex;
}

Scripting::Ped CustomFiberThread::GetPlayerPed() {
        Ped ped;
        GetPlayerChar(GetPlayer(), &ped);
        return ped;
}

void CustomFiberThread::setDefaultValues() {
        playAnim = false;
}

void CustomFiberThread::Start() {
        setDefaultValues();
        NativeThread::Start();
}

void CustomFiberThread::RunScript() {
        while(IsThreadAlive()) {
                if((GetAsyncKeyState(VK_F12) && 1) != 0) {
                        LogInfo("Requesting Argue animation");
                        RequestAnims("amb@argue");
                        playAnim = true;
                }

                if((GetAsyncKeyState(VK_F11) && 1) != 0) {
                        LogInfo("Requesting Argue animation");
                        RequestAnims("missbrian_1");
                        playAnim = true;
                }

                if(playAnim && HaveAnimsLoaded("amb@argue")) {
                        LogInfo("Playing animation");
                        TaskPlayAnim(GetPlayerPed(), "argue_a", "amb@argue", 4.0f, 0, 0, 0, 0, -1);
                        playAnim = false;
                }

                if(playAnim && HaveAnimsLoaded("missbrian_1")) {
                        LogInfo("Playing animation");
                        TaskPlayAnim(GetPlayerPed(), "friendly_idle", "missbrian_1", 4.0f, 0, 0, 0, 0, -1);
                        playAnim = false;
                }

                Wait(100);
        }
}



All times are GMT -6. The time now is 11:30 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.