Aller au contenu

Photo

Can't get an NPC to move to a waypoint


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

#26
Artfoundry

Artfoundry
  • Members
  • 62 messages
I've tried using a custom script to remove him from the party and I've tried the premade scripts. One problem I'm having is the variable named "sRosterName" - it seems to indicate the name of the roster in some functions and the name of the roster member in others, or else I'm not understanding them well enough. For example, these two functions:
AddRosterMemberToParty(string sRosterName, object oPC)
RemoveRosterMemberFromParty(string sRosterName, object oPC, int bDespawnNPC)

The description for the first one says "This script will add a Roster Member to the same party that the player character object passed in belongs to." That would indicate that the sRosterName refers to the roster member name and oPC refers to the player character. The description for the second one though says "This function removes a roster member from the party." This is much more ambiguous. sRosterName could be the roster name and oPC could be the roster member, or sRosterName could be the roster member and oPC could be the PC.

But if sRosterName refers to the roster member, that would be contrary to how I've used the variable with the premade scripts in conversations. With ga_party_add, ga_roster_add_object, and ga_roster_selectable, sRosterName refers to the roster name (not the member name), at least as far as I can tell (and they all seem to work when I use them that way).

Here's the script I have that removes the NPC from the party and clears his actions to prepare him to be moved:

#include "x0_i0_assoc"

void main(string sHench)
{
object oPC = GetPCSpeaker() ;
object oHench = StringToObject(sHench) ;

if (GetIsObjectValid(oHench))
{
SetAssociateState(NW_ASC_MODE_STAND_GROUND, TRUE, oHench);
AssignCommand(oHench, ClearAllActions(TRUE));
RemoveRosterMemberFromParty(sHench, oPC, FALSE);
}
else
{
SendMessageToPC(oPC, "Where is your henchman?!");
}
}

And here's the script I have to add him back to the party:

#include "x0_i0_assoc"

void main(string sHench)
{
object oPC = GetPCSpeaker() ;
object oHench = GetLocalObject(oPC, sHench) ;
if (GetIsObjectValid(oHench))
{
SetAssociateState(NW_ASC_MODE_PUPPET, FALSE, oHench) ;
AssignCommand(oHench, ClearAllActions(TRUE));
if (GetIsRosterMemberAvailable(sHench))
AddRosterMemberToParty (sHench, oPC);
}
}

The problem though, is when I use these scripts, the NPC sometimes follows the PC and sometimes goes to the waypoint.  It seems totally random.

Modifié par Artfoundry, 18 janvier 2011 - 01:31 .


#27
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 585 messages
I would look at a couple of the cutscenes in the OC. They move companions around and I doubt they remove them from the party. My guess is it is a combination of some cutscene functions and the commandable functions.



Regards

#28
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
If this is happening in a cutscene, then you could just Jump the NPC to the waypoint, as long as the camera is following the PC the whole time. The player won't notice the difference.

#29
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I just thought of something. Is the door opened or closed. I wonder if the AI is getting confused by the door. Maybe first delete the door and see how the script works to see if that's the problem.

#30
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 585 messages
I think the cutscene functions can be used even when you aren't in a cutscene. I'll see if I can find an example.

#31
Artfoundry

Artfoundry
  • Members
  • 62 messages
This is happening in a cutscene, but I can't use jump because the camera is showing both PC and companion running through the doors. The doors start out open, but at the end of the dialog, they're closed via script. So I can't remove the doors either. Funny thing is, I have my PC and companion running around in other cutscenes without a problem. So there's something funky about this setup I think. I'll look at the others though to see if I did something differently.

#32
Artfoundry

Artfoundry
  • Members
  • 62 messages
One more thing - is it better to put actions on an NPC node or on a PC node of a conversation?  Or does it make any difference?  I've noticed that sometimes they seem to work better on the NPC nodes.  Or does it depend on the type of action?

Modifié par Artfoundry, 24 janvier 2011 - 01:36 .


#33
dunniteowl

dunniteowl
  • Members
  • 1 559 messages
If I were you, I would place all actions for NPCs in their nodes. They are essentially the owners (as are placeables with convos) of all conversations. So, for that reason, it makes more practical sense to place all actions on the NPC nodes. I don't know if there's a real difference, honestly, but you know how sometimes things can get a little wonky if you don't do them like the Developers designed them. In this case, I am pretty sure the mind set was that the NPCs/Placeables, being the owners of the conversations, would be the logical point to place actions as well (other than PC emotes, possibly.)

dno

#34
Shallina

Shallina
  • Members
  • 1 011 messages
It matter on when you want the action to happen.

#35
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
In convo sections where I either have more than 1 NPC talking to each other, or some other situation where there is no PC reply (I have PC auto-skipped with [CONTINUE]) I use the PC node to assign commands/actions. Have never had a problem with the scripts firing off, though I am sure to designate who/what the action object is in the script.

#36
Artfoundry

Artfoundry
  • Members
  • 62 messages
Ok, I'm done trying to get this to work the way I want. I may very well just have some corrupt game files - the game has certainly crashed often enough for that to happen.

I found another solution - while the camera is looking at another NPC, I just have the companion jump to the waypoint - works like a charm. 

Thanks everyone for your help.  BTW, I'm looking for help in testing the module.  Let me know if you're interested.  It's almost ready for it.  Here's the info on it: http://social.biowar...t/3634/#details
The file posted there is outdated - I'll put a new one up soon.

Modifié par Artfoundry, 31 janvier 2011 - 06:27 .


#37
dunniteowl

dunniteowl
  • Members
  • 1 559 messages
You should also post a Call for Playtesters in the Modules Forums, Dave.



dno

#38
Artfoundry

Artfoundry
  • Members
  • 62 messages

dunniteowl wrote...

You should also post a Call for Playtesters in the Modules Forums, Dave.

dno


Thanks, I will once I get through the last of the issues.