Author Topic: PC Properties creature skin  (Read 808 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
PC Properties creature skin
« on: July 30, 2012, 03:36:42 am »


                When I rest in my world, I see a PC Properties skin in the inventory. Where can I go to not make it visable? 
               
               

               
            

Legacy_Carcerian

  • Hero Member
  • *****
  • Posts: 1655
  • Karma: +0/-0
PC Properties creature skin
« Reply #1 on: July 30, 2012, 12:17:16 pm »


               (assuming you meant "what can i do to make it not appear/hide it")

Nothing. (You can either delete it or prevent it from appearing in the first place...)

Thats the 1.69 PC hide that NWN insists on spamming you with because it thinks the most important thing in the world is forcing you to equip it's horse mounting feats bearing hide over and over...

You can either remove horses completly, or try Axe Murderer's "Killer" upgrade: Killer Horse Pack v1.1 by Axe

The simplest fix i could see is to delete it onaqquire if player already has an exisiting hide of same tag/resref equipped. Or at least, make a check for when players log on, to delete the extra hide if it exsists...

Theoreticly, to fix it properly. find were it decides to give you the hide in the first place, and add a check ito abort if player already has a hide equipped...

Supposedly the 1.69 horse system could thus be "debugged" but if somone has already done it it's news to me '<img'>
               
               

               


                     Modificata da Carcerian, 30 luglio 2012 - 11:35 .
                     
                  


            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
PC Properties creature skin
« Reply #2 on: July 30, 2012, 06:30:01 pm »


               You shouldn't see the PC skin at all. It equips into a creature slot that is not visible to the PC. I'd be more concerned about what you've modified that unequips the PC skin and places it into your inventory.

The PC skin is only given to a PC when the module is first entered - in the OnClientEnter event. ALL entering PCs get the skin unless they already have a skin. If the PC doesn't have the horse menu feat - and only if x3_mod_def_enter (or some derivative) is the OnClientEnter event - then the feat is added to the PC Properties skin. If the PC already has a skin then the horse menu feat is just added to it.

The easiest way to skip the spamming Carcerian refers to is to check if the PC has a skin and if so to check the skin to see if it has the horse menu feat as an item property. If it does then just skip the whole horse menu check.
               
               

               


                     Modificata da Pstemarie, 30 luglio 2012 - 07:46 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
PC Properties creature skin
« Reply #3 on: July 30, 2012, 07:10:43 pm »


               Alternatively, you could look at the rest script to see if it unequips and reequips the creature slot on the PC.
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
PC Properties creature skin
« Reply #4 on: July 30, 2012, 08:50:14 pm »


               After looking more closely at the default OnClientEnter event (x3_mod_def_enter), the script shouldn't spam people with adding the Horse Menu feat, given the entry on lines 21-28 of the script:


if ((GetIsPC(oPC)||GetIsDM(oPC))&&!GetHasFeat(FEAT_HORSE_MENU,oPC))
{ // add horse menu       
     HorseAddHorseMenu(oPC);       
     if (GetLocalInt(GetModule(),"X3_ENABLE_MOUNT_DB"))       
     { // restore PC horse status from database
          DelayCommand(2.0,HorseReloadFromDatabase(oPC,X3_HORSE_DATABASE));       
     } // restore PC horse status from database
} // add horse menu

You see that the Horse Menu feat is only added if the entering client is a PC OR DM AND they do not have a useable Horse Menu feat already. Therefore, either something in your OnPlayerRest event is unequipping the PC Properties Skin - as Henesua notes.
               
               

               


                     Modificata da Pstemarie, 30 luglio 2012 - 07:56 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
PC Properties creature skin
« Reply #5 on: July 30, 2012, 09:15:50 pm »


               

Pstemarie wrote...

You shouldn't see the PC skin at all..

This is not really true. You can see the skin in various situations after 1.69.

Most commonly its seen in loot due to the bad code attached to internal spellhook and some spells being recompiled in 1.69 - isaacs, firebrand, etc. After casting these spells on enemy, the skin is created on him and will drop in loot. (The Krit's remove PC Properties fixes this, as well as my community patch.)

Also you can see skin in situation where you log in into PW with ILR/ELC turned on, and the PW script apply death to you. In this case skin is not equipped and after you respawn yo ustill have it in inventory.

Conclusion: its quite normal, though not correct. Your OnRest script would help us to fix it for you.
               
               

               


                     Modificata da ShaDoOoW, 30 luglio 2012 - 08:18 .
                     
                  


            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
PC Properties creature skin
« Reply #6 on: July 31, 2012, 12:41:33 am »


               

ShaDoOoW wrote...

Pstemarie wrote...

You shouldn't see the PC skin at all..

This is not really true. You can see the skin in various situations after 1.69.

Most commonly its seen in loot due to the bad code attached to internal spellhook and some spells being recompiled in 1.69 - isaacs, firebrand, etc. After casting these spells on enemy, the skin is created on him and will drop in loot. (The Krit's remove PC Properties fixes this, as well as my community patch.)

Also you can see skin in situation where you log in into PW with ILR/ELC turned on, and the PW script apply death to you. In this case skin is not equipped and after you respawn yo ustill have it in inventory.

Conclusion: its quite normal, though not correct. Your OnRest script would help us to fix it for you.


Well that's kind of - insert colorful metaphor here. Does it behave this way with just default scripts? Reason I ask is because I've never seen the behavior you describe in my multiplayer games - or maybe just haven't noticed it. I use the default scripts for my LAN Server with custom modifications added in. However, my modifications are nowhere near as intricate as those used on other PWs, as I try to stay within the confines of nwscript and don't use extensions such as NWNX. 
               
               

               


                     Modificata da Pstemarie, 30 luglio 2012 - 11:42 .
                     
                  


            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
PC Properties creature skin
« Reply #7 on: July 31, 2012, 01:53:04 am »


               Here is the Rest script I have. For the most part it's the default.

//::///////////////////////////////////////////////
//:: Name: x2_onrest
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    The generic wandering monster system
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: June 9/03
//:://////////////////////////////////////////////
//:: Modified By: Deva Winblood
//:: Modified Date: January 28th, 2008
//:://////////////////////////////////////////////
#include "x2_inc_restsys"
#include "x2_inc_switches"
#include "x3_inc_horse"

void main()
{
    object oPC = GetLastPCRested();
    object oMount;
 

    object oDatabase = GetItemPossessedBy(oPC, "playerbook");
    location lLocation = GetLocation(oPC);
    // Store the location in the PC's database
    SetLocalLocation(oDatabase, "PC_LOCATION", lLocation);
    SendMessageToPC(oPC, "---location saved---");
    //Save toon
    ExportSingleCharacter(oPC);

    if (!GetLocalInt(GetModule(),"X3_MOUNT_NO_REST_DISMOUNT"))
    { // make sure not mounted
        /*  Deva, Jan 17, 2008
            Do not allow a mounted PC to rest
        */
        if (HorseGetIsMounted(oPC))
        { // cannot mount
            if (GetLocalInt(oPC,"X3_REST_CANCEL_MESSAGE_SENT"))
            { // cancel message already played
                DeleteLocalInt(oPC,"X3_REST_CANCEL_MESSAGE_SENT");
            } // cancel message already played
            else
            { // play cancel message
                FloatingTextStrRefOnCreature(112006,oPC,FALSE);
                SetLocalInt(oPC,"X3_REST_CANCEL_MESSAGE_SENT",TRUE); // sentinel
                // value to prevent message played a 2nd time on canceled rest
            } // play cancel message
            AssignCommand(oPC,ClearAllActions(TRUE));
            return;
        } // cannot mount
    } // make sure not mounted
    if (!GetLocalInt(GetModule(),"X3_MOUNT_NO_REST_DESPAWN"))
    { // if there is a paladin mount despawn it
        oMount=HorseGetPaladinMount(oPC);
        if (!GetIsObjectValid(oMount)) oMount=GetLocalObject(oPC,"oX3PaladinMount");
        if (GetIsObjectValid(oMount))
        { // paladin mount exists
            if (oMount==oPC||!GetIsObjectValid(GetMaster(oMount))) AssignCommand(oPC,HorseUnsummonPaladinMount());
            else { AssignCommand(GetMaster(oMount),HorseUnsummonPaladinMount()); }
        } // paladin mount exists
    } // if there is a paladin mount despawn it
    if (GetModuleSwitchValue(MODULE_SWITCH_USE_XP2_RESTSYSTEM) == TRUE)
    {
        /*  Georg, August 11, 2003
            Added this code to allow the designer to specify a variable on the module
            Instead of using a OnAreaEnter script. Nice new toolset feature!
            Basically, the first time a player rests, the area is scanned for the
            encounter table string and will set it up.
        */
        object oArea = GetArea (oPC);
        string sTable = GetLocalString(oArea,"X2_WM_ENCOUNTERTABLE") ;
        if (sTable != "" )
        {
            int nDoors = GetLocalInt(oArea,"X2_WM_AREA_USEDOORS");
            int nDC = GetLocalInt(oArea,"X2_WM_AREA_LISTENCHECK");
            WMSetAreaTable(oArea,sTable,nDoors,nDC);
            //remove string to indicate we are set up
            DeleteLocalString(oArea,"X2_WM_ENCOUNTERTABLE");
        }
 

        if (GetLastRestEventType()==REST_EVENTTYPE_REST_STARTED)
        {
            if (!WMStartPlayerRest(oPC))
            {
                // The resting system has objections against resting here and now
                // Probably because there is an ambush already in progress
                FloatingTextStrRefOnCreature(84142  ,oPC);
                AssignCommand(oPC,ClearAllActions());
            }
            if (WMCheckForWanderingMonster(oPC))
            {
                //This script MUST be run or the player won't be able to rest again ...
                ExecuteScript("x2_restsys_ambus",oPC);
            }
        }
        else if (GetLastRestEventType()==REST_EVENTTYPE_REST_CANCELLED)
        {
         // No longer used but left in for the community
         // WMFinishPlayerRest(oPC,TRUE); // removes sleep effect, etc
        }
        else if (GetLastRestEventType()==REST_EVENTTYPE_REST_FINISHED)
        {
         // No longer used but left in for the community
         //   WMFinishPlayerRest(oPC); // removes sleep effect, etc
         // Inform the player their location was saved. You may comment this out
         // if you want.
        }
    }

}
               
               

               


                     Modificata da Buddywarrior, 31 luglio 2012 - 01:02 .
                     
                  


            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
PC Properties creature skin
« Reply #8 on: July 31, 2012, 02:47:01 am »


               Your rest script is fine.

I just ran a test on my game. With the Inventory Panel open when you rest the PC Properties skin appears in your inventory during rest. When the rest ends you no longer see the item.

Evidently something - hard-coding most likely - is unequipping that slot when the rest begins, then equipping it again when the rest ends. If we can isolate that we can fix it...
               
               

               


                     Modificata da Pstemarie, 31 luglio 2012 - 01:47 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
PC Properties creature skin
« Reply #9 on: July 31, 2012, 02:59:04 am »


               It sounds like it happens so that Effects on the skin do not get removed from the PC when he rests.
               
               

               
            

Legacy_ShadowM

  • Hero Member
  • *****
  • Posts: 1373
  • Karma: +0/-0
PC Properties creature skin
« Reply #10 on: July 31, 2012, 03:38:30 am »


               You can do a simple test and remove you rest script or parts of it and do test to localize when the skin show up on your character. '<img'>
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
PC Properties creature skin
« Reply #11 on: July 31, 2012, 04:18:35 am »


               

Lightfoot8 wrote...

It sounds like it happens so that Effects on the skin do not get removed from the PC when he rests.


You may have nailed it. Its the only item that appears to exhibit this behavior. Personally, any effects I ever apply to the PC skin are set as permanent and supernatural so resting cannot remove them.
               
               

               
            

Legacy_Carcerian

  • Hero Member
  • *****
  • Posts: 1655
  • Karma: +0/-0
PC Properties creature skin
« Reply #12 on: July 31, 2012, 09:53:36 am »


               Also, if you have a full inventory, it will unceremoniously drop the hide on the ground...
               
               

               


                     Modificata da Carcerian, 31 luglio 2012 - 09:15 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
PC Properties creature skin
« Reply #13 on: July 31, 2012, 03:34:42 pm »


               

Pstemarie wrote...

Well that's kind of - insert colorful metaphor here. Does it behave this way with just default scripts? Reason I ask is because I've never seen the behavior you describe in my multiplayer games - or maybe just haven't noticed it. I use the default scripts for my LAN Server with custom modifications added in. However, my modifications are nowhere near as intricate as those used on other PWs, as I try to stay within the confines of nwscript and don't use extensions such as NWNX. 

actually im not sure now. Its more then year ago when I tried to find cause and fix it. But it occured in vanilla 1.69. Anyway Im sure where is cause - the cause is indeed in internal spellhook. The script there uses check to prevent casting certain spells while mounted - yet the GetIsMounted check needlessly adds the skin to the caller. (hmm or wasnt it actually reversed? skin probably appeared on enemies using the missile storm spells - makes more sense)

I dont know how The Krit fixed it, he claims he recompiled the spellscripts using his alternative horse include. So he probably changed the function that checks whether is caller mounted.

My own fix is such that I removed horse library completely from internal spellhook and replaced GetIsMounted check with my own code that is checking phenotypes which is much faster (see HorseGetIsMounted in x3_inc_horse)

btw Carcerian you are right skin also appears when player has full inventory, I have the same problem with my own pre 1.69 skin solution and so far don't know how to fix it nicely. I guess I will have to destroy->copy on ground items in inventory until the skin is created in there and then return items back, ugh.
               
               

               


                     Modificata da ShaDoOoW, 31 luglio 2012 - 02:35 .
                     
                  


            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
PC Properties creature skin
« Reply #14 on: July 31, 2012, 03:58:55 pm »


               Well after playing around with my OnPlayerRest and OnClientEnter (and the Pre-Enter) and OnUnEquip events, the behavior has stopped - the PC Properties skin no longer appears in the inventory when you rest. The odd thing is that my scripts are almost identical to what they were before I tried to fix it, so I have no idea what I did. ':blink:'

The only script that is different is my Pre-Enter event (called from the OnClientEnter event). I added this check to it, since I discovered that the script was firing for DMs as if they were a PC:


if (!GetIsPC(oPC) || GetIsDM(oPC))
     return;

However, I can't believe this fixed it...
               
               

               


                     Modificata da Pstemarie, 31 luglio 2012 - 03:03 .