Hi,
I have worked through the wiki example with a quest giver with a quest to clear a hut of a handfull of monsters and am currently just trying to tidy it up a little.
One of the features I'm trying to implement is a locked door. I have set the initial state of the door to locked easily enough and I have written as script which I think will work but I do not know which event is fired when a PC tries to open a locked door, does anyone here know?
Regards
Paul
Unlocking a locked door
Débuté par
Halchek
, déc. 12 2009 12:06
#1
Posté 12 décembre 2009 - 12:06
#2
Posté 12 décembre 2009 - 07:59
It would help if I knew exactly what you were trying to do.
If what you want is a door unlocked with the lockpicking skill or a door unlocked with a key, then you don't need a custom script. You can set the lockpicking difficulty and the key tag in the door's properties. Keys can be any type of item, so long as the tag matches. The default script will handle the rest.
If you want the door to be unlocked by something else, like a lever or whatever, then you'll want something like this, run from within the same area:
object oDoor = GetObjectByTag("my_door");
SetPlaceableState(oDoor, PLC_STATE_DOOR_UNLOCKED*);
*not certain on the exact naming of this constant, going from memory.
If what you want is a door unlocked with the lockpicking skill or a door unlocked with a key, then you don't need a custom script. You can set the lockpicking difficulty and the key tag in the door's properties. Keys can be any type of item, so long as the tag matches. The default script will handle the rest.
If you want the door to be unlocked by something else, like a lever or whatever, then you'll want something like this, run from within the same area:
object oDoor = GetObjectByTag("my_door");
SetPlaceableState(oDoor, PLC_STATE_DOOR_UNLOCKED*);
*not certain on the exact naming of this constant, going from memory.
Modifié par DavidSims, 12 décembre 2009 - 07:59 .
#3
Posté 03 février 2010 - 04:29
Mysticyx wrote...
Can anyone tell me how to make an npc give you a key after a conversation? It's already in his inventory and compatible with the door. Thanks in advance.
Create a plot flag in a plot with a custom script. Set the plot flag on the last line of the conversation. In the action handler for that plot flag, put something like this:
object oItemOwner = GetObjectByTag("creature_tag");
object oItem = GetItemPossessedBy(oItemOwner, "item_tag");
MoveItem(oItemOwner, GetHero(), oItem);
If the key has been pickpocketed, the above won't transfer anything, becuase the creature doesn't have it any more. If that's not desirable for whatever reason, you could use UT_AddItemToInventory to create one in the player's inventory no matter what. If you can't kill the creature and loot the key, or pickpocket the key, there's really no reason to put it on the creature to begin with so you don't have to move or get rid of it. Otherwise, use UT_RemoveItemFromInventory to get rid of the creature's version of the key.





Retour en haut






