Modifié par Sonmeister, 11 mai 2010 - 04:07 .
Trigger Conversation Script example needed (answered)
Débuté par
Sonmeister
, mai 10 2010 07:36
#1
Posté 10 mai 2010 - 07:36
Does anyone have an example of a trigger conversation script they are using that I could see?
#2
Posté 10 mai 2010 - 09:28
If you mean a trigger that starts a conversation, here's one I've used recently:
#include "plt_cw_ostagar" //My plots, obviously you'll use your own
#include "plt_cw_att_ostagar"
#include "wrappers_h"
#include "events_h"
void main() {
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
switch(nEventType)
{
case EVENT_TYPE_ENTER:
{
object oEnterer = GetEventCreator(ev);
if ((WR_GetPlotFlag(PLT_CW_ATT_OSTAGAR, OSTAGAR_FINISHED)) && (!(WR_GetPlotFlag(PLT_CW_OSTAGAR, CONV_POSTJUGG)))) { //Only want conversation to fire if the boss fight is done and it hasn't fired before
if (IsPartyMember(oEnterer)) { //Don't want random mobs firing the conversation
object oHero = GetHero();
SetPrimaryControlled(oHero); //Using default camera and followers have lines in convo - best to change control.
BeginConversation(GetObjectByTag("cw_medea"), oHero, R"cw_ost_postjugg.dlg"); // Conversation sets PLT_CW_OSTAGAR, CONV_POSTJUGG
Safe_Destroy_Object(OBJECT_SELF); //Trigger goes away as we don't need it.
}
}
break;
}
}
HandleEvent(ev, RESOURCE_SCRIPT_TRIGGER_CORE);
}
#include "plt_cw_ostagar" //My plots, obviously you'll use your own
#include "plt_cw_att_ostagar"
#include "wrappers_h"
#include "events_h"
void main() {
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
switch(nEventType)
{
case EVENT_TYPE_ENTER:
{
object oEnterer = GetEventCreator(ev);
if ((WR_GetPlotFlag(PLT_CW_ATT_OSTAGAR, OSTAGAR_FINISHED)) && (!(WR_GetPlotFlag(PLT_CW_OSTAGAR, CONV_POSTJUGG)))) { //Only want conversation to fire if the boss fight is done and it hasn't fired before
if (IsPartyMember(oEnterer)) { //Don't want random mobs firing the conversation
object oHero = GetHero();
SetPrimaryControlled(oHero); //Using default camera and followers have lines in convo - best to change control.
BeginConversation(GetObjectByTag("cw_medea"), oHero, R"cw_ost_postjugg.dlg"); // Conversation sets PLT_CW_OSTAGAR, CONV_POSTJUGG
Safe_Destroy_Object(OBJECT_SELF); //Trigger goes away as we don't need it.
}
}
break;
}
}
HandleEvent(ev, RESOURCE_SCRIPT_TRIGGER_CORE);
}
Modifié par Mengtzu, 10 mai 2010 - 09:31 .
#3
Posté 10 mai 2010 - 10:02
Thanks, I'll see if I can write mine off of yours as a guide. I'm trying to make as simple a "trigger a conversation script" as possible just because I'm still learning the ropes.
#4
Posté 10 mai 2010 - 10:38
If what you want to do is trigger a conversation from a conversation first you'll want a plot, and atatched to that plot a plot script. Make a plot flag in the plot and name it something apropriate. Then in the plot script, using an apropriate template, make a case in the action switch for your plot flag. Once you've done that, the code is fairly simple.
object oCreature = GetObjectByTag("creature_to_talk");
UT_Talk(oCreature);
You'll also have to assign the plot flag to the conversation line that you want the new conversation to fire after, most likely the end dialog node of a certain path.
object oCreature = GetObjectByTag("creature_to_talk");
UT_Talk(oCreature);
You'll also have to assign the plot flag to the conversation line that you want the new conversation to fire after, most likely the end dialog node of a certain path.
#5
Posté 10 mai 2010 - 11:13
What I'm simply trying to do is have my PC walk into an area with an enemy and have the trigger start a conversation with the "enemy" in the area. Instead of walking up to the enemy and clicking on him for a conversation.
I'm assuming a simple script attached to the trigger will accomplish this? I'm still learning the scripting and was hoping for a simple example of a script that would do this.
Would a simple script with UT_Talk be the answer?
I'm assuming a simple script attached to the trigger will accomplish this? I'm still learning the scripting and was hoping for a simple example of a script that would do this.
Would a simple script with UT_Talk be the answer?
Modifié par Sonmeister, 11 mai 2010 - 12:10 .
#6
Posté 11 mai 2010 - 12:36
The Wiki's pretty good on this, http://social.biowar...r#Talk_triggers
The upshot is: If all you want to do is start a conversation, you can use a boilerplate script.
If, on another hand, you want to consider the Wonderful World of Scripting, consider the following:
void main()
{
event eC = GetCurrentEvent(); // current event
if (GetEventType(eC) == EVENT_TYPE_ENTER) // if ENTER (not EXIT)
{ // enter BeginConversation(GetHero(),GetObjectByTag("mhairi"),R"banter.dlg");// OWNER is the second param DestroyObject(OBJECT_SELF); // inactive triggers still fire. For finer control, consider using "SetObjectActive(OBJECT_SELF,FALSE);" and "if (GetObjectActive(OBJECT_SELF))"
} // end enter
HandleEvent(eC,RESOURCE_SCRIPT_TRIGGER_CORE);// do default processing
} // end main()
The upshot is: If all you want to do is start a conversation, you can use a boilerplate script.
If, on another hand, you want to consider the Wonderful World of Scripting, consider the following:
void main()
{
event eC = GetCurrentEvent(); // current event
if (GetEventType(eC) == EVENT_TYPE_ENTER) // if ENTER (not EXIT)
{ // enter BeginConversation(GetHero(),GetObjectByTag("mhairi"),R"banter.dlg");// OWNER is the second param DestroyObject(OBJECT_SELF); // inactive triggers still fire. For finer control, consider using "SetObjectActive(OBJECT_SELF,FALSE);" and "if (GetObjectActive(OBJECT_SELF))"
} // end enter
HandleEvent(eC,RESOURCE_SCRIPT_TRIGGER_CORE);// do default processing
} // end main()
Modifié par QuickQuipt, 11 mai 2010 - 01:10 .
#7
Posté 11 mai 2010 - 01:07
The wiki info is what got me confused in the first place. I created a trigger since reading it and understand some of this but how do you get the trigger to trigger the dialogue you want it too by using a generic script?
Talk triggers (from wiki)
A talk trigger is a trigger that initiates a conversation. This occurs so frequently in Dragon Age's game design that a generic script, gen00tr_talk.nss, is available for this purpose. To use it with a trigger, set the trigger's "Script" property to "gen00tr_talk" and set the "Variable 2da" property to "var_trigger_talk".
Talk triggers (from wiki)
A talk trigger is a trigger that initiates a conversation. This occurs so frequently in Dragon Age's game design that a generic script, gen00tr_talk.nss, is available for this purpose. To use it with a trigger, set the trigger's "Script" property to "gen00tr_talk" and set the "Variable 2da" property to "var_trigger_talk".
#8
Posté 11 mai 2010 - 01:22
Ah. Short answer: Set the TRIG_TALK_SPEAKER variable field of the trigger to the tag? of the creature who's Conversation Property is the conversation to trigger.
Long answer: Check out the generic script gen00tr_talk.
Long answer: Check out the generic script gen00tr_talk.
#9
Posté 11 mai 2010 - 03:05
The easiest way to trigger a conversation when the player walks over a certain space is to place a talk trigger. Although you can make your own template and script, there is a generic talk trigger, gen00tr_talk.
In the area editor, go to the triggers pallet and filter for gen00tr_talk. Select that trigger, and draw it into the area. Select your trigger and look at the object inspector. Select local variables to bring up the list. Find TRIG_TALK_SPEAKER variable, and set it to the tag of the creature you want to talk.
By default talk triggers work when any party member enters them, and they work only once. If you want the trigger to fire more than once, or want it not to fire untill a particular plot variable is set, there are variables for all that as well. Make sure the conversation is assigned to the creature who will be talking. If it isn't, or can't be for some reason, there is a conversation file override variable.
You'll want the creature to be in the neutral group before the player talks to them, rather than the hostile group. To start the combat at the end of the conversation, there is a generic plot flag to turn the conversation owner hostile. I think it's under a global or generic golder, and I think the plot is gen00pt_generic_actions. The flag is owner_turns_hostile or something similar.
In the area editor, go to the triggers pallet and filter for gen00tr_talk. Select that trigger, and draw it into the area. Select your trigger and look at the object inspector. Select local variables to bring up the list. Find TRIG_TALK_SPEAKER variable, and set it to the tag of the creature you want to talk.
By default talk triggers work when any party member enters them, and they work only once. If you want the trigger to fire more than once, or want it not to fire untill a particular plot variable is set, there are variables for all that as well. Make sure the conversation is assigned to the creature who will be talking. If it isn't, or can't be for some reason, there is a conversation file override variable.
You'll want the creature to be in the neutral group before the player talks to them, rather than the hostile group. To start the combat at the end of the conversation, there is a generic plot flag to turn the conversation owner hostile. I think it's under a global or generic golder, and I think the plot is gen00pt_generic_actions. The flag is owner_turns_hostile or something similar.
Modifié par DavidSims, 11 mai 2010 - 03:05 .
#10
Posté 11 mai 2010 - 04:07
This is what I was trying to find out. Thanks!





Retour en haut






