Skip to content

Take items from player

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.

Comments

  • vxicepickxvvxicepickxv Member Posts: 6
    Because it's a conversation, you can actually get your total count in the part that checks to see if you have 3 or more, and then set up a loop to run 3 times to remove a MoonMushroom.
  • meaglynmeaglyn Member Posts: 149
    Just be sure to check the count again in the action taken script because... people.
  • vxicepickxvvxicepickxv Member Posts: 6
    meaglyn wrote: »
    Just be sure to check the count again in the action taken script because... people.

    This is why I like no drop items. It makes the second check not required.
  • Sfera_RojaSfera_Roja Member Posts: 9
    I give you one done and you can a
    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);


    }
Sign In or Register to comment.