Announcement

Collapse
No announcement yet.

Weapon fire stop varible and texture holding varieble

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

    Weapon fire stop varible and texture holding varieble

    Okay so I've got this new code and I know the variables that make a person stop moving, but When they get frozen they can still shoot me which is kind of annoying. I would like to know which varible makes them shoot so I can set it to false.


    //edit
    and also it would be neat if I knew which varieble held textures so I could make them appear different until the curse was over.

    #2
    I don't think it can be done with variables, but the functions are:

    In the pawn class:

    Function Fire( optional float F )
    Function AltFire( optional float F )

    Comment


      #3
      Do infantry weapons use FireCountdown "timers" the way ONSWeapons do? If so, just set the "timer" (it's just a variable set by native code) to something impossibly high (and don't forget to reset it afterwards).

      Comment


        #4
        couldent you make the function equal false? And as for the timer I want them to be unable to shoot until the adreniline runs out so I'm not sure that would work. I'll post a little of the code.

        The spot that's bold is the freezing effect so I need somthing that I can set that makes them unable to shoot.

        Code:
        var float EffectRange;
        var xpawn InstigatorPawn;
        var sound FreezeSound;
        var class<xEmitter> FreezeEffectClass;
        
        function StartEffect (xPawn P)
        {
                 SetTimer(0.3, true);
                 InstigatorPawn = P;
        }
        
        function Timer()
        {
         local xPawn P;
         local vector InstigatorDir, otherDir;
         local float Angle;
         
         InstigatorDir = vector(InstigatorPawn.Rotation);
         
         foreach visibleCollidingActors(class'xPawn', P, EffectRange, InstigatorPawn.Location)
         {
                 if (P != InstigatorPawn)
                 {
                  OtherDir = vector(P.Rotation);
                  Angle = Pi - Acos(InstigatorDir Dot otherDir);
                  
                  if (Angle < (Pi/4) && P.GroundSpeed != 0.1)
                  {
                     P.GroundSpeed = 0.1;
                     P.SetPhysics(PHYS_None);
        
                     P.PitchUpLimit = 1;
                     P.PitchDownLimit = 65536;
                     
                     if (FreezeSound != None)
                     PlaySound(FreezeSound, SLOT_None, 2*TransientSoundVolume);
                     
                     if (FreezeEffectClass != None)
                        Spawn(FreezeEffectClass, P, , P.Location, P.Rotation);
                  }
                }
             }
        }
        
        function stopEffect(xPawn P)
        {
                 local xPawn ResetPawn;
                 
                 foreach DynamicActors (class 'xPawn', ResetPawn)
                 {
                         if (ResetPawn != P)
                         {
                            ResetPawn.GroundSpeed = ResetPawn.Default.GroundSpeed;
        
                            if (ResetPawn.Physics == PHYS_None)
                               ResetPawn.SetPhysics(PHYS_Falling) ;
        
                               ResetPawn.PitchUpLimit = ResetPawn.Default.PitchUpLimit;
                               ResetPawn.PitchDownLimit = ResetPawn.Default.PitchDownLimit;
                               }
                    }
        }

        Comment


          #5
          Uhm... in the Pawn's Tick, set the countdown to 1 second every Tick? That way, the pawn will be able to fire only one second after the adrenaline runs out. Gives you time to play an emitter or something to signal the end.

          Comment


            #6
            I've never understood ticks could you be more clear. And woulden't he be able to fire one second after I give him the combo curse instead of after the adrenaline runs out?

            P.S.
            and on a little bit of a different topic is there also a texture holding variable cause it would be cool if they had a different texture until the curse was done.

            Comment


              #7
              For the texture:

              Skin?

              if you need a variable to hold the old texture:
              var Texture VarName

              Comment


                #8
                Texture:

                Yes I do Mean the Skin. I would like to make it so the guys skin would be replaced with a stone texture. To return the old skin coulden't I just reset whatever varieble I'm looking for.

                Comment


                  #9
                  How does this "thingy" work anyway? Is it a handheldweapon, an adrenaline combo, a vehicle mounted weapon?

                  Ticks are easy. Most actors (vehicles, player pawns, weapons) "tick" kind of like the way a clock ticks. Every time they tick, they execute their Tick() function. You can put code there that needs to be executed just about all the time. If you override a pawn's Tick, be sure to call its super.Tick. Most pawns do lotsa stuff in their Ticks. Examples include updating the Raptor thrusters or the Goliath treads to the vehicle's velocity and displaying Manta hover dust or Scorpion/Hellbender wheel dirt when those vehicles are in "contact" with the ground.

                  Comment


                    #10
                    It's an adreniline combo. The only thing that is not there is the class declaration and the default properties. You might be familiar with it, but I just thought that it wasn't very good in its current condition and I felt like enhancing it. When sombody stares at you and you are staring at them(excuse my spelling) they will freeze. The code however was just left like that and the enemys can still shoot which completely ruins the freezing effect. Not only that the effect that is supposed to spawn only gets called some of the time. It's kinda dumb also because when they freeze in the air as soon as they shoot there physics change and fall to the ground which isn't supposed to happen.

                    Comment


                      #11
                      This is something I wrote a while back for a stun weapon - sounds like I already worked out all of the stuff you want to implement. The full code is probably overkill for your purposes though.

                      Code:
                      //=============================================================================
                      // Crystal Chaos (Total Conversion Mod for UT2003/UT2004)
                      // ----------------------------------------------------------------------------
                      // Whodathunkit Core Development Team
                      // ----------------------------------------------------------------------------
                      // Shawn Downey aka. Unleaded
                      // Gerald Lance Tindall aka. <NDP>BOZO
                      // Wolfgang Schloyer aka. }TCP{Wolf aka. <]NDP[>Scorpion aka. Mia_The_Chaotic
                      // Doug Zeager aka. Pitbull
                      // John Barrett aka. [Sixpack]Shambler
                      // Lisa Wiggins aka. LethalMomma
                      // CODE NOT FOR REUSE WITHOUT PRIOR PERMISSION OF THE AUTHORS
                      //=============================================================================
                      // CCEngine.CC_StunController:
                      // Generic Control/Effects Mechanism for Stun.
                      //=============================================================================
                      class CC_StunController extends CC_Actor;
                      
                      // Control Variables
                      var() bool bAddProtectionFromStunWhenStunned;        // When True the Pawn Receives StunProtectionLevel of Protection from StunProtectionClass
                      var() bool bInvulnerableToWeaponsWhenStunned;        // When True the Pawn Receives 100% Protection From Weapon/Monster/Melee Damage
                      var() float StunProtectionLevel;                     // Amount of Stun Protection Received
                      var() Class<CC_DamType_Stun> StunProtectionClass;    // Type of Stun Protection Provided
                      var() float MinStunLength;                           // Minimum Allowed Stun Length
                      var() float MaxStunLength;                           // Maximum Allowed Stun Length
                      var() float BaseStunLength;                          // If no Stun Charge Setting Received - Base Stun Length Applied 
                      
                      // Internal variables
                      var float Charge;                         // Stun Charge Recieved 
                      var bool bInvulnerableToWeapons;          // When Flag Set Stunned Pawn is Invulnerable To Weapons / Monster and Melee Attacks
                      var int TimeRemaining;                    // Countdown Timer for Stun Effect Duration
                      var bool bStunProtect;                    // When Flag Set Stunned Pawn is Invulnerable to Further Stun
                      var int StunProtectTime;                  // Countdown Timer for Stun Protection Duration
                      var Pawn SP;                              // Stunned Pawn Reference
                      var Controller SPC;                       // Stunned Pawn Controller Reference
                      var bool bIsPlayer;                       // When True Pawn is Human Player
                      var bool bIsBot;                          // When True Pawn is Computer Bot
                      var bool bIsMonster;                      // When True Pawn is Monster
                      var GameRules PPR;                        // Pointer to Partial Protection Rules Reference (provides Stun Protection)
                      var GameRules SGR;                        // Pointer to Stun Game Rules Reference (tracks All Stun Controllers)
                       
                      
                      
                      // Location/View/Mesh/Texture Variables
                      var vector XLocation;
                      var rotator XRotation;
                      var bool bLanded;
                      var bool XBehindView;
                      var bool XHidden;
                      var bool XMesh;
                      
                      // Track Variables - Pawn Inventory
                      var Inventory XInventory;
                      var Inventory XSelectedItem;
                      var Weapon XWeapon;
                      
                      // Tracked Variables - Reset After Stun Over
                      var Name CurrStateController;
                      var Pawn XEnemy;
                      var Pawn XOldEnemy;
                      var Pawn XHated;
                      var Actor XTarget;
                      var UnrealPawn XTeamLeader;
                      var bool XTranslocate;
                      var bool XImpactJump;
                      
                      // Effects, Sound, and Messaging
                      var() Material StunOverlayEffect;
                      var() class <Actor>ActivateFXClass;
                      var() class <Actor>DeActivateFXClass;
                      var() class <Actor>ExpireFXClass;
                      var() sound ActivateSound;
                      var() sound DeActivateSound;
                      var() sound ExpireSound;
                      var() float ActivateSoundVolume;
                      var() float DeActivateSoundVolume;
                      var() float ExpireSoundVolume;
                      var() localized string ActivateMessage;
                      var() localized string DeActivateMessage;
                      var() localized string ExpireMessage;
                      var() localized string CountdownMessage;
                      
                      
                      //=============================================================================
                      // CC_StunController:replication
                      //=============================================================================
                      replication
                      {
                         reliable if(Role==ROLE_Authority)
                            Charge, bInvulnerableToWeapons, bStunProtect, TimeRemaining, SP, SPC, bIsPlayer, bIsBot, bIsMonster, bLanded, PPR, SGR;
                      }// end CC_StunController:replication
                      
                      
                      
                      //=============================================================================
                      // CC_StunController.PostBeginPlay()
                      //=============================================================================
                      event PostBeginPlay()
                      {
                         local GameRules RulePtr;
                         local GameRules NewRule;
                         local bool bRuleFound;
                         local Pawn P,TempP;
                         local Controller C;
                         local GameRules PPRPtr;
                         local GameRules NewPPR;
                         local float StunProtection;
                         local bool bInvulnerableToStun;
                      
                         // Initialize Variables
                         bInvulnerableToStun=False;
                         StunProtection=0.0;
                      
                         if(Role==ROLE_Authority)
                         {
                            // Spawn the Stun Game Rule Modifier if not present yet
                            bRuleFound=False;
                            RulePtr=Level.Game.GameRulesModifiers;
                      
                            while(RulePtr!=None)
                            {
                               if(ClassIsChildOf(RulePtr.Class,Class'CC_StunGameRules'))
                               {
                                  bRuleFound=True;
                                  break;
                               }// endif
                      
                               RulePtr=RulePtr.NextGameRules;
                            }// end while
                      
                            if(!bRuleFound) // THIS SHOULD NEVER HAPPEN BUT WE ARE MAKING SURE ANYWAYS!!!
                            {
                               NewRule=Spawn(Class'CC_StunGameRules');
                               CC_StunGameRules(NewRule).StunControllerClass=self.Class;
                               if(Level.Game.GameRulesModifiers==None)
                                  Level.Game.GameRulesModifiers=NewRule;
                               else
                                  Level.Game.GameRulesModifiers.AddGameRules(NewRule);
                               RulePtr=NewRule;
                            }// endif
                         }// endif
                      
                         if(RulePtr!=None)
                         {
                            SGR=RulePtr;
                      
                            log(SGR,'CC_StunController');
                            
                            TempP=CC_StunGameRules(SGR).GetLatestStunnedPawn();
                      
                            if(TempP!=None)
                            {
                               P=TempP;
                            }// endif
                         }// endif
                      
                         // Check for Invalid Stun Conditions
                         if (P==None || P.Controller==None || P.Health<=0 || P.InGodMode() || P.Controller.IsInState('GameEnded') || P.Controller.IsInState('Dead'))
                         {
                            log("FAILED INITIAL STUN CONDITIONS",'CC_StunController');
                            Destroy();
                         }// endif
                      
                      
                         if(Role==ROLE_Authority)
                         {
                            // Spawn the Partial Protection Game Rule Modifier if not present yet
                            bRuleFound=False;
                            PPRPtr=Level.Game.GameRulesModifiers;
                      
                            while(PPRPtr!=None)
                            {
                               if(PPRPtr.IsA('CC_PartialProtectionRules'))
                               {
                                  bRuleFound=True;
                                  break;
                               }// endif
                      
                               PPRPtr=PPRPtr.NextGameRules;
                            }// end while
                      
                            if(!bRuleFound)
                            {
                               NewPPR=Spawn(Class'CC_PartialProtectionRules');
                               if(Level.Game.GameRulesModifiers==None)
                                  Level.Game.GameRulesModifiers=NewPPR;
                               else
                                  Level.Game.GameRulesModifiers.AddGameRules(NewPPR);
                               PPRPtr=NewPPR;
                            }// endif
                      
                            PPR=PPRPtr;
                         }// endif
                      
                      
                         // Determine Existing and Set Additional Stun Protection
                         if(P!=None && StunProtectionClass!=None)
                         {
                            if(PPR!=None)
                            {
                               StunProtection=CC_PartialProtectionRules(PPR).GetProtection(P,StunProtectionClass);
                               if(StunProtection==1.0)
                               {
                                  bInvulnerableToStun=True;
                               }else
                               {
                                  if(bAddProtectionFromStunWhenStunned)
                                     CC_PartialProtectionRules(PPR).AddProtection(P,StunProtectionClass,StunProtectionLevel,self);      
                               }// endif
                            }// endif 
                         }// endif
                      
                        
                         if(bInvulnerableToStun)
                         {
                            Destroy();
                         }else
                         {
                            // Proceed with Stun
                      
                            // Get Pawn and Controller Info
                            if(P!=None && P.Controller!=None)
                            { 
                               SPC=P.Controller;
                               if(SPC.Pawn!=None)
                                  SP=SPC.Pawn;
                      
                               if(SP==None || SPC==None)
                                  Destroy();
                            }// endif
                      
                      
                            // Determine Stun Charge and Time Remaining in Stun
                            if(Rotation.Roll>=0)
                            {
                               Charge=Rotation.Roll;
                            }else
                            {
                               Charge=BaseStunLength;
                            }// endif
                      
                            Charge=Charge*(1.0-StunProtection);
                          
                            if(Charge<MinStunLength)
                               Charge=MinStunLength;
                      
                            if(Charge>MaxStunLength)
                               Charge=MaxStunLength;
                      
                            // Round Stun Length To Nearest Second
                            TimeRemaining=Charge;
                      
                      
                            // Find out Pawn Type
                            if(PlayerController(SPC)!=None)
                            {
                               bIsPlayer=True;
                            }else if(Bot(SPC)!=None && MonsterController(SPC)==None)
                            { 
                               bIsBot=True;
                            }else if(MonsterController(SPC)!=None)
                            {
                               bIsMonster=True;
                            }// endif
                      
                      
                            // Hide the Stunned Pawn so it is Not visible to Other Computer Controlled Pawns
                            SP.Visibility=0;
                      
                            // Remove the Stunned Pawn from the Bot/Monster Enemy Lists
                            // Keeps them from shooting at the Stunned Pawn when they are Stunned
                            // Also remove from Squad List
                            // This Affects Both Bots and Monsters
                            for(C=Level.ControllerList;C!=None;C=C.nextController)
                            {
                               // Force Hunting/Engaged Focus off of Stunned Pawn
                               // Stop Firing At Stunned Pawn
                               // Also Gets Rid of Pawn From any Active Enemy List
                               if(Bot(C)!=None && Bot(C).Enemy==SP)
                               {
                                  Bot(C).bHunting=False;
                                  Bot(C).bEnemyInfoValid=False;
                                  Bot(C).Enemy=None;
                                  Bot(C).bEnemyAcquired=False;
                                  Bot(C).bEnemyIsVisible=False;
                                  Bot(C).bEnemyEngaged=False;
                      
                                  // Stunned Pawn No Longer A Target
                                  if(Bot(C)!=None && C.Target==SP)
                                     Bot(C).Target=None;
                      
                                  // Stunned Pawn Should Not be an Old Enemy
                                  if(Bot(C)!=None && Bot(C).OldEnemy==SP)
                                     Bot(C).OldEnemy=None;
                      
                                  // Stunned Pawn Should Not be a Visible Enemy
                                  if(Bot(C)!=None && Bot(C).VisibleEnemy==SP)
                                     Bot(C).VisibleEnemy=None;
                      
                                  // Stunned Pawn Should Not be a Failed Hunt Enemy
                                  if(Bot(C)!=None && Bot(C).FailedHuntEnemy==SP)
                                     Bot(C).FailedHuntEnemy=None;
                      
                                  Bot(C).StopFiring();
                                  Bot(C).ClearScript();
                      
                               }// endif
                      
                            }// end for
                      
                      
                            // Removes Stunned Pawn From the Bot/Monster Enemy List (for Squads) and Finds New Enemy for Them
                            // Picks a New Squad Leader If Current Leader was the One Stunned
                            for(C=Level.ControllerList;C!=None;C=C.nextController)
                            {
                               if(Bot(C)!=None && Bot(C).Squad!=None)
                               {
                                  Bot(C).Squad.RemoveEnemy(SP);
                      
                                  if(Bot(C).Squad.SquadLeader==SPC)
                                     Bot(C).Squad.PickNewLeader();
                               }// endif
                      
                            }// end for
                      
                      
                            // Give Stunned Pawn Protection From Weapons/Monster/Melee Damage While Stunned If Flag Is Set
                            if(bInvulnerableToWeaponsWhenStunned)
                               bInvulnerableToWeapons=True;
                            else
                               bInvulnerableToWeapons=False;
                      
                      
                            // Shut the Pawn Sounds Off
                            SP.SoundDampening=0.0;
                      
                            // Make Stunned Pawn Drop to the Ground
                            SP.DropToGround();
                      
                      
                            if(bIsPlayer)   // PLAYER
                            {
                      
                               // End any Fire and AltFire Holds
                               PlayerController(SPC).bFire=0;
                               PlayerController(SPC).bAltFire=0;
                            
                               // Spectate the Stunned Pawn
                               PlayerController(SPC).GoToState('BaseSpectating');
                               PlayerController(SPC).ClientGoToState('BaseSpectating','');
                      
                      
                               // Adjust Camera View to Focus on Stunned Pawn
                               PlayerController(SPC).bFreeCamera=True;
                               PlayerController(SPC).bZeroRoll=True;
                               PlayerController(SPC).bCenterView=True;
                               PlayerController(SPC).bFrozen=True;
                      
                               PlayerController(SPC).EndZoom();
                               PlayerController(SPC).bBehindView=True;
                               PlayerController(SPC).ClientSetBehindView(True);
                               PlayerController(SPC).SetViewTarget(SP);
                      
                               // Remove Control of Animations
                               SPC.bControlAnimations=True;
                      
                               // Remove Control of Pawn from Player
                               PlayerController(SPC).CleanOutSavedMoves();
                               PlayerController(SPC).Pawn=None;
                               SP.Controller=None;
                      
                      
                            }else if(bIsBot) // BOT
                            {
                               // Make Invulnerable (bGodMode=True) and Ignore All Stimuli 
                               Bot(SPC).SetEnemyReaction(0);
                      
                               // Stop Weapon Fire / Disallow Firing
                               Bot(SPC).StopFiring();
                      
                               // Disable Adrenaline Powerup
                               Bot(SPC).bAdrenalineEnabled=False;
                      
                               // Kill All Currently Playing Animations and Disallow Any New Animation
                               Bot(SPC).ClearAnimation();
                      
                               // Get Rid of Any Current Goal Script
                               Bot(SPC).FreeScript();
                      
                               // Drop Any Current Actions / End Walk or Crouch
                               Bot(SPC).ClearScript();
                      
                      
                               // Drop Any Current Actions
                               Bot(SPC).ActionNum=0;
                               Bot(SPC).CurrentAction=None;
                               Bot(SPC).ScriptedFocus=None;
                      
                      
                               // Disable Enemy Tracking
                               Bot(SPC).bEnemyAcquired=False;      
                               Bot(SPC).bHuntPlayer=False;
                               Bot(SPC).bEnemyIsVisible=False;
                               Bot(SPC).bEnemyEngaged=False;
                      //      Bot(SPC).SetAlertness(0);
                               Bot(SPC).Enemy=None;
                               Bot(SPC).EnemyNotVisible();
                               Bot(SPC).bEnemyInfoValid=True;      // False when change Enemy, True when LastSeenPos etc updated
                      
                               // Disable Searching For Direction to Move
                               Bot(SPC).bPreparingMove=False;
                               Bot(SPC).bFrustrated=False;
                               Bot(SPC).bInitLifeMessage=False;
                               Bot(SPC).bReachedGatherPoint=False;
                               Bot(SPC).bFinalStretch=False;
                               Bot(SPC).bWasNearObjective=False;
                               Bot(SPC).BlockedPath=None;
                      
                               // Disable Special Moves
                               XTranslocate=Bot(SPC).bAllowedToTranslocate;
                               Bot(SPC).bAllowedToTranslocate=False;
                               XImpactJump=Bot(SPC).bAllowedToImpactJump;
                               Bot(SPC).bAllowedToImpactJump=False;
                      
                               // Bot Just Waits Until Stun Ends
                               Bot(SPC).GoToState('NoGoal');
                      
                               // Remove Control of Animations
                               SPC.bControlAnimations=True;
                      
                               // Remove Control of Pawn from Bot
                               SPC.Pawn=None;
                               SP.Controller=None;
                      
                      
                            }else if(bIsMonster)  // MONSTER
                            {
                               log("MONSTER"@SPC@SP,'CC_StunController');
                               // Make Invulnerable (bGodMode=True) and Ignore All Stimuli 
                               Bot(SPC).SetEnemyReaction(0);
                      
                               // Stop Weapon Fire / Disallow Firing
                               Bot(SPC).StopFiring();
                      
                               // Disable Adrenaline Powerup
                               Bot(SPC).bAdrenalineEnabled=False;
                      
                               // Kill All Currently Playing Animations and Disallow Any New Animation
                               Bot(SPC).ClearAnimation();
                      
                               // Get Rid of Any Current Goal Script
                               Bot(SPC).FreeScript();
                      
                               // Drop Any Current Actions / End Walk or Crouch
                               Bot(SPC).ClearScript();
                      
                      
                               // Drop Any Current Actions
                               Bot(SPC).ActionNum=0;
                               Bot(SPC).CurrentAction=None;
                               Bot(SPC).ScriptedFocus=None;
                      
                      
                               // Disable Enemy Tracking
                               Bot(SPC).bEnemyAcquired=False;      
                               Bot(SPC).bHuntPlayer=False;
                               Bot(SPC).bEnemyIsVisible=False;
                               Bot(SPC).bEnemyEngaged=False;
                      //      Bot(SPC).SetAlertness(0);
                               Bot(SPC).Enemy=None;
                               Bot(SPC).EnemyNotVisible();
                               Bot(SPC).bEnemyInfoValid=True;      // False when change Enemy, True when LastSeenPos etc updated
                      
                      
                               // Disable Searching For Direction to Move
                               Bot(SPC).bPreparingMove=False;
                               Bot(SPC).bFrustrated=False;
                               Bot(SPC).bInitLifeMessage=False;
                               Bot(SPC).bReachedGatherPoint=False;
                               Bot(SPC).bFinalStretch=False;
                               Bot(SPC).bWasNearObjective=False;
                               Bot(SPC).BlockedPath=None;
                      
                               // Disable Special Moves
                               XTranslocate=Bot(SPC).bAllowedToTranslocate;
                               Bot(SPC).bAllowedToTranslocate=False;
                               XImpactJump=Bot(SPC).bAllowedToImpactJump;
                               Bot(SPC).bAllowedToImpactJump=False;
                      
                               // Bot Just Waits Until Stun Ends
                               Bot(SPC).GoToState('NoGoal');
                      
                               // Remove Control of Animations
                               SPC.bControlAnimations=True;
                      
                               // Remove Control of Pawn from Bot
                               SPC.Pawn=None;
                               SP.Controller=None;
                            }// endif
                        
                      
                            ActivateEffect();
                            PlayActivateSound();
                            PlayActivateMessage();
                      
                            enable('tick');
                            SetTimer(1.0,True);
                            Timer();
                         }// endif
                      
                      
                      }// end CC_StunController:PostBeginPlay
                      
                      
                      //=============================================================================
                      // CC_StunController.Tick()
                      //=============================================================================
                      event Tick(float DeltaTime)
                      {
                         // Make the Stunned Pawn Fall
                         if(SP.Physics==PHYS_Flying || SP.IsInState('FeigningDeath'))
                         {
                            if(SP.IsA('UnrealPawn'))
                            {
                               SP.GoToState('PlayerWalking');
                               SP.SetPhysics(PHYS_Falling);
                            }// endif
                         }// endif
                      
                         // Check for Pawn Landing
                         if((SP.Physics!=PHYS_Falling) && !bLanded)
                         {
                            bLanded=True;
                            // Set Base to Pawn.Base in Case we are standing on a Moving Object
                            if(Mover(SP.Base)!=None)
                            {
                               SetLocation(SP.Location);
                               SetBase(SP.Base);
                               XLocation=SP.Location-Base.Location;
                            }else // Otherwise set Base to Pawn
                            {
                               SetLocation(SP.Location);
                               SetBase(SP);
                               XLocation=SP.Location;
                            }// endif
                      
                            // Once Pawn Lands Kill Velocity and Ignore Any Momentum 
                            SP.Velocity=vect(0,0,0);
                            SP.Acceleration=vect(0,0,0);
                            SP.bIgnoreForces=True;
                         }// endif
                      
                         // Check for Starting to Fall Again
                         if(SP.Physics==PHYS_Falling && bLanded)
                         {
                            SP.SetBase(None);
                            bLanded=False;
                            SP.bIgnoreForces=False;
                         }// endif
                      
                      }// end CC_StunController:tick
                      
                      
                      
                      //=============================================================================
                      // CC_StunController.Timer()
                      //=============================================================================
                      event Timer()
                      {
                         if(SP==None || SP.Health<=0)
                            Destroy();
                      
                      
                         if(bInvulnerableToWeapons)
                         {
                            if(TimeRemaining>0)
                            {
                               if(bIsPlayer)
                                  PlayerController(SPC).ClientMessage(TimeRemaining@GetLocalString(3),'CriticalEvent'); 
                               TimeRemaining--;
                            }else // UnStun the Player yet retain Stun Invulnerability for a Short Time
                            {
                      
                               SP.bStasis=False;
                      
                               SP.bCanBeDamaged=True;
                               SP.bIgnoreForces=False;
                               bInvulnerableToWeapons=False;
                      
                               SPC.bControlAnimations=False;
                       
                      
                               SP.Visibility=SP.default.Visibility;
                      
                               // Turn the Pawn Sounds On
                               SP.SoundDampening=1.0;
                      
                               if(bIsPlayer)
                               {
                                  PlayerController(SPC).Pawn=SP;
                                  SP.Controller=SPC;
                                  if(SP.PhysicsVolume.IsA('WaterVolume'))
                                    PlayerController(SPC).GoToState('PlayerSwimming');
                                  else
                                     PlayerController(SPC).GoToState('PlayerWalking');
                                  SP.Eyeheight=SP.BaseEyeHeight;
                                  SP.ChangeAnimation();
                                  PlayerController(SPC).ClientSetBehindView(False);
                                  PlayerController(SPC).bBehindView=False;
                                  SP.BecomeViewTarget();
                      
                               }else if(bIsBot)
                               {
                                  // Supply Control Once Again
                                  SPC.Pawn=SP;
                                  SP.Controller=SPC;
                       
                                  // Enable Special Moves
                                  Bot(SPC).bAllowedToTranslocate=XTranslocate;
                                  Bot(SPC).bAllowedToImpactJump=XImpactJump;
                      
                      
                                  SPC.bEnemyInfoValid=False;
                                  Bot(SPC).SetAlertness(SP.default.Alertness);
                      
                                  // Make Vulnerable and Pay Attention Again
                                  Bot(SPC).SetEnemyReaction(3);
                      
                                  SPC.GotoState('Roaming');
                               }else if(bIsMonster)
                               {
                                  // Supply Control Once Again
                                  SPC.Pawn=SP;
                                  SP.Controller=SPC;
                      
                                  // Enable Special Moves
                                  Bot(SPC).bAllowedToTranslocate=XTranslocate;
                                  Bot(SPC).bAllowedToImpactJump=XImpactJump;
                      
                                  SPC.bEnemyInfoValid=False;
                                  Bot(SPC).SetAlertness(SP.default.Alertness);
                      
                                  // Make Vulnerable and Pay Attention Again
                                  Bot(SPC).SetEnemyReaction(3);
                      
                                  SPC.GotoState('Roaming');
                               }// endif
                      
                               DeActivateEffect();
                               PlayDeActivateSound();
                               if(bIsPlayer)
                                  PlayDeActivateMessage();
                      
                               disable('Tick');
                               SetTimer(5.0,False);
                            }// endif
                         
                         }else // Stun Invulnerability Over
                         {
                            ExpireEffect();
                            PlayExpireSound();
                            if(bIsPlayer)
                               PlayExpireMessage();
                            Destroy();
                         }// endif
                      }// end event CC_StunController.Timer
                      
                      
                      //======================================================================================
                      // CC_StunController.Destroyed()
                      //======================================================================================
                      event Destroyed()
                      {
                         // Remove From Stun List
                         CC_StunGameRules(SGR).RemoveFromStunList(SP);
                      
                         // Remove Stun Protection
                         if(bAddProtectionFromStunWhenStunned)
                            CC_PartialProtectionRules(PPR).RemoveProtection(SP,StunProtectionClass,StunProtectionLevel,self);
                      
                      }// end event CC_StunController.Destroyed
                      
                      
                      // ------------------------------------------------------------------------------------------------------------------
                      
                      
                      //======================================================================================
                      // CC_StunController.GetLocalString()
                      //======================================================================================
                      static function string GetLocalString(optional int Switch,
                      	optional PlayerReplicationInfo RelatedPRI_1, 
                      	optional PlayerReplicationInfo RelatedPRI_2)
                      {
                         // Pass the Appropriate Message
                         if(Switch==0)
                            return Default.ActivateMessage;
                         if(Switch==1)
                            return Default.DeActivateMessage;
                         if(Switch==2)
                            return Default.ExpireMessage;
                         if(Switch==3)
                            return Default.CountdownMessage;
                      }// end static function CC_StunController.GetLocalString
                      
                      
                      // ------------------------------------------------------------------------------------------------------------------
                      
                      //======================================================================================
                      // CC_StunController.ActivateEffect()
                      //======================================================================================
                      function ActivateEffect()
                      {
                         local Inventory TempInv;
                         local Rotator TempRot;
                      
                         TempRot=rot(0,0,0);
                      
                      //   NOTE: UT2003 ONLY - FOR SOME REASON THIS SETTING NEEDS TO BE TWICE THE ACTUAL TIME FOR THE FX...
                      //   TempRot.Roll=Charge*2;
                      
                         TempRot.Roll=Charge;
                      
                      
                         // Display Activate Effect
                         if(ActivateFXClass!=None)
                         {
                            Spawn(ActivateFXClass,SP,,SP.Location,TempRot);
                         }// endif
                      
                         // Display Stun Overlay Effect
                         if(StunOverlayEffect!=None)
                         {
                      //    NOTE: UT2003 ONLY - FOR SOME REASON THIS SETTING NEEDS TO BE TWICE THE ACTUAL TIME FOR THE FX...
                      //      SP.SetOverlayMaterial(StunOverlayEffect,Charge*2,False);
                      //      if(SP.Weapon!=None)
                      //         SP.Weapon.SetOverlayMaterial(StunOverlayEffect,Charge*2,False);
                      
                            SP.SetOverlayMaterial(StunOverlayEffect,Charge,False);
                            if(SP.Weapon!=None)
                               SP.Weapon.SetOverlayMaterial(StunOverlayEffect,Charge,False);
                            if(SP.Inventory!=None)
                            {
                               for(TempInv=SP.Inventory;TempInv!=None;TempInv=TempInv.Inventory)
                               {
                      //   NOTE: UT2003 ONLY - FOR SOME REASON THIS SETTING NEEDS TO BE TWICE THE ACTUAL TIME FOR THE FX...
                      //            if(TempInv.ThirdPersonActor!=None)
                      //               TempInv.ThirdPersonActor.SetOverlayMaterial(StunOverlayEffect,Charge*2,False);
                      
                                  if(TempInv.ThirdPersonActor!=None)
                                     TempInv.ThirdPersonActor.SetOverlayMaterial(StunOverlayEffect,Charge,False);
                               }// end for
                            }// endif
                         }// endif
                      
                      }// end function CC_StunController.ActivateEffect
                      
                      
                      //======================================================================================
                      // CC_StunController.PlayActivateSound()
                      //======================================================================================
                      function PlayActivateSound()
                      {
                         // Play Activate Sound
                         if(ActivateSound!=None && PlayerController(SPC)!=None)
                            PlayerController(SPC).ClientPlaySound(ActivateSound,True,ActivateSoundVolume,SLOT_Interact);
                      }// end function CC_StunController.PlayActivateSound
                      
                      
                      //======================================================================================
                      // CC_StunController.PlayActivateMessage()
                      //======================================================================================
                      function PlayActivateMessage()
                      {
                         // Play Activate Message
                         if(PlayerController(SPC)!=None)
                            PlayerController(SPC).ReceiveLocalizedMessage( MessageClass, 0, None, None,  self.Class );
                      }// end function CC_StunController.PlayActivateMessage
                      
                      // ------------------------------------------------------------------------------------------------------------------
                      
                      //======================================================================================
                      // CC_StunController.DeActivateEffect()
                      //======================================================================================
                      function DeActivateEffect()
                      {
                         // Display DeActivate Effect
                         if(DeActivateFXClass!=None)
                         {
                            Spawn(DeActivateFXClass,SP,,Location);
                         }// endif
                      
                      }// end function CC_StunController.DeActivateEffect
                      
                      
                      
                      //======================================================================================
                      // CC_StunController.PlayDeActivateSound()
                      //======================================================================================
                      function PlayDeActivateSound()
                      {
                         // Play DeActivate Sound
                         if(DeActivateSound!=None && PlayerController(SPC)!=None)
                            PlayerController(SPC).ClientPlaySound(DeActivateSound,True,DeActivateSoundVolume,SLOT_Interact);
                      }// end function CC_StunController.PlayDeActivateSound
                      
                      
                      //======================================================================================
                      // CC_StunController.PlayDeActivateMessage()
                      //======================================================================================
                      function PlayDeActivateMessage()
                      {
                         // Play DeActivate Message
                         if(PlayerController(SPC)!=None)
                            PlayerController(SPC).ReceiveLocalizedMessage( MessageClass, 1, None, None, self.Class );
                      }// end function CC_StunController.PlayDeActivateMessage
                      
                      // ------------------------------------------------------------------------------------------------------------------
                      
                      //======================================================================================
                      // CC_StunController.ExpireEffect()
                      //======================================================================================
                      function ExpireEffect()
                      {
                         // Display Expire Effect
                         if(ExpireFXClass!=None)
                         {
                            Spawn(ExpireFXClass,SP,,Location);
                         }// endif
                      }// end function CC_StunController.ExpireEffect
                      
                      
                      //======================================================================================
                      // CC_StunController.PlayExpireSound()
                      //======================================================================================
                      function PlayExpireSound()
                      {
                         // Play Expire Sound
                         if(ExpireSound!=None && PlayerController(SPC)!=None)
                            PlayerController(SPC).ClientPlaySound(ExpireSound,True,ExpireSoundVolume,SLOT_Interact);
                      }// end function CC_StunController.PlayExpireSound
                      
                      
                      //======================================================================================
                      // CC_StunController.PlayExpireMessage()
                      //======================================================================================
                      function PlayExpireMessage()
                      {
                         // Play Expire Message
                         if(PlayerController(SPC)!=None)
                            PlayerController(SPC).ReceiveLocalizedMessage( MessageClass, 2, None, None, self.Class );
                      }// end function CC_StunController.PlayExpireMessage
                      
                      
                      // ------------------------------------------------------------------------------------------------------------------
                      
                      
                      //=============================================================================
                      // CC_StunController:defaultproperties
                      //=============================================================================
                      defaultproperties
                      {
                         bAddProtectionFromStunWhenStunned=True
                         bInvulnerableToWeaponsWhenStunned=True
                         StunProtectionLevel=1.0
                         StunProtectionClass=Class'CC_DamType_Stun'
                         MinStunLength=5
                         MaxStunLength=15
                         BaseStunLength=10 
                      
                         Charge=0
                         MessageClass=Class'CriticalEventPlus'
                      
                         StunOverlayEffect=Shader'XGameShaders.PlayerShaders.LightningHit'
                      
                         ActivateFXClass=None
                         ActivateSound=None
                         ActivateSoundVolume=1.0
                         ActivateMessage="You have been trapped in a stun field."
                      
                         DeActivateFXClass=None
                         DeActivateSound=None
                         DeActivateSoundVolume=1.0
                         DeActivateMessage="The stun field has weakened..."
                      
                         ExpireFXClass=None
                         ExpireSound=None
                         ExpireSoundVolume=1.0
                         ExpireMessage="The stun effect is no longer active."
                      
                         CountdownMessage="seconds remaining in stun..."
                      
                         RemoteRole=ROLE_DumbProxy
                         bNetInitialRotation=True
                         bAlwaysRelevant=True
                         bUpdateSimulatedPosition=True
                         bOnlyDirtyReplication=False
                         bStatic=False
                         bNoDelete=False
                         bMovable=True
                         LifeSpan=0.0
                         bGameRelevant=True
                         bNetTemporary=False
                         bReplicateMovement=True
                         bReplicateInstigator=True
                         bSkipActorPropertyReplication=False
                         bOnlyRelevantToOwner=False
                      
                      }// end CC_StunController:defaultproperties

                      Comment


                        #12
                        put your thing in [code*] [/code*] without the stars and It will keep the format.

                        Edit///////////
                        Thats an awful lot of code. Could you put in bold what you think is the most important parts. I would really appreciate it.

                        Comment


                          #13
                          Ok the main code has been Highlighted showing the various settings you may want to adjust. It is commented pretty well so should be easy to follow.

                          You also will probably want to implement everything in the Tick routine - it takes care of the stunned while in the air problem you were speaking about.

                          Comment

                          Working...
                          X