Author Topic: Homebrew scripts vs Internal Function calls  (Read 1215 times)

Legacy_Zarathustra217

  • Sr. Member
  • ****
  • Posts: 322
  • Karma: +0/-0
Homebrew scripts vs Internal Function calls
« Reply #45 on: July 23, 2012, 11:08:30 pm »


               Ah, now it makes more sense to me.

And the NWNx solution is handy - I imagine it wouldn't even matter whether the spell ID actually exists.
               
               

               
            

Legacy_the.gray.fox

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Homebrew scripts vs Internal Function calls
« Reply #46 on: July 25, 2012, 03:02:10 pm »


               

ShaDoOoW wrote...

Zarathustra217 wrote...

You honestly lost me there. Invisible placeable? Creator?

It's just something to ponder really, nothing concrete, at least not from my side.

Im following the Failed.Bard's idea/suggestion that improves upon your suggestion to use custom spell to track effects.

If you want to apply some KD effect somewhere and later be able to find that effect is a knockdown effect (since kd effect returns effect_type_invalid). You would normally use object in module with speficic tag, called the effect creator. Then loop over effects and check the effect creator to find this out.


Hello.
Without detracting from what has been said, it may be handy to remember that an effect is only ever equal to itself (*). By virtue of this you can make a direct comparison between two effects and tell precisely if they are the same or not -- without need to know/retrieve informations such as effect's Spell Id, Creator, and most other sub-properties (like the magnitude of an attack penalty, to name one) of the queried effect.
The very exception to this is about the Duration of the effect. An effect X can be applied Permanently on Object A and Temporarily on Object B. When compared, the two effects shall evaluate equal -- incidentally revealing that the Duration trait of an effect is not considered integrant part of the very effect (it is rather an added property).

So the trick is to save the original effect somewhere safe, with Permanent duration, usually in an inaccessible Area, and applied to an inert Creature that will not react to anything (I used this in Fox Spells with flawless results -- if you want an idea of the extent this can go, have a look at my implementation of the Dirge mobile aoe spell). Creatures can hold _any_ effect +positive and -negative, except for the summoning effects (those used to spawn a summoned creature -- To "save" a summoning effect on a creature equals to have that creature use the effect and spawn a summoned associate (regardless of who created said effect) -- which is not what you want to happen).
Saving the original effect can be useful for many reasons. One I have grown fond of (while making Fox Spells) is the ability to make quick and surgical removal of a _specific_ effect. You just issue a RemoveEffect() on the target creature, and if she had that very effect, it shall be removed. Otherwise all you wasted is 1 call -- as opposed to any [lenghty] scan to first determine if the target creature may hold an effect such as _the_ one you are interested in.

(*)Equal to itself means precisely that. If effect A is copied into effect B, A and B are found equal always, regardless of how many variables and scopes you have them traverse during their lifetime. But if then A is linked to another effect C, once you compare the new A with B they shall be found not equal. As far as I know this unwanted side-effect of linking is irreversible (if anyone knows of a solution, I will hear it gladly).

(off topic: Quake I on Nightmare is definitely not for my poor heart)


-fox
               
               

               


                     Modifié par the.gray.fox, 25 juillet 2012 - 02:26 .