Jump to content

Home

Crossed Legs


Pavlos

Recommended Posts

Does anyone know the script for having crossed legs on an NPC, so that when inactive they will be sitting on the floor with their legs crossed (Like Kreia on the Ebon Hawk) and then when you talk to them they get up and then when you go away they sit down again. I've tried a few things but I can't seem to get anything to work, I'm just wondering if I can call upon the modding expertise of my superiors.

Link to comment
Share on other sites

I used this in one of my unreleased mods and it works:

 

AssignCommand(GetObjectByTag("npc_tag"), PlayAnimation( ANIMATION_LOOPING_SIT_AND_MEDITATE, 0.5, 0.0 ));

Replace the 0.0 at the end by the duration of the animation (in seconds)

 

Note that some npcs do not have this animation.

Link to comment
Share on other sites

Ok, thanks. There was one thing that I did notice however. It is that when you use the spawn in on enter script and then link that to the original on enter script I get a drop in performance, quite considerably actually. Has anyone else ever had this?

Link to comment
Share on other sites

That frequently happens when you assign too much to the spawn in script as it gets bogged down with loading models and textures and then additional scripts. Part of it comes from the fact the scripting system has no way to set priority levels so the game is giving equal priority to running that script as it would the scripts loading the 3D scene. I have discovered this after reading the book in my sig as this is one of the numerous things discussed in that book that also gets addressed by the scripting language you get to write as you follow along.

Link to comment
Share on other sites

A single extra script running won't do too much a difference to game performance though, unless the script is extremely large (or it runs often), or unless you have unterminated loops or rampaging recursions in your script. A normal script that doesn't add objects to the world or do anything I/O intensive shouldn't noticably change the performance of the game when it runs.

 

The "lag" when spawning new creatures is usually caused by loading the model and animations. I believe spawning creatures with a animation supermodel that's already in use is a lot faster than one with a new or custom animation set.

 

Another thing I've noticed that slows down spawning a lot is the creation of the objects in the creature's inventory. Spawning a creature with a lot of items equipped and possessed is very noticably slower than spawning one with few or no items.

 

Are you really sure that its the script that causes the slowdown, and not some other change you've made to the template? Try removing all code except the ExecuteScript() statement from the Spawn script and see if it changes. If the slowdown then disappears, post your spawn script here and I'll see if I can spot any problems with it.

Link to comment
Share on other sites

No no probelm, it happens that with all my warping around that my game was starting to get really messed up (I use 1 particular save for testing out wierd stuff that I do) so I started a new 1 and there is no slow down, now to test that script. Thanks!

 

Edit: If I wanted to have it on infinite meditating as opposed to a set time what would I do? Also what is the animation name for getting up from this, or does it do it automatically?

Link to comment
Share on other sites

0 can't be infinite as he sits down and stands up again so I'll try -1

 

Edit: It doesn't seem to work, never mind, thanks for the help. Anyone else?

 

Edit: I put it in OnHeartBeat and now the NPC stays down, so hopefully that will have fixed the problem.

 

Edit: I should have known, when it is in there every time he says something he gets up then sits down again. I'll fiddle then until some kindly superior modder passes by.

 

Edit: Yes another one! I edited it slightly and put -1.0 in, now he will spawn in as a meditating person (Though this doesn't seem to work from a save, he is just standing there) and he wont sit down again! Agh!

 

Edit: Would I need to generate an on end dialogue script involving:

 

 AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_LOOPING_SIT_AND_MEDITATE, 1.0, -1.0)); [/Code]

 

Edit: Ok so that works. How would I get it to work from a save because if I warp to the module it is ok, as is if I enter the module normally, but if I load a save in the module it doesn't work. Frustrating! Anyway, sorry for the number of edits.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...