x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

how do i make a power up blueprint that increases the damage given by multiple projectiles

I am trying to make a power up actor that when my character picks up it increases the damage for a few seconds for multiple projectile actors, not just one. I'm still learning so sorry if this is a basic thing but for some reason I can't get it done. I tried casting the classes to each other but it wont work for some reason.

I want my (stupid name I know) actor to change the value of damage in multiple projectile actor. How can I do it?

Product Version: UE 4.16
Tags:
more ▼

asked Aug 28 '17 at 10:32 PM in Blueprint Scripting

avatar image

MadLed
20 2 4 9

avatar image MadLed Aug 28 '17 at 10:33 PM

sorry this is my first time asking a question didn't know it would look messed up like that

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi MadLed, How is handled the projectiles spawn from your player?

You spawn it when you use a "Fire" event?

if is this the case you can expose a powerup damage bool in your projectiles and handle it inside.

give me a sec i make an example to be clear :)

more ▼

answered Aug 28 '17 at 10:57 PM

avatar image

ps2invader
41 1 5 8

avatar image ps2invader Aug 28 '17 at 11:26 PM

Ok this settings can solve problem.

First start with your projectile, in the construction script you have to put this (ignore the block parent: construciton script, you need only the branch)

alt text be sure to set the Bool Editable and Expose on Spawn. [Do this for every bullet you have]

Second: Put this code inside your player

alt text

The function PowerUpBullet have a float input for the time and set the BulletPowered of the player true for a certain amount of time.

The InputActionFire is to test the project (i think you already have a function for this ehehe)

Third: this is the PowerUpZone

alt text

Is a simple Actor with a Box Collider and a Exposed float for PowerUpTime, when a player touch the trigger zone do a cast to that player and call the function to powerup the projectile with the PowerUp Time set in the editor (or inside the blueprint). after this the powerup zone destroy itself.

I hope this is what you need ;) If you have other question feel free to ask! Bye!

avatar image MadLed Aug 29 '17 at 09:19 AM

Thank you very much that solved my problem :) BUT now i have a different problem.

since i have multiple bullets that means i've put them in a class array so the player can switch between them alt text

that way the exposed variable won't show up on the Spawn Actor From Class Node, so how do i do it?

or maybe there is a better way of switching between projectiles? i tried switching weapon actors but i had no luck in doing so.

thanks :)

avatar image ps2invader Aug 29 '17 at 11:01 AM

Hi! You not see the exposed variable because the spawn actor can not see the projectlie class, is consider a generic spawn

I think this can be solved by use a Base Projectile class and every projectile is a blueprint child of this class.

I will test and show you an example give me a sec :)

avatar image ps2invader Aug 29 '17 at 11:37 AM

Ok it work,

First of all, choose one of the projectiles to make him the main class (or create a new one)

After that Right Click on that blueprint and select "Create Child Blueprint Class"

You must have this situation

alt text

After that inside the Base class put this on construction script

alt text

Is the same of old script but this time you have 2 new var: "PowerUpDamage" and "BaseDamage"

this vars allow you to customize the damage for each projectile.

Remember to put the bool editable and exposed on spawn.

Now inside your child blueprint you will see this inside construction script.

alt text

Don't add any code in construction but modify the new vars inside the detail panel (highlited in the image)

After that inside the player make a class array of the projectile base class and put the sons inside it

alt text

In this case the spawn show the exposed bool and you can use it with every childs class.

From now you can create how much projectiles you want ;)

P.S: Remember to put the Bullet logic inside the base class. The childs will inherit that code.

you can do it with other things to like weapon, items, etc...

I hope this will help! :)

avatar image MadLed Aug 29 '17 at 12:45 PM

Thank you very much :) that solves all of my problems for now :D sorry for troubling you

avatar image ps2invader Aug 29 '17 at 12:59 PM

no problem dude, make game (even this little things) is always fun ;) Best luck for your work :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question