Hello all:
I used the wizard in the conversation editor to create thris script. It makes a line show up if the PC has a specific item in his/her inventory. I need it to only run once, even if the item is still in the PC's inventory. I tried using the Script Generator but I did not find an option to write starting conditional scripts so they run only once.
I'm sure this is an easy fix but I can't figure it out.
Thanks for any help!
//::///////////////////////////////////////////////
//:: FileName sc_atnote
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 2/11/2012 1:45:18 PM
//:://////////////////////////////////////////////
#include "nw_i0_tool"
int StartingConditional()
{
// Make sure the PC speaker has these items in their inventory
if(!HasItem(GetPCSpeaker(), "AncientTemple"))
return FALSE;
return TRUE;
}
Make a starting conditional script so it only runs once
Débuté par
UnrealJedi
, juin 16 2012 06:21
#1
Posté 16 juin 2012 - 06:21
#2
Posté 16 juin 2012 - 06:47
int StartingConditional()
{
object oPC = GetPCSpeaker();
string sVar = GetPCPlayerName(oPC) + GetName(oPC);
if(GetLocalInt(OBJECT_SELF, sVar)) return FALSE;
if(GetItemPossessedBy(oPC, "AncientTemple") != OBJECT_INVALID)
{
SetLocalInt(OBJECT_SELF, sVar, TRUE);
return TRUE;
}
return FALSE;
}
EDIT: L8 solution is even better if his assumption is correct
Kato
{
object oPC = GetPCSpeaker();
string sVar = GetPCPlayerName(oPC) + GetName(oPC);
if(GetLocalInt(OBJECT_SELF, sVar)) return FALSE;
if(GetItemPossessedBy(oPC, "AncientTemple") != OBJECT_INVALID)
{
SetLocalInt(OBJECT_SELF, sVar, TRUE);
return TRUE;
}
return FALSE;
}
EDIT: L8 solution is even better if his assumption is correct
Kato
Modifié par Kato_Yang, 16 juin 2012 - 06:52 .
#3
Posté 16 juin 2012 - 06:49
Assumptions I made in the rewrite.
The item is unique.
You only want the item used once. Passing it to another PC, Will not allow it to be used again.
int StartingConditional()
{
object oItem = GetItemPossessedBy(GetPCSpeaker(), "AncientTemple");
if (oItem != OBJECT_INVALID)
{
int nUsed = GetLocalInt(oItem,"used");
if (!nUsed)
{
SetLocalInt(oItem,"used",TRUE);
return TRUE;
}
}
return FALSE;
}
The item is unique.
You only want the item used once. Passing it to another PC, Will not allow it to be used again.
int StartingConditional()
{
object oItem = GetItemPossessedBy(GetPCSpeaker(), "AncientTemple");
if (oItem != OBJECT_INVALID)
{
int nUsed = GetLocalInt(oItem,"used");
if (!nUsed)
{
SetLocalInt(oItem,"used",TRUE);
return TRUE;
}
}
return FALSE;
}
#4
Posté 16 juin 2012 - 06:52
Thanks to both of you for your quick replies! It's a SP module so it will only be used once by default.
Thanks again!
Thanks again!





Retour en haut







