Mandalore_The_Great Posted February 18, 2009 Share Posted February 18, 2009 I found a script called qa_setanim and it says it's a disguise script void main() { int nX = GetRunScriptVar(); effect eDisguise = EffectDisguise(nX); ClearAllEffects(); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDisguise, GetFirstPC()); } What do I replace to make this into a working disguise script? I'm guessing it would be a line in appearance.2da or the tag, but I'm not sure where to put all the info Link to comment Share on other sites More sharing options...
Star Admiral Posted February 18, 2009 Share Posted February 18, 2009 This script is designed to change the PC's appearance. As it stands, it should work just fine. Where to put it depends on what you want to do with it. You can attach it to a dialog to change the PC's appearance at the end of the conversation, for example. There's no need to edit the appearance.2da file; I doubt it even has a column for scripts. - Star Admiral Link to comment Share on other sites More sharing options...
Mandalore_The_Great Posted February 19, 2009 Author Share Posted February 19, 2009 when I use it as is my game crashes Link to comment Share on other sites More sharing options...
Silveredge9 Posted February 19, 2009 Share Posted February 19, 2009 You could try something like this: void main() { effect eDisguise = EffectDisguise(APPEARANCE.2DA LINE NUMBER GOES HERE); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDisguise, GetFirstPC()); } To clear the effect, you could use the "ClearAllEffects();" function. Link to comment Share on other sites More sharing options...
Mandalore_The_Great Posted February 19, 2009 Author Share Posted February 19, 2009 Oh... I think I understand what some of this stuff actually means. effect eDisguise=... is telling the script what to do when eDisguise is mentioned in another line... then the second line is activating the eDisguise specified in the first line. for some reason I never saw it that way Edit: well thanks, it works. Kind of odd that script didn't work, though Link to comment Share on other sites More sharing options...
Star Admiral Posted February 19, 2009 Share Posted February 19, 2009 I believe that it didn't work because of the lines: int nX = GetRunScriptVar(); effect eDisguise = EffectDisguise(nX); If you attached the script to a dialog file, but did not pass in any variables from the dialog, the script would not know which appearance to change the main character to. That might have crashed the game. - Star Admiral Link to comment Share on other sites More sharing options...
Mandalore_The_Great Posted February 21, 2009 Author Share Posted February 21, 2009 pass in any variables? Link to comment Share on other sites More sharing options...
Star Admiral Posted February 21, 2009 Share Posted February 21, 2009 The neat thing about the dialog file in TSL is that it allows you to pass in up to 4 numbers and 1 string when executing a script, allowing the same script to be used multiple times, depending on what was passed in. K1, unfortunately, lacked this ability. - Star Admiral Link to comment Share on other sites More sharing options...
glovemaster Posted February 21, 2009 Share Posted February 21, 2009 I had tried using GetRunScriptVar() with little success, it always seemed to return 2001 no matter what. The alternative that I used was a LocalNumber, setting the number in the first script and getting it again in the second. Link to comment Share on other sites More sharing options...
stoffe Posted February 21, 2009 Share Posted February 21, 2009 I had tried using GetRunScriptVar() with little success, it always seemed to return 2001 no matter what. The GetRunScriptVar() function is not used to get dialog parameters as was stated above. It's used in conjunction with with ExecuteScript() function. This function takes 3 parameters; the name of the script to run, an object reference to the object that should run the script (OBJECT_SELF inside the script), and an optional numeric parameter. This number you pass as the third parameter to ExecuteScript() can then be retrieved inside that script by using the GetRunScriptVar() function. (A wild guess as to why you'd get 2001 is that if you call the GetRunScriptVar() function inside a script that you haven't run with the ExecuteScript() function it will return the parameter from the last script that was run via that method, which in your case presumably would be the general AI script, k_ai_master, which will run a party member heartbeat script if passed 2001 as parameter, which happens for each active party member roughly every 3 seconds.) Link to comment Share on other sites More sharing options...
glovemaster Posted February 21, 2009 Share Posted February 21, 2009 Sorry that wasn't a very clear post, I was using ExecuteScript() though despite passing numbers like 300 or just 1, in the executed script GetRunScriptVar() just returned 2001. IIRC The NWscript mentions something about it being used for debugging? Link to comment Share on other sites More sharing options...
stoffe Posted February 21, 2009 Share Posted February 21, 2009 Sorry that wasn't a very clear post, I was using ExecuteScript() though despite passing numbers like 300 or just 1, in the executed script GetRunScriptVar() just returned 2001. IIRC The NWscript mentions something about it being used for debugging? It works as intended, otherwise the general AI that runs every creature in the game would be utterly broken. All the specific AI scripts set on the event trigger hooks on creatures do little other than ExecuteScript() the k_ai_master script, passing it a numeric parameter to tell it what to do (2001 = run party member heartbeat script, for example, as mentioned above). This applies to both games. I've used it in several mods I've made as well with the intended results. Link to comment Share on other sites More sharing options...
Mandalore_The_Great Posted February 21, 2009 Author Share Posted February 21, 2009 Wow... I have no idea what you guys are talking about. I like scripting but I'm not good with the lingo thanks for the help, Silveredge9. Works fine. Is there a resource somewhere that has lists of these sort of things besides NWscript.nss? to me, it doesn't give enough information on how to use the functions and how to write it. scripting is somewhat over my head Link to comment Share on other sites More sharing options...
Star Admiral Posted February 21, 2009 Share Posted February 21, 2009 Whoops, got the GetRunScriptVar() mixed with GetScriptParameter() . Sorry about that, and thanks for correcting me. Regarding other sites where you can find some explanations of how to use the script functions, you could try the NWN Lexicon here. Although it was written for NeverWinter Nights, most of it applies to KOTOR as well. - Star Admiral Link to comment Share on other sites More sharing options...
Mandalore_The_Great Posted February 22, 2009 Author Share Posted February 22, 2009 Thanks SA, helps a lot. Now I know what all that mess means.... just a random question, but when using CastFakeSpellAt-whatever, does it use the animation as well as the sparkles and shimmer? Or would I need to specify that before the void main()? Link to comment Share on other sites More sharing options...
Star Admiral Posted February 22, 2009 Share Posted February 22, 2009 Not 100% sure, as I've never used this function before, but judging from its description, only the casting animations specified for the spell in the spells.2da file will be used. The actual script for the spell will be ignored. So no, you don't need to specify the animations before. Correct me if I'm wrong. - Star Admiral Link to comment Share on other sites More sharing options...
Mandalore_The_Great Posted February 23, 2009 Author Share Posted February 23, 2009 More scripting woes.... void main() { object oPC=GetPCSpeaker(); ActionPauseConversation(); //Make it seem like I'm casting the //spell in line 15 of spells.2da ActionCastFakeSpellAtObject(15, oPC); //Apply a couple of visual effects to the PC int nDur=DURATION_TYPE_INSTANT; effect e1=EffectVisualEffect(3010); effect e2=EffectVisualEffect(3016); effect e3=EffectVisualEffect(1018); ActionDoCommand(ApplyEffectToObject(nDur, e2, oPC)); ActionDoCommand(ApplyEffectToObject(nDur, e1, oPC)); ActionDoCommand(ApplyEffectToObject(nDur, e3, oPC)); ActionResumeConversation(); } I've tried this script in two different conversations(one with and one without the ActionPause/ResumeConversation() ) and neither worked. Ideas? Link to comment Share on other sites More sharing options...
Star Admiral Posted February 23, 2009 Share Posted February 23, 2009 Not sure how needed the ActionPauseConversation() is, as I've never used it before. Do you want your character to fake cast a power at a target, or do you want the target to fake cast a power at your character? The ActionDoCommand() looks suspicious to me. - Star Admiral Link to comment Share on other sites More sharing options...
Mandalore_The_Great Posted February 24, 2009 Author Share Posted February 24, 2009 well, I made it so that whoever's talking to the PC casts it. This was originally an example from the downloadable version of the NWN Lexicon that I edited a little to add in an extra effect. I used the ActionPauseConversation() to give it a cinematic effect. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.