Kexikus 995 Posted March 21, 2016 I'm currently trying to have a character do a looping animation with a script in K1 (the LS character screen animation, i.e. row 59 from animations.2da, to be more specific). I tried both AssignCommand(GetObjectByTag("Juhani"), ActionPlayAnimation(59, 1.0, -1.0f)); AssignCommand(GetObjectByTag("Juhani"), PlayAnimation(59, 1.0, -1.0f)); but neither of these did anything. So then I tried one of the animation constants ANIMATION_LOOP_DANCE and it's integer value 16 and both of these did work, so I figure it's only the animation constant that's wrong. I also tried both 53 and 54 for the row indices/indexes? of the two dance animations but they didn't work either. While looking around for a solution I found this thread: http://deadlystream.com/forum/topic/3569-making-ingame-cutscenes/ and HHs last post where he claims that the number should be 100[XX] for stuff that's not in nwnscript.nss. That made sense to me, since the bow animation in a dialog has the value 10035 for example. So I tried 10059, but that also did nothing. I went ahead and tried 10035 for the bow animation and once again nothing happened (though this might also be because it's no looping animation maybe?). I then checked both animations.2da and nwnscript.nss for the bow animation and it turns out that its idea is not 35, but something else in both of them. So now, I know neither whether the 100[something] works at all, nor how to get that number for a specific animation... Any help on how to get this animation to work would be great Quote Share this post Link to post Share on other sites
Kexikus 995 Posted March 23, 2016 I looked through some more lucasforums threads and all I could find was one post that suggested not using the duration of -1.0 for non-nwnscript animations, but changing that didn't work either. I'm beginning to think that the number 100[xx] for animations from animations.2da is something that's only possible in TSL and there is no way to use them in K1... Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted March 23, 2016 I've never had success scripting anything that isn't in NWScript in K1 either, unfortunately. And it's specifically a scripting problem, because it is possible to script those animations if you mess around with animations.2da or the models - essentially, if you change the alignment animation to be called dance instead, you can script it using the dance constant. Of course, changing the 2DA is not really an option for a mod, because that would change it for everyone everywhere... although it might be funny to see light side characters dancing in the character screen instead. And I wouldn't recommend changing the player's animations at all, unless you can find one you're sure isn't used anywhere (though dance is). But if this is for a specific NPC, it wouldn't be too hard to do something tricky with the model so its dance animation is different. Quote Share this post Link to post Share on other sites
Kexikus 995 Posted March 23, 2016 I've never had success scripting anything that isn't in NWScript in K1 either, unfortunately. And it's specifically a scripting problem, because it is possible to script those animations if you mess around with animations.2da or the models - essentially, if you change the alignment animation to be called dance instead, you can script it using the dance constant. Of course, changing the 2DA is not really an option for a mod, because that would change it for everyone everywhere... although it might be funny to see light side characters dancing in the character screen instead. And I wouldn't recommend changing the player's animations at all, unless you can find one you're sure isn't used anywhere (though dance is). But if this is for a specific NPC, it wouldn't be too hard to do something tricky with the model so its dance animation is different. Well, this is for Juhani but it would be no problem to use a unique Juhani utc for this scene instead of the party member herself. So I could give her another appearance/model, but I have no idea how I would change the animation for that model. If you happen to know that and it's not too much work, could you tell me? If it's a complicated process or very difficult for some other reason, don't bother, the animation isn't that important^^ Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted March 24, 2016 It's... kind of complicated but not really difficult if you know what you're doing. The way the animations work is a series of steps. When you fire the script, it checks a specific line in animations.2da. This then checks the name of the animation - in this case, good - and it goes looking for the animation based on that name. First it checks the model, then if it can't find that (most models don't have special animations) it checks the supermodel, and then the supermodel's supermodel, and so on down the chain. Once it finds the animation it plays it, and so long as the animation you want to play is at the top of the chain, it's fine. The upshot is you can add an animation to any model (or supermodel) and so long as it's at the top of the chain and you link it to the one of the standard supermodels, all the other animations will be unaffected and play as they're supposed to. So, you want to add the good animation to Juhani, but under a different name - one that can already be scripted. There are two options here: you can either add it to a model, or you can add it to a supermodel. You said you're using a UTC, so I assume she's going to be wearing some specific item, and you only actually need that model... but I'm not sure if that will be easier because the importing method requires a bit of work in 3ds Max and involves some further complications. The other option is to simply hex edit the model - S_Male02 in this case - and change good to whatever you want to use. But when you're replacing something through hex editing you have to keep the number of characters the same... or I guess you could convert it to ASCII, edit the ASCII in Notepad, and then convert it back through MDLOps. There are a number of options here. If this sounds like too much work I won't blame you, but if you're interested in doing it I can provide some more specific details. I do this sort of thing all the time and it's not difficult, just kind of time consuming, and the best method to use is very situational. 1 Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted March 24, 2016 JC: I get what you're saying and have done that once before myself with K1R. I imagine Kex would be asking me soon anyways, so I'll see what I can do for this. Quote Share this post Link to post Share on other sites
Kexikus 995 Posted March 24, 2016 It's... kind of complicated but not really difficult if you know what you're doing. The way the animations work is a series of steps. When you fire the script, it checks a specific line in animations.2da. This then checks the name of the animation - in this case, good - and it goes looking for the animation based on that name. First it checks the model, then if it can't find that (most models don't have special animations) it checks the supermodel, and then the supermodel's supermodel, and so on down the chain. Once it finds the animation it plays it, and so long as the animation you want to play is at the top of the chain, it's fine. The upshot is you can add an animation to any model (or supermodel) and so long as it's at the top of the chain and you link it to the one of the standard supermodels, all the other animations will be unaffected and play as they're supposed to. So, you want to add the good animation to Juhani, but under a different name - one that can already be scripted. There are two options here: you can either add it to a model, or you can add it to a supermodel. You said you're using a UTC, so I assume she's going to be wearing some specific item, and you only actually need that model... but I'm not sure if that will be easier because the importing method requires a bit of work in 3ds Max and involves some further complications. The other option is to simply hex edit the model - S_Male02 in this case - and change good to whatever you want to use. But when you're replacing something through hex editing you have to keep the number of characters the same... or I guess you could convert it to ASCII, edit the ASCII in Notepad, and then convert it back through MDLOps. There are a number of options here. If this sounds like too much work I won't blame you, but if you're interested in doing it I can provide some more specific details. I do this sort of thing all the time and it's not difficult, just kind of time consuming, and the best method to use is very situational. Okay, that makes sense I think. The problem is that I really know nothing about Kotor models or 3d models in general and that probably makes things harder for me :/ Still, I'm interested in doing that, so I'll just try and see what I can learn about model basics and then with your additional details I can hopefully learn how to do this and make it work. One more thing to note is that she ideally won't be wearing a specific robe. If a new row in appearance.2da is necessary, I'd just spawn a character with that appearance and then equip whatever the original party member Juhani is wearing with a script. So I guess it would have to be the supermodel of that appearance or something that needs to be edited but as I said, I don't really know^^ JC: I get what you're saying and have done that once before myself with K1R. I imagine Kex would be asking me soon anyways, so I'll see what I can do for this. Hehe, sorry for bothering you all the time... Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted March 24, 2016 One more thing to note is that she ideally won't be wearing a specific robe. If a new row in appearance.2da is necessary, I'd just spawn a character with that appearance and then equip whatever the original party member Juhani is wearing with a script. So I guess it would have to be the supermodel of that appearance or something that needs to be edited but as I said, I don't really know^^ Nah, you do know things. That's exactly right. So, in that case, you still have the choice of importing the supermodel and changing the animations, or hex editing, or getting around hex editing by converting to ASCII and then back. I'm thinking the last method might be the easiest here. So, first you extract the model files, S_Male02.mdl and S_Male02.mdx and convert them to ASCII with MDLOps by reading and writing the model. You can then open the ASCII in Notepad and edit stuff. There are four things you need to do with the ASCII. First, you need to change the good animation to what you want - some animation that you can already script, and that's of the same type (in this case looping). The dance animation would be an ideal choice, as that's rarely used. Unless she's going to be dancing in the scene, I don't know what you're planning here. Second, I'd also suggest deleting all other animations from the model so it doesn't interfere with anything else. Each animation branch starts with "newanim" and ends with "doneanim". Third, you need to set the supermodel to Juhani's original supermodel, S_Female03, so replace S_Male01 with S_Female03. The final thing you have to do is change the model name from S_Male02 to something else, and there's a bit of a catch here. You have to edit all of Juhani's body models, as well as her head, to use this supermodel instead of S_Female03. Hex editing is easier so I'd suggest changing the supermodel to have the same number of characters as S_Female03, something like S_Juhani01. So replace all instances of S_Male02 in the model with that. And then rename your model to S_Juhani01-ascii (or whatever you're doing and then -ascii). Then to convert the model back into binary format, you need a binary model for MDLOps to read as the original. This is kind of silly, but extracting the supermodel S_Female03 and then renaming it to S_Juhani01 (or whatever) will cover that. Assuming everything is in the same location, MDLOps can convert it properly - select the ASCII and read and write again. I'm not sure why MDLOps needs this, but that's what I do and it generally works. Then once the model is converted you can put it in Override and rename it S_Juhani01 (or whatever). After that, you have to hex edit Juhani's models to use that supermodel instead of S_Female03. That's just a matter of opening the MDLs in a hex editor and replacing that text. Just make sure you don't add or delete any characters. You also have to change these models' names so they don't conflict with the originals, and I make sure to hex edit the names as well, because I've found that not doing so may confuse the game. Again, keeping the same amount of characters, so for example PFBIM might become Juh_I. You could do the ASCII thing again to get around the character limit, but remember that MDLOps still isn't perfect so in most cases it's better to avoid using it when you don't really need it. And you have to do this for the head too. Unfortunately mod compatibility will be an issue here... well, not compatibility exactly. Basically anything that changes Juhani's appearance won't change your new appearance line, so she'll look different. But you could make patches and so on. I think that should cover anything. If you don't want to take on this endeavor yourself, maybe this information will be of use to Fair Strides instead. Quote Share this post Link to post Share on other sites
Kexikus 995 Posted March 24, 2016 Sounds perfectly achievable and I'll attempt that tomorrow. Thanks for the explanation. One more question to be sure though: I'd then create a new line in appearance.2da that uses these "new" models, right? So it'd be Juh_I instead of PFBIM for example. Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted March 24, 2016 Yes, that's right... and you can leave the texture entries the same so they otherwise match the originals. Quote Share this post Link to post Share on other sites
Kexikus 995 Posted March 25, 2016 Well, it didn't work... or atleast not the way it was supposed to. Instead of standing as in the good animation, she was standing similar to the dark side animation but completely still, except for her head that would still do the dance animation... Looked hilarious xD The head is probably due to the fact that I wasn't able to find S_Female03 in her head mdl and thus not able to change the supermodel. The same goes for her underwear model P_JuhaniBA, but that one wasn't even used here. Any ideas why that's the case? But it seems like I also made some other mistake with the other models. Currently I have no idea what it could be, but I'll try and find it Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted March 25, 2016 The head is probably due to the fact that I wasn't able to find S_Female03 in her head mdl The supermodel for Juhani's head is P_JuhaniBB. Quote Share this post Link to post Share on other sites
Kexikus 995 Posted March 25, 2016 The supermodel for Juhani's head is P_JuhaniBB. Thanks, changing that to my new JuhaniBB model worked. And I also figured out why the animation doesn't look the way I want it to. The good animation is different for male and female characters and since I used S_Male02 as a base, I got the male animation while I originally wanted the female version. Fixing that shouldn't be too hard though Edit: It worked Not sure if I like the animation though xD Thanks for all the help! Edit 2: Well, it works... but I found a new problem. The animation won't stop, neither when another animation is supposed to play nor when the duration of the animation as specified in the script is over. I guess I screwed something up, so I'll try again later, but if anyone knows what the issue might be, please let me know. I did everything the way JC described it except for the fact that I used S_Female03 as a base instead of S_Male02, simply because I wanted the female "good" animation. And in the head model I used the new version of P_JuhaniBB as supermodel. The animation ending was working when I still had the male model as a base, so I assume something went wrong afterwards. The supermodel of my S_Juhani01 model that's based on S_Female03 is also still S_Female03 if that makes any difference. Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted March 25, 2016 I did everything the way JC described it except for the fact that I used S_Female03 as a base instead of S_Male02, simply because I wanted the female "good" animation. And in the head model I used the new version of P_JuhaniBB as supermodel. Those both should be fine. I wasn't aware females had a different animation, so getting it from S_Female03 would be the thing to do. And the head shouldn't be an issue either, if it's pointing to your edited model. And anyway the head plays the animation separately from the body, so any issue with the head wouldn't be affecting the body. The animation ending was working when I still had the male model as a base, so I assume something went wrong afterwards. The supermodel of my S_Juhani01 model that's based on S_Female03 is also still S_Female03 if that makes any difference. Hmm... is it possible you corrupted something in the model when you did it the second time? If it worked once, we can rule out any scripting issue, I think. The supermodel of my S_Juhani01 model that's based on S_Female03 is also still S_Female03 if that makes any difference. That's how it should be, I believe. Quote Share this post Link to post Share on other sites
Kexikus 995 Posted March 25, 2016 I remade the supermodel S_Juhani01 from scratch, this time using S_Female03 as a base and not trying to replace things I already did and now it works perfectly I think I screwed up some renaming somewhere and that resulted in these weird issues. Thanks again for all your help Quote Share this post Link to post Share on other sites