Author Topic: OnClick event number for OnUserDefined  (Read 459 times)

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
OnClick event number for OnUserDefined
« on: December 17, 2010, 12:03:36 pm »


               Greets
As doors only have the following events

OnAreaTransitionClick
OnClose
OnDamaged
OnDeath
OnFailToOpen
OnHeartbeat
OnLock
OnOpen
OnPhysicalAttacked
OnSpellCastAt
OnUnlock
OnUserDefined

and have no OnClick event I was wondering if it is possible to use OnUserDefined instead? If so is there an event number I could use? if not is there any other way around this?

Thanks in advance.

TR
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
OnClick event number for OnUserDefined
« Reply #1 on: December 17, 2010, 02:37:35 pm »


               What are you trying to do?
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
OnClick event number for OnUserDefined
« Reply #2 on: December 17, 2010, 02:51:34 pm »


               

Baragg wrote...

What are you trying to do?


Think they are looking to apply an affect (as opposed to an Effect) on the door. For example, lock or unlock the door based upon a detected variable, like the class of the PC trying to use the door. I gave an example script in another thread, but NWN has no OnClicked event for doors like NWN2 does, so I can't offer a suggested way of running the script in NWN.
               
               

               


                     Modifié par _Knightmare_, 17 décembre 2010 - 02:54 .
                     
                  


            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
OnClick event number for OnUserDefined
« Reply #3 on: December 17, 2010, 03:06:13 pm »


               Use "OnFailToOpen" as your controlling event and just ensure the door is locked. Then you can script it to unlock based on your class/race/widget possession or even time of day.
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
OnClick event number for OnUserDefined
« Reply #4 on: December 17, 2010, 03:47:27 pm »


               What I'm actually trying to do is at its most basic level

if(condition==TRUE)
    Lock Door
else
    Unlock Door

without the door moving unless the door is supposed to be unlocked.

TR
               
               

               


                     Modifié par Tarot Redhand, 17 décembre 2010 - 03:49 .
                     
                  


            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
OnClick event number for OnUserDefined
« Reply #5 on: December 17, 2010, 04:19:23 pm »


               The only way I know to make the door restrictions work as you've discussed both here and elsewhere is to have the doors always defaulted to locked and let the script open or ignore based on whatever parameters you wish. This is how most handle making merchants that close after dark and open back up by day or have a shady bar only open in the night.
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
OnClick event number for OnUserDefined
« Reply #6 on: December 17, 2010, 04:41:18 pm »


               I was beginning to think along those lines but had hoped there was another way. Ah well, I've got an interesting set of scripts for chests now '<img'>. Thanks for the info.

TR
               
               

               


                     Modifié par Tarot Redhand, 17 décembre 2010 - 04:43 .
                     
                  


            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
OnClick event number for OnUserDefined
« Reply #7 on: December 17, 2010, 04:49:25 pm »


               With the door placeables you have the placeable event set that contains an onClick and onUsed.  If you implement your door using a placeable instead of a "door" you can have that.  But you have to implement the regular functionality in that case.
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
OnClick event number for OnUserDefined
« Reply #8 on: December 17, 2010, 04:50:28 pm »


               An alternate method might be to draw a generic trigger on the ground right in front of the door and have your script OnEnter that affects the nearest door or whatever.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
OnClick event number for OnUserDefined
« Reply #9 on: December 17, 2010, 05:07:18 pm »


               We use a targeting item for our dm_lock and dm_unlock chat commands. It directs the user to use an item, which is created if they don't have one, to select the target. The only catch is that you can't target doors, normally. We get around this by means of an engine hack to make instant-use items, which hooks the item use, but even lacking that hack, you could simply have the command target the nearest door.



Funky