Jump to content

making a player do a animation


aweaweaweaweawe

Recommended Posts

im trying to making a player do a animation and lock the controls while the character do the animation and i am encountering problems, i dont know if i am using the right method and and there is 2 list of animation files here is the code, the first is in anims_X and animsold, what list i should use to get the name of the animation? here is my code

function twitchIntegration_OnKeyPressed(key)
	local doEvent = key
	if doEvent >= 75 and doEvent <= 82 then
		local nome = getCurrentUserProfileName()
		if nome ~= "ExtraBanal" then --the test is == but ~= just for test purpose
			local distOffset = 30
			local player = getPlayer();	
			local posX = player:getX() + ZombRand(distOffset)-distOffset/2;
			local posY = player:getY() + ZombRand(distOffset)-distOffset/2;
			local posZ = player:getZ();
			
			local audioManager = getSoundManager()
			if     doEvent == 82 then 
				local sound = ZombRand(8)
				local name = "zombierand"..tostring(sound)
				audioManager:PlayWorldSoundImpl(name,false,posX,posY,posZ,0,distOffset+5,0,false)
			elseif doEvent == 79 then 
				local sound = ZombRand(3) + 1
				local name = "Thumpdistant0"..tostring(sound)
				audioManager:PlayWorldSoundImpl(name,false,posX,posY,posZ,0,distOffset+5,0,false)
			elseif doEvent == 80 then audioManager:PlayWorldSoundImpl("windowclose",false,posX,posY,posZ,0,distOffset+5,0,false)
			elseif doEvent == 81 then audioManager:PlayWorldSoundImpl("doorclose",false,posX,posY,posZ,0,distOffset+5,0,false)
			elseif doEvent == 75 then audioManager:PlayWorldSoundImpl("BrokenGlass",false,posX,posY,posZ,0,distOffset+5,0,false)
			elseif doEvent == 76 then audioManager:PlayWorldSoundImpl("BrokenGlass",false,posX,posY,posZ,0,distOffset+5,0,false)
			elseif doEvent == 77 then player:PlayAnim("pushups")
			else
				print("erro")
			end
		end
	end
end

Events.OnKeyPressed.Add(twitchIntegration_OnKeyPressed)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...