Yet another noob
#1
Posté 09 juillet 2011 - 03:57
#include "plot_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"
void main()
{
object oPC = GetHero();
event eCurrent = GetCurrentEvent();
int iEventType = GetEventType(eCurrent);
switch(iEventType)
{
case EVENT_TYPE_AREALOAD_SPECIAL:
{
UT_Talk(fam_oldlady //Owner of the conversation , GetHero() //Listener (the player), R"old_lady_conv.dlg" //The conversation);
break;
}
default:
{
// Fall through to rules_core
HandleEvent(eCurrent, RESOURCE_SCRIPT_AREA_CORE);
break;
}
}
}
help please:blush:...
#2
Posté 09 juillet 2011 - 08:33
The help for this function doesn't appear in the toolset, owing to a coding error in utility_h. If you open that file, you'll see
To get your script to work, there are a couple of things to fix./** @brief Instantly initiate dialog with 2 objects
*
* Calling this function will instantly trigger dialog between 2 objects. The dialog
* can be ambient or not.
*
* @param oInitiator - The main talking creature - owner of the default dialog file, if any
* @param oTarget - The creature being spoken to. Should be the player object most of the time
* @returns TRUE on success, FALSE on error
* @author Yaron
*/
void UT_Talk(object oInitiator, object oTarget, resource rConversation = R"", int nPartyResurrection = TRUE);
Embedded comments must start with /* (not //) and end with */. Otherwise, the compiler doesn't know what's script and what's comment. Better still, remove the comments, break them out into a comment line, or group them at the end of the line.
fam_oldlady is presumably the creature object who will start talking to the player, so you need to declare the variable and initialise it to a value first. For example,
object fam_oldlady = GetObjectByTag("xxxx");
UT_Talk(fam_oldlady, GetHero(), R"old_lady_conv.dlg");
where xxxx is the unique tag of the creature.
You can omit the third parameter if old_lady_conv is the conversation specified in the creature template.
Presumably, only one area will have this script, so that it only executes in that particular area.
As it stands, the old lady will talk to the player every time they enter the area. If that's not what you want, you can either make the call to UT_Talk conditional on a plot flag, or ensure that the conversation only has one opening line with a visibility setting of "once per game".
The latter technique depends on the fact that UT_Talk will do nothing if it can't find a suitable opening line in the conversation. Easier, but potentially more fragile.
Modifié par Proleric1, 09 juillet 2011 - 08:38 .
#3
Posté 09 juillet 2011 - 09:23
#4
Posté 10 juillet 2011 - 07:11
Firstly, we always have to declare variables, so that the compiler knows whether they're integers, objects, strings or whatever.
Secondly, we need to give the variable an initial value before we can use it. So far, we've said that fam_oldlady is an object, but which object? In this instance, we can identify the object by tag:object fam_oldlady;
The compiler allows us to combine those two statements into one.fam_oldlady = GetObjectByTag("xxxx");
GetObjectByTag is often used, but there are other options - for example, the nearest creature, or the creature that triggered the event.





Retour en haut






