Author Topic: how to: detect failed attemp to open a door  (Read 421 times)

Legacy_Calgacus

  • Full Member
  • ***
  • Posts: 195
  • Karma: +0/-0
how to: detect failed attemp to open a door
« on: September 22, 2010, 04:52:17 am »


               Hi, I tried OnFailtoOpen event but it doens't fire, I guess it only fires when the player attempts to use Open Lock skill on a  locked object.
So, How do I detect when the player fails to open a door thats locked without trying to use the open lock skil.
Thanks

PS: Maybe a custom trap script?  it fires every time someone attepts to open the door - but I want the behavior only when the door fails to open - I guess I could but  another variable on the door..

PPS: But would that force an innapropriate trap message to display?
               
               

               


                     Modifié par Calgacus, 22 septembre 2010 - 04:24 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
how to: detect failed attemp to open a door
« Reply #1 on: September 22, 2010, 05:18:13 am »


               You do use the "OnFailToOpen" event. How are you scripting it? Are you using GetClickingObject(); to define the player?
               
               

               
            

Legacy_Calgacus

  • Full Member
  • ***
  • Posts: 195
  • Karma: +0/-0
how to: detect failed attemp to open a door
« Reply #2 on: September 22, 2010, 05:33:13 am »


               i  used getlastopenedby - not sure why, let me try the other...
               
               

               
            

Legacy_Calgacus

  • Full Member
  • ***
  • Posts: 195
  • Karma: +0/-0
how to: detect failed attemp to open a door
« Reply #3 on: September 22, 2010, 05:36:46 am »


               No luck,  seems the code just does not run as I get no end turn message, here the OnFailToOpen script:


#include "laby_vars"
#include "laby_turn_funcs"


void main(){
   oPC = GetPlaceableLastClickedBy();
   oArea = GetArea(oPC);
   FloatingTextStringOnCreature("Your turn is over.", oPC, FALSE);
   endTurn();
   SoundObjectPlay(GetObjectByTag(GetLocalString(oArea, snd_HITWALL)));
   DragonsTurn();
}
               
               

               


                     Modifié par Calgacus, 22 septembre 2010 - 04:38 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
how to: detect failed attemp to open a door
« Reply #4 on: September 22, 2010, 12:54:21 pm »


               

Calgacus wrote...

 oPC = GetPlaceableLastClickedBy();
 }


Your  problem is you are useing the placable functions for the door events. A door is not a placeable.

try useing:

object oPC = GetClickingObject();
               
               

               
            

Legacy_Calgacus

  • Full Member
  • ***
  • Posts: 195
  • Karma: +0/-0
how to: detect failed attemp to open a door
« Reply #5 on: September 23, 2010, 03:50:58 am »


               Thanks, i'll try it out.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
how to: detect failed attemp to open a door
« Reply #6 on: September 23, 2010, 04:30:39 am »


               

GhostOfGod wrote...

Are you using GetClickingObject(); to define the player?


Deja vu? ':whistle:'
               
               

               


                     Modifié par GhostOfGod, 23 septembre 2010 - 03:31 .