Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

How would I combine this two scripts?

Page: 1 of 1
 JebusJM
05-19-2011, 11:04 PM
#1
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!
 JebusJM
05-20-2011, 11:19 AM
#2
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?
 TimBob12
05-20-2011, 2:24 PM
#3
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.
 Fastmaniac
05-21-2011, 9:08 AM
#4
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
Page: 1 of 1