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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How do I send a string on Input?

Hey! I am trying to create a dash function, but it does not look like I can send the string via the player input. Anyone know what I can do?

 InputComponent->BindAction("Left", IE_DoubleClick, this, &AInstinctCharacter::Dodge("left"));
 void AInstinctCharacter::Dodge(FString direction)

Thank you in advance!

Product Version: Not Selected
more ▼

asked May 21 '14 at 04:06 PM in C++ Programming

avatar image

174 43 39 48

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

1 answer: sort voted first

We don't currently support parameters to actions bound to input events. You would need to create a DodgeLeft, DodgeRight, etc. function and the implementation of those could call a shared common function with the parameter you wish to pass.

So something like

void AInstinctCharacter::DodgeLeft() { Dodge("left"); }

Also, and this is just some unsolicited general advice, don't use strings for something like this, create an enumeration or something like. Using strings for non-text things is a great way to slow game code down.

more ▼

answered May 21 '14 at 05:41 PM

avatar image

Marc Audy STAFF
2.2k 42 35 95

avatar image Borzi May 21 '14 at 07:20 PM

Oh okay, thats some pretty great advice :) Thank you! Will look into the ENumeration thing, was not aware that it actually slowed down the game by that much. It feels kinda inconvient that I have to make 4 functions for "Dodge", a seperate one for each key (wsad). Would you have some advice on that too? It would be really appreciated!

(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