Aller au contenu

Photo

unlock a door by scripting


1 réponse à ce sujet

#1
slaaleth

slaaleth
  • Members
  • 71 messages
hi

I want to unlock a door by scripting.

I have an area door that I set the initial state to lock and the pick lock level to impossible. and I want when the player recieve the quest from the npc (who is in the same area) the door come unlock. I try this code, but it doesn't work:



#include "events_h"
#include "plt_quest_armure"
#include "wrappers_h"

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

    switch(nEventType)
    {
        case EVENT_TYPE_SET_PLOT:
        {
            int iprog=WR_GetPlotFlag(PLT_QUEST_ARMURE, TUER_LES_MONSTRE_SOUS_LA_CHANTRIE, TRUE);
            object odoor=GetObjectByTag("door_sanctuaire_ch");

            if(iprog== TRUE)
            {
                SetPlaceableState(odoor, PLC_STATE_DOOR_UNLOCKED);
            }

            // Insert event-handling code here.
            break;

        }

    }
    HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
}

is someone can help me?

Modifié par slaaleth, 12 janvier 2010 - 09:29 .


#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
That seems to be a plot script, but you don't have a switch/case statement to branch based on which flag is set. Technicaly that works, if you're okay with the script running no matter which flag is set.



However, if looks like maybe instead of the switch you're trying to grab the value of the flag and check it. Flags are set after the plot script runs, not before. That flag would have to be set twice before the door would open, assuming the tag is correct and everything is hooked up properly.