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"

FTimerDelegate Throws Vague Exception

I am trying to implement an weapon swapping system using the FTimerDelegate. The basic Idea is that equip is called once holster is finished. I declare my FTimerDelegate like so:

 UCLASS()
 class AXLCharacter : public ACharacter
 {
     GENERATED_BODY()
 
 public: 
 
         // .....
 
     FTimerDelegate TimerDelegate_SwitchWeapon;
 
         //...
 }

My code that implements the FTimerDelegate is below:

 float AXLCharacter::EquipWeapon(uint32 Weapon)
 {
     float Duration = 0.0f;
     if (CharacterWeapons->Inventory.Num() > 0)
     {
         if (CurrentWeapon)
         {
             float Duration = HolsterWeapon() * 10;
 
             TimerDelegate_SwitchWeapon.BindUFunction(this, FName("EquipWeapon"), Weapon);
             GetWorldTimerManager().SetTimer(TimerHandle_SwitchWeapon, TimerDelegate_SwitchWeapon, Duration, false);
         }
         else
         {
             try
             {
                 CurrentWeapon = CharacterWeapons->Inventory[Weapon];
                 Duration = CurrentWeapon->StartEquip("RightHand");
             }
             catch (std::exception const & ex)
             {
                 ex;
             }
         }
     }
     return Duration;
 }
 float AXLCharacter::HolsterWeapon()
 {
     float Duration = 0.0f;
     if (CurrentWeapon)
     {
         Duration = CurrentWeapon->StartUnequip();
         CurrentWeapon = NULL;
     }
     return Duration;
 }

The initial equip works great and holster the weapon works great. But when switch the holster section of the code run fine a the timer successfully calls equip. but when trying to execute the code DelegateInstanceInterface.h throw the following exception:

alt text

This give me no information, I have no idea what the issue it. If someone has any ideas -- I would appreciate the help

Product Version: UE 4.19
Tags:
screenshot-14.png (170.6 kB)
more ▼

asked Mar 25 '18 at 07:21 PM in C++ Programming

avatar image

Janyx
492 67 65 212

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

0 answers: sort voted first
Be the first one to answer this question
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