Aller au contenu

Photo

Spawn scaling script


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
rjshae

rjshae
  • Members
  • 4 509 messages
Here's another little scripting trick. It's handy for randomizing the appearance of creatures spawned for encounters, thereby giving a better illusion of variety. All you do is add the script to your module then set the SpawnScript variable to the name of this script on the creature blueprints where you want this to run.

// ms_spawn_resize
/*
   This script resizes the owner by a small amount. It
  	can be passed as part of a creature spawn script by
  	setting the "SpawnScript" variable to the script name.
*/
// 25apr12 RJH

void main()
{
  float fSize = 0.82 + (0.02 * d8(2)); // 0.88-1.14
  float fX = fSize * ( 0.82 + (0.02 * d8(2)) );
  float fY = fSize * ( 0.82 + (0.02 * d8(2)) );
  float fZ = fSize * ( 0.82 + (0.02 * d8(2)) );
  SetScale( OBJECT_SELF, fX, fY, fZ );
}

One thing I didn't like on SoZ was the cookie-cutter nature of the OM encounters. Adding variety like this may serve to give it a little more realism.

Modifié par rjshae, 20 juin 2012 - 07:13 .


#2
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
Here's mine:

if (GetLocalInt(OBJECT_SELF, "iNoRandomizedScale") == 0) {
float fModFactor = (IntToFloat(Random(15))/100.0 - 0.075) + 1.0;
float fX = GetScale(OBJECT_SELF, SCALE_X) * fModFactor;
float fY = GetScale(OBJECT_SELF, SCALE_Y) * fModFactor;
float fZ = GetScale(OBJECT_SELF, SCALE_Z) * fModFactor;

SetScale(OBJECT_SELF, fX, fY, fZ);
}

I like to resize different creatures for various reasons, like making elite goblins a little bigger than the young mooks, so the mod factor preserves those original values.

I tried to program in a standard deviation once, but it was more trouble than it was worth. Your multiple die rolls, though, handle that pretty well.

#3
rjshae

rjshae
  • Members
  • 4 509 messages
Good point about preserving the original scaling factor. I think I'll roll that one in.

Another possibility for adding encounter variation may be to perform slight color modifications to the armor and/or skin. I.e. modify the RGB colors by a small, random percentage (so that, say, an orange may be given a red or yellow tinge, and either lightened or darkened). I'm not sure if that is possible, but it might be interesting to try.

Modifié par rjshae, 20 juin 2012 - 07:20 .


#4
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 603 messages
Take a look at my campaign spawn script in King's Festival "bb_kingsfestival_sp". It uses functions to randomize height, change armor/clothing, and set skin color tone based on variables on the creature. Useful for walkers and mobs. I'm certain I've posted the script or its functions online somewhere before.

Regards

Modifié par Kaldor Silverwand, 21 juin 2012 - 04:33 .


#5
rjshae

rjshae
  • Members
  • 4 509 messages
Thanks Kaldor.