Can't get an NPC to move to a waypoint
#1
Posté 11 octobre 2010 - 04:38
I've got a conversation in which at one point the PC and companion NPC are instructed using ga_move to move to 2 waypoints. The PC moves fine, but the NPC doesn't - he just follows the PC, staying a few feet behind. I've triple-checked the waypoint tag and the NPC tag both in the objects and in the conv. node action script. I've also tried putting the action in two different nodes - the same one that has the action for the PC and the one following it. Made no difference.
Any ideas?
#2
Posté 11 octobre 2010 - 06:48
You got 2 choice : Remove the compagnion from the group for the duration or your event. Or play with the SetCommandable Function.
#3
Posté 11 octobre 2010 - 10:11
For ga_commandable, is there something else I need to do?
For removing the companion, what could i be doing wrong? If I remove a companion from the party, I don't need to readd him to the roster before readding to the party, do I?
#4
Posté 12 octobre 2010 - 07:22
#include "x0_i0_assoc"
void main()
{
object oPC = GetPCSpeaker() ;
object oHench = GetLocalObject(oPC, "HENCHMAN") ;
if (GetIsObjectValid(oHench))
{
SetAssociateState(NW_ASC_MODE_STAND_GROUND, TRUE, oHench) ;
RemoveHenchman(oPC, oHench);
AssignCommand(oHench, ClearAllActions(TRUE)); // needed to get rid of autofollow
}
}
I added the RemoveHenchman because the NPC wouldn't follow but would go into area transitions anyway. Now the SetAssociateState might be an overkill, I wrote this script 3 years ago don't really remember
In your case you can use this script without the RemoveHenchman line and see if you can get the ga_move to work afterwards.
Or maybe something like this:
#include "x0_i0_assoc"
void main()
{
object oPC = GetPCSpeaker() ;
object oHench = GetLocalObject(oPC, "HENCHMAN") ;
if (GetIsObjectValid(oHench))
{
SetAssociateState(NW_ASC_MODE_PUPPET, TRUE, oHench) ;
AssignCommand(oHench, ClearAllActions(TRUE));
}
}
then this to resume to normal state
#include "x0_i0_assoc"
void main()
{
object oPC = GetPCSpeaker() ;
object oHench = GetLocalObject(oPC, "HENCHMAN") ;
if (GetIsObjectValid(oHench))
{
SetAssociateState(NW_ASC_MODE_PUPPET, FALSE, oHench) ;
AssignCommand(oHench, ClearAllActions(TRUE));
}
}
Sorry don't have the time to test it but SetAssociateState seems to be the way to go to me. STAND_GROUND or PUPPET or maybe a mix of the two are the best candidates.
Modifié par Olblach, 12 octobre 2010 - 07:46 .
#5
Posté 13 novembre 2010 - 01:18
#6
Posté 13 novembre 2010 - 12:11
What happens if you use NW_ASC_MODE_STAND_GROUND, instead of NW_ASC_MODE_PUPPET?
Did you try both? I'm quite sure STAND_GROUND will stop the follow, as for going to the waypoint it's another story.
Another possibility would be that HENCHMAN variable is not set. There are plenty ways to access your Henchman, how do you get his/her object normally?
#7
Posté 13 novembre 2010 - 09:20
For setting the companion, I altered your code slightly to allow make the script more generic and allow me to enter the name through the conversation parameters UI:
#include "x0_i0_assoc"
void main(string sHench)
{
object oPC = GetPCSpeaker() ;
object oHench = GetLocalObject(oPC, sHench) ;
if (GetIsObjectValid(oHench))
{
SetAssociateState(NW_ASC_MODE_STAND_GROUND, TRUE, oHench) ;
AssignCommand(oHench, ClearAllActions(TRUE));
}
}
#8
Posté 13 novembre 2010 - 10:13
if (GetIsObjectValid(oHench))
{
SetAssociateState(NW_ASC_MODE_STAND_GROUND, TRUE, oHench) ;
AssignCommand(oHench, ClearAllActions(TRUE));
}
else
{
SendMessageToPC(oPC, "Where is your henchman?!");
}
Modifié par Olblach, 13 novembre 2010 - 10:14 .
#9
Posté 14 novembre 2010 - 04:52
#10
Posté 14 novembre 2010 - 02:18
It can happen for various reasons. The #1 is include file not recompiled and the #2 is syntax error unnoticed. "Compile All" fixes #1 and helps detecting #2.
#11
Posté 14 novembre 2010 - 05:03
Bear in mind that's just a logic point of view, not programming experience (of which my last real programming experience was around 1978 in High School with BASIC.)
dno
#12
Guest_Chaos Wielder_*
Posté 14 novembre 2010 - 05:49
Guest_Chaos Wielder_*
/digression
#13
Posté 14 novembre 2010 - 06:30
Chaos Wielder wrote...
"if" statements need not necessarily have an else statement in programming. In reality, too, I think it could be framed as. "I'm walking, and if it's raining I'll go inside." The "else" might be implicit that I'll keep walking if it doesn't rain, but I don't know if it's anything more than that(maybe just baggage language, or something like that).
/digression
A good analogy here.
You do not need an "else" for every "if" as the "else" is implied. In this case (of no "else") the implied "else" is "do nothing".
There's a bunch of ways to do that in normal language:
"If it is night time, I will go to sleep.... It is day time." Implies that since it is daytime I will not go to sleep.
#14
Posté 14 novembre 2010 - 11:08
Olblach wrote...
There are pixies in the compiler, it's a well known fact^^.
It can happen for various reasons. The #1 is include file not recompiled and the #2 is syntax error unnoticed. "Compile All" fixes #1 and helps detecting #2.
heh heh, damn pixies. Ok, well thanks for the help!
#15
Posté 15 janvier 2011 - 11:47
Olblach wrote...
There are pixies in the compiler, it's a well known fact^^.
It can happen for various reasons. The #1 is include file not recompiled and the #2 is syntax error unnoticed. "Compile All" fixes #1 and helps detecting #2.
So, I'm still having problems with this issue. Much of the time, the NPC doesn't go to the waypoint but continues to follow the PC instead. Sometimes though he does what he's supposed to. And I compile all scripts every time. Any other ideas?
#16
Posté 15 janvier 2011 - 11:51
#17
Posté 16 janvier 2011 - 12:21
#18
Posté 16 janvier 2011 - 12:37
Modifié par Artfoundry, 16 janvier 2011 - 12:46 .
#19
Posté 16 janvier 2011 - 01:40
Modifié par M. Rieder, 16 janvier 2011 - 01:43 .
#20
Posté 16 janvier 2011 - 02:32
const string TARGET_PC_NEAREST= "$PC_NEAREST";// NearestPC (owned and alive)
Therefore, if you use $PC_NEAREST, the script will use the nearest PC that is owned for the script. Not sure if this helps.
#21
Posté 16 janvier 2011 - 02:47
I also tried removing the reference altogether (which makes the script use the owner of the conv. by default), and another NPC ended up moving to the PC's waypoint while my henchman moved to his waypoint (and the PC just stayed put - in fact, my henchman ran AROUND the PC to get to the waypoint).
#22
Posté 16 janvier 2011 - 04:52
Just to clarify, is it a henchman or companion?
#23
Posté 16 janvier 2011 - 08:29
I'll try removing him from the party and then adding him back in.
#24
Posté 17 janvier 2011 - 09:20
#25
Posté 17 janvier 2011 - 09:45
You need to set your compagnion as campaign NPC as well.
Modifié par Shallina, 17 janvier 2011 - 09:53 .





Retour en haut






