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

6 or more shot dual loading rocket launcher?

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

    #16
    Are you trying to make Lock On Grenades?
    - because that's a whole other ball game
    - I guess you need to know what fire mode, have a new projectile and check to see that " bLockedOnTarget = true"

    random guess
    Code:
        if ( !bLockedOnTarget && (LoadedFireMode == RFM_GRENADES) )
    Code:
    function class<Projectile> GetProjectileClass()
    {
        if (CurrentFireMode == 1 && LoadedFireMode == RFM_Grenades)
        {
            return GrenadeClass;
        }
        else if (bLockedOnTarget)
        {
            return SeekingRocketClass;
        }
        else if ( LoadedShotCount > 1 )
        {
            return LoadedRocketClass;
        }
       else if ( LoadedShotCount > 1 )
        {
            return LoadedRocketClass2;
        }
    
        else
        {
            return WeaponProjectiles[CurrentFireMode];
        }
    }
    i think you need an extra else if statment to cover the seeking rocket

    Comment


      #17
      Originally posted by TKBS View Post
      Are you trying to make Lock On Grenades?
      - because that's a whole other ball game
      - I guess you need to know what fire mode, have a new projectile and check to see that " bLockedOnTarget = true"
      No just trying to get both fire modes to load up rockets and grenades, seeking is broken so I am not even worried about that.

      My problem is I can't use a simple operator to for it to do both modes.

      Here's the code bits that govern load for the most part as without these it dose not work at all.


      Code:
      simulated function WeaponFireLoad()
      {
      //zippy marker   part of main load code
      	SetCurrentFireMode(1);
      	IncrementFlashCount();
      
      	if (Role == ROLE_Authority)
      	{
      		FireLoad();
      	}
      
      	PlayFiringSound();
      	InvManager.OwnerEvent('FiredWeapon');
      	GotoState('WeaponPlayingFire');
      
      	//We've expended all our ammo, make sure the ammo geometry is hidden from view
      	if (AmmoCount == 0 && Instigator.IsHumanControlled() && Instigator.IsLocallyControlled())
      	{
      		HideRocket('MackRocketScale', true);
      		bIsAnyAmmoHidden = true;
      	}
      }
      Under simulated state WeaponLoadAmmo

      Code:
      	
         	simulated function BeginFire(byte FireModeNum)
      	{
      	//zippy marker
      		if (FireModeNum == 0)
      		{
      			LoadedFireMode = ERocketFireMode((int(LoadedFireMode) + 1) % RFM_Max);
      			WeaponPlaySound(AltFireModeChangeSound);
      		}
      
      		Global.BeginFire(FireModeNum);
      	}
      
      	simulated function TimeWeaponFiring( byte FireModeNum )
      	{
      	//zippy marker  main load code
      		SetTimer( GetFireInterval(1) , false, 'RefireCheckTimer' );
      	}
      
      
      
      
      
      
      		// If we have released AltFire - Just fire the load
      		//zippy marker   main load code
      		if ( !StillFiring(1) )
      		{
      			if ( LoadedShotCount > 0 )
      			{
      				// We have to check to insure we are in the proper state here.  StillFiring() may cause
      				// bots to end their firing sequence.  This will cause and EndFire() call to be made which will
      				// also fire off the load and switch to the animation state prematurely.
      
      				if ( IsInState('WeaponLoadAmmo') )
      				{
      					WeaponFireLoad();
      				}
      			}
      			else
      			{
      				GotoState('Active');
      			}
      		}
      
      
      
      
      simulated function AddProjectile()
      	{
      		WeaponPlaySound(AltFireSndQue[Clamp(LoadedShotCount, 0, AltFireSndQue.Length - 1)]);
      
      		// Play the que animation
      		if ( Instigator.IsFirstPerson() && (LoadedShotCount < 13) )
      		{
      			PlayWeaponAnimation( LoadUpAnimList[LoadedShotCount], AltFireQueueTimes[LoadedShotCount]);
      
      		}
      		//zippy marker    main load code
      		TimeWeaponFiring(1);
      	}

      These pretty much turn load on or off, you can only switch them between fire modes, I've tried ^ and | with no luck, tried else, tried if else I'm just not doing it the right way to have both modes call out to it.

      Comment


        #18
        Commented code:
        Code:
        function class<Projectile> GetProjectileClass()
        {
        //changes zippy if (CurrentFireMode == 0 && LoadedFireMode == RFM_Grenades)
            if (CurrentFireMode == 0 && LoadedFireMode == RFM_Grenades)
            {
                // This Grenade class will be returned if the firemode is 0 AND then the loaded firemode is set to grenade.
                // if either value is not correct, it will go and check the next if statement...
                return GrenadeClass;
            } // ... which will only check for bLockedOnTarget, no matter what firemode is set
            else if (bLockedOnTarget)
            {
                // The code will always return the seeking rocket even if you want grenades
                return SeekingRocketClass;
            } // At this time, we check for a loaded count
            else if ( LoadedShotCount > 1 )
            {
                return LoadedRocketClass2;
            }
        
            // The following code will only be processed if the loaded count is exactly 1
            
            //===zippy changes dup
            else if (CurrentFireMode == 1 && LoadedFireMode == RFM_Grenades)
            {
                return GrenadeClass;
            }
            else if (bLockedOnTarget) // useless check
            {
                return SeekingRocketClass;
            }
            else if ( LoadedShotCount > 1 ) // useless check
            {
                return LoadedRocketClass;
            }
            else
            {
                return WeaponProjectiles[CurrentFireMode];
            }
        }
        So what's your intention?

        As I see, you want always the GrenadeClass if the LoadedFireMode is set to grenades. This would be your first check.
        Code:
        if (LoadedFireMode == RFM_Grenades)
            return GrenadeClass;
        The next thing I see is that you always the seeking rocket class if the homing is active. Important to know, for this check, we have to be sure that LoadedFireMode is not Grenades.
        Code:
        if (LoadedFireMode != RFM_Grenades && bLockedOnTarget)
            return SeekingRocketClass;
        I'm not sure when the 2nd Loaded-class or the original class should be used. I'm assuming that one 2nd FireMode (RMB) the snd loaded class will be used (or other way around). We first check if the weapon is loaded. The 2nd check will be a inline if-statement just for the clean code.
        Code:
        if (LoadedShotCount > 1)
            return CurrentFireMode == 0 ? LoadedRocketClass : LoadedRocketClass2;
        This last check is the same as:
        Code:
        if (LoadedShotCount > 1)
        {
            if (CurrentFireMode == 0)
            {
                return LoadedRocketClass;
            }
            else
            {
                return LoadedRocketClass2;
            }
        }
        No we have to combine all checks:

        Code:
        function class<Projectile> GetProjectileClass()
        {
            if (LoadedFireMode == RFM_Grenades)
                return GrenadeClass;
        
            // at this line, we can be sure that the FireMode is not set
            // to Grenades, we can skip that condition
        
            // Important: else
            else if (bLockedOnTarget)
                return SeekingRocketClass;
        
            // Important: else
            else if (LoadedShotCount > 1)
                return CurrentFireMode == 0 ? LoadedRocketClass : LoadedRocketClass2;
        
            // now the default projectile class
            else
                return WeaponProjectiles[CurrentFireMode];
        }
        Cleaner code:
        Code:
        function class<Projectile> GetProjectileClass()
        {
            if (LoadedFireMode == RFM_Grenades)
                return GrenadeClass;
            else if (bLockedOnTarget)
                return SeekingRocketClass;
            else if (LoadedShotCount > 1)
                return CurrentFireMode == 0 ? LoadedRocketClass : LoadedRocketClass2;
            else
                return WeaponProjectiles[CurrentFireMode];
        }

        Comment


          #19
          My intention is for both fire modes to always load up ammo, for primary to always do rockets and for alt fire to always do grenades. My main problem is I can not get both fire modes to load up rockets/grenades its either or. I was hoping with the loadedrocketclass I could use it for rockets then under it add loadedrocketclass2 call to grenades, this way I can keep flock/spread mode for grenades.

          How do you go about telling codes like these



          Code:
          	SetCurrentFireMode(1);

          Code:
          	SetTimer( GetFireInterval(1) , false, 'RefireCheckTimer' );

          Code:
          	TimeWeaponFiring(1);
          Code:
          		if ( !StillFiring(1) )
          To talk to both fire modes?


          Here is the most recent code file. http://jmp.sh/0QmPTxp

          I've tried ^ and | and they do not seem to work.

          Comment


            #20
            You would need to change the state which does the logic for a shot for the first fire mode like this:
            Code:
            defaultproperties
            {
                //...
                FiringStatesArray(0)=WeaponLoadAmmo
            }
            Try to understand the code. After that you would be able to easily create everything you need.

            Comment


              #21
              Originally posted by RattleSN4K3 View Post
              You would need to change the state which does the logic for a shot for the first fire mode like this:
              Code:
              defaultproperties
              {
                  //...
                  FiringStatesArray(0)=WeaponLoadAmmo
              }
              Try to understand the code. After that you would be able to easily create everything you need.
              Done that and without changing the code the mention it dose not load up shots.

              Basically without these


              Code:
              	SetCurrentFireMode(1);

              Code:
              	SetTimer( GetFireInterval(1) , false, 'RefireCheckTimer' );

              Code:
              	TimeWeaponFiring(1);
              Code:
              		if ( !StillFiring(1) )
              AND firingstatesarray you can not get get it to load up.

              Comment


                #22
                So far got it to load up on both modes with a small glitch on primary fire gets stuck on a full load, I might can track that down but I'm having trouble with


                Code:
                function class<Projectile> GetProjectileClass()
                {
                    if (LoadedFireMode == RFM_Grenades)
                        return GrenadeClass;
                    else if (bLockedOnTarget)
                        return SeekingRocketClass;
                    else if (LoadedShotCount > 1)
                        return CurrentFireMode == 0 ? LoadedRocketClass : LoadedRocketClass2;
                    else
                        return WeaponProjectiles[CurrentFireMode];
                }
                Original code
                Code:
                function class<Projectile> GetProjectileClass()
                {
                	if (CurrentFireMode == 1 && LoadedFireMode == RFM_Grenades)
                	{
                		return GrenadeClass;
                	}
                	else if (bLockedOnTarget)
                	{
                		return SeekingRocketClass;
                	}
                	else if ( LoadedShotCount > 1 )
                	{
                		return LoadedRocketClass;
                	}
                	else  (CurrentFireMode == 0 && LoadedFireMode)
                	
                	{
                		return WeaponProjectiles[CurrentFireMode];
                	}
                }

                Basically I need to force primary fire with loadedrocketclass and alt fire with grenadeclass, but nothing I have tried so far likes what I am trying to do.

                Comment


                  #23
                  check should fire on release

                  - maybe you need to remove this :
                  //LoadUpAnimList[0]=WeaponAltFireQueue1
                  //LoadUpAnimList[1]=WeaponAltFireQueue2
                  //LoadUpAnimList[2]=WeaponAltFireQueue3
                  - i imagine that would interefre with what your doing

                  Comment


                    #24
                    Originally posted by TKBS View Post
                    check should fire on release

                    - maybe you need to remove this :
                    //LoadUpAnimList[0]=WeaponAltFireQueue1
                    //LoadUpAnimList[1]=WeaponAltFireQueue2
                    //LoadUpAnimList[2]=WeaponAltFireQueue3
                    - i imagine that would interefre with what your doing
                    I've got both modes loading ammo now but they load the same ammo. The code bits I showen above control that but I am at a loss right now to figure out how to force primary to do only rockets and alt fire to do only grenades.

                    Comment


                      #25
                      i think u should change your mode

                      Comment


                        #26
                        Originally posted by sibibale View Post
                        i think u should change your mode
                        How? Both modes need to be called too separately in order to load grenades with one and rockets with the other.

                        I wish this would compile but it will not


                        Code:
                        {
                        	if (CurrentFireMode == 0 && LoadedFireMode)
                        		
                        		{
                        		return LoadedRocketClass;
                        	    }
                        	
                        	else if (bLockedOnTarget)
                        	{
                        		return SeekingRocketClass;
                        	}
                        	
                        	
                        	else if  (CurrentFireMode == 1 && LoadedFireMode == RFM_Grenades)
                        	
                        	{
                        		return GrenadeClass;
                        	}
                        	else	
                        	{
                        		return WeaponProjectiles[CurrentFireMode];
                        	}
                        }

                        Comment


                          #27
                          Ah the whole firemode code not that part of it....oy I get to fixated.

                          I managed to make both modes load up rockets or grenades, now I am trying to run down odds and ends.

                          This bit of code is giving me trouble

                          Code:
                          	simulated function TimeWeaponFiring( byte FireModeNum )
                          	{
                          	//zippy marker //part of main fly switch mode code
                          		SetTimer( GetFireInterval(0) , false, 'RefireCheckTimer'); && SetTimer( GetFireInterval(1) , false, 'RefireCheckTimer' );
                          		
                          	}
                          I need it to talk to both fire modes but no matter what method I come up with it hates me.....


                          (one of them at least)

                          Here's the code I have a couple glitches, both fire modes(one of them at least) lock up at a full load of 6 shots, I think I need the above code to get both modes to correctly switch flock modes..


                          Thanks again for all the help guys!

                          Comment


                            #28
                            And iz done!

                            ALRIGHT!!!!!! I finally got it the way I want it.

                            Its a UT3 8ball launcher, might tweak it more but its working with no issues other than animation/muzzle flash,ect but you can barely tell.

                            Primary dose rockets, sped up the first load so you can fire off a single rocket/grenade more quickly tho fast taping results in loading 2 or so lol, while loading rockets you can change its flock mode by clicking alt fire.
                            Alt fire is grenades, while loading you can press primary to switch flock modes.

                            It loads 8 rockets or grenades, the current damage of grenades/rockets is a bit to low(20 something) I need to tweak it some.

                            Got its skin done yesterday.

                            http://zippydsmlee.tumblr.com/image/89217194495

                            And a video of it working
                            https://www.youtube.com/watch?v=QIR-...ature=youtu.be


                            And finally heres the code
                            http://jmp.sh/TtLjcfM


                            Thanks again for all your help I feel I have gained a few levels of understanding....still a code nawer tho... lol

                            Comment


                              #29
                              Originally posted by ZippyDSMlee View Post
                              I've got both modes loading ammo now but they load the same ammo. The code bits I showen above control that but I am at a loss right now to figure out how to force primary to do only rockets and alt fire to do only grenades.

                              Sent from my GT-I9100 using Tapatalk

                              Comment

                              Working...
                              X