Jump to content

Home

Three scripts I need


Warlord664

Recommended Posts

Hey! Can some one help me out with these?

 

 

(1) I need a script that makes it trigger a conversation after you open a door.

 

(2) I need a script that gives you credits kinda like a quest reward.

 

(3) I need a script that makes one guy attack the other guy and kill him all in conversation.

 

Ty.

Link to comment
Share on other sites

  • Replies 51
  • Created
  • Last Reply

Here are the script you need, they should all compile because these are the generic scripts I use as templates while work on my project. Note that a lot of scripts can work in both TSL and KOTOR because they have basically the same set of functions. However TSL gives you a couple of more scripting options. Anyways, onto the scripts:

 

1. Conversation after Door - Attach this the OnOpen field of the door and it will fire when the door opens. Also I attached a small delay script so that the script will fire 3 seconds after the door is opened. I did this so that you would click the door and start a conversation while the door is still opening. Also I saw from your post that apparently all the doors in the area you want to use this have the same tag, that's bad, real bad, as in not breathing bad. You need to go in the .git file, find the door that you want the script to fire at (by matching up the coordinates with the whereami armband), and change the name so that it's unique. Otherwise the script will fire every time you open a door with the same tag.

 

void main() {

 

object oNPC=GetObjectByTag("npc tag or the name of dialog if there is no npc to fire it");

ActionDoCommand(SetCommandable(TRUE,oNPC));

DelayCommand(3.0,AssignCommand (oNPC, ActionStartConversation(GetFirstPC())));

 

}

 

2. Add Credits to the PC

 

void main()

{

GiveGoldToCreature(GetFirstPC(),200);

 

}

 

3. Two Guys Fight and Die - This one requires two scripts, one to fire at some point to make the guys fight and the second to kill the one you want. What's going on here is that the two characters will fight each other but you will NOT be able to intervene in the fight. What you need to do is fire the first script when you want the to characters to fight and the second when you want one of them to die.

 

First Script:

void main() {

object oObject1=GetObjectByTag("first character");

object oObject2=GetObjectByTag("second character");

 

ChangeToStandardFaction(oObject1, 12);

ChangeToStandardFaction(oObject2, 13);

 

ExecuteScript("k_ai_master",oObject1,1005);

ExecuteScript("k_ai_master",oObject2,1005);

 

}

 

Second Script:

void main() {

effect eStun = EffectDeath();

object oTarget = GetObjectByTag("tag of character to die");

 

ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eStun,oTarget);

}

 

I hope this helps, if you have any questions, yell at me.

Link to comment
Share on other sites

Ty Har. But the last script I just want the one guy to swing once and kill the other guy. I wasn't planning on having a big fight with these guys. Im guessing it will still work thoguh. Not sure where two place the second script. Will I have to have the guy whos killing the other guy talking while he does it?

Link to comment
Share on other sites

If you want you could combine the two scripts together and do something like this for the second script:

 

DelayCommand(5.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eStun, oTarget));

 

Just replace this with the last line of the last script and now it will happen after 5 seconds, you can change that pretty easily. Now that these two scripts are combined you can watch the fighting and then after 5 seconds the one guy will die.

Link to comment
Share on other sites

Another option is to simply place the .git file in the override and start the game that way. The .git in the override will in a sense "reset" the level and ensure that everything you do to the module will take affect. Some changes require you to start a new game to see their affects if you've already compiled the modules. If I'm testing something I always keep the .git file and any edited/new files in the override until I'm not with that section and have to move on to the next module.

Link to comment
Share on other sites

void main()
{
  object oNPC=GetObjectByTag("[color=darkorange]to'ggar[/color]");

  ActionDoCommand(SetCommandable(TRUE,oNPC));
  DelayCommand(3.0,AssignCommand(oNPC,ActionStartConversation(GetFirstPC())));

}

Not sure if the hyphen is a valid character or not for tags.... so that may be the problem.

 

Otherwise, the code compiles fine. Have you placed it as the action script in the OnOpen field of the door's .utd?

 

If so, then I am not sure what the issue might be... maybe harIII has an idea.

 

For fun, you could play around with the DelayCommand.... try changing the value to a shorter time, or try it without the DelayCommand (you would need to remove the 3.0 value as well as the DelayCommand parentheses).

Link to comment
Share on other sites

Ok, so try this...

 


void main()
{
  object oPC=GetFirstPC();
  object oTalker=GetObjectByTag("to'ggar");

  ActionDoCommand(SetCommandable(TRUE,oTalker));
  DelayCommand(3.0, AssignCommand(oTalker,ActionStartConversation(oPC,"[color=darkorange]yourdialogname[/color]",CONVERSATION_TYPE_CINEMATIC)));

}

 

This should, when you have substituted the name of your dialog for what is in orange above, fire the dialog immediately after opening the door.

Link to comment
Share on other sites

It compiles for me with no errors, even with the generic dialog name yourdialogname...

 

I did edit my post a couple times... I was copy and pasting old code, and realized I had not declared a variable in my initial "try this" post. Sorry :p

 

Try what is posted now, just copy & paste it into your editor and simply replace the name of your dialog where it is highlighted orange, leaving the quotes! Then compile and blissfully admire your modmaking!

Link to comment
Share on other sites

Archived

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


×
×
  • Create New...