Take items from player
gpeddino
Member Posts: 51
I'm working on a conversation script in which the player gives three items he was required to fetch. All of the items have the same tag ("MoonMushroom") and there's a possibility that the player will be carrying more than three.
How can I organize that in a script? The script wizard won't help me. Would it be useful to use a while/for loop?
I'm a bit of a beginner, please excuse me if I'm asking something stupid.
How can I organize that in a script? The script wizard won't help me. Would it be useful to use a while/for loop?
I'm a bit of a beginner, please excuse me if I'm asking something stupid.
0
Comments
This is why I like no drop items. It makes the second check not required.
adapt to your needs
//Solo funciona si se pone en 1 (dialogo de la otra parte) Y 2) EN CRIATURAS Y OBJETOS !?
#include "nw_i0_plot"
#include "nw_i0_tool"
void main()
{
object oPC = GetPCSpeaker();
{
string sMark = "oro_o"; // Enter tag of your Item
object oMark = GetObjectByTag(sMark);
int nMarkCount = 2; // Change to num Items you want
if(GetNumItems(GetPCSpeaker(),sMark) >= nMarkCount)
{
TakeNumItems(GetPCSpeaker(),sMark,nMarkCount);
// Uncomment the following line to Give the PC an Item Also
// CreateItemOnObject("item_ResRef",GetPCSpeaker(),1);
}
} ;
object oItem;
oItem = GetItemPossessedBy(oPC, "oro_o");
if (GetIsObjectValid(oItem))
DestroyObject(oItem);
CreateItemOnObject("oro", oPC);
CreateItemOnObject("oro", oPC);
AssignCommand(oPC, TakeGoldFromCreature(25000, oPC, TRUE));
RewardPartyXP(800, oPC, FALSE);
}