Announcement

Collapse
No announcement yet.

Replicate explosion on instant hit?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Replicate explosion on instant hit?

    I think I will have to go to the instant hit code(simulated function InstantFire in weapon.uc), bring it to the weapon and put in info to spawn an explosion,ect am I close to having the right idea, or dose UT3 change things around?

    I got wormbros UT04 explosive bullet code to give an idea how to do it, but I do not know how much UT3 changes things.

    I know Instant hit has damage radius now but I'd like to spawn the effects.

    #2
    Dumb Q about UTDmgType can you put fire mode info in it like explode functions and such or is it strictly for effects?

    Comment


      #3
      Explode is nothing else like a particle effect (mostly) with the function call TakeRadiusDamage. You can pass any DmgType to that function.

      Comment


        #4
        I can find projectilehurtradius but not HurtRadius as listed here. I am a bit confused.

        Comment


          #5
          I'm confused as well.

          Comment


            #6
            Originally posted by RattleSN4K3 View Post
            I'm confused as well.
            Okay so as I understand it you take most of the projectilehurtradius code(simulated function bool ProjectileHurtRadius) from utprojectile parent class and put it on the weapon I want to give instant hit explosive too. Am I close to being right?

            Comment


              #7
              I guess you're talking about a code snippet made by Wormbo, right? I don't know his code.

              In general - and if you understand the logic behind the weapon code - you would only need to damage overlapping actors of a specific location and replicate the explosion particle emitter.

              For keeping it easy, spawn a projectile at the trace end of your instant hit weapon and explode it directly. In this case you do have a replicated actor (in this case the Projectile) which will do the explosion effect.

              Comment


                #8
                Okay then I will try and research spawning a projectile at the hit location, what would be the simulated function I'd look too for examples of spawning a projectile?
                Wait I looked through the flackshell code, dose "HitActor = Trace(HitLocation, HitNormal, SpawnPos, Location, false);" sound like the right place to start?
                =======

                EDIT


                No wait that's projectile code not weapon code I forget to think in relation to the parent class.
                What I need to look to is this

                Code:
                simulated function Projectile ProjectileFire()
                {
                	local vector		RealStartLoc;
                	local Projectile	SpawnedProjectile;
                
                	// tell remote clients that we fired, to trigger effects
                	IncrementFlashCount();
                
                	if( Role == ROLE_Authority )
                	{
                		// this is the location where the projectile is spawned.
                		RealStartLoc = GetPhysicalFireStartLoc();
                
                		// Spawn projectile
                		SpawnedProjectile = Spawn(GetProjectileClass(),,, RealStartLoc);
                		if( SpawnedProjectile != None && !SpawnedProjectile.bDeleteMe )
                		{
                			SpawnedProjectile.Init( Vector(GetAdjustedAim( RealStartLoc )) );
                		}
                
                		// Return it up the line
                		return SpawnedProjectile;
                	}
                
                	return None;
                }

                And change it to something like this

                Code:
                simulated function Projectile HitLocation()
                {
                	local vector		HitLocation;
                	local Projectile	SpawnedProjectile;
                
                	// tell remote clients that we fired, to trigger effects
                	IncrementFlashCount();
                
                	if( Role == ROLE_Authority )
                	{
                		// this is the location where the projectile is spawned.
                		HitLocation = GetPhysicalFireStartLoc();
                
                		// Spawn projectile
                		SpawnedProjectile = Spawn(class'UTProj_FlakShell',,, HitLocation);
                		if( SpawnedProjectile != None && !SpawnedProjectile.bDeleteMe )
                		{
                			SpawnedProjectile.Init( Vector(GetAdjustedAim( HitLocation )) );
                		}
                
                		// Return it up the line
                		return SpawnedProjectile;
                	}
                
                	return None;
                }

                Flakshell is just a test projectile.


                ==================

                it complies but dose not spawn a projectile ><

                Comment


                  #9
                  Okay I am stuck, will I need EWFT_Custom? Or am I using the wrong code...again LOL

                  ===================

                  SO far I can either make it spawn a projectile at the weapon or not at all.

                  Code:
                  simulated function CustomFire()
                  {
                      local vector		HitLocation;
                  	local Projectile	SpawnedProjectile;
                  	local vector		RealStartLoc;
                  	
                  	
                  	local vector StartTrace, EndTrace;
                  	local Array<ImpactInfo>	ImpactList;
                  	local ImpactInfo RealImpact, NearImpact;
                  	local int i, FinalImpactIndex;
                  
                  	// define range to use for CalcWeaponFire()
                  	StartTrace = InstantFireStartTrace();
                  	EndTrace = InstantFireEndTrace(StartTrace);
                  	bUsingAimingHelp = false;
                  	// Perform shot
                  	RealImpact = CalcWeaponFire(StartTrace, EndTrace, ImpactList);
                  	FinalImpactIndex = ImpactList.length - 1;
                  
                  	if (FinalImpactIndex >= 0 && (ImpactList[FinalImpactIndex].HitActor == None || !ImpactList[FinalImpactIndex].HitActor.bProjTarget))
                  	{
                  		// console aiming help
                  		NearImpact = InstantAimHelp(StartTrace, EndTrace, RealImpact);
                  		if ( NearImpact.HitActor != None )
                  		{
                  			bUsingAimingHelp = true;
                  			ImpactList[FinalImpactIndex] = NearImpact;
                  		}
                  	}
                  
                  	for (i = 0; i < ImpactList.length; i++)
                  	{
                  		ProcessInstantHit(CurrentFireMode, ImpactList[i]);
                  	}
                  
                  	if (Role == ROLE_Authority)
                  	{
                  		// Set flash location to trigger client side effects.
                  		// if HitActor == None, then HitLocation represents the end of the trace (maxrange)
                  		// Remote clients perform another trace to retrieve the remaining Hit Information (HitActor, HitNormal, HitInfo...)
                  		// Here, The final impact is replicated. More complex bullet physics (bounce, penetration...)
                  		// would probably have to run a full simulation on remote clients.
                  		if ( NearImpact.HitActor != None )
                  		{
                  			SetFlashLocation(NearImpact.HitLocation);
                  		}
                  		else
                  		{
                  			SetFlashLocation(RealImpact.HitLocation);
                  		}
                  	}
                  	
                  	///simulated function Projectile HitLocation()
                    
                  	//local vector		HitLocation;
                  	//local Projectile	SpawnedProjectile;
                  
                  	// tell remote clients that we fired, to trigger effects
                  	//IncrementFlashCount();
                  
                  	if( Role == ROLE_Authority )
                  	{
                  		// this is the location where the projectile is spawned.
                  		//SpawnedProjectile = HitLocation();
                  		RealStartLoc = GetPhysicalFireStartLoc();
                  
                  		// Spawn projectile
                  		SpawnedProjectile = Spawn(class'UTProj_FlakShell',,, HitLocation);
                  		if( SpawnedProjectile != None && !SpawnedProjectile.bDeleteMe )
                  		{
                  			SpawnedProjectile.Init( Vector(GetAdjustedAim( HitLocation )) );
                  		}
                  
                  		// Return it up the line
                  		//return SpawnedProjectile;
                  	}
                  
                  	//return None;
                  }
                  Not sure what I am doing wrong will go over it again later .

                  Comment


                    #10
                    You're talking about instant hit? Instant doesn't use projectiles. The Custom-fire logic can be used for some special logic.

                    You can spawn a explosion actor (which handles the damage and the visible explosion) in the ProcessInstantHit method.

                    Comment


                      #11
                      Between the "ProcessInstantHit" in the sniper rifle and weapon parent class I can not figure how spawn an explosion actor, is there anything with an explosion actor code in it so i can see some example code? Took a look at the shock rifle it ran me around alot but its still primarily projectile

                      Comment


                        #12
                        You would just need to spawn a replicated actor which handles the explosion emitter (on clients and listen players) and the damaging part on the server side. You can subclass an existing projectile class for this case and directly force the explode logic.

                        Comment


                          #13
                          I am going to need some example code or else my head is going to explode.

                          BTW why can't you just spawn a projectile on instant hit? It seems plausiable enough, is the engine not really built for it?

                          Comment


                            #14
                            The engine doesn't restrict you from spawning a projectile on intant hit, it's more the framework which you have to use in order weapons work as intended.

                            PSEUDO like
                            Code:
                            simulated function ProcessInstantHit( byte FiringMode, ImpactInfo Impact )
                                if(Role == Role_Authority)
                                     HurtRadius(Damage, Radius, DamageType, MomentumTransfer, Impact.HitLocation )
                                     Spawn(ComboExplosionEffect,,, Impact.HitLocation)
                                     PlaySound(SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_AltFireImpactCue')
                                else
                                     return

                            Comment


                              #15
                              *headdesk* I swear I am bonkers I thought hurtradius had to be in the parent class of the weapon in order for it to process hurtradius. *headdesk* *headdesk* *headdesk* ><

                              Thank you! That should keep away for acouple days LOL

                              Comment

                              Working...
                              X