View Single Post
Old 01-07-2012, 04:19 AM   #33
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,628
Quote:
Originally Posted by Fallen Guardian View Post
danm50_foyerg's 1 and 2, danm50_secc, and danm50_doha all move to just infront of the door, rather than passing through it and continuing to their specified location. The other NPC's take 1-3 hesitant steps and then stop completely. I have no idea what's going on here, perhaps someone could shed some light?
Hard to tell without seeing it, but ActionForceMoveTo should only fail if the destination does not exist - unlike the regular ActionMoveTo, which can fail for other reasons. So my guess would be your use of vectors rather than waypoints is responsible. I can think of a number of reasons why vectors wouldn't work when there are doors involved. Waypoints, however, are usually a safe bet because they're spawned right when the module is loaded. Since you're working with your own module anyway, you don't have to worry about compatibility.

Or it could be the door isn't fully open when they get to it. Try having it open after they start, but a lot sooner than you have it now, and see if that works - before you undertake the tedious process of editing the module. I also have a script lying around that opens a door when a creature gets close enough to it, which would rule out the need for a DelayCommand:
Code:
	object oTarget = GetNearestObject(OBJECT_TYPE_DOOR, OBJECT_SELF, 1);

if( GetIsObjectValid(oTarget) && GetDistanceBetween(OBJECT_SELF, oTarget) <= 10.0 && !GetIsOpen(oTarget) ){
	AssignCommand(oTarget, ActionUnlockObject(oTarget));
	AssignCommand(oTarget, ActionOpenDoor(oTarget));
	}
I use it as a subroutine and have the creature fire it every tenth of a second for as long as I need them to. Of course, you could easily narrow down the time, since you have a general idea of when the door needs to open and when it shouldn't anymore. But a set distance should help resolve any incongruities between the length of the door animation and the actual length it takes for the door object to open.
Quote:
Originally Posted by Qui-Gon Glenn View Post
Hey Fallen and script curious... I think we are getting closer to your problem's solution, thanks to this thread in the Bioware NWN forums. Specifically, using AssignCommand-type commands on a door rather than on a PC/NPC seems to be the issue.
There's no reason AssignCommand shouldn't work on a door. It's used all the time in the games' scripts. I usually prefer to use it on the door, because that opens it immediately; if you use it on a creature, it will walk or run up to the door and try to open it, exactly what happens when you click on a door in the game, which is a bit rubbish when you're dealing with cutscenes. And if you're closing the door - don't even get me started on if you're closing it.

SetCommandable, on the other hand, is only used to allow/disallow a creature to add things to their action menu - to attack another creature, to use or change items, to open doors, etc. Moving is just about the only thing one can do when this is set to false. And it wouldn't do anything in this situation, because the only commands are movements. Frankly you shouldn't use this function in any situation, ever, because it should always be set to true.

Yes, I know that was in October. No, I don't care.


JCarter426 is offline   you may: quote & reply,