Pavlos Posted November 6, 2005 Share Posted November 6, 2005 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 More sharing options...
Darth333 Posted November 6, 2005 Share Posted November 6, 2005 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 More sharing options...
Pavlos Posted November 6, 2005 Author Share Posted November 6, 2005 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 More sharing options...
Darkkender Posted November 7, 2005 Share Posted November 7, 2005 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 More sharing options...
Pavlos Posted November 7, 2005 Author Share Posted November 7, 2005 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. Link to comment Share on other sites More sharing options...
stoffe Posted November 7, 2005 Share Posted November 7, 2005 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 More sharing options...
Pavlos Posted November 7, 2005 Author Share Posted November 7, 2005 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. Link to comment Share on other sites More sharing options...
Mono_Giganto Posted November 7, 2005 Share Posted November 7, 2005 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. Link to comment Share on other sites More sharing options...
Pavlos Posted November 9, 2005 Author Share Posted November 9, 2005 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 More sharing options...
Mono_Giganto Posted November 9, 2005 Share Posted November 9, 2005 I think the value for infinite is either 0 or -1, don't quote me on that though. Link to comment Share on other sites More sharing options...
Pavlos Posted November 9, 2005 Author Share Posted November 9, 2005 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 More sharing options...
Det. Bart Lasiter Posted November 9, 2005 Share Posted November 9, 2005 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. Link to comment Share on other sites More sharing options...
Darth333 Posted November 10, 2005 Share Posted November 10, 2005 You could try using the GetLoadFromSaveGame() function. Link to comment Share on other sites More sharing options...
Pavlos Posted November 10, 2005 Author Share Posted November 10, 2005 Ok, I'll try that later, thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.