PDA

View Full Version : Help with a script


Myster
10-28-2005, 07:55 AM
ok right what i want to happen is in a conv the npc will attack the pc once and then carry on talking. how can i make this happen? i tryed making the npc hostile for a couple of seconds and then changeing it back to neutral but im new to scripting and i couldent get it to work.
so can somone help me out id realy appreciate it

( BTW im scripting for Kotor 1 )

Pavlos
10-28-2005, 08:56 AM
Within dialogue editor for scripts put a_attackonend to get the guy to be hostile and then I suppose you could use global numbers to say that it has been done also put this in scripts void main()
{
SetGlobalNumber("Put your reference from the Globalcat here", 0);
}

And then you can check that in a new dialogue with a conditional script:


int StartingConditional()
{
return (GetGlobalNumber ("Whatever you said above") == 1);
}

And then you can fight him, and the next time you open up a dialogue with him you can have a different conversation. It may be slightly round about and you would ahve to edit globalcat but that is really the only way I can think of at the moment. Never modded kotor though, only ever TSL I don't know why, just haven't.

Darth333
10-28-2005, 10:17 AM
I wouldn't use a global variable for this: it's way overkill. A local boolean would do the job and you wouldn't need to edit globalcat.2da. Local variables are stored on an object and Globals affect the whole game. Also, local variables do not require you to edit globalcat.2da (which creates mod conflicts). Use globals when you need to keep track of a quest, of the actions of your PC, per example, not a simple dialogue.


Chekc this tutorial: http://www.lucasforums.com/showthread.php?t=126615

Myster
10-28-2005, 06:40 PM
Well is there a way to like get the guy to attack the pc once and the pc cant fight back or even just in the convo to show the action of my pc getting hit by the npc.

Det. Bart Lasiter
10-28-2005, 08:10 PM
There's no script 'a_attackonend' built into KotOR 1, lest you re-create it for KotOR 1.

Darth333
10-29-2005, 12:29 AM
but there is a cutsceneattack function:

void main() {
object oAttacker=GetObjectByTag("attacker_tag");
object oPC=GetFirstPC(); //target
ActionPauseConversation();
AssignCommand(oAttacker,CutsceneAttack(oPC,int nAnimation,ATTACK_RESULT_HIT_SUCCESSFUL,10));
DelayCommand(5.0,ActionResumeConversation());
}

Replace int nAnimation by the correspoding row number in animations.2da . Make sure you have the correct animation or the npc will just play the animation and no real attack.

And the value at the end (10) corresponds to the damage dealt on the target.

Edit: to find combat animations in animations.2da, this list by Cerasumat is very useful: http://www.lucasforums.com/showthread.php?t=133683

Pavlos
10-29-2005, 02:16 AM
There's no script 'a_attackonend' built into KotOR 1, lest you re-create it for KotOR 1.
Well there you go, hid mod is going to spiral out of control and in two years time he will have reconstructed the Odyssey Engine.

Det. Bart Lasiter
10-29-2005, 02:43 AM
Or the dialog wouldn't have worked because the script was non-existant.