View Full Version : Crossed Legs
11-06-2005, 01:31 PM
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.
11-06-2005, 02:37 PM
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.
11-06-2005, 02:47 PM
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?
11-07-2005, 01:14 PM
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.
11-07-2005, 02:04 PM
So is there any way to cut down the script as this isn't a module supported by the KotOR Tool's module editor- much as I'd like it to be.
11-07-2005, 03:14 PM
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.
11-07-2005, 04:06 PM
Ok, thanks. I can't do it right now as I have a tonne (Or is the phrase meant to use an imperial ton?) of revision to do for Exams etc. :( I hate revision.
11-07-2005, 05:30 PM
Well, what module is it? There may be another way to use your script besides the on enter script. May not slow down quite as much.
11-09-2005, 02:05 PM
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?
11-09-2005, 03:12 PM
I think the value for infinite is either 0 or -1, don't quote me on that though.
11-09-2005, 04:35 PM
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_MEDI TATE, 1.0, -1.0));
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.
Det. Bart Lasiter
11-09-2005, 07:29 PM
That's what usually happens when the NPC isn't part of the module, I'm not sure if there's a way around it.
11-09-2005, 10:10 PM
You could try using the GetLoadFromSaveGame() function.
11-10-2005, 01:33 PM
Ok, I'll try that later, thanks.
vBulletin®, Copyright ©2000-2014, Jelsoft Enterprises Ltd.