Jump to content

Home

Help with script


Veldrin

Recommended Posts

Posted

I need help with some script. I need to create a script make the NPC with we talkig exit area( disappear) .

 

Useeng Kotor Tool I find this script:

 

//:: k_act_exitarea

/*

Causes an NPC to move to waypoint

K_EXIT and destroy self

*/

//:: Created By: Preston Watamaniuk

//:: Copyright © 2002 Bioware Corp.

 

#include "k_inc_debug"

#include "k_inc_utility"

 

void main()

{

DelayCommand(0.5, UT_ExitArea());

}

 

But when I use in in Dialog they nothing happening.

 

Please help!!

  • Replies 53
  • Created
  • Last Reply
Posted

I used this script recently and it worked fine. Did you attach it to the last line of dialog in the dlg? also where did you test the script it may only work in certain areas. I used it on Korriban.

Posted
Originally posted by Veldrin

I delete all waypoints. The script is repley in the dialog.

 

Well then I would say thats why the script didn't work. It uses the Way points.you can try and add them back into the git. sry I can't be of more help But perhaps another will swoop in and help ya out.

Posted

Ok. Then I must create some Waypoints. Then what? The NPC moves to this waypoint and disapper? Where am I must wrote the ref of waypoints? In script?

Posted

Ok waypoints are the .utw files, you just place them like any other placeables. They determine where you pc enters an area, how npcs enter/exit the area, you can also make npcs walk around an area using waypoints. I suggest you have a look at this site: http://nwn.bioware.com/developers/ and more particularily , this document: http://nwn.bioware.com/developers/Bioware_Aurora_Waypoint_Format.pdf

 

Also, this script cannot work unless you compile it with "k_inc_debug" and "k_inc_utility" in the same folder as your .nss file...

...However, you don't even need to do this: however, this script is already compiled for you by Bioware and you simply need to type k_act_exitarea in the script field of your dialogue branch and it will work (and make sure it is attached to an NPC entry and not your PC reply). It helps keeping the override folder less messy :D

Posted

void main () {

 // goodbye.nss

 // This script will make any NPC 
 // move to a desired location and vanish.

 object oNPC=GetObjectByTag("Carth");    // insert NPC's tag here

 float x=93.77;                         // do a whereami cheat
 float y=141.06;                        // to get x, y, and z
 float z=0.0;                        

 int bRun=FALSE;                         // you can set this to TRUE
                                         // if you want the NPC to run


 vector vExit=Vector(x,y,z);
 location lExit=Location(vExit,0.0f);
 ActionDoCommand(SetCommandable(TRUE,oNPC));
 AssignCommand (oNPC,ActionForceMoveToLocation(lExit,bRun));
 AssignCommand (oNPC,ActionDoCommand(DestroyObject(oNPC)));

 // you can omit this last command if you like --
 // if the NPC is not able to move to the
 // location, this command will prevent
 // you from being able to speak with him
 // again.   But if they're going to leave anyway...

  ActionDoCommand(SetCommandable(FALSE,oNPC));

}

This script has been tested on Carth in the "Hideout" when first arriving on Taris.

Posted

The trick here is to bury the DestroyObject function into the AssignCommand and ActionDoCommand functions. That way the 'commands' are issued in order. Otherwise the NPC will disappear before they move.

Posted

Try this script when you're in the Hideout on Taris with Carth.

void main () {

 //magic_trick.nss

 // This script will make Carth do a magic trick

 object oNPC=GetObjectByTag("Carth"); 
 float x=93.77;           
 float y=141.06; 
 float z=0.0;                        
 int bRun=FALSE;
 vector vExit=Vector(x,y,z);
 location lExit=Location(vExit,0.0f);
 ActionDoCommand(
   SetCommandable(TRUE,oNPC)
 );
 AssignCommand(
   oNPC,ActionForceMoveToLocation(
      lExit,bRun)
 );
 AssignCommand(
  oNPC,ActionDoCommand(
     ApplyEffectToObject(
        0,EffectVisualEffect(1039),oNPC
     )
  )
 );
 AssignCommand(
   oNPC, ActionWait(0.8)
 );
 AssignCommand(
   oNPC,ActionDoCommand(
     ApplyEffectToObject(
        1,EffectVisualEffect(8000),oNPC,3.8
     )
   )
 );
 AssignCommand(
    oNPC,ActionWait(1.5)
 );
 AssignCommand(
    oNPC,ActionJumpToLocation(
       Location(
          GetPosition(
              GetFirstPC()
          ),GetFacing(oNPC)
       )
    )
 );
 AssignCommand(
    oNPC, ActionDoCommand(
       ApplyEffectToObject(
          0,EffectVisualEffect(1039),oNPC
       )
    )
 );
}
Posted

I think the problem is in the .dlg file.

 

I see your ReplyList looks like this:

 

ReplyList

- 0

- - EntriesList

- - - 0

- - - - Active: exitarea

- - - - Index: 1

- 1

- - EntriesList

- - - 0

- - - - Active: exitarea

- - - - Index: 1

 

While your EntryList looks like this:

EntryList

- 1

- - Script: goobye

 

 

This .dlg as it is, requires a script called 'exitarea' to return TRUE before EntryList #1 ever occurs.

 

Try clearing the Active field in Reply#0 EntriesList #0 and Reply #1 EntriesList #0.

Posted

Can you write simple dlg file for me?

 

I create 2 line of Entry list:

 

0: I must go.

1: Blank = script goodbye.ncs

 

and 1 line of Replies list

 

0: Bye

 

The Startring list ist 0: I must go, then i have Repley 0: Bye

 

Then this Repley Entry is 1:Blank line=script.

 

I wrote dlg like this but it still don't work. Help!

Posted

I have a question of my own. I am working on a simple mod but it requires that some of the NPC's in the party be unavailable for selection. What is the command to do this? I know about the RemoveAvailableNPC() bit of code but I don't want to remove them permenantly, just for a while.

Posted

The functions you're looking for are

SetNPCSelectability and GetNPCSelectability.

 

Here is an example:

void main () {
 if (GetNPCSelectability(NPC_BASTILA)) {
   SetNPCSelectability(NPC_CARTH, FALSE);
 }
}

Posted

Thanks for the dialog. But I have found bug in the dialog. I wrote wrond npc tag. But thx for all help:rolleyes:

 

PS. I have other problem:confused: Where in the utc i van change the options to the UTC attack as?

Posted
PS. I have other problem Where in the utc i van change the options to the UTC attack as?
I think you mean the faction of the .utc? That is the FactionID field. The main values for this field are:

 

1 = hostile

2 = friendly

5 = neutral

 

The possible set of values are listed in nwscript.nss as STANDARD_FACTION_* constants.

Posted

Hey Tk102 can you help me with a script as well.

 

Here is what I would like to do. I would like to have a script that does a check and execute function depending on the results of the check. general idea is below:

 

 

(execute the following)

 

check if a certain dialogue has been spoken/performed or if a certain script has actually run.(either of these actions would be fine I would prefer one that checks for a script firing)

 

if result is yes then perform one action

 

if result is no then perform another action

 

 

(example case)

 

if bastilla's (dialogue file/or script that performs her recruitment) to join the party has occured then remove custom NPC by Template(that is currently occupying her spot) and replace custom NPC by Template with bastilla's Template.

 

else if bastilla's (dialogue file/or script that performs her recruitment) to join the party has not occured then remove custom NPC by Template.

 

The primary function I'm looking for is dialogue or script check returning a positive or negative result. I already know which script lines to add in for the execute after the if statements.

 

Thank you in advanced of any help you can provide.

 

*edit*

 

would setting a global conditional like is discussed in this thread be how I should go about this?

 

http://www.lucasforums.com/showthread.php?s=&threadid=121013

 

I saw this after asking my above question and got the brilliant idea that maybe All I'm trying to do is check for a global conditional that may already be in place.

Posted

Find the global you are looking for in the game - I don't have the game with me and can't check it ) and then use a script like this one:

 

(This script checks the advancement of the Dustil plot)

void main() 
{ 
   int nResult = GetGlobalNumber("KOR_DANEL");
   int nPlot = GetGlobalBoolean("K_SWG_DUSTIL1");
   if ((nResult == 6) && (nPlot == FALSE)) { 

do something
      } 

else { 

do something else

 } 
}

Archived

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

×
×
  • Create New...