Jump to content

Home

Script Help


supreme kotor

Recommended Posts

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

Link to comment
Share on other sites

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:

 

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.

Link to comment
Share on other sites

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/user/kotormods/media/scripthelp_zpsb689bc49.jpg.html?sort=3&o=1#/user/kotormods/media/scripthelp_zpsb689bc49.jpg.html?sort=3&o=1&_suid=136329913022708499366370750661

 

Dialouge:http://s1324.beta.photobucket.com/user/kotormods/media/unibeltconvo_zps4788a578.jpg.html?sort=3&o=0

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;

}

Link to comment
Share on other sites

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.

 

int StartingConditional() 
{ 
object oUniBelt = GetObjectByTag("unibelt");

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

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

return FALSE; 
}

Link to comment
Share on other sites

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/user/kotormods/media/misc/2C2F6F53-5718-4D5E-86D4-62784A7BDDAF-2319-0000012345E5AD77_zps016bad4c.jpg.html?sort=3&o=0#/user/kotormods/media/misc/2C2F6F53-5718-4D5E-86D4-62784A7BDDAF-2319-0000012345E5AD77_zps016bad4c.jpg.html?sort=3&o=0&_suid=1363455541099007720292841498466

 

 

 

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 :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...