Jump to content

Home

Disguise Script


Recommended Posts

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

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

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

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

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

:lol: 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

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

Whoops, got the GetRunScriptVar() mixed with GetScriptParameter() :migraine:. 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

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 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

Archived

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

×
×
  • Create New...