Aller au contenu

Photo

On Fail To Open Script


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

#1
Morbane

Morbane
  • Members
  • 1 883 messages
 Hello

What object function should trigger On Fail To Open?

Right now I am using GetLastUsedBy() but it only triggers if the PC right clicks and selects Use.

I am trying to get it to fire when the PC fails to pick the lock or even when they try to open it and find it is locked (and trapped)

Thanks for any tips.

Edit: I also tried GetClickingObject(); no love there :pinched:

Modifié par Morbane, 11 septembre 2011 - 04:44 .


#2
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
I'm surprised that GetClickingObject doesn't work. You are sure that the script itself is running?

#3
Morbane

Morbane
  • Members
  • 1 883 messages
The script runs -
void main()
{
object oPC = GetClickingObject();

AssignCommand(oPC, ActionStartConversation(oPC, "a_versette_vault", FALSE, FALSE, TRUE, FALSE));

if(GetGlobalInt("versette_vault") == TRUE) return;

CreateObject(OBJECT_TYPE_CREATURE, "n_versette00", GetLocation(GetWaypointByTag("wp_versette")));

effect eShock = EffectDamage(d6(3), DAMAGE_TYPE_ELECTRICAL, DAMAGE_POWER_NORMAL);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eShock, oPC);

SetGlobalInt("versetter_vault", TRUE);
}
The problem is it only fires when the PC "uses" the door, I have put it in On Click & Fail To Open but neither fires from just clicking or failing to pick the lock? Im confounded.

Modifié par Morbane, 11 septembre 2011 - 06:17 .


#4
Morbane

Morbane
  • Members
  • 1 883 messages
I found a viable workaround - the script seemed to work properly when the door was unlocked - but it did not open - so in the script I had attached to the door now has a ActionLockObject(OBJECT_SELF) in it. Which works for now.

#5
The Fred

The Fred
  • Members
  • 2 516 messages
I think you need GetEnteringObject(). It's weird, but it seems to be the catch-all for if there isn't a specific function. I think GetEnteringObject() actually works in place of GetClickingObject(). Don't quote me on that, though.

If the PC can pick locks, they will attempt to do so before the OnFailToOpen script fires. Otherwise it should occur just as they click it and it says "*locked*".