Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Scripting Mishap

Page: 1 of 1
 Fallen Guardian
09-17-2011, 4:02 PM
#1
So I have a script where in a dialogue file when a node is passed over this script will run:

void main()
{
ActionPauseConversation();

object oDoor=GetObjectByTag("man26ad_door02");

object oNPC = GetObjectByTag("p_avix");

object oNPC1 = GetObjectByTag("Bastila");

object oPC=GetFirstPC();

SetCommandable(TRUE,oNPC);

SetCommandable(TRUE,oNPC1);

SetCommandable(TRUE,oPC);

AssignCommand(oPC, ActionForceMoveToLocation (Location(Vector(420.65048, 164.75064, 8.00), 0.0)));

AssignCommand(oNPC, ActionForceMoveToLocation (Location(Vector(423.07117, 163.83559, 8.00), 0.0)));

AssignCommand(oNPC1, ActionForceMoveToLocation (Location(Vector(419.32086, 165.04903, 8.00), 0.0)));


AssignCommand(oDoor, ActionOpenDoor(oDoor));

ActionWait(3.5);

DelayCommand(3.5, AssignCommand(oDoor, ActionCloseDoor(oDoor)));


ActionResumeConversation();
}

Now, the problem is.....no one moves. They just stand there stupidly, I added in the makenpc commandable line (I think I did that wrong) just in case they were set not to be and still no luck.

Anyone else know why?
 Qui-Gon Glenn
09-17-2011, 5:03 PM
#2
location: A location has three components- the object ID of the area, a vector representing the position within the area, and a floating point number representing the facing.
Are you missing something in your Location call... it seems to be missing a parameter, namely the object ID of the area. If this is indeed the case (I really don't know) then that would explain the NPC's failing to follow orders. The call is going out to the ether!
 Fallen Guardian
09-17-2011, 5:05 PM
#3
As far as I can tell it's good. I actually used the move commands from another script which worked fine, but then again that script was executed out of dialogue. I know this type of script works:

void main()
{

ActionPauseConversation();

object oPC=GetFirstPC();

float x=420.65048;
float y=164.75064;
float z=8.00;

int bRun=FALSE;

vector vPCcoor=Vector(x,y,z);
location lSpot=Location(vPCcoor,0.0f);

AssignCommand(oPC, ActionForceMoveToLocation(lSpot,bRun));

ActionResumeConversation();
}

But is there a way to make it so that I can address multiple people to move to different places with a script like this?
 Qui-Gon Glenn
09-17-2011, 5:19 PM
#4
It should work fine... sorry about that FG, I got ahead of myself, there was nothing wrong with how you used location.

I am playing with it right now... it seems that it should all work ok. I guess it would help me to know this... are these people walking through the door that is opening and closing. What part in all of this does the door play?

EDIT: If you can, give me a little screenplay version... If I can follow what is supposed to happen from the story side, I think I can better work out how to get the script dialed-in.
 Fallen Guardian
09-17-2011, 5:23 PM
#5
Yeah they walk through the door, and then it closes after it passes through. I made an estimate on the delay command because I never got to see how long it took for them to make it through the door. Also, there's another character that has a script to move him almost identical to the one I posted the second time and it doesn't work either.


EDIT: Could you go on Hssiss chat? It might prove to be more time saving.
 Qui-Gon Glenn
09-17-2011, 5:55 PM
#6
Just a little reorganizing of your code, may change nothing, and I will look for you in the chat-box shortly, but this may be helpful:

void main()
{

object oPC=GetFirstPC();
object oNPC=GetObjectByTag("p_avix");
object oNPC1=GetObjectByTag("Bastila");
object oDoor=GetObjectByTag("man26ad_door02");

ActionPauseConversation();
SetCommandable(TRUE,oNPC);
SetCommandable(TRUE,oNPC1);
SetCommandable(TRUE,oPC);
AssignCommand(oDoor, ActionOpenDoor(oDoor));
ActionWait(1.0);
AssignCommand(oPC, ActionForceMoveToLocation (Location(Vector(420.65048, 164.75064, 8.00), 0.0)));
AssignCommand(oNPC, ActionForceMoveToLocation (Location(Vector(423.07117, 163.83559, 8.00), 0.0)));
AssignCommand(oNPC1, ActionForceMoveToLocation (Location(Vector(419.32086, 165.04903, 8.00), 0.0)));
DelayCommand(5.0, AssignCommand(oDoor, ActionCloseDoor(oDoor)));
ActionResumeConversation();
}
 Fallen Guardian
09-17-2011, 5:55 PM
#7
Alright, I'll try it.
 Qui-Gon Glenn
09-20-2011, 7:31 AM
#8
Any luck?
 Fallen Guardian
09-20-2011, 10:06 PM
#9
Nope, I think I may try it another way and get back to you. Thanks for the help so far Glenn.
 Qui-Gon Glenn
09-21-2011, 12:07 AM
#10
I am screwing around on the endar spire a bit. I will see if I can test this on a door or two in there. I will just need to make a dummy convo...
 Fallen Guardian
09-21-2011, 12:34 AM
#11
Okay, thanks.
 Qui-Gon Glenn
09-22-2011, 12:04 AM
#12
Hey Fallen Guardian -

I have been thinking and searching. I wonder if you have looked at this thread[/color] (][color=darkorange) by Dak Vesser? Specifically this portion:

~snip

This next one I created is an On Blocked Script. Added "Picked Lock Routine" for the Holo Droid just in case a locked door gets in its Pathway, it can unlock or attempt to unlock and open it. That way, the player won't have to Deactivate/reactivate the droid to get it back to within float range.

The reason for this is because when I added the “PC Location Jump” options in the planetary Debug section of the "g_cheatbot01" dialogue, I needed to make sure the Holo Droid could follow and or catch up.

#include "k_inc_debug"
#include "k_inc_generic"
#include "k_inc_switch"
#include "k_inc_utility"

void main()
{
object oDoor = GetBlockingDoor();
if(!GN_GetSpawnInCondition(SW_FLAG_AI_OFF))
{
if(GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 5)
{
if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_OPEN) &&
GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 7 )
{
DoDoorAction(oDoor, DOOR_ACTION_OPEN);
SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the -door open- routine...");
}
if(GetLocked(oDoor))
{
DoDoorAction(oDoor, DOOR_ACTION_UNLOCK);
SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the -picked lock- routine...");
}
else if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_BASH))
{
DoDoorAction(oDoor, DOOR_ACTION_BASH);
SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the -door bash- routine...");
}
}
}
if(GN_GetSpawnInCondition(SW_FLAG_EVENT_ON_BLOCKED ))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1009));
}
}


This is a good script if you wanna create a creature with a custom pathway through a locked door..Now, it is important to note that this is a TSL script, so not all of the functions are available in KotOR's nwscript.nss. However, there might be something helpful here :)
Page: 1 of 1