LucasForums

LucasForums (http://www.lucasforums.com/index.php)
-   Holowan Laboratories (http://www.lucasforums.com/forumdisplay.php?f=324)
-   -   Script Help (http://www.lucasforums.com/showthread.php?t=212001)

supreme kotor 03-13-2013 11:40 PM

Script Help
 
Ok probobly a TOTAL n00b question:rolleyes: but I want a dialog option only available if a certian item is equiped to the pc. The current script i am using won't work? Here is my current script:
int StartingConditional()
{
object oPC = GetPCSpeaker();

if (GetItemPossessedBy(oPC, "unibelt") == OBJECT_INVALID) return FALSE;

return TRUE;
}


By the way thanks in advance everyone is so helpfull around here. :)
Edit: ps. This script is for kotor 1 don't really know if that matters

Fallen Guardian 03-14-2013 12:02 AM

If you want the conversation option available once the "unibelt" is equipped, you wouldn't want to check it against OBJECT_INVALID and return the script as false, because then the thing will never come up. Also, the item can be possessed but not equipped, so the PC could still get your node even if they didn't have the thing equipped. This script should be more of what you are looking for:

Code:

int StartingConditional()
{

object oUniBelt = GetObjectByTag("unibelt");

object oItem = GetItemInSlot(INVENTORY_SLOT_BELT, GetFirstPC());

if ( oItem == oUniBelt)
    {
        return TRUE;
    }
return FALSE;
}

This compiles fine, I just don't know if it will work in-game (I've never done a script like this before). However, it should work... if it doesn't, feel free to come back and tell us what problems you're having.

supreme kotor 03-14-2013 04:17 PM

Sorry but that script want work either. (It compiled fine as you said but in game didnt work. Here is as much info as i could think of: the script is for kotor 1. I made sure I deleated all saves so it wasnt loading a save. I am including both the .nss and the .ncs files when I build the mod. Other script within the module work fine.
Here are two pics one of the actual script maybe i am doing somethin wrong with it? And this one is of the dialouge the script is called from.

script:http://s1324.beta.photobucket.com/us...99366370750661

Dialouge:http://s1324.beta.photobucket.com/us...tml?sort=3&o=0

Hassat Hunter 03-15-2013 07:09 AM

Didn't do any KOTOR1 modding but try to add "break;" under return TRUE... as it now even when true still goes towards the return FALSE, the break should cut the script off right there, not overwriting the TRUE with the FALSE.

Think it should work fine then...

Fair Strides 2 03-15-2013 12:49 PM

Quote:

Originally Posted by Hassat Hunter (Post 2829525)
Didn't do any KOTOR1 modding but try to add "break;" under return TRUE... as it now even when true still goes towards the return FALSE, the break should cut the script off right there, not overwriting the TRUE with the FALSE.

Think it should work fine then...

You know, I stared at the script for a good ten minutes last night, knew there was something missing, and couldn't name what. This is embarrassing since I'm a scripter.

supreme kotor 03-15-2013 03:53 PM

Well maybe it's just bad luck or my inability to script but now when i het compile I get this: Error: "break" statment only allowed in "switch", "do", "while", and "for" statments Complation aborted with errors

ps. thanks for all the help and if this script wont work just let me know I will just change the dialog and use a difrent script.

EDIT: Got the script to compile but it still just wont work script now looks like this:

int StartingConditional()
{

object oUniBelt = GetObjectByTag("unibelt");

object oItem = GetItemInSlot(INVENTORY_SLOT_BELT, GetFirstPC());

if ( oItem == oUniBelt)
{
return TRUE;
("break");
}
return FALSE;
}

Fallen Guardian 03-15-2013 05:09 PM

Quote:

Originally Posted by supreme kotor (Post 2829543)
EDIT: Got the script to compile but it still just wont work script now looks like this:

int StartingConditional()
{

object oUniBelt = GetObjectByTag("unibelt");

object oItem = GetItemInSlot(INVENTORY_SLOT_BELT, GetFirstPC());

if ( oItem == oUniBelt)
{
return TRUE;
("break");
}
return FALSE;
}

You want the break command to look as it does below, with no quotes or parentheses.

Code:

int StartingConditional()
{
object oUniBelt = GetObjectByTag("unibelt");
 
object oItem = GetItemInSlot(INVENTORY_SLOT_BELT, GetFirstPC());
 
  if ( oItem == oUniBelt)
    {
      return TRUE;
      break;
      }

return FALSE;
}


supreme kotor 03-16-2013 11:42 AM

Well bad news I am now getting the same error as beafore I think I should just switch to a diffrent type of script but just in case you want to see what im talking about here ya go:

http://s1324.beta.photobucket.com/us...20292841498466



Great but pathetic news after you guys fixed the script (Thank you) I found out it was a dialog issue not a script issue but thanks it works now :)


All times are GMT -4. The time now is 04:31 PM.

Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.