Rnd Mesh/skins

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Sett

New Member
Jan 14, 2002
55
0
0
Visit site
Any hints on how to spawn a custom projectile with Random skins
and or meshes so each time the proj. is fired it shoots something different. Is this do-able? mind you this is a projectile mod not a
weapon mod.
 

Shiit

Shiit
Dec 19, 2000
168
0
0
That's easy enough. As a matter of fact, I recently had to do this myself. Here's the code I came up with: (this replaces all 4 flakchunk's at random)



PHP:
class BLUTChunk expands UTChunk;

simulated function PostBeginPlay()
{
	local int ChunkType;
	Super.PostBeginPlay();
	ChunkType = Rand(4);
	switch (ChunkType)
	{
		case 0:
			Mesh=LodMesh'Botpack.chunkM'; break;
		case 1:
			Mesh=LodMesh'Botpack.chunk2M'; break;
		case 2:
			Mesh=LodMesh'Botpack.chunk3M'; break;
		case 3:
			Mesh=LodMesh'Botpack.chunk4M'; break;
	}

}

(EDIT) Woo, funky colours!
 
Last edited:

Sett

New Member
Jan 14, 2002
55
0
0
Visit site
Thanks for the help but I'm getting an err on the


PHP:
simulated function PostBeginPlay()

Line. the err is "Missing function Name"

here is my script:
PHP:
//=============================================================================
// CarShell02.
//=============================================================================
class CarShell02 expands Projectile;
(( #exec commmads omited))
simulated function PostBeginPlay()
{
	Local int CarType;    
    Super.PostBeginPlay();
    CarType = Rand(3);
    switch (CarType)
    {
        case 0:
            Mesh=LodMesh'Botpack.Car01'; break;
        case 1:
            Mesh=LodMesh'Botpack.Car02'; break;
        case 2:
            Mesh=LodMesh'Botpack.Car03'; break;
    }
}
auto state Flying
{
	function ProcessTouch (Actor Other, vector HitLocation)
	{
		If ( (Other!=Instigator) && (!Other.IsA('Projectile') || (Other.CollisionRadius > 0)) )
			Explode(HitLocation,Normal(HitLocation-Other.Location));
	}

	function BeginState()
	{
		Velocity = vector(Rotation) * speed;	
	}
}


function Explode(vector HitLocation,vector HitNormal)
{
	PlaySound(ImpactSound, SLOT_Misc, 0.5,,, 0.5+FRand());
	HurtRadius(Damage, 70, MyDamageType, MomentumTransfer, Location );
	
		//Spawn(class'ut_superring2',,, HitLocation+HitNormal*8,rotator(HitNormal));
		Spawn(class'ShockWave',,, HitLocation+HitNormal*8,rotator(HitNormal));

	Destroy();
}
 

Brood_of_Evil

Selene's martyr
Nov 3, 2001
147
0
0
46
Look outside your window!
Visit site
well if you want different skins with the same mesh, you don't have to create 3 different meshes, with a different skin, just do this:

1.Create a texture array, like : var Texture MySkins[3];

2.In default properties, assign a texture to each item in the texture array, like this:

Code:
defaultproperties
{
    MySkins(0)=Texture'Skin1'
    MySkins(1)=Texture'Skin2'
    MySkins(2)=Texture'Skin3'
}

3.In post begin play instead of doing that switch statement simply do this:
Code:
simulated function PostBeginPlay()
{
    Super.PostBeginPlay();

    Skin = MySkins[Rand(3)];
}

4.To make sure this works, delete (or comment), the "#exec MESHMAP SETTEXTURE" in the model you're asigning the skin to.
 

KillerMonk

UScript and VC++ Master Mind
Jan 9, 2002
48
0
0
Utah
www.programmersheaven.com
Upon looking into the Projectile.uc file, I have found that there is no postbeginplay function, of any type. That's your problem right there.

There is, however, in the UTChunk.uc file a function called
postbeginplay. This is it's code
Code:
simulated function PostBeginPlay()
{
	local rotator RandRot;

	if ( Level.NetMode != NM_DedicatedServer )
	{
		if ( !Region.Zone.bWaterZone )
			Trail = Spawn(class'ChunkTrail',self);
	               SetTimer(0.1, true);
	}

	if ( Role == ROLE_Authority )
	{
		RandRot = Rotation;
		RandRot.Pitch += FRand() * 2000 - 1000;
		RandRot.Yaw += FRand() * 2000 - 1000;
		RandRot.Roll += FRand() * 2000 - 1000;
		Velocity = Vector(RandRot) * (Speed + (FRand() * 200 - 100));
		if (Region.zone.bWaterZone)
			Velocity *= 0.65;
	}
	Super.PostBeginPlay();
}
What gun are you making this projectile for? Look into the .uc files that you are extending, and check for functions that may be useful. You can't program with out knowing what you're doing.

What is strange, however, is that UTChunk is a subclass of projectile, and it uses the PostBeginPlay() function. Strange and compeling this is. Why, I don't know, ask someone with more experience.
 

KillerMonk

UScript and VC++ Master Mind
Jan 9, 2002
48
0
0
Utah
www.programmersheaven.com
Ah, the wonders of inheritance. Well, if I said it all wrong, then just tell me I'm stupid and forget all my advice. I'm learning right along side all the newbs, but I'm probably more towards the back of the line than the front.
 

Brood_of_Evil

Selene's martyr
Nov 3, 2001
147
0
0
46
Look outside your window!
Visit site
GRRRRRRRRRR

Well this is funny...cuz I just got DM-Antares reviwed in Sunspire codex....I've been waiting for months to get it reviewed there...but you know what..THEY REVIEWED ANOTHER GODDAMN MAP!!!!! AND THEY CALLED IT DM-ANTARES!!!!!!!! And to make things worse THEY GAVE IT 2 THUMBS DOWN!!!!!! I know it's not my map, but MAN....oh well at least they got the author name wrong, so my rep is saved hahahaha. It seems some other guy made a map and named it dm-antares as well!!
 
Last edited:

Sett

New Member
Jan 14, 2002
55
0
0
Visit site
OK I found out what is wrong .

the Function .... block
had to go after the
auto state flying .... block



the stuggle continues...
:(
 
Sett - congratulations.

Brood - ouch what a drag. I like the flow of Antares, and of course the rocketlauncher trap. But in general the texturing is also great, and stuff you an see outside and in the floors/walls etc is great.

I also don't know what to think about Sunspire; i recently read a review of theirs where they were criticizing the map for having BSP holes in it, but what they were describing was very clearly graphics card shortcomings not BSP. Just to be sure, i downloaded the map, and tested it on my 2 machines. My non-gaming card Matrox G450 fit their description of the map, but on my GeForce2 card the map looked fine with no problems.

So if a reviewer is faulting a map for having bad BSP problems (a serious shortcoming in a finished map) when in fact the problem lies in the reviewer's graphics card it makes me not take what they have to say too seriously. OTOH, maybe their reviewers aren't also mappers? i don't know.