Author Topic: Custom Creature Appearance Change on PC  (Read 359 times)

Legacy_PLUSH HYENA of DOOM

  • Hero Member
  • *****
  • Posts: 995
  • Karma: +0/-0
Custom Creature Appearance Change on PC
« on: August 12, 2014, 02:09:36 am »


               

Sorry if this has been covered on these forums before - can't find it if it has... nor can I find anything in the Lexicon, etc, possibly by means of looking in the wrong places...


 


I want to create a "simple" script - which blatantly isn't simple 'cause I've failed abysmally to do it thus far...


So probably I need a hideously complicated script...


 


I have a PC character I wish to use in a Module. The character has more than one aspect (in other words, she changes form), currently depicted by two completely new custom PHoD Weirdo Creature models. They're both identical in the 2da other than their names, so there shouldn't be any problems with movement speeds altering or anything.


 


I want an item which can go in the PC's inventory with an "OnActivated" script which changes the PC appearance from one Creature model to the other and vice versa. Or two items, one to change to each model is fine.


 


The hideous, disfiguring, flea-encrusted problem is that whilst all the BioWare Creatures are listed in a big pile in the Constants, there doesn't appear to be any scope for hitting UserDefined Creatures with bricks.


 


So, is it possible to have a PC who morphs between two Custom models every time she hits herself with a brick, and if it is... HOW?!?!


I was kicking this round for a week and got nowhere. This is thus a pathetic, last ditch "can somebody with blistering insight do this for me" sort of plea.


 


I'm currently hellishly busy being savaged by huge extinct superpredators, so here is a vast pile of thanks in advance for any assistance anyone can give. I probably won't be around in the next week, so please forgive any lack of instant response. I will be very grateful, just as soon as I'm here again.


 


Thank you,


The Dribbling Hyena Lunatic



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Custom Creature Appearance Change on PC
« Reply #1 on: August 12, 2014, 06:47:44 am »


               

The BioWare constants are just 2da row numbers.  If you know the row number, you do not need the constant.



               
               

               
            

Legacy_Verilazic

  • Sr. Member
  • ****
  • Posts: 263
  • Karma: +0/-0
Custom Creature Appearance Change on PC
« Reply #2 on: August 12, 2014, 05:39:30 pm »


               

Try a different shaped brick.


 


But yeah WhiZard has it. One potential shortcut would be to use the constant for a non-user-defined creature, and then increment it the number of rows between the 2da entries.



               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Custom Creature Appearance Change on PC
« Reply #3 on: August 12, 2014, 09:41:00 pm »


               

Some questions to clarify.


 


Will the PC have a third default appearance as well or will they just permanently have one of the 2 custom appearances after the first use?


 


If the player also has a default (3rd) appearance do you want to cycle through all 3 when they use the item? IE the third use changes them back to the way they are supposed to look?



               
               

               
            

Legacy_PLUSH HYENA of DOOM

  • Hero Member
  • *****
  • Posts: 995
  • Karma: +0/-0
Custom Creature Appearance Change on PC
« Reply #4 on: August 12, 2014, 10:31:40 pm »


               

Two custom models only... one of which is already present, even BEFORE first use.


 


Thanks.



               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Custom Creature Appearance Change on PC
« Reply #5 on: August 13, 2014, 09:41:23 am »


               

The script itself could be something as simple as:



#include "x2_inc_switches"
void main()
{
    int iEvent = GetUserDefinedItemEventNumber();
    if (iEvent != X2_ITEM_EVENT_ACTIVATE) return;

    object oPC = GetItemActivator();
    int iAppearance = GetAppearanceType(oPC);

    if (iAppearance == 1)//2da appearance row number
    {
        SetCreatureAppearanceType(oPC, 2);//2da appearance row number
    }

    else
    {
        SetCreatureAppearanceType(oPC, 1);//2da appearance row number
    }

    FloatingTextStringOnCreature("You hit yourself with a brick...", oPC);
}

But as WhiZard pointed out you would need to look in whatever appearances 2da you are using for said custom appearances and use those row numbers instead where I have put the numbers 1 and 2. Or if as you said they already have one of these appearances before they even use this item then you could look into the script that gives them the custom appearance and see if there is a number or a constant. If there is a constant there might also be an additional #include at the top of the script.



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Custom Creature Appearance Change on PC
« Reply #6 on: August 13, 2014, 12:49:11 pm »


               You can make your own constants as shown below:
 
const int APPEARANCE_TYPE_FOO     = 9001;   // Use your 2da line numbers instead of 9001 and 9002
const int APPEARANCE_TYPE_BAR     = 9002;

void main()
  {
    // do stuff like GhostOfGod said to toggle appearance from Foo to Bar
  }
Doesn't make a jot of difference, simply makes the code easier to read.

You might conceivably want to SetFootstepType, SetPortraitResref etc
               
               

               
            

Legacy_PLUSH HYENA of DOOM

  • Hero Member
  • *****
  • Posts: 995
  • Karma: +0/-0
Custom Creature Appearance Change on PC
« Reply #7 on: August 13, 2014, 08:52:38 pm »


               

Just thought I'd check in whilst dashing past...


 


Huge, rampaging, Gojira-sized thanks for that script, GhostOfGod. I'm going to use that as the basis for the Goddess Kali to shift between her aspects, since a single Item is best for that.


 


But eerily immense thanks also WhiZard and Verilazic, for revealing that shockingly simple truth about Constants... It just never even occurred to me to try putting "DIRE_WOLF+2643" or such like things. But it works and will be immediately used henceforth in place of the rather more rubbish method I've been using for NPCs who suddenly mutate hideously into PHoD Weirdo Creatures.


 


Thanks also, Proleric, for that little pointer on how to make the script code look more seethingly amusing... though I'm not sure how good Kali's sense of humour is...


 


You may all consider yourselves in receipt of a freshly killed Gnu, with only minor mangling from Hyenaesque teeth. GhostOfGod gets a free, slightly mushed Zebra's head too! No, honestly, there's no greater gift a Hyena can give...