Jump to content


Photo

Theme: Surprise


  • Please log in to reply
34 replies to this topic

#21 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 05 March 2008 - 11:06 PM

Understandeably, there's nothing wrong with using UIScenes in mutators - but if you're just displaying information and not having any interactivity, why not just draw information to the screen?

#22 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 06 March 2008 - 08:23 AM

This is a good point. At the beginning I wanted to close The UIScene when the player presses any key or after a period.
But the "after period" took me a lot of time as UIScene class is not an actor so I had no way to use timer. I tried to use Kismet as you suggest but after 2 hours I gave up as I have no suitable tutorial to understand what to do.
So I implemented my own timer "generic" because it can be used with any object (actor and non actor)

I know I can use HUD and draw on Canvas, next mutators :)

I try to commit on SVN yesterday night but forgot my login and password. I found the mail where you gave passwords this morning, so I will upload files tonight :ph34r:

Edited by xiongmao, 06 March 2008 - 08:32 AM.


#23 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 06 March 2008 - 11:11 AM

I've PMed you the user and password anyway :ph34r:

#24 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 09 March 2008 - 05:21 PM

Hi All,
I have a question on events. Is there a way to get event such as game start and game end. I saw somewhere that we can do this using Kismet. Question is: How can I link those events to mutator class for example ?

#25 knighteyes

knighteyes
  • Members
  • 21 posts

Posted 09 March 2008 - 10:07 PM

I uploaded to svn. Had no time to finish, maybe I'll have time to do something else the next days.

Question: If I have a variable in a gamerules class, do I have to lock it before using it, to avoid deadlock? I wanted to randomly change it when someone does a kill, but the same var was checked every time someone got injured, and the game froze or gave me troubles. After removing the random part (not changing the var during gameplay) the troubles disappeared.

#26 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 10 March 2008 - 09:55 AM

I Check your mut, it looks great !!! :wink_new:

did you try other ways to get your random number ?
- call your method in netDamage
- call directly rand(3)

I use the Rand method the same way as you in my GameRule above, the difference is your extra method and the type const of your random range.

Anyway GJ :D

#27 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 10 March 2008 - 10:08 AM

Hi All,
I have a question on events. Is there a way to get event such as game start and game end. I saw somewhere that we can do this using Kismet. Question is: How can I link those events to mutator class for example ?


Good question. It may or may not be possible. I'll have a look into it when I get the chance. I would have thought they would be accessible through Game Rules.

I uploaded to svn. Had no time to finish, maybe I'll have time to do something else the next days.

Question: If I have a variable in a gamerules class, do I have to lock it before using it, to avoid deadlock? I wanted to randomly change it when someone does a kill, but the same var was checked every time someone got injured, and the game froze or gave me troubles. After removing the random part (not changing the var during gameplay) the troubles disappeared.


Try and finish if you can - there's a week before next mutator week, so you can have until Thursday, when I compile the package into a beta release. I'll be trying to do an extra one or two mutators (Pinata and Take Cover!), but we'll see how far I get with my rather busy workload at the moment.

As far as I'm aware, deadlock like that should not be possible - try using different random number techniques of shifting around some code. I'll look at it when I get a chance, but I can't imagine why you'd be causing a deadlock.

#28 knighteyes

knighteyes
  • Members
  • 21 posts

Posted 10 March 2008 - 01:45 PM

thanks!!
I'll try to make some changes to the code and see what happens.

Thanks for your help, to all of you.

#29 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 10 March 2008 - 06:09 PM

Finished the Take Cover! mutator. I'll add it to subversion tomorrow. Still haven't cracked Pinata, can't find a decent way to spawn things.

class LP_Mutator_TakeCover extends UTMutator;

var class<GameRules> GRClass;

function InitMutator(string Options, out string ErrorMessage)
{
	WorldInfo.Game.AddGameRules(GRClass);

	Super.InitMutator(Options, ErrorMessage);
}

DefaultProperties
{
	GRClass=class'MWSurprise.LP_TakeCover_Rules'
	name="Default__UTMutator_TakeCover"
}

class LP_TakeCover_Rules extends GameRules;

var vector LocationFudge;

function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
{
	//Difficulty in switching, using 'if' instead. Silly.
		if (Killed.Weapon.IsA('UTWeap_Enforcer'))
		{
			GenericProjectileExplode(60, 1600, Killed.Controller);
		}
		else if (Killed.Weapon.IsA('UTWeap_BioRifle_Content'))
		{
			BioProjectileExplode(30, Killed.Controller);
		}
		else if (Killed.Weapon.IsA('UTWeap_ShockRifle'))
		{
			ShockCoreExplode(Killed.Controller);
		}
		else if (Killed.Weapon.IsA('UTWeap_LinkGun'))
		{
			LinkProjectileExplode(50, Killed.Controller);
		}
		else if (Killed.Weapon.IsA('UTWeap_Stinger'))
		{
			StingerProjectileExplode(50, Killed.Controller);
		}
		else if (Killed.Weapon.IsA('UTWeap_FlakCannon'))
		{
			GenericProjectileExplode(80, 800, Killed.Controller);
		}
		else if (Killed.Weapon.IsA('UTWeap_RocketLauncher'))
		{
			RocketProjectileExplode(25, Killed.Controller);
		}
		else if (Killed.Weapon.IsA('UTWeap_SniperRifle'))
		{
			GenericProjectileExplode(30, 2400, Killed.Controller);
		}
		else if (Killed.Weapon.IsA('UTWeap_AVRIL_Content'))
		{
			AVRILProjectileExplode(20, Killed.Controller);
		}
		else if (Killed.Weapon.IsA('UTWeap_InstagibRifle'))
		{
			ShockCoreExplode(Killed.Controller);
		}
		else if (Killed.Weapon.IsA('UTWeap_Redeemer_Content'))
		{
			RedeemerProjectileExplode(3, Killed.Controller);
		}
		else
		{
			//Do nothing!
		}
		
	if ( (NextGameRules != None) && NextGameRules.PreventDeath(Killed,Killer, damageType,HitLocation) )
	{
		return true;
	}
	return false;
}

function BioProjectileExplode(Int Number, Controller Killed)
{
	local UTProj_BioGlobling SpawnedProjectile;
	local int i;
	
	for (i = 0; i < number; i++)
	{
		SpawnedProjectile = Spawn(class'UTGameContent.UTProj_BioGlobling',,, (Killed.Pawn.Location + LocationFudge));
		
		if (SpawnedProjectile != None)
		{
			SpawnedProjectile.InstigatorController = Killed;
			SpawnedProjectile.Velocity = (Normal(SpawnedProjectile.Velocity) * SpawnedProjectile.Speed * (0.4 + 40)/(1.35*40));
			SpawnedProjectile.RestTime = SpawnedProjectile.default.RestTime + 2;
			SpawnedProjectile.gotostate('Flying');
		}
	}
	`log("BioSplode");
}

function GenericProjectileExplode(Int Number, Int Speed, Controller Killed)
{
	local UTProj_FlakShard SpawnedProjectile;
	local int i;
	
	for (i = 0; i < number; i++)
	{
		SpawnedProjectile = Spawn(class'UTGame.UTProj_FlakShard',,, (Killed.Pawn.Location + LocationFudge));
		
		if (SpawnedProjectile != None)
		{
			SpawnedProjectile.InstigatorController = Killed;
			SpawnedProjectile.Init(vector(RotRand(true)));
			SpawnedProjectile.Speed = 100 + Rand(Speed);
		}
	}
	`log("SplodeSplode");
}

function LinkProjectileExplode(Int Number, Controller Killed)
{
	local UTProj_LinkPowerPlasma SpawnedProjectile;
	local int i;
	
	for (i = 0; i < number; i++)
	{
		SpawnedProjectile = Spawn(class'UTGame.UTProj_LinkPowerPlasma',,, (Killed.Pawn.Location + LocationFudge));
		
		if (SpawnedProjectile != None)
		{
			SpawnedProjectile.InstigatorController = Killed;
			SpawnedProjectile.Init(vector(RotRand(true)));
			SpawnedProjectile.Speed = 100 + Rand(800);
		}
	}
	`log("LinkSplode");
}

function RocketProjectileExplode(Int Number, Controller Killed)
{
	local UTProj_Rocket SpawnedProjectile;
	local int i;
	
	for (i = 0; i < number; i++)
	{
		SpawnedProjectile = Spawn(class'UTGame.UTProj_Rocket',,, (Killed.Pawn.Location + LocationFudge));
		
		if (SpawnedProjectile != None)
		{
	 		SpawnedProjectile.InstigatorController = Killed;
			SpawnedProjectile.Speed = 200 + Rand(800);
			SpawnedProjectile.Init(vector(RotRand(true)));
		}
	}
	`log("RocketSplode");
}

function ShockCoreExplode(Controller Killed)
{
	local UTProj_ShockBall SpawnedProjectile;
	
	SpawnedProjectile = Spawn(class'UTGame.UTProj_ShockBall',,, (Killed.Pawn.Location + LocationFudge));
	
	if (SpawnedProjectile != None)
	{
		SpawnedProjectile.InstigatorController = Killed;
		SpawnedProjectile.ComboExplosion();
	}
	`log("ShockSplode");
}

function StingerProjectileExplode(Int Number, Controller Killed)
{
	local UTProj_StingerShard SpawnedProjectile;
	local int i;
	
	for (i = 0; i < number; i++)
	{
		SpawnedProjectile = Spawn(class'UTGame.UTProj_StingerShard',,, (Killed.Pawn.Location + LocationFudge));
		
		if (SpawnedProjectile != None)
		{
	 		SpawnedProjectile.InstigatorController = Killed;
			SpawnedProjectile.Init(vector(RotRand(true)));
			SpawnedProjectile.Speed = 100 + Rand(800);
		}
	}
	`log("StingerSplode");
}

function AVRILProjectileExplode(Int Number, Controller Killed)
{
	local UTProj_AVRILRocket SpawnedProjectile;
	local int i;
	
	for (i = 0; i < number; i++)
	{
		SpawnedProjectile = Spawn(class'UTGameContent.UTProj_AVRILRocket',,, (Killed.Pawn.Location + LocationFudge));
		
		if (SpawnedProjectile != None)
		{
	 		SpawnedProjectile.InstigatorController = Killed;
			SpawnedProjectile.Speed = 200 + Rand(800);
			SpawnedProjectile.Init(vector(RotRand(true)));
		}
	}
	`log("AVRILSplode");
}

function RedeemerProjectileExplode(Int Number, Controller Killed)
{
	local UTProj_Redeemer SpawnedProjectile;
	local int i;
	
	for (i = 0; i < number; i++)
	{
		SpawnedProjectile = Spawn(class'UTGameContent.UTProj_Redeemer',,, (Killed.Pawn.Location + LocationFudge));
		
		if (SpawnedProjectile != None)
		{
	 		SpawnedProjectile.InstigatorController = Killed;
			SpawnedProjectile.Speed = 200 + Rand(800);
			SpawnedProjectile.Init(vector(RotRand(true)));
		}
	}
	`log("DeemerSplode");
}

DefaultProperties
{
	LocationFudge = (X = 0, Y = 0, Z = 100)
}

Edited by ambershee, 10 March 2008 - 06:09 PM.


#30 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 11 March 2008 - 11:07 AM

looks interesting !!!
Not sure to understand what it does. According to the weapon the killed player owns, it creates a new projectile with a random rotation ?

afraid of redeemer (nuclear chain reaction :sad: )

#31 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 11 March 2008 - 12:51 PM

Yeah, pretty much - the player that is killed will explode in a shower of projectiles depending on what weapon they are carrying. I played it in Warfare and found it to be quite enjoyable - the result was a lot less Manta pancaking, because running over players would result in taking damage - especially if they were carrying bigger weapons :sad:

#32 knighteyes

knighteyes
  • Members
  • 21 posts

Posted 11 March 2008 - 11:55 PM

Apparently the solution was:

- the random function updates the variable which tells the selected regime
- the function which switchs the selected regime doesn't read the variable anymore, it receives its value as a parameter

Still has to do some coding with more regimes and I'd like to show on screen the current regime (no idea how to do this, will have to read some code).

cheers

#33 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 12 March 2008 - 12:07 AM

To show message on screen, you can use PlayerController.clientMessage
or use localMessage on HUD :p

Edited by xiongmao, 12 March 2008 - 08:51 AM.


#34 THE_SPELUNKERmw

THE_SPELUNKERmw
  • Guests
  • 4 posts

Posted 02 April 2008 - 04:18 AM

It looks like I need to add my own suprise mutator!

This gives you a random powerup whenever you get a kill or respawn! I don't know how, but it is somehow self-balancing! I even included the invincibility powerup and yet it's still self-balanced! How!?

since it's random, it fits in suprise week! It could also fit in upgrade since it gives you powerups to enhance your player.

it is here: http://www.savefile.com/files/1472467

code here:

/////////////////////////////////////////////////////
// Mutator: Random Powerup gained upon spawning and getting kills
// Assembled By: THE SPELUNKER
/////////////////////////////////////////////////////
class TWMut_RevengeSpree extends UTMutator;

var class<GameRules> GRClass;

function bool MutatorIsAllowed()
{
	return (WorldInfo.NetMode == NM_Standalone);
}

function InitMutator(string Options, out string ErrorMessage)
{	
	WorldInfo.Game.AddGameRules(GRClass);

	Super.InitMutator(Options, ErrorMessage);
}

function ModifyPlayer(Pawn Other)
{
	local UTPawn P;
	local int PN;
	
	PN = Rand(5);
	
	P = UTPawn(Other);
	
	if ((P != None))
	{
		switch(PN)
		{
			case 1:		P.CreateInventory(Class'UTInvulnerability'); break;
			case 2:		P.CreateInventory(Class'UTInvisibility'); break;
			case 3:		P.CreateInventory(Class'UTBerserk'); break;
			case 4:		P.CreateInventory(Class'UTUDamage'); break;
		}
	}
	
	Super.ModifyPlayer(Other);
}

defaultproperties
{
	GRClass=Class'TechradWeapons.TWGR_RevengeRules'
	GroupNames(0)="POWERUPS"
}

////////////////////////
// The actual Game Rules
////////////////////////
class TWGR_RevengeRules extends GameRules;

function ScoreKill( Controller Killer, Controller Killed)
{
	local UTPawn P;
	local int PN;
	
	PN = Rand(5);
	
	P = UTPawn(Killer.Pawn);

	if (( PlayerController(Killer) != None) && (P != None) && (Killer.PlayerReplicationInfo != None))
	{
		switch(PN)
		{
			case 1:		P.CreateInventory(Class'UTInvulnerability'); break;
			case 2:		P.CreateInventory(Class'UTInvisibility'); break;
			case 3:		P.CreateInventory(Class'UTBerserk'); break;
			case 4:		P.CreateInventory(Class'UTUDamage'); break;
		}
	}
	
	Super.ScoreKill( Killer, Killed);
}

defaultproperties
{
}

This was the first mutator that I made without reading a tutorial. In fact, I actually used Ambershee's tutorials on moddb.com to start! I can map from the utIII collector's edition videos! HOOOOOORRRAAAAAAAAAYYYYY! :p :) :D

Edited by THE_SPELUNKERmw, 02 April 2008 - 04:21 AM.


#35 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 02 April 2008 - 08:24 AM

I'll chalk it up to Upgrade, since Surprise finished a while back :p




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users