Jump to content

Home

Spawning Trigger


Miltiades

Recommended Posts

I need a trigger which starts a cutscene (dialog file). Problem is: I spawned my NPCs with the on_enter script of the module as not to use the .git file, but triggers can't be spawned using a script (due to the need of 3 coordinates, I guess). I need something that can trigger the dialog file once I come to a certain part of the module, without the need to edit the .git file. Is that possible, or is there no other way than editing the .git file?

Link to comment
Share on other sites

You can attach the script that starts a conversation anywhere. It doesn't have to be a trigger. One possibility is to make a heartbeat script that will start the conversation when you get close enough to whatever object the script is attached to.

Link to comment
Share on other sites

One possibility is to make a heartbeat script that will start the conversation when you get close enough to whatever object the script is attached to.

I done this myself a few days ago and now I feel this is one of the easiest ways to start off a dialog - thanks to lactose_ as he gave me the distance part of it in a thread I started.

 

void main() {

object oNPC = GetObjectByTag("NPC_TAG");
object oPC = GetFirstPC();

	// The 5.0 is the distance in metres.

if ((GetDistanceBetween(oNPC, oPC) <= 5.0))
   {

	// As you want a cutscene this will make the PC walk to the NPC before starting the conversation.

int bRun=FALSE;

AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionMoveToObject(oNPC, bRun, 15.0f));
DelayCommand(3.0, ActionStartConversation(GetFirstPC(), "", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));

	// If you don't want the PC to move to the NPC, just uncomment the next part and delete everything above up to th bRun part.

// ActionStartConversation(GetFirstPC(), "", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));

	// This will fire the original game on HeartBeat script so the NPC will continue to act as normal.

ExecuteScript("k_def_heartbt01", OBJECT_SELF, 1002);    
   }
else {

	// Again this will fire the standard on HeartBeat script
ExecuteScript("k_def_heartbt01", OBJECT_SELF, 1002);    
}
}

Complie that script and attach it to the onHeartBeat field of the NPC's .utc file without the .ncs extension.

 

--Stream

Link to comment
Share on other sites

Then where to put the name of the dialog file? To make things clearer: Two NPCs fight, and when you come close to them (script is attached to heartbeat field of one of two), the dialog file is triggered, which is a cutscene (and which starts just with the two continuing to fight).

Link to comment
Share on other sites

You don't need to specify the dialog file as the script will use the dialog file for the object, which in this case is the NPC. You could use that script for more or less anything, say a computer panel and it will automatically use the objects dialog file, all you need to do is change the tag of the object.

 

--Stream

Link to comment
Share on other sites

It should do, this is the same script that I made for Seamhainn and it work when I tested it, are you sure you but the exact name of the scrip in the onHeartBeat field without the extension and that all the files are in the override folder?

 

--Steam

Link to comment
Share on other sites

Everything is done right. I tried filling the name of the dialog file between the quotes, and that did work! Just one more question: how do I make the script only fire once then, since it'll fire as long as I'm near the NPC?

 

Edit: Also, it doesn't matter what distance I put between the NPC and the PC, the script doesn't fire until I reach the NPC, or when I stand still for a minute. The script should trigger immediately when the distance between the PC and NPC is less than that in the script.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...