Author Topic: Can use limitation  (Read 328 times)

Legacy_altphil

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Can use limitation
« on: April 20, 2012, 02:48:00 pm »


               Go easy on me, my first post for scripting help.

My google-fu fails me.

Is there a simple way to tell if target player can use target item, taking into account alignment/class restrictions and player's UMD?

Would I just have to write my own check by using IPGetHasUseLimitation(), and if true, check GetHasSkill() for UMD,   use GetIsSkillSuccessful() with UMD vs Item Level... and if not loop through item properties looking for any limitations and comparing them to the player to return true of false for if the player can use it?

I'm just kind of surprised that function hasn't been written already.  Maybe I'm just not finding it.  Seems like I shouldn't be the first person ever to have a need to check item usability in script.  I can write it no sweat, just looking to save time.
               
               

               


                     Modifié par altphil, 20 avril 2012 - 04:05 .
                     
                  


            

Legacy_Dylmani555

  • Jr. Member
  • **
  • Posts: 95
  • Karma: +0/-0
Can use limitation
« Reply #1 on: April 20, 2012, 08:48:25 pm »


               As far as I am aware there isn't one, perhaps you should check on the nwn lexicon (google it)
               
               

               
            

Legacy_altphil

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Can use limitation
« Reply #2 on: April 20, 2012, 09:33:15 pm »


               Heh, yeah, I use the heck out of nwn lexicon.

I went ahead and wrote it, but having some trouble with it.  I'll post up the sloppy results when I'm done.  Working through a different issue right now.
               
               

               
            

Legacy_altphil

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Can use limitation
« Reply #3 on: April 20, 2012, 11:11:56 pm »


               Well, got it written.  It's too ugly to post online.

For some reason, IPGetHasUseLimitation() totally hosed up my function.  I imagine because it returns in the middle of the IP loop?  I really don't fully understand the GetFirst/GetNext thing.  All I know is it totally hosed things up, I
comment it out, and everything works great.

Doesn't make a lot of sense to use IPGetHasUseLimitation in my function anyway, just adding another needless IP loop.  I have to do one anyway, might as well just do one instead of two.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Can use limitation
« Reply #4 on: April 20, 2012, 11:31:42 pm »


               I do not really know what you are trying to do or what type of script you are tring to find this information in .   The standard functions for spells are located in x2_inc_spellhook and are: 


// Use Magic Device Check.
// Returns TRUE if the Spell is allowed to be cast, either because the
// character is allowed to cast it or he has won the required UMD check
// Only active on spell scroll
int X2UseMagicDeviceCheck();

// This function holds all functions that are supposed to run before the actual
// spellscript gets run. If this functions returns FALSE, the spell is aborted
// and the spellscript will not run
int X2PreSpellCastCode();

-----------


 IPGetHasUseLimitation: I have no Idea what that function does or where you found it.