Mutator idea: Pawn Attribute Randomizer

Search, find and discuss about Mutators!
Post Reply
User avatar
heliumcat
Skilled
Posts: 185
Joined: Mon Apr 01, 2013 11:47 am

Mutator idea: Pawn Attribute Randomizer

Post by heliumcat »

I've been thinking of this after playing around with the UTC classes mod, would it be interesting and wise to create a mutator that scans all the pawns basic attributes like groundspeed, airspeed, jumpz, health and adds or removes a certain percentage from it when the pawn is spawned? (and make it compatible with relics, runez, uwar pickups and so on...)

Would this be an interesting idea to other people than me?

Would this be easy to code?
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Mutator idea: Pawn Attribute Randomizer

Post by Higor »

This mutator will make monsters either thinner or fatter.
Fat monsters are stronger and slower.
Thin monsters are faster and more skilled.

Code: Select all

class PawnRandomizer expands Mutator;

function bool IsRelevant(Actor Other, out byte bSuperRelevant)
{
	local bool bResult;

	// allow mutators to remove actors
	bResult = Super.IsRelevant(Other,bSuperRelevant);

	if ( bResult && (ScriptedPawn(Other) != none) )
		ModifyMonster( ScriptedPawn(Other));
	return bResult;
}

Code: Select all

function ModifyMonster( scriptedPawn Other)
{
	local float factor, fTemp;

	factor = RandRange(0.6,1.5); //Between 0.6 and 1.5

	fTemp = Other.Fatness;
	fTemp *= factor;
	Other.Fatness = Clamp(fTemp,0,255); //Safe way of handling fatness
	Other.GroundSpeed /= factor;
	Other.AirSpeed /= factor;
	Other.WaterSpeed /= factor;
	Other.Health *= sqrt(factor);
	if ( factor < 0 )
		Other.Skill /= factor;
}
User avatar
heliumcat
Skilled
Posts: 185
Joined: Mon Apr 01, 2013 11:47 am

Re: Mutator idea: Pawn Attribute Randomizer

Post by heliumcat »

Higor wrote:This mutator will make monsters either thinner or fatter.
Fat monsters are stronger and slower.
Thin monsters are faster and more skilled.

Code: Select all

class PawnRandomizer expands Mutator;

function bool IsRelevant(Actor Other, out byte bSuperRelevant)
{
	local bool bResult;

	// allow mutators to remove actors
	bResult = Super.IsRelevant(Other,bSuperRelevant);

	if ( bResult && (ScriptedPawn(Other) != none) )
		ModifyMonster( ScriptedPawn(Other));
	return bResult;
}

Code: Select all

function ModifyMonster( scriptedPawn Other)
{
	local float factor, fTemp;

	factor = RandRange(0.6,1.5); //Between 0.6 and 1.5

	fTemp = Other.Fatness;
	fTemp *= factor;
	Other.Fatness = Clamp(fTemp,0,255); //Safe way of handling fatness
	Other.GroundSpeed /= factor;
	Other.AirSpeed /= factor;
	Other.WaterSpeed /= factor;
	Other.Health *= sqrt(factor);
	if ( factor < 0 )
		Other.Skill /= factor;
}
Yes!!!
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: Mutator idea: Pawn Attribute Randomizer

Post by MrLoathsome »

Very nice mutator and code example Higor.

Short and sweet, and considerably more useful than a "Hello World" type of example.
blarg
User avatar
heliumcat
Skilled
Posts: 185
Joined: Mon Apr 01, 2013 11:47 am

Re: Mutator idea: Pawn Attribute Randomizer

Post by heliumcat »

Okay, I'm going to place my version of this mutator here for you all to download.

The code is a bit tweaked to fit my tastes, but the change is extremely minor, just changed some values on it, nothing more, the core essence is still there.

It's got the u, int and readme file in it, so it should run in UT99.

Enjoy!
Attachments
MonsterAttributeRandomizer (heliumcat edit).zip
(1.9 KiB) Downloaded 222 times
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Mutator idea: Pawn Attribute Randomizer

Post by Higor »

Wohoo
User avatar
Dr.Flay
Godlike
Posts: 3347
Joined: Thu Aug 04, 2011 9:26 pm
Personal rank: Chaos Evangelist
Location: Kernow, UK
Contact:

Re: Mutator idea: Pawn Attribute Randomizer

Post by Dr.Flay »

I do like using Loathsomes random monster sizer, but often find it hard to tell if a swarm zombie is a giant or too close !
The physics works nice with small creatures being kicked across the map, so I'll see how this compares.
Post Reply