I am trying to develope a script that goes on a placeable to identify all unidentified items in a PC's inventory at a cost per item. I got it identifying all items but am having a problem getting the cost to apply.
void IdentifyAll(object oObject, object oPC);
int GetNumIDItems(object oPC);
void main()
{
object oPC = GetLastUsedBy();
int nNumItems;
int nGold = 250;
int nGoldAmt = nNumItems * nGold;
int nPCGold = GetGold(oPC);
if(nPCGold >= nGoldAmt)
{
TakeGoldFromCreature(nGoldAmt, oPC, TRUE);
IdentifyAll(oPC, oPC);
IdentifyAll(OBJECT_SELF, oPC);
SendMessageToPC(oPC, "Your items are all Identified!");
}
else
{
SendMessageToPC(oPC, "You don't have enough gold to identify all of the items!");
}
}
void IdentifyAll(object oObject, object oPC)
{
object oItem = GetFirstItemInInventory(oObject);
while(oItem != OBJECT_INVALID)
{
if(!GetIdentified(oItem))
{
SetIdentified(oItem, TRUE);
}
oItem = GetNextItemInInventory(oObject);
}
}
int GetNumIDItems(object oPC)
{
int nNumItems = 0;
object oItem = GetFirstItemInInventory(oPC);
while(oItem != OBJECT_INVALID)
{
if(!GetIdentified(oItem))
{
nNumItems ++;
}
oItem = GetNextItemInInventory(oPC);
}
return nNumItems;
}
Thats what I got so far. Can anyone help a bit?
Identifying Items script
Débuté par
LordLestat
, déc. 16 2010 02:22
#1
Posté 16 décembre 2010 - 02:22
#2
Posté 16 décembre 2010 - 02:38
The solution is simple, you never call your GetNumIDItems() function in your void main() section of the script.
Just change the line:
int nNumItems;
to:
int nNumItems = GetNumIDItems(oPC);
And it should work.
Just change the line:
int nNumItems;
to:
int nNumItems = GetNumIDItems(oPC);
And it should work.
Modifié par _Knightmare_, 16 décembre 2010 - 02:39 .
#3
Posté 16 décembre 2010 - 02:47
Thanks I will try that. I knew it had to something simple I was just missing it.
#4
Posté 28 janvier 2013 - 10:21
Howdy,
I am trying to come up with a StartConditional, Convo script that checks to see if a PC has a item and if the item is identified. Lots of did not compiles. I took the standard has item and tried adding
if(GetIdentified(oItem))
return FALSE;
return TRUE;
Also Tried adding it to the origanal if statement. Nope.
I got several scripts that made sense to me, unfotunately the compiler did not agree.
Any help out there ?
I am trying to come up with a StartConditional, Convo script that checks to see if a PC has a item and if the item is identified. Lots of did not compiles. I took the standard has item and tried adding
if(GetIdentified(oItem))
return FALSE;
return TRUE;
Also Tried adding it to the origanal if statement. Nope.
I got several scripts that made sense to me, unfotunately the compiler did not agree.
Any help out there ?
#5
Posté 28 janvier 2013 - 11:56
Ed Venture wrote...
Howdy,
I am trying to come up with a StartConditional, Convo script that checks to see if a PC has a item and if the item is identified. Lots of did not compiles. I took the standard has item and tried adding
if(GetIdentified(oItem))
return FALSE;
return TRUE;
Also Tried adding it to the origanal if statement. Nope.
I got several scripts that made sense to me, unfotunately the compiler did not agree.
Any help out there ?
HasItem() returns true or false so it doesn't actually save you an object that the script can start querying. Maybe try the object function, GetItemPossessedBy(), instead?
ex:
int StartingConditional()
{
object oItem = GetItemPossessedBy(GetPCSpeaker(), "TAG_OF_THE_ITEM");
if (GetIsObjectValid(oItem)) if (!GetIdentified(oItem)) return TRUE;
return FALSE;
}
#6
Posté 29 janvier 2013 - 04:28
Here's the mass identifier script we use. It's pretty simple, and doesn't use a convo, but it may be of help to you regardless.
Funky
void main() {
object oPC = GetLastUsedBy();
object oCheck = GetFirstItemInInventory(oPC);
int nCheck = 0;
while (GetIsObjectValid(oCheck)) {
if (!GetIdentified(oCheck))
nCheck++;
oCheck = GetNextItemInInventory(oPC);
}
if (nCheck == 0)
FloatingTextStringOnCreature("You have no items in need of identification", oPC);
else {
int nGold = GetGold(oPC);
int nCost = 120*nCheck;
if (nGold < nCost)
FloatingTextStringOnCreature("There is a 120gp charge per item. You are trying to identify " + IntToString(nCheck) + " items, costing " + IntToString(nCost) + "gp, and you only have " + IntToString(nGold) + "gp.", oPC);
else {
object oItem = GetFirstItemInInventory(oPC);
int nCount = 0;
while (GetIsObjectValid(oItem)) {
if (!GetIdentified(oItem))
SetIdentified(oItem, TRUE);
oItem = GetNextItemInInventory(oPC);
}
TakeGoldFromCreature(nCost, oPC, TRUE);
FloatingTextStringOnCreature("Identifed " + IntToString(nCheck) + " items for " + IntToString(nCost) + " gold. Come again!", oPC);
effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
}
}
}
Funky





Retour en haut






