Author Topic: Player tool help  (Read 361 times)

Legacy_Terrorble

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Player tool help
« on: May 26, 2011, 03:04:07 am »


               I add Player Tool04 to the PC skin OnEnter/OnLevelUp, and then give it this functionality:

#include "x3_inc_horse"
#include "x2_inc_itemprop"
#include "nw_i0_plot"
float TimeUntilNextHiPSUse(object oPC);
void main()
{
    object oPC = OBJECT_SELF;

    //Give the player HiPS just long enough to let them to hide
    object oSkin = SKIN_SupportGetSkin(oPC);
    IPSafeAddItemProperty(oSkin,ItemPropertyBonusFeat(IP_CONST_FEAT_HIDE_IN_PLAIN_SIGHT),0.2,X2_IP_ADDPROP_POLICY_IGNORE_EXISTING);
    DelayCommand(0.1, SetActionMode(oPC,ACTION_MODE_STEALTH,TRUE));

    //DecrementRemainingFeatUses(oPC, FEAT_PLAYER_TOOL_04);
    DelayCommand(TimeUntilNextHiPSUse(oPC), IncrementRemainingFeatUses(oPC, FEAT_PLAYER_TOOL_04));
}

//non-SDs can use HiPS sooner if they have more ranger/rogue/assassin levels
//maximum usage rate is 2 rounds for these classes
float TimeUntilNextHiPSUse(object oPC)
{
    int nRang = GetLevelByclass(class_TYPE_RANGER,oPC);
    int nRogue = GetLevelByclass(class_TYPE_ROGUE,oPC);
    int nAss = GetLevelByclass(class_TYPE_ASSASSIN,oPC);
    float fTime = 52.0 - nRang - nRogue - nAss;
    return fTime;
}

I am having a couple problems:

1.  When I add HiPS to the player skin with IPSafeAddItemProperty() using a 0.2 duration, it takes anywhere from 4-11 seconds for the feat to actually disappear from the player in-game.  So a player could spam HiPS the entire time, which completely ruins what I want to do.  Is that a coding mistake on my part, server lag, or what?  Any ideas?

2.  In feats.2da I set the player tool USESPERDAY to 1.  I figured it would become unusable until my function increments the feat uses back up, but this isn't working.  It stays usable all the time.  I even tried, with the line I commented out, to manually decrement the feat uses in the script.  That did not help either.  Any thoughts?

I can limit the feat use by setting a local int when it is used, and setting it back to its original state when it can be re-used, but I'd prefer to use incrementremainingfeatuses() if I can.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Player tool help
« Reply #1 on: May 26, 2011, 04:02:25 pm »


               1) do not use IPSafe, just add it on the skin without delay
2) just do ordinary stealth if the timer didnt passed yet and additionally you can say player that he used it too early, but no reason for decreasing/increasing uses.

I used the same method for HIPS limiting years ago before 1.69 and PC Tools, so you can check my HIPS limit script on vault and compare with yours. http://nwvault.ign.c....Detail&id=3506