Aller au contenu

Photo

Item Acquisition Quest Scripting [solved]


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
BillHoyt

BillHoyt
  • Members
  • 109 messages
I'm having a little trouble getting a quest to update when I acquire an item, so I'm hoping someone can see what I'm missing here.

The quest itself is familiar: go kill that monster and bring me what it drops.  In this case, it's a spider and a set of clothes (there's a reason for that unimportant to this post, trust me).  The item carries a tag of spider_man_clothes and has the following properties:

Plot item = false (I set this because I'm going to delete it from PC inventory, but tested it both ways)
Script: none
Variable 2da: var_item
Under variables, they are all default except ITEM_SEND_ACQUIRED_EVENT, which is 1.  I hoped this would kick off an event when the PC picks up the clothes.

PC goes into an area with the following area script:

#include "events_h"
#include "wrappers_h"
#include "plt_kill_the_spider"

void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);

    switch(nEventType)
    {
        case EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED:
        {
            object oItemAquired = GetEventObject(ev,0);
            if(oItemAquired == (GetObjectByTag("spider_man_clothes")))
            {
                WR_SetPlotFlag(PLT_KILL_THE_SPIDER, SPIDER_KILLED, TRUE);
            }
            break;
        }
    }
    HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
}

But when I pick up the clothes from the dead spider, nothing.

I have tested the WR_SetPlotFlag line on a "destroy team" event and it works, I just seem to be unable to generate an event when I pick this item up.  Any ideas (mocking laughter and snide remarks certainly count) would be appreciated.

Modifié par BillHoyt, 12 avril 2010 - 02:03 .


#2
PavelNovotny

PavelNovotny
  • Members
  • 344 messages
Isn't EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED a module event and not an area event?

#3
BillHoyt

BillHoyt
  • Members
  • 109 messages
Why yes it is. I moved the CASE to the module script and it worked swimmingly. Thanks a bunch!