Author Topic: On Equip script to turn pc into a Lich  (Read 324 times)

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
On Equip script to turn pc into a Lich
« on: April 15, 2011, 03:46:32 pm »


               Hi,
 
Im looking for a script that would turn a pc into a Lich when they equip a certain item. And remove the effect when they unequip the item.

Thanx
               
               

               


                     Modifié par Madasahatter, 15 avril 2011 - 02:58 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
On Equip script to turn pc into a Lich
« Reply #1 on: April 15, 2011, 09:22:30 pm »


               Well I don't think there is a polymorph for a lich so you will have to settle for just looking like one. But you could always add other feats or whatever if you really want to try and make the player become and actual lich.

This is a tag based script example. So you would just make sure that the tag of the item equipped/unequipped matches whatever you name this script:


#include "x2_inc_switches"
void main()
{
    int nEvent = GetUserDefinedItemEventNumber();

    if (nEvent == X2_ITEM_EVENT_EQUIP)
    {
        object oHelm = GetPCItemLastEquipped();
        object oPC = GetPCItemLastEquippedBy();
        int iCurrAppearance = GetAppearanceType(oPC);
        SetLocalInt(oHelm, "CURRNT_APPR", iCurrAppearance);
        SetCreatureAppearanceType(oPC, APPEARANCE_TYPE_LICH);
    }

    if (nEvent == X2_ITEM_EVENT_UNEQUIP)
    {
        object oHelm = GetPCItemLastUnequipped();
        object oPC = GetPCItemLastUnequippedBy();
        int iPrevAppearance = GetLocalInt(oHelm, "CURRNT_APPR");
        SetCreatureAppearanceType(oPC, iPrevAppearance);
    }
}


I named the object that was equipped/unequipped "oHelm" as an example. If you are using another type of item then you can name that something else of course. You might also want to add some visual effects to make the transformation look cooler. This is just the basics.

Hope this gets you heading in the right direction. good luck.
               
               

               


                     Modifié par GhostOfGod, 15 avril 2011 - 08:23 .
                     
                  


            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
On Equip script to turn pc into a Lich
« Reply #2 on: April 16, 2011, 06:34:28 am »


               Thank's exactly what i was looking for '<img'>
               
               

               
            

Legacy_Artistmonk

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
On Equip script to turn pc into a Lich
« Reply #3 on: May 03, 2011, 03:09:01 am »


               This goes where exactly?

Thanks
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
On Equip script to turn pc into a Lich
« Reply #4 on: May 03, 2011, 10:44:36 am »


               It's a tag based script. You don't put it anywhere. It just needs to be in your module. If you have tag based scripting turned on in your module, any time a player acquires, unacquires, equips, unequips, or activates an item, your module will automatically look for and execute a script that is named the same as the tag of that item.
               
               

               
            

Legacy_Artistmonk

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
On Equip script to turn pc into a Lich
« Reply #5 on: May 04, 2011, 04:12:09 pm »


               Thanks.