hzqst / MetaHookSv

MetaHook (https://github.com/nagist/metahook) porting for SvEngine (GoldSrc engine modified by Sven-Coop)
MIT License
144 stars 35 forks source link

是否可以为布娃娃施加一个向后的推力 #287

Open 1912188434 opened 1 year ago

1912188434 commented 1 year ago

能否实现子弹推力,类似CSGO中玩家被爆头后子弹会把人物推倒。

1912188434 commented 1 year ago

目前玩家被杀死后只会随意向任何一个方向倾倒 https://github.com/hzqst/MetaHookSv/assets/62979586/3a2dabbb-04cf-418b-b618-45394bbc0122

hzqst commented 1 year ago

客户端是拿不到玩家被击杀时的伤害来源方向的,你可以试下把转换为ragdoll的时间设大一点,让玩家播放飞在空中的时候再转换为ragdoll,这样玩家实体的飞行速度在转换时会一起带到物理引擎里面

di57inct commented 1 year ago
[DeathAnim]
101 99
102 31
103 72
104 14
105 142
106 155
107 14
108 139
109 21
110 16

Death frames calculated to retain as much animation possible while also making sure the model won't be out of collision box and won't clip through walls.

1912188434 commented 1 year ago
[DeathAnim]
101 99
102 31
103 72
104 14
105 142
106 155
107 14
108 139
109 21
110 16

Death frames calculated to retain as much animation possible while also making sure the model won't be out of collision box and won't clip through walls.

I personally prefer to modify the parameters, because the animation and ragdoll connection is not coherent. It would be more natural for the ragdoll to take over directly after the character dies.

di57inct commented 1 year ago

Then you have to use frame 0 for all animations

1912188434 commented 1 year ago

然后你必须对所有动画使用第 0 帧

I tried it yesterday on an old character model and it didn't work very well. I think it might be fixed that day

di57inct commented 1 year ago

Each model has it's own skeleton structure. The ragdoll files from the hd models won't work with other models.

1912188434 commented 1 year ago

每个模型都有自己的骨架结构。来自高清模型的布娃娃文件不适用于其他模型。

How did you make these files? Although I have the ragdoll file of the classic character model, I don't know how to make it

download: https://www.mediafire.com/file/01eviqe0evglua4/CS+1.6+LD+Ragdolls.zip/file

di57inct commented 1 year ago

The ragdolls from the file you linked work fine for me. Make sure you extracted them in the correct folder.

di57inct commented 9 months ago

The client cannot get the direction of the source of damage when the player is killed.

Didn't properly read your message at first. It is possible actually via "Damage" message received: https://wiki.alliedmods.net/Half-Life_1_Game_Events#Damage

/**

  • Instant damage values for use with the 3rd parameter of the "Damage" client
  • message. */

    define DMG_GENERIC 0 // Generic damage was done

    define DMG_CRUSH (1<<0) // Crushed by falling or moving object

    define DMG_BULLET (1<<1) // Shot

    define DMG_SLASH (1<<2) // Cut, clawed, stabbed

    define DMG_BURN (1<<3) // Heat burned

    define DMG_FREEZE (1<<4) // Frozen

    define DMG_FALL (1<<5) // Fell too far

    define DMG_BLAST (1<<6) // Explosive blast damage

    define DMG_CLUB (1<<7) // Crowbar, punch, headbutt

    define DMG_SHOCK (1<<8) // Electric shock

    define DMG_SONIC (1<<9) // Sound pulse shockwave

    define DMG_ENERGYBEAM (1<<10) // Laser or other high energy beam

    define DMG_NEVERGIB (1<<12) // With this bit OR'd in, no damage type will be able to gib victims upon death

    define DMG_ALWAYSGIB (1<<13) // With this bit OR'd in, any damage type can be made to gib victims upon death.

    define DMG_DROWN (1<<14) // Drowning

    define DMG_PARALYZE (1<<15) // Slows affected creature down

    define DMG_NERVEGAS (1<<16) // Nerve toxins, very bad

    define DMG_POISON (1<<17) // Blood poisioning

    define DMG_RADIATION (1<<18) // Radiation exposure

    define DMG_DROWNRECOVER (1<<19) // Drowning recovery

    define DMG_ACID (1<<20) // Toxic chemicals or acid burns

    define DMG_SLOWBURN (1<<21) // In an oven

    define DMG_SLOWFREEZE (1<<22) // In a subzero freezer

    define DMG_MORTAR (1<<23) // Hit by air raid (done to distinguish grenade from mortar)

    define DMG_GRENADE (1<<24) // Counter-Strike only - Hit by HE grenade

    define DMG_TIMEBASED (~(0x3fff)) // Mask for time-based damage

hzqst commented 9 months ago

The client cannot get the direction of the source of damage when the player is killed.

Didn't properly read your message at first. It is possible actually via "Damage" message received: https://wiki.alliedmods.net/Half-Life_1_Game_Events#Damage

/**

  • Instant damage values for use with the 3rd parameter of the "Damage" client
  • message. */

    define DMG_GENERIC 0 // Generic damage was done

    define DMG_CRUSH (1<<0) // Crushed by falling or moving object

    define DMG_BULLET (1<<1) // Shot

    define DMG_SLASH (1<<2) // Cut, clawed, stabbed

    define DMG_BURN (1<<3) // Heat burned

    define DMG_FREEZE (1<<4) // Frozen

    define DMG_FALL (1<<5) // Fell too far

    define DMG_BLAST (1<<6) // Explosive blast damage

    define DMG_CLUB (1<<7) // Crowbar, punch, headbutt

    define DMG_SHOCK (1<<8) // Electric shock

    define DMG_SONIC (1<<9) // Sound pulse shockwave

    define DMG_ENERGYBEAM (1<<10) // Laser or other high energy beam

    define DMG_NEVERGIB (1<<12) // With this bit OR'd in, no damage type will be able to gib victims upon death

    define DMG_ALWAYSGIB (1<<13) // With this bit OR'd in, any damage type can be made to gib victims upon death.

    define DMG_DROWN (1<<14) // Drowning

    define DMG_PARALYZE (1<<15) // Slows affected creature down

    define DMG_NERVEGAS (1<<16) // Nerve toxins, very bad

    define DMG_POISON (1<<17) // Blood poisioning

    define DMG_RADIATION (1<<18) // Radiation exposure

    define DMG_DROWNRECOVER (1<<19) // Drowning recovery

    define DMG_ACID (1<<20) // Toxic chemicals or acid burns

    define DMG_SLOWBURN (1<<21) // In an oven

    define DMG_SLOWFREEZE (1<<22) // In a subzero freezer

    define DMG_MORTAR (1<<23) // Hit by air raid (done to distinguish grenade from mortar)

    define DMG_GRENADE (1<<24) // Counter-Strike only - Hit by HE grenade

    define DMG_TIMEBASED (~(0x3fff)) // Mask for time-based damage

The usermsg "Damage" will only be transmitted to the player who actually takes the damage, not to others, see: https://github.com/number201724/CS16ND/blob/8c629d18f4131183456f04fb53d9e3f47bed80e7/dlls/player.cpp#L5694

di57inct commented 9 months ago

My bad, i thought about that the wrong way. Anyway, the client is aware of the killer and victim position most of the time. Could cover those cases if you want to when possible.