![]() The collision handling: define how/if the actor have to spawn in case of overlap with other actors The transform: where the actor have to spawn When you spawn an actor (or construct an object, but spawning is generally better) you can set 3 properties: Every object you create from a class will be stored into your memory. ![]() When you define a class you have a “mold” that you can use to create objects. To get references there’s tens of ways but before you need to know how class and object works: How to reference an object in the next reply since I’m running out of chars If you don’t have any child class specific method or variable you don’t even need to cast. I can invoke every method and get any variable contained into weapon class. I will, instead, set a 2 Weapon reference variables where I can store my weapons data. Since i can’t know first wich weapons my character will have (if there’s multiple weapons in the game) I can’t have a Sword/Mace/Flail/Club/Estoc/BastardSword/Scythe etc object references into my character BP. Also, if I make a game where the character can dual wield/akimbo I could need to store both weapons references. If you have different levels with different rules (deathmatch, capture, the flag etc) you need to create multiple class wich inherit from Game Mode class and set the game modes into your levels (only 1 for level). Since the game mode is REQUIRED in every map/level, you have to create your custom game mode. Obviously YOU have to define the rules of your own game, so you have to program your own game mode. The Game Mode is a class used to define the rules of your game. ![]() I can more easly answer using an example: “Why and how do I have to create a Childactor of my Actor Bluepring and how do I then reference that?” ![]() The cast node is used when you have a reference to something but you need to get data from a specific class wich inherit from it. But since we are using a Weapon ref we can’t use the Swing method because that method isn’t in the weapon class but in the Flail class. Since Flail inherit from Weapon you can store a Flail object reference into a Weapon reference variable (object oriented languages rules, more in deep is related to memory addresses). Even if you create a Flail object you can reference it to the parent class. “Why would I need to cast to when the swing event was already created in the flail class?”īecause that what we have is a Weapon reference, not a Flail reference. To close the circle: if I’ve stored my flail into my weapon variable and I want to call the swing event I need to cast it to flail to invoke the method.īack to your example: you are using the cast node properly for the game mode but the second cast you did isn’t correct, you have to previously create an actor (that is a child class of object) from your BP_Ground class and then use the reference to that object to call the Set Text function. Now, if I need to store a generic weapon reference I need a weapon reference variable (ref variable are light blue in BP) and I can store it even if it’s a child of it (sword, mace, flail from the example) BUT obviously I can ONLY call weapon_class variables and methods until I cast it to the matched child class. For example let’s suppose we add the “swing” event to flail class. You can add new variables and methods as you can override existing ones for each child class. From weapon class you can create child classes such “sword”, “mace” and “flail” wich will contain the same variables and methods of weapon class. As you probably know you can create a class who contain some data and from that class you can create a child class that inherit all the previous data and can implement or override other data.įor example: you can create a weapon class that contain damage, weight and cosmetic data. The cast node borns from object oriented languages.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |