
Thanks enough for everything ! =)
class UDNProj_Champi_Platform extends UTProjectile; simulated function PostBeginPlay() { Super.PostBeginPlay(); //SetTimer(10); //Grenade begins unarmed RandSpin(100000); } /* simulated event Bump(Actor Other, PrimitiveComponent OtherComp, Vector HitNormal) { local rotator myRot; SetPhysics(PHYS_None); MomentumTransfer = 50000; if ( Champi(Other) == none || Debris(Other) == none ) { if (HitNormal.Z < -0.3) { //Will Explode } else if (HitNormal.X < -0.5) { //Will Explode } else if (HitNormal.X > 0.5) { //Will Explode } else if (HitNormal.Z < 0.5) { myRot = rotator(HitNormal); myRot.Pitch -= 16384; SetRotation(myRot); SpawnChampi_Wall(Other, vect(0,0,0)); } else if (HitNormal.X < 0.5) { //myRot.Pitch = (HitNormal.X * 32768/PI *-0.5); SetRotation(rotator(HitNormal)); SpawnChampi_Ground(Other, vect(0,0,0)); } else if ( Champi(Other) != none || Debris(Other) == none) { //Will Explode } } Explode(Location, vect(0,0,1)); } */ simulated event HitWall(vector HitNormal, Actor Wall, PrimitiveComponent WallComp) { local rotator myRot; SetPhysics(PHYS_None); MomentumTransfer = 50000; if (HitNormal.Z < -0.5) { //Will Explode } else if (HitNormal.Z < 0.75) { myRot = rotator(HitNormal); myRot.Pitch /= 3; SetRotation(myRot); SpawnChampi_Wall(Wall, vect(0,0,0)); } else if (HitNormal.X < -0.5) { //Will Explode } else if (HitNormal.X > 0.5) { //Will Explode } else if (HitNormal.X < 0.5) { if (HitNormal.X < 0) { myRot = rotator(-HitNormal); myRot.Pitch += 16384; } else if (HitNormal.X >= 0) { myRot = rotator(HitNormal); myRot.Pitch -= 16384; } SetRotation(myRot); SpawnChampi_Ground(Wall, vect(0,0,0)); } else { //will explode } self.Destroy(); //Explode(Location, vect(0,0,1)); } simulated function SpawnChampi_Wall(Actor Wall, vector HitNormal) { local Actor Champi_Wall; Champi_Wall = Spawn(class'UDNChampi_Platform_Wall'); Champi_Wall.SetBase(Wall); } simulated function SpawnChampi_Ground(Actor Wall, vector HitNormal) { local Actor Champi_Ground; Champi_Ground = Spawn(class'UDNChampi_Platform_Ground'); Champi_Ground.SetBase(Wall); } /* bBlockedByInstigator = true; if ( WorldInfo.NetMode != NM_DedicatedServer ) { PlaySound(ImpactSound, true); } // check to make sure we didn't hit a pawn if ( Pawn(Wall) == none ) { Velocity = 0.75*(( Velocity dot HitNormal ) * HitNormal * -2.0 + Velocity); // Reflect off Wall w/damping Speed = VSize(Velocity); if (Velocity.Z > 400) { Velocity.Z = 0.5 * (400 + Velocity.Z); } // If we hit a pawn or we are moving too slowly, explod if ( Speed < 20 || Pawn(Wall) != none ) { ImpactedActor = Wall; SetPhysics(PHYS_None); } } else if ( Wall != Instigator ) // Hit a different pawn, just explode { Explode(Location, HitNormal); } */ simulated function PhysicsVolumeChange( PhysicsVolume NewVolume ) { if ( WaterVolume(NewVolume) != none ) { self.Destroy(); //Explode(Location, vect(0,0,1)); } Super.PhysicsVolumeChange(NewVolume); } DefaultProperties { ProjFlightTemplate=ParticleSystem'WP_RocketLauncher.Effects.P_WP_RocketLauncher_Smoke_Trail' ProjExplosionTemplate=ParticleSystem'WP_RocketLauncher.Effects.P_WP_RocketLauncher_RocketExplosion' ExplosionLightClass=class'UTGame.UTRocketExplosionLight' Speed=500.0 MaxSpeed=500.0 Damage=26.0 DamageRadius=220.0 MomentumTransfer=50000 MyDamageType=class'UTDmgType_Grenade' LifeSpan=3.0 ExplosionSound=SoundCue'A_Weapon_RocketLauncher.Cue.A_Weapon_RL_Impact_Cue' ExplosionDecal=MaterialInstanceTimeVarying'WP_RocketLauncher.Decals.MITV_WP_RocketLauncher_Impact_Decal01' DecalWidth=128.0 DecalHeight=128.0 bCollideWorld=true bBounce=false TossZ=+10.0 Physics=PHYS_Falling CheckRadius=36.0 ImpactSound=SoundCue'A_Weapon_RocketLauncher.Cue.A_Weapon_RL_GrenadeFloor_Cue' bNetTemporary=False bWaitForEffects=false CustomGravityScaling=0.5 }
//near top of class var projectile ThisIsAGlobalVar;
function spawnDecal(vector hitLoc){ local MaterialInstanceTimeVarying MITV_Decal; MITV_Decal = new(self) class'MaterialInstanceTimeVarying'; //does not have to be a time varying, could be any kind of material interface MITV_Decal.SetParent( MaterialInstanceTimeVarying'yourMITV' ); WorldInfo.MyDecalManager.SpawnDecal( MITV_Decal, hitLoc,//Location, rot(-16384,0,0), randRange(384,512),//ImpactEffect.DecalWidth, randRange(384,512),//ImpactEffect.DecalHeight, 1000.0, false, RandRange(0, 360) ); //material instance time varying specific MITV_Decal.SetScalarStartTime( 'DissolveAmount', RandRange(7, 12) ); }
class UDNProj_Champi_Platform extends UTProjectile; simulated function PostBeginPlay() { Super.PostBeginPlay(); //SetTimer(10); //Grenade begins unarmed RandSpin(100000); } /* simulated event Bump(Actor Other, PrimitiveComponent OtherComp, Vector HitNormal) { local rotator myRot; SetPhysics(PHYS_None); MomentumTransfer = 50000; if ( Champi(Other) == none || Debris(Other) == none ) { if (HitNormal.Z < -0.3) { //Will Explode } else if (HitNormal.X < -0.5) { //Will Explode } else if (HitNormal.X > 0.5) { //Will Explode } else if (HitNormal.Z < 0.5) { myRot = rotator(HitNormal); myRot.Pitch -= 16384; SetRotation(myRot); SpawnChampi_Wall(Other, vect(0,0,0)); } else if (HitNormal.X < 0.5) { //myRot.Pitch = (HitNormal.X * 32768/PI *-0.5); SetRotation(rotator(HitNormal)); SpawnChampi_Ground(Other, vect(0,0,0)); } else if ( Champi(Other) != none || Debris(Other) == none) { //Will Explode } } Explode(Location, vect(0,0,1)); } */ simulated event HitWall(vector HitNormal, Actor Wall, PrimitiveComponent WallComp) { local rotator myRot; SetPhysics(PHYS_None); MomentumTransfer = 50000; if (HitNormal.Z < -0.5) { //Will Explode } else if (HitNormal.Z < 0.75) { myRot = rotator(HitNormal); myRot.Pitch /= 3; SetRotation(myRot); SpawnChampi_Wall(Wall, vect(0,0,0)); } else if (HitNormal.X < -0.5) { //Will Explode } else if (HitNormal.X > 0.5) { //Will Explode } else if (HitNormal.X < 0.5) { if (HitNormal.X < 0) { myRot = rotator(-HitNormal); myRot.Pitch += 16384; } else if (HitNormal.X >= 0) { myRot = rotator(HitNormal); myRot.Pitch -= 16384; } SetRotation(myRot); SpawnChampi_Ground(Wall, vect(0,0,0)); } else { //will explode } self.Destroy(); //Explode(Location, vect(0,0,1)); } simulated function SpawnChampi_Wall(Actor Wall, vector HitNormal) { local Actor Champi_Wall; Champi_Wall = Spawn(class'UDNChampi_Platform_Wall'); Champi_Wall.SetBase(Wall); } simulated function SpawnChampi_Ground(Actor Wall, vector HitNormal) { local Actor Champi_Ground; Champi_Ground = Spawn(class'UDNChampi_Platform_Ground'); Champi_Ground.SetBase(Wall); } /* bBlockedByInstigator = true; if ( WorldInfo.NetMode != NM_DedicatedServer ) { PlaySound(ImpactSound, true); } // check to make sure we didn't hit a pawn if ( Pawn(Wall) == none ) { Velocity = 0.75*(( Velocity dot HitNormal ) * HitNormal * -2.0 + Velocity); // Reflect off Wall w/damping Speed = VSize(Velocity); if (Velocity.Z > 400) { Velocity.Z = 0.5 * (400 + Velocity.Z); } // If we hit a pawn or we are moving too slowly, explod if ( Speed < 20 || Pawn(Wall) != none ) { ImpactedActor = Wall; SetPhysics(PHYS_None); } } else if ( Wall != Instigator ) // Hit a different pawn, just explode { Explode(Location, HitNormal); } */ simulated function PhysicsVolumeChange( PhysicsVolume NewVolume ) { if ( WaterVolume(NewVolume) != none ) { self.Destroy(); //Explode(Location, vect(0,0,1)); } Super.PhysicsVolumeChange(NewVolume); } DefaultProperties { ProjFlightTemplate=ParticleSystem'WP_RocketLauncher.Effects.P_WP_RocketLauncher_Smoke_Trail' ProjExplosionTemplate=ParticleSystem'WP_RocketLauncher.Effects.P_WP_RocketLauncher_RocketExplosion' ExplosionLightClass=class'UTGame.UTRocketExplosionLight' Speed=500.0 MaxSpeed=500.0 Damage=26.0 DamageRadius=220.0 MomentumTransfer=50000 MyDamageType=class'UTDmgType_Grenade' LifeSpan=3.0 ExplosionSound=SoundCue'A_Weapon_RocketLauncher.Cue.A_Weapon_RL_Impact_Cue' ExplosionDecal=MaterialInstanceTimeVarying'WP_RocketLauncher.Decals.MITV_WP_RocketLauncher_Impact_Decal01' DecalWidth=128.0 DecalHeight=128.0 bCollideWorld=true bBounce=false TossZ=+10.0 Physics=PHYS_Falling CheckRadius=36.0 ImpactSound=SoundCue'A_Weapon_RocketLauncher.Cue.A_Weapon_RL_GrenadeFloor_Cue' bNetTemporary=False bWaitForEffects=false CustomGravityScaling=0.5 }
} function YourProjectileObject throwTracer() { //pc is ref to your controller class //see my other tutorials on giving //this class a ref to your pc using //post begin play pawnRot = Vector(pc.pawn.Rotation); throwDir = pawnRot;// * 1000; throwDir.z *= 3; spawnLoc = pc.pawn.Location + pawnRot * 64; spawnLoc.z += 64; //spawn p = spawn(Class'YourProjectileObject',,, spawnLoc, rot(0, 0, 0) ); //init //p.InitializeProjectile(pc, throwDir); //implementation dependent return p; }
class UDNWeap_Champi_Platform extends UDNWeapon; defaultproperties { WeaponFireTypes(0)=EWFT_Projectile WeaponProjectiles(0)=class'UDNProj_Champi_Platform' FireOffset=(X=16,Y=10) CurrentRating=+0.75 bInstantHit=false bSplashJump=false bRecommendSplashDamage=false bSniping=false bCanThrow=false AmmoCount=1 LockerAmmoCount=1 MaxAmmoCount=1 InventoryGroup=1 }
class UDNWeapon extends UTWeapon; var UDNPlayerController pc; var vector throwDir; var vector pawnRot; var vector spawnLoc; var UDNProj_Pathway p; //============Display Path ============ var YourProjectilePathNode pathNodes[40]; var UDNProj_Pathway tracer; var int curPathNodeCount; //================================= var int v; var vector vc; var YourProjectilePathNode pnode; simulated function PostBeginPlay() { //~~~~~~~~~~~~~~~~~~~~~~~~ super.PostBeginPlay(); //~~~~~~~~~~~~~~~~~~~~~~~~ pc = UDNGameInfo(WorldInfo.Game).CurrentPlayer; createNodesRunOnceEntireGame(); } //============ Draw Path =============== //================= //Memory Management //================= //Create Once For Entire Life of this Weapon function createNodesRunOnceEntireGame() { for (v = 0; v < ArrayCount(pathNodes); v++ ) { //last spawn parameter makes sure spawning occurs regardless of obstructing collision pnode = spawn(Class'YourProjectilePathNode',,, pc.pawn.Location, rot(0, 0, 0),, true); //pnode.staticmeshcomponent.setMaterial(0); pathNodes[v] = pnode; //pc.optimize("node set"@v); } //hide from view clearPathNodes(); } //when this class is destroyed, //destroy the objects spawned into world //to act as path node indicators //this is an actor event and is called by unreal engine simulated event Destroyed() { super.Destroyed(); for (v = 0; v < ArrayCount(pathNodes); v++ ) { if (pathNodes[v] == none) continue; pathNodes[v].destroy(); } } function stopDrawingPathNodes() { if(tracer != none) { tracer.destroy(); } ClearTimer('drawPathNodes'); clearPathNodes(); } function startDrawingPathNodes() { //already running if (isTimerActive('drawPathNodes')) return; //clear any remaining previous path nodes //clearPathNodes(); //throw the tracer tracer = throwTracer(); //hide tracer.setHidden(true); curPathNodeCount = 0; SetTimer(0.01, true, 'drawPathNodes'); //max life span of 12 seconds SetTimer(12, false, 'clearPathNodes'); } function drawPathNodes() { //end case if (curPathNodeCount >= ArrayCount(pathNodes) ) { ClearTimer('drawPathNodes'); return; } //lost tracer case if (tracer == none) { ClearTimer('drawPathNodes'); return; } positionPathNode(); } function clearPathNodes() { //position doesnt update if hidden for some reason //so move node way far away from player to simulated being hidden //still faster than spawning/destroying //would like to know how to make location update properly even while its hidden //some sort of low-level or native optimization that is getting in the way here for (v = 0; v < ArrayCount(pathNodes); v++ ) { //set the loc vc.x = (v + 1) * 4000; vc.y = (v + 1) * 4000; vc.z = pc.pawn.Location.z - (v + 1) * 4000; //make sure not going below killz if (vc.z < worldinfo.killz) vc.z = worldinfo.killz + 5; pathNodes[v].move(pc.pawn.Location + vc - pathNodes[v].Location); } } function positionPathNode() { //end case if (curPathNodeCount >= ArrayCount(pathNodes)) return; //lost the tracer if (tracer == none) return; //move is way faster than SetLocation //this code says "move path node the amount that is the difference //between its current location and the desired goal position" pathNodes[curPathNodeCount].move( tracer.Location - pathNodes[curPathNodeCount].Location ); curPathNodeCount++; } function UDNProj_Pathway throwTracer() { //pc is ref to your controller class //see my other tutorials on giving //this class a ref to your pc using //post begin play pawnRot = Vector(pc.pawn.Rotation); throwDir = pawnRot;// * 1000; throwDir.z *= 3; spawnLoc = pc.pawn.Location + pawnRot * 64; spawnLoc.z += 64; //spawn p = spawn(Class'UDNProj_Pathway',,, spawnLoc, rot(0, 0, 0) ); //init //p.InitializeProjectile(pc, throwDir); //implementation dependent return p; } defaultproperties { }
Leave a comment: