Aller au contenu

Photo

Making NPC leave and disappear after conversation


  • Veuillez vous connecter pour répondre
10 réponses à ce sujet

#1
JonnieR

JonnieR
  • Members
  • 98 messages
I have an instance where an NPC relays some info to the PC and his party and then leaves the scene. I am not sure what the script would look like which I assume I would added to the conversation actions to make the NPC walk off and disappear. Any help wouldbe appreciated.

#2
kamal_

kamal_
  • Members
  • 5 259 messages
The function to use is ga_move_exit. Presumably you want him leaving when he's done so the function should go with the last line of the conversation.

#3
Claudius33

Claudius33
  • Members
  • 258 messages
ga_force_exit

Put it at the very last line of the conversation, if the NPC is the main interlocutor. Otherwise the convo gets broken as soon as the script runs.

#4
JonnieR

JonnieR
  • Members
  • 98 messages
Thanks, ga_force exit seems to work fine. But the following script does not work. The message appears but the NPCs do not spawn in at all. I am not a very skilled scripter.


//Put this script OnEnter
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
FloatingTextStringOnCreature("You come across a group of rough looking men who are menacing a small man.", oPC);
object oTarget;
object oSpawn;
location lTarget;
oTarget = oPC;
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "n_krevish", lTarget);
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "n_yartarthug", lTarget);
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "n_yartarthug", lTarget);
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "n_yartarthug", lTarget);
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "n_yartarthug", lTarget);
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "n_yartarthug", lTarget);
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "n_vasily", lTarget);
oTarget = oSpawn;
AssignCommand(oTarget, ActionStartConversation(oPC, ""));
}

#5
kamal_

kamal_
  • Members
  • 5 259 messages
Are those the template, or the tag? The template is also known as the resref, if you look at the properties of the blueprints.

#6
JonnieR

JonnieR
  • Members
  • 98 messages
I thought they were suppose to be the Resref template and not the tag when spawning in a creature. The references above are the resref.

#7
JonnieR

JonnieR
  • Members
  • 98 messages
I check everything, even created new characters to spawn in, nothing seems to be working. I must have made a error somewhere but I have not discovered it as yet.

#8
JonnieR

JonnieR
  • Members
  • 98 messages
I found the error, but I am confused. The script requires the resref and I had created two unique characters to be spawned in. I gave them unique tags and resref. The game would not spawn in my unique characters. So I then created a test script and used generic orcs and did not change the resref. They all spawned in as planned. How do you create unique NPCs (i.e., thugs and a thug leader) without a unique Resref since the spawn in does not use the tag which is always unique.

#9
Claudius33

Claudius33
  • Members
  • 258 messages
I have spawned plenty of creatures with unique tag and resref without any problem. It may be something in your blueprints properties.
Check that 'Hidden Script' is properly set to FALSE. Otw the creature is spwaned but not rendered and do not trigger collision until a special event occurs.
Sorry, my toolset in in French so the property's translation is approximative.

#10
JonnieR

JonnieR
  • Members
  • 98 messages
Your correct. I got sloppy when I created these NPCs and the Resref was really screwed up. I fixed all that and the script works pretty well now. I expanded the script somewhat and specified waypoints to spawn in the NPCs. Otherwise they just closter around your party. Your ga_force_exit script works just as I it wanted too, Merci.

#11
Claudius33

Claudius33
  • Members
  • 258 messages
De rien. Glad you have solved the problem.