PDA

View Full Version : A question about npc.


Darth Balor
04-03-2007, 07:44 AM
What would I have to do to get a character to change their model at a certain point in the game. I.e. Kreia with both hands to Right-hand-less kreia?

Master Zionosis
04-03-2007, 07:51 AM
Here you go, i had to use this script for my Kreia's Mechanical Hand mod:

void main()
{
object oNPC = GetObjectByTag("Kreia");
ChangeObjectAppearance(oNPC, 455);
}

Change Kreia to the tag of the NPC's appearance you want to change, then replace 455 with the line in the appearance.2da witch you want to use. Then attach it to your .dlg and that should work!

Hope this helps :D

Darth Balor
04-03-2007, 08:09 AM
Awesome! thank you zionosis. Also where are unit models locted in the game files. I'm changing a unit to a model that doesnt have an appearence line so I need to know the model name to make the appearence file.

Master Zionosis
04-03-2007, 09:33 AM
Hmm.. I'm not sure, that would require .2da editing and that is my weakness, sorry pretty much every time i try to edit a .2da file my head explodes.

Darth Balor
04-03-2007, 09:41 AM
I found the model folder. But somehow the model I want isnt there, I know it is in the game files because I can set it as the main menu sith lord.

This is a screen taken from my TSL main menu. it is a picture of darth atris. (http://i123.photobucket.com/albums/o314/aomsavage_beast/darth_traya.png)

That is the model I'm trying to find.

Master Zionosis
04-03-2007, 10:17 AM
Ok i found it for you, the name in the appearance.2da is Unique_Darth_Traya and the line number is 491, here is the script for you, all you have to do is change the tag of the npc you want the appearance of:

void main()
{
object oNPC = GetObjectByTag("Kreia");
ChangeObjectAppearance(oNPC, 491);
}

Tell me if you need any more help! :)

Darth Balor
04-03-2007, 10:38 AM
ok I had thought that was the evil kreia, my bad. thanks. I can't seem to remember, after the rebuilt enclave scene when is the last dialog before you exit the hawk onto telos?

Master Zionosis
04-03-2007, 10:48 AM
That would be Atton's small dialog that tells you that Kreia has left either with the Handmaiden if you a male, or just gone if you a female.

I have looked though the .dlg's and cannot find it, I'm not sure where the .dlg is, but i know that is the last .dlg before you leave the Ebon Hawk after the Dantooine rebuilt enclave.

Darth Balor
04-04-2007, 09:07 AM
What is the name of the script that determines what happens when entering the hawk? How are scripts fired from the start of the game?

glovemaster
04-04-2007, 09:15 AM
scripts are fired from the start of the module by a part of the ARE that says "OnEnter" the name of the script for the Ebon Hawk varies as there are 7 Ebon Hawk Modules.
For 001EBO it is called "a_bet3m4.ncs"

Darth Balor
04-04-2007, 12:58 PM
scripts are fired from the start of the module by a part of the ARE that says "OnEnter" the name of the script for the Ebon Hawk varies as there are 7 Ebon Hawk Modules.
For 001EBO it is called "a_bet3m4.ncs"

Why thank you, everyone here is so helpful! Hypothetical: A script needs to be fired right after the scene where kreia helps atris fall, what would need to edited to do so.

stoffe
04-04-2007, 01:11 PM
scripts are fired from the start of the module by a part of the ARE that says "OnEnter" the name of the script for the Ebon Hawk varies as there are 7 Ebon Hawk Modules.
For 001EBO it is called "a_bet3m4.ncs"

Keep in mind that the Area's OnEnter script isn't an "onLoad" script; it fires at the start of a module since the player character enters the area at that time. This is not the only time this script fires though. It is run any time a creature (not necessarily the player or a party member, could be any NPC or monster) is spawned into the area, when the player enters the area, or when the player loads a savegame that was made in that area (multiple times if you have party members with you).

The module itself has an OnModuleLoad event (set in module.ifo) that only fires once when the module is loaded. Though if you use that keep in mind that the player character has not been loaded into the area yet while it is running, so GetFirstPC() will return OBJECT_INVALID if you run that function in this script (unless you delay it, but that's a risky approach since you could get different results depending on how fast the computer you're playing on is).

Hypothetical: A script needs to be fired right after the scene where kreia helps atris fall, what would need to edited to do so.

You'll need to edit the a_kreatris script found in the 262TEL module. Case 8 in this script is run at the end of that scene, when Kreia leaves the chamber and the two Handmaidens run up the ramp. The script looks like this:

// ST: a_kreatris.nss (262TEL_s.rim)

void SwitchToHandmaiden() {
SwitchPlayerCharacter(NPC_HANDMAIDEN);
}

void StartHandmaidenScene() {
CreateObject(OBJECT_TYPE_CREATURE, "p_handmaiden012", GetLocation(GetWaypointByTag("sp_sis_sisend1")));
CreateObject(OBJECT_TYPE_CREATURE, "p_handmaiden013", GetLocation(GetWaypointByTag("sp_sis_sisend2")));
CreateObject(OBJECT_TYPE_CREATURE, "p_handmaiden014", GetLocation(GetWaypointByTag("sp_sis_sisend3")));
CreateObject(OBJECT_TYPE_CREATURE, "p_handmaiden014", GetLocation(GetWaypointByTag("sp_sis_sisend4")));
CreateObject(OBJECT_TYPE_CREATURE, "p_handmaiden014", GetLocation(GetWaypointByTag("sp_sis_sisend5")));

DelayCommand(0.2f, AssignCommand(GetPartyLeader(), ActionJumpToObject(GetWaypointByTag("sp_hand_sisend"))));
SetMinOneHP(GetPartyLeader(), TRUE);
AssignCommand(GetPartyLeader(), ClearAllActions());
AssignCommand(GetPartyLeader(), ActionStartConversation(GetPartyLeader(), "sisend"));
}

void SpawnFinalAtris() {
CreateObject(OBJECT_TYPE_CREATURE, "n_darthtraya001", GetLocation(GetWaypointByTag("sp_traya")));
}

void main() {

int nParam1 = GetScriptParameter(1);

object oAtris = GetObjectByTag("Atris");
object oKreia = GetObjectByTag("KreiaEvil");
object oDrone1 = GetObjectByTag("Sister1");
object oDrone2 = GetObjectByTag("Sister2");

switch (nParam1) {
case 0:
AssignCommand(oKreia, ActionMoveToObject(GetWaypointByTag("wp_kreia_end2")));
break;
case 1:
AssignCommand(oKreia, ActionMoveToLocation(GetLocation(GetWaypointByTag("wp_kreia_ending"))));
AssignCommand(oKreia, ActionDoCommand(SetFacing(GetFacing(GetWaypointByT ag("wp_kreia_ending")))));
break;
case 2:
AssignCommand(oKreia, SetFacing(90.0f));
break;
case 3:
AssignCommand(oKreia, ActionMoveToObject(GetWaypointByTag("wp_kreia_end")));
break;
case 4:
SetLockOrientationInDialog(oAtris, TRUE);
SetLockOrientationInDialog(oKreia, TRUE);
AssignCommand(oKreia, SetFacing(270.0f));
break;
case 5:
SetGlobalFadeOut(1.0f, 2.0f);
break;
case 6:
AssignCommand(oKreia, ActionJumpToObject(GetObjectByTag("wp_pc_end")));

CreateObject(OBJECT_TYPE_CREATURE, "p_handmaiden003", GetLocation(GetObjectByTag("sp_hand_kreia1")));
CreateObject(OBJECT_TYPE_CREATURE, "p_handmaiden004", GetLocation(GetObjectByTag("sp_hand_kreia2")));

DestroyObject(oAtris);
break;
case 7:
AssignCommand(oKreia, ActionMoveToObject(GetObjectByTag("wp_atris_2")));
SetGlobalFadeIn(0.1f, 2.0f);
break;
case 8:
AssignCommand(oDrone1, ActionMoveToObject(GetObjectByTag("wp_hand_kreia1"), TRUE));
AssignCommand(oDrone2, ActionMoveToObject(GetObjectByTag("wp_hand_kreia2"), TRUE));
AssignCommand(oKreia, ActionMoveToObject(GetObjectByTag("wp_atris_3")));

SetGlobalFadeOut(0.1f, 2.0f);

DelayCommand(4.0, DestroyObject(oDrone1));
DelayCommand(4.0, DestroyObject(oDrone2));

if (IsAvailableCreature(NPC_HANDMAIDEN)) {
SetNPCSelectability(NPC_HANDMAIDEN, TRUE);
DelayCommand(4.0, SwitchToHandmaiden());
DelayCommand(5.0, StartHandmaidenScene());
DelayCommand(5.5, SetGlobalFadeIn(0.1f, 2.0f));
DelayCommand(8.0, DestroyObject(oKreia));
}
else {
DelayCommand(5.0, SpawnFinalAtris());
DelayCommand(6.0, SetGlobalFadeIn(0.1f, 2.0f));
DelayCommand(10.0f, DestroyObject(oKreia));
}
break;
}
}

Darth Balor
04-05-2007, 11:22 AM
So to get it to fire my custom script would the script need to actually be added to the one you posted?

stoffe
04-05-2007, 11:27 AM
So to get it to fire my custom script would the script need to actually be added to the one you posted?

That depends on what your script is supposed to do. If it only changes/adds some things to the area, or something like that that doesn't take any time, you can just Execute your script from within case 8. If, however, your script is running a cutscene or something that needs to take time (or transitions to other areas) then you'll need to modify the a_kreatris script to fire your scene instead of the Handmaiden/Atris/Player scene it normally leads to.

Darth Balor
04-15-2007, 11:30 AM
ok i tried firing the script from kreia's line "Your Mistress awaits. She has much to share with you." but it didnt work.