Jump to content

Home

How would I combine this two scripts?


JebusJM

Recommended Posts

I want to add these two scripts together:

 

int StartingConditional() {

return GetIsObjectValid(GetItemPossessedBy(GetFirstPC(), "jebord_robe"));

}

 

along with the already-made-"conditional" script:

 

k_con_talkedto

 

Thanks!

Link to comment
Share on other sites

I'm using this script here:

 

#include "k_con_talkedto"

 

int StartingConditional()

{

return GetIsObjectValid(GetItemPossessedBy(GetFirstPC(), "jebord_robe"));

}

 

And it's returning this error: Function "StartingConditional" already has a body defined.

 

Any ideas?

Link to comment
Share on other sites

My guess is your getting that error because k_con_talkedto already has a StartingConditional() bit in it. You are therefore attempting to create both which it don't like. Personally I find it a lot easier to use custom global variables for this kind of thing. It means you can keep track of what is being used when and where. It also means you can combine them with scripts like yours. Its not that hard to do and its a fairly simple procediure.

Link to comment
Share on other sites

Well, the source code for k_con_talkedto is available:

 

k_con_talkedto:

//:: k_con_talkedto
/*
   Returns true if the PC has not
   talked to this NPC before.
*/
//:: Created By: Preston Watamaniuk
//:: Copyright (c) 2002 Bioware Corp.

#include "k_inc_debug"
#include "k_inc_utility"

int StartingConditional()
{
   if(UT_GetTalkedToBooleanFlag(OBJECT_SELF) == FALSE)
   {
       return TRUE;
   }
   return FALSE;
}

 

So merging the scripts should look like this:

 


//:: k_con_talkedto
/*
   Returns true if the PC has not
   talked to this NPC before.
*/
//:: Created By: Preston Watamaniuk
//:: Copyright (c) 2002 Bioware Corp.

#include "k_inc_debug"
#include "k_inc_utility"

int StartingConditional()
{
   object oObject = GetItemPossessedBy(GetFirstPC(), "jebord_robe");
   if(UT_GetTalkedToBooleanFlag(OBJECT_SELF) == FALSE && GetIsObjectValid(oObject))
   {
       return TRUE;
   }
   return FALSE;
}

 

That should do it... Though I'm not sure about it...

 

Fastmaniac

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...