void main()
{
object oForge = OBJECT_SELF;
object oStorage = GetNearestObjectByTag("Forge_Date_Bank");
object oSlag = GetNearestObjectByTag("Slag_Gatherer");
object oPC = GetLastClosedBy();
int nCraft = GetLocalInt(oPC,"nCraft");
// This function counts up the total number of items in the first PC's inventory. (The number of items in a stackable count toward the total)
int nItems = 0;
object oItem = GetFirstItemInInventory(oForge);
//string sRes = GetResRef(oItem);
while (GetIsObjectValid(oItem) == TRUE)
//if (sRes == "cold_iron_ore001")
{
//int nCraft = GetLocalInt(oStorage,"nCraft");
//if (nCraft = 0)
// {
//SpeakString("You have started a Dark Iron recipe. You need 5 more Dark Iron Ores to craft an item.");
//SetLocalInt(oStorage,"nCraft",1);
if (GetResRef(oItem)=="cold_iron_ore001")
{
if (nCraft = 0)
{
SpeakString("You have started a Dark Iron recipe. You need 5 more Dark Iron Ores to craft an item.");
SetLocalInt(oPC,"nCraft",1);
DestroyObject(oItem);
}
else if ((nCraft > 0) && (nCraft < 5))
{
int nRemainder = (5 - nCraft +1);
SpeakString("You have started a Dark Iron recipe. You need " + IntToString(nRemainder) + "more Dark Iron Ores to craft an item.");
//SendMessageToPC(oMember, "Worgs left to kill: " + IntToString(nWorg2));
nCraft += 1;
SetLocalInt(oPC, "nCraft", nCraft);
DestroyObject(oItem);
}
else if (nCraft = 5)
{
//int nRemainder = (5 - nCraft +1);
SpeakString("You have finished a Dark Iron recipe. You may collect the slag from the .");//need to name
//SendMessageToPC(oMember, "Worgs left to kill: " + IntToString(nWorg2));
SetLocalInt(oPC,"nCraft",80);
DestroyObject(oItem);
CreateItemOnObject("slag_dark", oSlag);
}
else if (nCraft > 5)
{
//int nRemainder = (5 - nCraft +1);
SpeakString("You have wasted some ore!");
//SendMessageToPC(oMember, "Worgs left to kill: " + IntToString(nWorg2));
//nCraft += 1;
DestroyObject(oItem);
}
} // end If cold_iron_ore001 (Dark Iron)
else if (GetResRef(oItem)!="cold_iron_ore001")
{
DestroyObject(oItem);
}
oItem = GetNextItemInInventory(oForge);
} //end While Valid Object
//while (GetIsObjectValid(oItem) == TRUE)
//{
// nItems = nItems + GetNumStackedItems(oItem);
// oItem = GetNextItemInInventory(GetFirstPC());
//}
} //END OF VOID MAIN
Hi!
I'm currently reworking my forge system - I want to try using strings and parses for item upgrades - and I'm running into a problem on a script. The following script almost works, but it is creating "slag_dark" after placing just 1 'cold_iron_ore' into the cauldron.
I'm trying to fix it so that the PC must place 5 ores into the cauldron, either all at once, or consecutively, before the bucket of slag is created (on another placeable).
I tried to design the script to leave open the possibility for other ore types to be used in the cauldron (although I'm leaning towards a cauldron type for each type of ore).
Anyways, 1 ore is creating 1 bucket of slag... I want 5 ores to be eaten before creating the bucket of slag. I'm wondering if its just a delay that is required... . If anyone can fix this, please have a go.
Sorry script is above my request...