Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Strange Touch() issue

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

  • Strange Touch() issue

    Hi!

    I'm working on some general Legend of Zelda ideas as just something to try to learn UnrealScript, and I'm running into this issue with destructible grass.

    As of right now, I link the LOZGrass actor to the LOZGrassTriggerVolume in the editor, which when a projectile passes through the volume it successfully calls LOZGrass.GetCut(); however, it only does it halfway. It will spawn the rupee and the emitter, but SetTimer() never gets called until my Pawn touches the volume, which is incredibly confusing to me. Once the projectile passes through, I set bAlreadyDestroyed to true, which shouldn't allow the GetCut() to be called again. It's almost as if GetCut() is paused once the emitter is spawned and doesn't resume until the Pawn touches the volume.

    So I guess my question is, "What in the world is going on?" Haha.

    LOZGrassTriggerVolume.uc
    Code:
    class LOZGrassTriggerVolume extends TriggerVolume
         placeable;
    
    var(ConnectToLOZGrass) LOZGrass LG;
    var bool bAlreadyDestroyed;
    
    simulated function Touch( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal )
    {
         super.Touch(Other,OtherComp,HitLocation,Hitnormal);
         if(Projectile(Other)!= none && bAlreadyDestroyed == false)
         {
              LG.GetCut();
              bAlreadyDestroyed = true;
         }
    }
    
    defaultproperties
    {
         bAlreadyDestroyed = false
    }
    LOZGrass.uc
    Code:
    class LOZGrass extends InteractiveFoliageActor
         placeable;
    
    var ParticleSystemComponent PSC;
    
    function GetCut()
    {
    
         self.StaticMeshComponent.SetStaticMesh(StaticMesh'Pickups.Ammo_Link.Mesh.S_Ammo_LinkGun');
         SpawnRupee();
         PSC = WorldInfo.MyEmitterPool.SpawnEmitter(ParticleSystem'Castle_Assets.FX.P_FX_Smoke_SubUV_01',self.Location, self.Rotation);
         SetTimer(1.0, false, 'KillEmitter');
    
    }
    
    function KillEmitter()
    {
         PSC.DeactivateSystem();
         `log("And time!");
    }
    
    function SpawnRupee()
    {
         Spawn(class'LOZGame.LOZRupeeOne',,,self.Location,self.Rotation);
    }
    
    defaultproperties
    {
         bCanBeDamaged = true
         bStatic = false
         
         Begin Object Class=StaticMeshComponent Name=LOZGrassMeshComponent
              StaticMesh=LOZStaticMeshes.StaticMeshes.FernTest
         End Object
         Components.Add(LOZGrassMeshComponent)
    }
    [bonusquestion] For some reason SetStaticMesh randomly stopped working as well? [/bonusquestion]

  • #2
    I really hate bumping stuff, but I've continued to play with this and haven't been able to produce any different results. Is there a resource that could explain what's going on here? Everything I keep finding has something like this in it, but the topic of conversation is about something else. :[

    Comment


    • #3
      Just in case anyone has a problem similar to this or anything, I'll post what I was able to do to get all of this working for reference sake.

      First, the reason SetStaticMesh() appeared to not work was because InteractiveFoliageActor sets up a StaticMeshComponent for us named FoliageMeshComponent0. What I was doing was adding a second StaticMeshComponent and then changing that StaticMesh, which actually WAS working. I just couldn't tell because everything I was changing it to was smaller than FoliageMeshComponent0.

      InteractiveFoliageActor.uc
      Code:
      defaultproperties
      {
      	Begin Object Class=InteractiveFoliageComponent Name=FoliageMeshComponent0
      		bAllowApproximateOcclusion=TRUE
      		bForceDirectLightMap=TRUE
      		bUsePrecomputedShadows=TRUE
      		// Foliage actors are usually animated using vertex position offset, which does not work correctly with decals
      		bAcceptsStaticDecals=FALSE
      		bAcceptsDynamicDecals=FALSE
      	End Object
      	StaticMeshComponent=FoliageMeshComponent0
      	Components.Remove(StaticMeshComponent0)
      	Components.Add(FoliageMeshComponent0)
      
      ...
      All I had to do was change the name of my StaticMeshComponent to FoliageMeshComponent0 and the problem went away.

      LOZGrass.uc [defaultproperties]
      Code:
           Begin Object Name=FoliageMeshComponent0
                StaticMesh=StaticMesh'LOZStaticMeshes.StaticMeshes.FernTest'
           End Object
           Components.Add(FoliageMeshComponent0)
      As far as the emitter issue goes, I'm not sure what was causing the weird Touch() stuff to happen, but when I created my own ParticleSystem, there were options in the Required module that make the emitter only run once. Under this module, in the Emitter category I checked Kill On Completed, and under the Duration category I changed Emitter Loops to 1.

      Comment

      Working...
      X