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"

Using the UDamageType Class

I am trying to add projectiles to my game (bullets that my gun will shoot). I want them to deal damage obviously so I initialized it as followed:

     /** type of damage */
     UPROPERTY(EditDefaultsOnly, Category = WeaponStat)
     TSubclassOf<UDamageType> DamageType;
 
     /** defaults */
     FProjectileWeaponData()
     {
         ProjectileClass = NULL;
         ProjectileLife = 10.0f;
         ExplosionDamage = 100;
         ExplosionRadius = 300.0f;
         DamageType = UDamageType::StaticClass();
     }


The last line DamageType = UDamageType::StaticClass(); I get an error that says

  "Error: Incomplete type is not allowed"

When I try and run anyways I get the error

 "error C2027: use of undefined type 'UDamageType'"

I am using unreal engine 4.4.3 if that helps at all. If anyone knows what is going on please let me know. Thanks for the help!

Product Version: Not Selected
Tags:
more ▼

asked Oct 10 '14 at 12:28 AM in C++ Programming

avatar image

Janyx
497 67 65 212

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

1 answer: sort voted first

Did you include DamageType.h?

more ▼

answered Oct 10 '14 at 12:51 AM

avatar image

cgrebeld
497 25 16 33

avatar image Janyx Oct 10 '14 at 12:57 AM

I tried but is said that no such file existed. I wonder if the header file is called something else.

avatar image cgrebeld Oct 10 '14 at 02:25 AM

It's here: Runtime/Engine/Classes/GameFramework/DamageType.h

avatar image Janyx Oct 10 '14 at 02:42 AM

I see I need to type #include "GameFramework/DamageType.h". That way it knows where to look

(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