Author Topic: Creating random appearances  (Read 327 times)

Legacy_Nebril2

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Creating random appearances
« on: November 11, 2014, 04:39:16 pm »


               

Hi all!


 


 


 


I use to had a module months ago where every created npc character had a random appearance. I mean i created a script where when they spawn they get a random head, skin color, phenotype etc. So there was no identical people. 


 


But that module got deleted by a problem in my pc and all my scripts. Now im trying to start over and i cant remember how i did it!


 


I cant find a way to change with a script the appearance (head skin color etc).


 


Maybe i had installed a .hak or something that allowed me to do it adding functions to scripts, but now i dont remember....


 


Can you help me? 



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Creating random appearances
« Reply #1 on: November 11, 2014, 05:15:31 pm »


               

The essential OnSpawn code will look something like this:



      SetCreatureBodyPart(CREATURE_PART_HEAD, nHead, oNPC);
      SetColor(oNPC, COLOR_CHANNEL_SKIN,     nSkin);
      SetColor(oNPC, COLOR_CHANNEL_HAIR,     nHair);
      SetColor(oNPC, COLOR_CHANNEL_TATTOO_1, nTatoo1);
      SetColor(oNPC, COLOR_CHANNEL_TATTOO_2, nTatoo2);

where the integers nHead, nSkin etc are values chosen at random from a list.


 


For example, you might choose from the following colours:


 


const string SKIN_COLOR    = "000 001 002 004 005 008 009 012";
const string HAIR_COLOR    = "000 004 008 012 020 116 124";

 


Unfortunately, there is an engine bug which can spawn NPCs with no head or other invisible parts. This can be minimised by


 


  1. Choosing a random NPC template with the desired clothing (rather than equipping random clothing).

  2.    
  3. Actioning the NPC to jump to an empty area, then immediately jump back.

I imagine you can tint the clothing randomly, too, but I haven't tested that.



               
               

               
            

Legacy_Nebril2

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Creating random appearances
« Reply #2 on: November 11, 2014, 05:24:29 pm »


               

Ohhh right... that is. Thanks man....


 


 


 


The problem is that for some reason i don have the "setcreaturebodypart" on my functions list so i cant compile... what im missing here? i have diamond edition, with both expansions of course... 



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Creating random appearances
« Reply #3 on: November 11, 2014, 05:25:55 pm »


               

look up that function in the lexicon and investigate which include you need for it.



               
               

               
            

Legacy_Nebril2

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Creating random appearances
« Reply #4 on: November 11, 2014, 05:40:21 pm »


               

Well cant find it in lexicon.


 


Im missing a lot of functions it seems. reinstalled and nothing. 


 


Im missing something big here. Game version 1.69.



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Creating random appearances
« Reply #5 on: November 11, 2014, 05:45:14 pm »


               

hmm if it is a standard function (requires no include) then you should patch your game again.



               
               

               
            

Legacy_Nebril2

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Creating random appearances
« Reply #6 on: November 11, 2014, 10:05:56 pm »


               

Done. Working. 


 


Thanks guys '<img'>