command cmd = CommandStartConversation(GetHero());
AddCommand(GetObjectByTag("npc_nea"), cmd, FALSE, TRUE );
As a result the NPC will run to the Player when entering the area. But the conversation won't fire. I have also tried to enter the resource name of the conversation in the CommandStartConversation() but it won't help.
I tried to get around the problem using an alternative way to setup a conversation by using creature script but it won't work either.
Here's the creature script:
#include "events_h"
#include "rules_h"
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
PrintToLog("Nea_Script_Called: EventType="+ToString(nEventType));
switch (nEventType)
{
case EVENT_TYPE_COMMAND_COMPLETE:
{
PrintToLog("EVENT_TYPE_COMMAND_COMPLETE");
object oActor = GetEventCreator(ev); // creature acting
object oTarget = GetEventObject(ev, 1); // The target that command was applied to
int nLastCommand = GetEventInteger(ev, 0); // Type of the last command (e.g. COMMAND_TYPE_ATTACKED)
if (nLastCommand == COMMAND_TYPE_MOVE_TO_OBJECT) {
PrintToLog("COMMAND_TYPE_MOVE_TO_OBJECT");
BeginConversation(GetHero(), oActor);
}
break;
}
}
HandleEvent(ev, RESOURCE_SCRIPT_CREATURE_CORE);
}
This is all that's printed into a Log. (related to the script above)
Script Nea_Script_Called: EventType=11
Script Nea_Script_Called: EventType=3
And that would be equal to: EVENT_TYPE_EQUIP, EVENT_TYPE_SPAWN. Unfortunately EVENT_TYPE_COMMAND_COMPLETE won't fire. Of course, the CommandStartConversation() was replaced with CommandMoveToObject()
AddCommand(GetObjectByTag("npc_nea"), CommandMoveToObject(GetHero(),TRUE,3.0));
Of course, the Player can initiate the conversation by right-clicking the NPC, in that case event 18 is printed into the log.
Modifié par BioSpirit, 17 décembre 2009 - 09:17 .





Retour en haut







