Chessnut / NutScript

A free role-play framework for Garry's Mod.
http://nutscript.rocks
MIT License
94 stars 77 forks source link

Stupid fuckin' animtable #506

Closed Rubberbandits closed 9 years ago

Rubberbandits commented 9 years ago

Apparently, after forcing the sequence, I learned that the animations are actually fine. Something in NS is fucking up the way the animations are being played, even forcing the animtable that the model uses it doesn't work.

nut.anim = nut.anim or {} nut.anim.citizen_male = { normal = { [ACT_MP_STAND_IDLE] = {"mtidle_notdumb", "2hraim"}, [ACT_MP_CROUCH_IDLE] = {"sneak1hmaim", "sneak2hraim"}, [ACT_MP_WALK] = {"mtwalk", "2hraim_walk"}, [ACT_MP_CROUCHWALK] = {"sneakmtwalk", "2hraim_sneak"}, [ACT_MP_RUN] = {"mtrun", "2hrrun"} }, pistol = { [ACT_MP_STAND_IDLE] = {"1hpaim", ACT_RANGE_ATTACK_PISTOL}, [ACT_MP_CROUCH_IDLE] = {ACT_COVER_PISTOL_LOW, ACT_RANGE_AIM_PISTOL_LOW}, [ACT_MP_WALK] = {ACT_WALK, ACT_WALK_AIM_RIFLE_STIMULATED}, [ACT_MP_CROUCHWALK] = {ACT_WALK_CROUCH, ACT_WALK_CROUCH_AIM_RIFLE}, [ACT_MP_RUN] = {ACT_RUN, ACT_RUN_AIM_RIFLE_STIMULATED}, attack = ACT_GESTURE_RANGE_ATTACK_PISTOL, reload = ACT_RELOAD_PISTOL }, smg = { [ACT_MP_STAND_IDLE] = {ACT_IDLE_SMG1_RELAXED, ACT_IDLE_ANGRY_SMG1}, [ACT_MP_CROUCH_IDLE] = {ACT_COVER_SMG1_LOW, ACT_RANGE_AIM_SMG1_LOW}, [ACT_MP_WALK] = {ACT_WALK_RIFLE_RELAXED, ACT_WALK_AIM_RIFLE_STIMULATED}, [ACT_MP_CROUCHWALK] = {ACT_WALK_CROUCH_RIFLE, ACT_WALK_CROUCH_AIM_RIFLE}, [ACT_MP_RUN] = {ACT_RUN_RIFLE_RELAXED, ACT_RUN_AIM_RIFLE_STIMULATED}, attack = ACT_GESTURE_RANGE_ATTACK_SMG1, reload = ACT_GESTURE_RELOAD_SMG1 }, shotgun = { [ACT_MP_STAND_IDLE] = {ACT_IDLE_SHOTGUN_RELAXED, ACT_IDLE_ANGRY_SMG1}, [ACT_MP_CROUCH_IDLE] = {ACT_COVER_SMG1_LOW, ACT_RANGE_AIM_SMG1_LOW}, [ACT_MP_WALK] = {ACT_WALK_RIFLE_RELAXED, ACT_WALK_AIM_RIFLE_STIMULATED}, [ACT_MP_CROUCHWALK] = {ACT_WALK_CROUCH_RIFLE, ACT_WALK_CROUCH_RIFLE}, [ACT_MP_RUN] = {ACT_RUN_RIFLE_RELAXED, ACT_RUN_AIM_RIFLE_STIMULATED}, attack = ACT_GESTURE_RANGE_ATTACK_SHOTGUN }, grenade = { [ACT_MP_STAND_IDLE] = {ACT_IDLE, ACT_IDLE_MANNEDGUN}, [ACT_MP_CROUCH_IDLE] = {ACT_COVER_LOW, ACT_COVER_PISTOL_LOW}, [ACT_MP_WALK] = {ACT_WALK, ACT_WALK_AIM_RIFLE_STIMULATED}, [ACT_MP_CROUCHWALK] = {ACT_WALK_CROUCH, ACT_WALK_CROUCH_AIM_RIFLE}, [ACT_MP_RUN] = {ACT_RUN, ACT_RUN_RIFLE_STIMULATED}, attack = ACT_RANGE_ATTACK_THROW }, melee = { [ACT_MP_STAND_IDLE] = {ACT_IDLE_SUITCASE, ACT_IDLE_ANGRY_MELEE}, [ACT_MP_CROUCH_IDLE] = {ACT_COVER_LOW, ACT_COVER_LOW}, [ACT_MP_WALK] = {ACT_WALK, ACT_WALK_AIM_RIFLE}, [ACT_MP_CROUCHWALK] = {ACT_WALK_CROUCH, ACT_WALK_CROUCH}, [ACT_MP_RUN] = {ACT_RUN, ACT_RUN}, attack = ACT_MELEE_ATTACK_SWING }, glide = ACT_GLIDE, vehicle = { ["prop_vehicle_prisoner_pod"] = {"podpose", Vector(-3, 0, 0)}, ["prop_vehicle_jeep"] = {"sitchair1", Vector(14, 0, -14)}, ["prop_vehicle_airboat"] = {"sitchair1", Vector(8, 0, -20)}, chair = {"sitchair1", Vector(1, 0, -23)} }, }

nut.anim.setModelClass("models/police.mdl", "metrocop") nut.anim.setModelClass("models/combine_super_soldier.mdl", "overwatch") nut.anim.setModelClass("models/combine_soldier_prisonGuard.mdl", "overwatch") nut.anim.setModelClass("models/combine_soldier.mdl", "overwatch") nut.anim.setModelClass("models/vortigaunt.mdl", "vort") nut.anim.setModelClass("models/vortigaunt_blue.mdl", "vort") nut.anim.setModelClass("models/vortigaunt_doctor.mdl", "vort") nut.anim.setModelClass("models/vortigaunt_slave.mdl", "vort") nut.anim.setModelClass("models/fallout/player/leatherarmor.mdl", "citizen_male")

Chessnut commented 9 years ago

Do you have code that you can show?

Rubberbandits commented 9 years ago

http://cr8r.me/2015-06-14_14-23-58.mp4 here is what i mean.

Chessnut commented 9 years ago

Probably because acts usually run continuously while sequences are not continuous. Sequences usually has to be reset at a certain point, but the activities for a player do not need to be. As a result, instead of running like a normal activity the sequence is constantly being reset leading to the jittering. But I am not sure about a fix because the engine does not use sequences for walking, but rather activities. This is because the TranslateActivity is used to change the desired HL2MP act into an appropriate one. If possible, you should try to set the animation to correspond with the correct act.

Rubberbandits commented 9 years ago

I'm currently writing a system to check every tick if the player is walking, running, or not moving at all.

I was just wondering what was causing this. Thanks, chessnut. Also, you didn't accept my friend request.

Chessnut commented 9 years ago

Isn't that what the CalcMainActivity hook is for?

Rubberbandits commented 9 years ago

I haven't taken a look at that hook, but I was looking for a check to see if the player is moving instead of using GetVelocity

[ERROR] gamemodes/nstest/schema/hooks/sh_hooks.lua:10: attempt to index local 'client' (a nil value)

  1. v - gamemodes/nstest/schema/hooks/sh_hooks.lua:10
    1. unknown - lua/includes/modules/hook.lua:84

apparently this is a thing, but i really don't understand it as this is my code:

hook.Add("Tick", "host_animSys" , function(client)
    if (client:GetVelocity() == Vector(0, 0, 0)) then
    player:forceSequence("mtidle_notdumb", function() end, CurTime(), false)
elseif (client:GetVelocity() <= Vector(130, 0, 0)) then
    player:forceSequence("mtwalk", function() end, CurTime(), true)
elseif (client:GetVelocity() >= Vector(130, 0, 0)) then
    player:forceSequence("mtrun", function() end, CurTime(), true)
end
end)

this makes no sense.

Chessnut commented 9 years ago

Tick doesn't pass a player. Read the GMod wiki.

Rubberbandits commented 9 years ago

What hook should I use then? I can't find the hook that activates every time a player moves.

Chessnut commented 9 years ago

I told you earlier, you should see the CalcMainActivity hook.

On Sun, Jun 14, 2015 at 5:29 PM, Rubberbandits notifications@github.com wrote:

What hook should I use then? I can't find the hook that activates every time a player moves.

— Reply to this email directly or view it on GitHub https://github.com/Chessnut/NutScript/issues/506#issuecomment-111891717.

Rubberbandits commented 9 years ago

After getting it to work, now we need to solve 1 problem: getting the animation to only play a single time:

http://cr8r.me/2015-06-14_17-54-04.mp4

Ignore the jitter, its just the mp4. The player quite literally glides around, and I don't know how to make the animation only play once. Help?

Chessnut commented 9 years ago

Why can't you use the normal acts like ACT_IDLE with your models? On Sun, Jun 14, 2015 at 17:58 Rubberbandits notifications@github.com wrote:

After getting it to work, now we need to solve 1 problem: getting the animation to only play a single time:

http://cr8r.me/2015-06-14_17-54-04.mp4

Ignore the jitter, its just the mp4. The player quite literally glides around, and I don't know how to make the animation only play once. Help?

— Reply to this email directly or view it on GitHub https://github.com/Chessnut/NutScript/issues/506#issuecomment-111894248.

Rubberbandits commented 9 years ago

They are not on the source skeleton, and don't use source animations.

Chessnut commented 9 years ago

Why don't you just rig them so they do? Seems way easier than redoing the animation system. On Sun, Jun 14, 2015 at 18:03 Rubberbandits notifications@github.com wrote:

They are not on the source skeleton, and don't use source animations.

— Reply to this email directly or view it on GitHub https://github.com/Chessnut/NutScript/issues/506#issuecomment-111894467.

Rubberbandits commented 9 years ago

I think making an animation play once is alot easier than rigging many, many models. And, sacrificing the animations. If I was willing to just go use the source animations I'd go download some ports off the workshop.

Chessnut commented 9 years ago

Well this is no longer an NS issue since it's just your models being affected, so the issue doesn't need to remain open. On Sun, Jun 14, 2015 at 18:06 Rubberbandits notifications@github.com wrote:

I think making an animation play once is alot easier than rigging many, many models. And, sacrificing the animations. If I was willing to just go use the source animations I'd go download some ports off the workshop.

— Reply to this email directly or view it on GitHub https://github.com/Chessnut/NutScript/issues/506#issuecomment-111894638.