Jump to content

Home

Scripting Mishap


Fallen Guardian

Recommended Posts

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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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();
}

Link to comment
Share on other sites

Hey Fallen Guardian -

 

I have been thinking and searching. I wonder if you have looked at this thread[/color] 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 :)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...