Old 08-26-2009   #1
ShadowFox014
Registered User
Newbie Member
 
Join Date: Aug 2009
Posts: 1
ShadowFox014 is an unknown quantity at this point
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);
	}
}
ShadowFox014 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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