Announcement

Collapse
No announcement yet.

Need help with Blueprint weapon design

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

    Need help with Blueprint weapon design

    Not sure if this the right place to be posting, but I need help with a basic weapon in Blueprint. I want to make a simple weapon that does damage to the user if they don't hit another character with it. Is there a way to do this? If so, how?

    #2
    Originally posted by jghall1 View Post
    Not sure if this the right place to be posting, but I need help with a basic weapon in Blueprint. I want to make a simple weapon that does damage to the user if they don't hit another character with it. Is there a way to do this? If so, how?
    There is a FireShotOverride function in the weapon BP, which you can use to damage the instigator with a fixed amount of damage.

    Comment


      #3
      So how exactly would I go about doing that? Is the FireShot block what I am looking for? And how do I use it to do a hitscan?

      Comment


        #4
        Originally posted by jghall1 View Post
        So how exactly would I go about doing that? Is the FireShot block what I am looking for? And how do I use it to do a hitscan?
        Based on how you described it in your other thread, you'll probably want to call FireShotOverride, then from FireShotOverride, execute your custom firing behavior, and then return true.

        The way FireShot & FireShotOverride work is...

        FireShot is executed. During FireShot's execution, it checks to see if FireShotOverride() ever returns true. If FireShotOverride does not return true, then FireShot executes built in behavior that fires the weapon.


        In your case, you'll want to have FireShotOverride return true, because you desire custom behavior to occur immediately after firing your hitscan trace. So your FireShotOverride method will look something like this (pseudocode):

        Code:
        // this assumes the custom firemode you want to implement is only on the primary fire
        if (CurrentFireMode == 0)
        {
           K2_FireInstantHit(true, HitResult);
           if (Cast<UTCharacter>(HitResult))
           {
              //any special behavior on hit
           }
           else
           {
              WeaponOwner.TakeDamage(DamageToTakeOnMiss);
           }
           return true;
        }
        else
        {
           return false;
        }
        Hope that helps.
        Last edited by Wail; 07-08-2015, 08:32 PM.
        Join Project: Open Tournament: OpenTournamentGame.com | Project Trello | Discord | YouTube

        Subscribe to /r/UnrealSeries - The subreddit for free & uncensored discussion of Unreal series games!

        Unreal Prime Weapons: Impact Hammer | Enforcer | BioRifle | Shock Rifle | Link Gun | Ripper | Minigun | Flak Cannon | Rocket Launcher | Sniper Rifle | Grenade Launcher | Dispersion Pistol

        Comment


          #5
          I'm sorry if I am being dumb, but I am still having trouble understanding. I am working in Blueprint because I am curious to see what I can do with it as opposed to actual coding. I cannot find a FireShotOverride Blueprint node or anything of the sort anywhere. The closest thing is simply FireShot. I don't know how to make FireShotOverride return a specific value, or how to do any kind of if/then statement (in blueprint). I am familiar with the ideas, I just don't know how to execute them in Blueprint.

          Comment


            #6
            Here's the place to override the function:





            And here's the exact blueprint scheme of what Wail suggested:


            Attached Files
            Last edited by vlad.serbanescu11; 07-08-2015, 08:41 PM.

            Comment


              #7
              Great! That helps a ton! Not only did I learn how to make the weapon, I learned how to do so many more things in Blueprint! Thanks for your help, I really appreciate it!

              Comment

              Working...
              X