Fine animation control
Fine animation control
Is there a way to control player or NPC animations? Example, maybe have the animation freeze on specific frames for a certain amount of time in order to capture a certain pose or something.
Does this mean it's not really possible to make a character lay on the floor as if they are going to sleep?
I guess the only way to do that would be to make the player invisible, make a copy of the player at the player's location, then play the death animation on that copy of the player and leave that NPC dead. And when the player *wakes up* the copy is removed and the player is made visible again. m i rite
I guess the only way to do that would be to make the player invisible, make a copy of the player at the player's location, then play the death animation on that copy of the player and leave that NPC dead. And when the player *wakes up* the copy is removed and the player is made visible again. m i rite
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
Yeah, but you wouldn't have to make an actual copy of the player and kill him. Just make the player fall over - then make him invisible and add a corpse item looking just like him on the ground. Attach an onUse JS to the corpse, setup so the player will become visible again and regain his items (if transferred to the corpse earlier) when he double-clicks it.
Would also have to make sure that only that specific character could double-click it though
Would also have to make sure that only that specific character could double-click it though
-= Ho Eyo He Hum =-
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
Yep. I've done that myself in a half-finished script I wrote to let characters sleep on beds. i.e. hide, freeze & mute the real character, add a corpse (renamed, of course) on the bed with the player character's physical features (skin color, hair, beard), transfer all items from character to corpse.
-= Ho Eyo He Hum =-
-
Maarc
- Developer
- Posts: 576
- Joined: Sat Mar 27, 2004 6:22 am
- Location: Fleet, UK
- Has thanked: 0
- Been thanked: 0
- Contact:
You're making the bold assumption that it is something that should be fixed 
The events on death are handled in HandleDeath(), in pcmanage.cpp (around line 1000). You probably want to tinker with MoveItemsToCorpse(), which is around line 920. That basically shunts everything across to the corpse, except for trade containers, bank boxes, and the backpack (though contents of the backpack do get moved in). As long as it's not a spellbook, nor a newbie item, that is.
The events on death are handled in HandleDeath(), in pcmanage.cpp (around line 1000). You probably want to tinker with MoveItemsToCorpse(), which is around line 920. That basically shunts everything across to the corpse, except for trade containers, bank boxes, and the backpack (though contents of the backpack do get moved in). As long as it's not a spellbook, nor a newbie item, that is.
Ah, makes sense. If a container has multiple items but you know the exact location of a specific item you would be able to access them quickly in O(1) time without iterating through all the items, like a hash table.Maarc wrote:Yup, the xyz is either a location in the world, or a location within the container. Container's tend to like to be organised, I think the client treats certain cooardinates certain ways. But yup, it's to make sure they're within the proper bounds of the container so that someone can see them.
I take it that on resurrection there is a script somewhere that searches for items called "Hair/Beard". Do Corpses have layers in the same way that players do? Maybe it's simply a matter of creating a copy of the player's hair and facial hair and putting them into the proper layers on the corpse?
Edit: I've also noticed that SetCont has no checks for elven hair styles. Wouldn't that result in a bug?
-
Maarc
- Developer
- Posts: 576
- Joined: Sat Mar 27, 2004 6:22 am
- Location: Fleet, UK
- Has thanked: 0
- Been thanked: 0
- Contact:
No, corpses don't have layers, which is part of why all that logic has to be there. As for constant access, while we set it, we don't do location based lookups, we have a vector based list, so it'd be more O(n) really. But it was a damn sight better than it used to be in 0.7x, where it was stuffed into a global hash table, which means it also contained other containers and their items as well that you'd have to look through 
Resurrection is handled through NpcResurrectTarget(), in targeting.cpp. It can call onResurrection script, yes. But as far hair/beard handling, actually, no, it doesn't look like there is. Interesting, I wonder what that really means.
And the SetCont thing is probably a bug, yes. We should probably not be checking against hard coded IDs anyway, but whether the item's layer property is IL_HAIR or IL_FACIALHAIR.
Resurrection is handled through NpcResurrectTarget(), in targeting.cpp. It can call onResurrection script, yes. But as far hair/beard handling, actually, no, it doesn't look like there is. Interesting, I wonder what that really means.
And the SetCont thing is probably a bug, yes. We should probably not be checking against hard coded IDs anyway, but whether the item's layer property is IL_HAIR or IL_FACIALHAIR.
Interesting. I also wonder what it really means.Maarc wrote:No, corpses don't have layers, which is part of why all that logic has to be there. As for constant access, while we set it, we don't do location based lookups, we have a vector based list, so it'd be more O(n) really. But it was a damn sight better than it used to be in 0.7x, where it was stuffed into a global hash table, which means it also contained other containers and their items as well that you'd have to look through
Resurrection is handled through NpcResurrectTarget(), in targeting.cpp. It can call onResurrection script, yes. But as far hair/beard handling, actually, no, it doesn't look like there is. Interesting, I wonder what that really means.
I wouldn't doubt that the hair and beard never actually leaves the player. Strangely enough, while messing around I noticed I can get hair to appear on a players paperdoll without appearing on the actual character. Most puzzling.
Yea, but the IDs probably aren't going anywhere for a while. The missing ranges are 0x2FBF to 02FC2 and 0x2FCC to 0x2FD2And the SetCont thing is probably a bug, yes. We should probably not be checking against hard coded IDs anyway, but whether the item's layer property is IL_HAIR or IL_FACIALHAIR.