Author Topic: HELP...again? Additional Property [Unknown]  (Read 447 times)

Legacy_Michael_Patty

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
HELP...again? Additional Property [Unknown]
« on: September 02, 2010, 05:51:32 am »


               Hello!


What exactly does the "Additional Property" under item properties do, and how the heck do I use it?

Can it be put on an item to "do something" when a weapon is used to attack?

Thanks for your time!

Michael
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
HELP...again? Additional Property [Unknown]
« Reply #1 on: September 02, 2010, 07:16:48 am »


               It does nothing, it is just placeholder for custom script systems.



Sure it can do something when attack, or when (un)equiped, but you need to script it.
               
               

               
            

Legacy_Michael_Patty

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
HELP...again? Additional Property [Unknown]
« Reply #2 on: September 02, 2010, 04:13:37 pm »


               How do I script something to "do such and such" on attack?

It has been my (admittedly poor) understanding that for a script to fire, you need an event. To what event would I attach the script to make it fire on attack? (there is no OnAttack event that I know if).

Thank you patience regarding my ignorance.  '<img'>

Michael
               
               

               


                     Modifié par Michael_Patty, 02 septembre 2010 - 03:16 .
                     
                  


            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
HELP...again? Additional Property [Unknown]
« Reply #3 on: September 02, 2010, 04:59:08 pm »


               If you are using tag-based scripting:



Add this to your weapon:

On Hit Cast Spell: Unique Power (OnHit)



Add a script with the same tag as your weapon.  There are numerous templates available for this.  You'll be looking for the X2_ITEM_EVENT_ONHITCAST: section of that script.



You can also do this with armor.



Tag-based scripting opens countless doors for custom items.  I personally have several hundred such scripts in my PW.  Very versatile.
               
               

               
            

Legacy_Michael_Patty

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
HELP...again? Additional Property [Unknown]
« Reply #4 on: September 02, 2010, 06:17:15 pm »


               The Amethyst Dragon:



Won't that work only when they HIT? I would think it would not fire when they miss. Is there any way to make a script fire when they attack, regardless of whether they hit or miss?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
HELP...again? Additional Property [Unknown]
« Reply #5 on: September 02, 2010, 06:20:52 pm »


               

Michael_Patty wrote...

The Amethyst Dragon:

Won't that work only when they HIT? I would think it would not fire when they miss. Is there any way to make a script fire when they attack, regardless of whether they hit or miss?

Yes, using npcs OnPhysicalAttack event, however this event fires few milisecond before the weapon reaches target, so it do not need to be realiable. Also Players do not have this event.

Also NWNX has OnAttack event but it fires when player click at enemy, not good. Why you want to do something when player attack anyway?
               
               

               
            

Legacy_Michael_Patty

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
HELP...again? Additional Property [Unknown]
« Reply #6 on: September 03, 2010, 05:56:31 pm »


               ShaDoOoW:



To generate effects and sounds from a weapon when it fires. It would need to be on attack because it would happen whether they hit or not.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
HELP...again? Additional Property [Unknown]
« Reply #7 on: September 03, 2010, 07:32:58 pm »


               hmm that could be onphysical event used for, however as I said already, players dont have this, if player uses the weapon at another player, you can catch only ondamaged and only with intensive scripting, this event is not default, must be workarounded
               
               

               
            

Legacy_Invisig0th

  • Sr. Member
  • ****
  • Posts: 279
  • Karma: +0/-0
HELP...again? Additional Property [Unknown]
« Reply #8 on: September 04, 2010, 12:27:19 am »


               I believe all this was covered in the other thread. You were correct from the start -- you do indeed need an event to attach your script to, and there is no such event that fires when a weapon is used to attack. The OnHit event is pretty much all you have -- and as you quite correctly observed, that won't meet the requirements here.

If PCs cannot be attacked with your custom weapon, you could theoretically set up a custom OnPhysicalAttacked script for every single possible target in your module (creatures, placeables, doors, everything) to check for that weapon and play a sound. However, that is preposterously convoluted, and most likely not very practical.
               
               

               


                     Modifié par Invisig0th, 03 septembre 2010 - 11:35 .