I need help with a little script it is for TSL. I am trying to get an npc to
come towards my character and start a conv. everything works except
the npc does not move. Have even tried adding a specific waypoint for
him to move to with no success. this is the script I am using.
void main() {
object oEntering = GetEnteringObject();
object oPC=GetFirstPC();
object oKaah = GetObjectByTag("Kaah", 0);
AssignCommand(oKaah, ClearAllActions());
AssignCommand((GetObjectByTag("Kaah")),ActionMoveToObject(oPC));
AssignCommand(oKaah, ActionStartConversation(GetFirstPC(), "", 0, 0, 0, "", "", "", "", "", "", 0));
DestroyObject(OBJECT_SELF);
}
object oEntering = GetEnteringObject();
You should use the GetEnteringObject function to check whether the object is a player controlled character so some other object doesn't trip the script. Also you might want to make sure you are using an uppercase K in your .utc's Tag field. (I'd recommend always use lowercase so you don't have to try to remember when it comes time to script.)
Try this instead. You can remove the SendMessageToPC lines after you're done debugging. :)
void main() {
object oPC=GetFirstPC();
SendMessageToPC(oPC,"DEBUG: My script has fired"); //optional debug line
if (GetEnteringObject() != oPC) {
return;
}
SendMessageToPC(oPC,"DEBUG2: PC has entered"); //optional debug line
object oKaah = GetObjectByTag("Kaah");
if (!GetIsObjectValid(oKaah)) {
SendMessageToPC(oPC,"DEBUG: Eek, could not find Kaah!");
return;
}
SendMessageToPC(oPC,"DEBUG3: Telling Kaah to come here and talk to me"); //optional
AssignCommand(oKaah, ClearAllActions());
AssignCommand(oKaah, ActionMoveToObject(oPC));
AssignCommand(oKaah, ActionStartConversation(oPC));
SendMessageToPC(oPC,"DEBUG4: Destroying trigger object"); //optional
DestroyObject(OBJECT_SELF);
}
Okay I will try this script. thankyou. The other question is am I using it properly by
running it from a trigger?
Yes. Just make sure the script name is located in the ScriptOnEnter field of the .utt.
Well I got all that working now I just need to know if there is a simple script
for having the NPC commit suicide?
Meaning what exactly? Disappear? Fall down?
I think he means like what Visas can do on the Ravager, though i thought only She had the animations to do that, but i would just use a script that makes them hold their heart and fall to the floor face down, not sure what the script is at the moment though, I've never used it, only seen it.
If you just want them to fall over and die a simple script like this should work:
void main() {
object oVictim = GetObjectByTag("DeadAsADoorNail");
AssignCommand(oVictim, SetIsDestroyable(FALSE));
AssignCommand(oVictim, PlayAnimation(ANIMATION_LOOPING_CHOKE_WORKING, 1.0, 0.5));
DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oVictim));
}
yep that is excactly what I was looking for thank you.