Author Topic: SKIN_Support Issues  (Read 347 times)

Legacy_Psynexus

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
SKIN_Support Issues
« on: March 20, 2011, 10:55:17 am »


               After many attempts I'm not having much luck getting the SKIN_SupportEquipSkin or SKIN_SupportGetSkin functions to work. My question is - what is necessary to get those functions to work properly? I've tried just about everything I know how and can not get my PC to successfully equip a skin of any kind via conversation. 

I have included both x3_mod_def_enter and x3_mod_def_hb in the corresponding module events (running first), and am using a standard nw_ skin. Here is my code for reference: 

Code:
#include "x3_inc_skin" 

void main() 

    object oPC = GetPCSpeaker(); 

    object oSkin = CreateItemOnObject("nw_creitemvamp", oPC); 

    AssignCommand(oPC, SKIN_SupportEquipSkin(oSkin, 0)); 
    SetSubRace(oPC, "Vampire"); 



I've tried several variations of this code, and the most successful I've been is using the SKIN_SupportGetSkin option, which creates a default skin when none is detected, and then adding itemproperties manually. While this works, I'd much rather have a skin loadout on the custom pallete. I appreciate any help on this issue.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
SKIN_Support Issues
« Reply #1 on: March 20, 2011, 11:25:19 am »


               By default in 1.69 < the skin has item level restriction. NPCs can equip a skin with greater ILR than their HD, but not PC. Check the skin level and player's. Player also can't equip unidentified skin.

Both issues are gone with my community patch btw.

Also you should do this:

SetLocalObject(oPC,"oX3_Skin",oSkin);

Otherwise default horse scripts that also inflicted several AI/spell scripts may swap your skin with the 1.69 default one.
               
               

               


                     Modifié par ShaDoOoW, 20 mars 2011 - 11:28 .
                     
                  


            

Legacy_Psynexus

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
SKIN_Support Issues
« Reply #2 on: March 21, 2011, 11:53:30 am »


               I'm positive that will work, thanks a bunch!
               
               

               


                     Modifié par Psynexus, 21 mars 2011 - 11:54 .
                     
                  


            

Legacy_Psynexus

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
SKIN_Support Issues
« Reply #3 on: March 22, 2011, 08:48:30 am »


               Well lo and behold, it didn't work. I made a new skin and verified that the required level was 1 and that it was identified. It attempts to equip itself but then says that the item is lost. Would turning off item level restrictions in the server setting fix it? (also, if I decide I don't want to do that what else can I do to make it work?)
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
SKIN_Support Issues
« Reply #4 on: March 22, 2011, 09:44:00 am »


               Yeah, next issue the skin is lost if you have ELC/ILR on on your server when you log in with it.
               
               

               
            

Legacy_Psynexus

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
SKIN_Support Issues
« Reply #5 on: March 22, 2011, 11:22:11 pm »


               *sigh* Another fail. Again, I thought that would do it.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
SKIN_Support Issues
« Reply #6 on: March 24, 2011, 11:39:56 am »


               Ok I looked deeply.

First your skin is custom right? cos default vampire skin have resref "nw_creitemvam"

Second, it looks that this function is "private" cos there is no definition and it don't work with custom content which is what you trying to do that. This function is apparently meant only for equpping default horse skin that came with 1.69 and so when it found out there is some skin already it destroys the one being equipped.

So, a workaround for it would be to destroy current PC skin OR if PC have skin already instead of changing it, you can add itemproperties from vampire skin into current one.

The first workaround would be done like this:

  object oCurrent = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
     if(GetIsObjectValid(oCurrent))
     {
     DestroyObject(oCurrent);
     }

second would need to loop itemproperties in vampire skin, and copy them (and to create it on the ground instead and destroy immediately) or better manually input them via ItemProperty* functions

But really this function is not for what you are trying to do that.

You can try my function but its been a while since I used it so I cannot guarantee it will not mess with default skin (which is not present in my module at all).

//force equip the skin
void ActionForceEquipItem(object oItem, int
nInventorySlot);

void ActionForceEquipItemContinue(object oItem, int nInventorySlot)
{
object oSelf = OBJECT_SELF;
 if(GetIsObjectValid(oSelf) && GetIsObjectValid(oItem))
 {
  if(!GetIdentified(oItem))
  {
  SetIdentified(oItem,TRUE);
  }
  if(!GetIsInSlot(nInventorySlot,oItem,oSelf))
  {
   if(GetLocalObject(oSelf,"ActionForceEquipItem_"+IntToString(nInventorySlot)) == oItem)
   {
   ClearAllActions();
   ActionEquipItem(oItem,nInventorySlot);
   DelayCommand(0.1,ActionForceEquipItemContinue(oItem,nInventorySlot));
   }
  }
  else
  {
  DeleteLocalInt(oItem,"FIRST_TIME");
  DeleteLocalInt(oItem,"ActionForceEquipItem");
  DeleteLocalObject(oSelf,"ActionForceEquipItem_"+IntToString(nInventorySlot));
  }
 }
}

void ActionForceEquipItem(object oItem, int nInventorySlot)
{
 if(!GetLocalInt(oItem,"ActionForceEquipItem"))
 {
 SetLocalObject(OBJECT_SELF,"ActionForceEquipItem_"+IntToString(nInventorySlot),oItem);
 SetLocalInt(oItem,"ActionForceEquipItem",TRUE);
 ActionForceEquipItemContinue(oItem,nInventorySlot);
 }
}


               
               

               
            

Legacy_Psynexus

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
SKIN_Support Issues
« Reply #7 on: March 24, 2011, 12:02:40 pm »


               Got it! Sure enough, you have to destroy the current skin before you can attempt to equip another. I'm sure I'll be able to do do whatever I want from here. Thanks for putting forth the effort, if you want to see the end result feel free to visit my project link and try it out for yourself. '<img'>

http://social.biowar...m/project/4141/