Scripts / Need some info about "SetEntityRagdollForce(e,limb,x,y,z,v)"

Author
Message
DarinM1967
6
Years of Service
User Offline
Joined: 1st Sep 2018
Location:
Posted: 18th Aug 2019 22:14
Would like to know specifically what it's for and if someone could give a short/brief example of it's use so I can understand it a bit better. Thanks!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 18th Aug 2019 22:51
It's for setting the force on the limb of an entity when in rag doll mode (i.e. when a character is dead).

You would use it to imitate the force of a bullet, for example, hitting a particular body part.

limb is the limb id to apply the force, x, y. z is the direction of the force (i.e. a vector) and v presumably is the force to apply.

I would search the ai scripts to see where (if at all) it is used.
Been there, done that, got all the T-Shirts!
PM
DarinM1967
6
Years of Service
User Offline
Joined: 1st Sep 2018
Location:
Posted: 19th Aug 2019 00:00
Thanks AmenMoses for your quick response. What you said brings to my mind another question and that is, can you force an entity to ragdoll without killing them? Like if you want them to collapse and appear either dead, unconscious for a time. I've searched the forums, but all I can find is people trying to by-pass the death of the entity, which Lee gives the example of applying 1000 points to them, then when they reach a level similar 1000 - their original health they can fake death. I can see how this would work if the entity has an animation that makes them appear dead, but nobody shows or explains a way to get the entity to ragdoll without killing them, which then puts them on a short clock to destruction. Any insights into this would be greatly appreciated. I've been reading gameguru scripts and trying stuff out, but still very newbie about it. Thanks again, AmenMoses, you've been very helpful!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 19th Aug 2019 06:42 Edited at: 19th Aug 2019 06:44
Backup your module_combatshoot file, sit on C:\Program Files (x86)\Steam\steamapps\common\Game Guru\Files\scriptbank\ai

Replace it with file attached below.

It works pressing E key, so soldier does ragdoll anim, and pressing E key again, he does the idle anim, and kill me. LOL
Backup too this file since you can lose it via the next update, and/or steam file check.



It can help you as start point, if I've got your point right.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

Attachments

Login to view attachments
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th Aug 2019 10:50
That's not ragdoll though...

as far as I'm aware, no you can't make a character ragdoll without killing it because you need the animations to stop being called and that only happens when you trigger the engine to do so via telling it the character is dead.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 19th Aug 2019 14:13
Fake ragdoll test1 video.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
DarinM1967
6
Years of Service
User Offline
Joined: 1st Sep 2018
Location:
Posted: 19th Aug 2019 15:40
Thanks 3com, but smallg understood what I was asking. I understand how to trigger animations, was just wondering how to use ragdoll instead since it's a more realistic and less work for the animator. It's a shame that death is hardcoded. Needs to have a hook that we can use to control what happens to the entity on death instead of having the system automatically destroyed it, especially since I think we cannot load entities from scripts on the fly during runtime. Thanks smallg for explaining things better and thanks again 3com for trying to help!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th Aug 2019 16:21
if you don't want the engine to remove the entity you need to keep calling the preexit(e) function
Quote: "Understanding PREEXIT system
----------------------------
SetPreExitValue: SetPreExitValue(e,value) -- where e is the entity and a value of 2 will exit preexit function
function ai_melee_animmove_init(e)
SetPreExitValue(e,0) -- set this to zero to clear out this value for the entity
end
function ai_melee_animmove_preexit(e)
SetPreExitValue(e,1) -- setting this to one will ensure we keep calling preexit over and over
if module_combatmelee.preexit(e,ai_movetype_useanim) == 1 then
SetPreExitValue(e,2) -- when we set this to two, we instruct the engine to stop calling preexit and go to _exit
end
end
function ai_melee_animmove_exit(e)
module_combatmelee.exit(e)
end"

however i don't think it's possible to make an entity get back up once it is dead, best you could do is spawn a new one in the same place and make it play some "get up" animation - but of course it won't line up the limbs to the old characters ragdoll and there's not enough commands in place for limbs yet to fake it ... still enough to look good if you used a few variations of the animation but if you're going to do that then you might as well just make some death animations and you end up with 3coms solution
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 19th Aug 2019 16:59
@ DarinM1967
Ok now I've got your point right, sorry.
Dead entity is full destroyed for sake of the perfomance, thougt.
About create entitity a fly in game mode, I suggested that before, it's a good idea.

@ smallg
Your right mate about ragdool,, it's the end, unless the dead man is called Lazarus.

I was missed that quote about SetPreExitValue command, miss many things that year I was away
Thanks for the tip.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
DarinM1967
6
Years of Service
User Offline
Joined: 1st Sep 2018
Location:
Posted: 19th Aug 2019 19:32
Thanks again smallg. The only problem I have with your solution of just spawning up new entity to replace the dead one, is if I understand correctly about loading entities, is that you can't load them from scripts on the fly during runtime and can only use the entities you've already placed on your area/level in the editor. Is that right or can I load/create new entity from the computers folders/files?
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Aug 2019 15:23
You're right that you can't create new entities from scripts but you can spawn the same character again (I think, been a long time since I tried it but you should be able to still, it just might cause a few issues - at least last time I tried it it was broken).
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-12-22 09:01:30
Your offset time is: 2024-12-22 09:01:30