AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [TF2] Acquire player's weapon_bone coordinates? (https://forums.alliedmods.net/showthread.php?t=319148)

Shadowysn 10-15-2019 06:52

[TF2] Acquire player's weapon_bone coordinates?
 
3 Attachment(s)
(SOLVED, GO TO SECOND LAST POST FOR SOLUTION)
SetParent and SetParentAttachment don't work this time, unfortunately.

I'm trying to make a dropped clone of the player's weapon, but after switching to using offsets to spawn the weapon it's physics now freeze.
(If you don't know what offsets I'm talking about, it's like signatures but easier to find due to asherkin's vtable dumper)

I soon found out that the cause was the parenting, where it had previously worked for a CreateEntityByName-spawned weapon drop.

Before I wrote up the code utilizing SetParent on the given entity, I had experimented with getting an origin and angles from a parented info_target but it didn't work too well once I found out it doesn't have an origin property...

Now I brought back that old info_target thing after finally discovering datamaps existed, but GetEntPropVector reports the datamap as out of bounds, only having 1 element... (Happens to m_vecOrigin, m_angRotation plus their Abs counterparts m_vecAbsOrigin, m_angAbsRotation respectively)

Anyone willing to offer some help? I don't exactly use IDA so... er...

EDIT:
Attachment 177843
Attachment 177841
Attachment 177842
Put the .txt file into the gamedata folder.

Neuro Toxin 10-15-2019 15:43

Re: [TF2] Spawn weapon drop onto player's hands properly WITHOUT SetParentAttachment?
 
Lets skip past what you think the solution is a double check your XY problem.

What are you trying to do?

Shadowysn 10-16-2019 01:32

Re: [TF2] Spawn weapon drop onto player's hands properly WITHOUT SetParentAttachment?
 
Quote:

Originally Posted by Neuro Toxin (Post 2669821)
Lets skip past what you think the solution is a double check your XY problem.

What are you trying to do?

I'm trying to create a dropped weapon with the same properties of the player's active weapon without removing the active weapon A.L.A dead ringer weapon drop. I'm trying to recreate a feign death :P
I want to spawn the dropped weapon on the coordinates of the player's weapon bone.

I initially used SetParent and SetParentAttachment but after I decided to spawn a dropped weapon using gamedata, it's physics no longer work/sleep and it stays frozen in the air if I used the parent method, which I don't want it to. The physics'll work if I just leave it alone after spawning, but then it won't spawn on the player's weapon bone.

Yes I tried the Wake input and no, it doesn't work because the dropped weapon doesn't have the input.

Lux 10-16-2019 02:35

Re: [TF2] Spawn weapon drop onto player's hands properly WITHOUT SetParentAttachment?
 
Quote:

Originally Posted by Shadowysn (Post 2669849)
I'm trying to create a dropped weapon with the same properties of the player's active weapon without removing the active weapon A.L.A dead ringer weapon drop. I'm trying to recreate a feign death :P
I want to spawn the dropped weapon on the coordinates of the player's weapon bone.

I initially used SetParent and SetParentAttachment but after I decided to spawn a dropped weapon using gamedata, it's physics no longer work/sleep and it stays frozen in the air if I used the parent method, which I don't want it to. The physics'll work if I just leave it alone after spawning, but then it won't spawn on the player's weapon bone.

Yes I tried the Wake input and no, it doesn't work because the dropped weapon doesn't have the input.

I had that issue where physics were frozen on L4D2_Defib_Ragdolls

So i had to damage the ragdoll with DMG_CLUB or DMG_BLAST
https://github.com/LuxLuma/L4D2_Defi...s.sp#L337-L357

https://github.com/LuxLuma/L4D2_Defi...gdolls.sp#L276

Because using TeleportEntity() would cause the ragdoll to sleep.

Maybe this will work in TF2?
Incase you have an issue with damage forces and can't disable it, you can make a damage hook and edit damage forces in there to 0

https://github.com/LuxLuma/L4D2_Defi...s.sp#L232-L240

Like here i do with the ragdoll editing the damage forces.

Shadowysn 10-16-2019 06:49

Re: [TF2] Spawn weapon drop onto player's hands properly WITHOUT SetParentAttachment?
 
Quote:

Originally Posted by Lux (Post 2669853)
I had that issue where physics were frozen on L4D2_Defib_Ragdolls

So i had to damage the ragdoll with DMG_CLUB or DMG_BLAST
https://github.com/LuxLuma/L4D2_Defi...s.sp#L337-L357

https://github.com/LuxLuma/L4D2_Defi...gdolls.sp#L276

Because using TeleportEntity() would cause the ragdoll to sleep.

Maybe this will work in TF2?
Incase you have an issue with damage forces and can't disable it, you can make a damage hook and edit damage forces in there to 0

https://github.com/LuxLuma/L4D2_Defi...s.sp#L232-L240

Like here i do with the ragdoll editing the damage forces.

I tried what you said, but it also didn't work. The point_hurt is spawned and works, but the weapon remains frozen in the air.

Pelipoika 10-16-2019 08:27

Re: [TF2] Spawn weapon drop onto player's hands properly WITHOUT SetParentAttachment?
 
https://forums.alliedmods.net/showthread.php?t=266692 ?

Shadowysn 10-16-2019 09:17

Re: [TF2] Spawn weapon drop onto player's hands properly WITHOUT SetParentAttachment?
 
Quote:

Originally Posted by Pelipoika (Post 2669866)

I've already checked that discussion before I came up with spawning a dropped weapon, and there isn't anything that can help wake up the physics of the dropped weapon, or even prevent it sleeping in the first place.
I'm spawning the weapon through the signatures, yeah.
Spawning that weapon through the sig, then using SetParent + SetParentAttachment causes it to sleep/remain frozen in the air.

That bug didn't happen on a dropped weapon made by CreateEntityByName.

I've decided to post the full Dead Ringer sp file on the first post. Check up there.
Oh yeah, it's also the first time I'm using attachments so forgive me for it looking like a link.
EDIT: My dumbass forgot to include the gamedata, sorry for throwing any of you off.

Dragokas 10-18-2019 14:35

Re: [TF2] Spawn weapon drop on player's hand coords properly WITHOUT SetParentAttachm
 
Quote:

Spawn weapon drop on player's hand coords properly WITHOUT SetParentAttachment?
What is a whole idea of what you doing? Is EquipPlayerWeapon() not work for you?

If you need a clone, that should be something like CreateEntityByName + tf_weapon_* - see:
https://developer.valvesoftware.com/...ess_2_Entities

BHaType 10-18-2019 19:03

Re: [TF2] Spawn weapon drop on player's hand coords properly WITHOUT SetParentAttachm
 
2 Attachment(s)
If tf2 has features like this you can try through signatures like I did but this is for l4d2

Using the signatures I got the coordinates of the bones
what you need should be in the 44-56 lines

Shadowysn 10-19-2019 00:52

Re: [TF2] Spawn weapon drop on player's hand coords properly WITHOUT SetParentAttachm
 
Quote:

Originally Posted by Dragokas (Post 2670088)
What is a whole idea of what you doing? Is EquipPlayerWeapon() not work for you?

If you need a clone, that should be something like CreateEntityByName + tf_weapon_* - see:
https://developer.valvesoftware.com/...ess_2_Entities

F***, I knew I should've worded it more properly to avoid confusion. Then again, I had flu at the time so I wasn't really paying attention.
I want to replicate the effect of dropping a weapon like in a feign death.
Quote:

Originally Posted by BHaType (Post 2670118)
If tf2 has features like this you can try through signatures like I did but this is for l4d2

Using the signatures I got the coordinates of the bones
what you need should be in the 44-56 lines

Well, thanks. Unsure of whether it'll work in TF2 or not, something tells me it may not.
If it doesn't, then I'm in a bit of a pickle regarding IDA; I don't know how to use it to find signatures.
I'd like to find signatures by myself, but all of the tutorials I found only gave a bit of info at it's best.
Plus, I really don't want to get a VAC ban and I don't have any other PC operating system other than Windows.


All times are GMT -4. The time now is 04:47.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.