Welcome to the UE4 forum! Do not be afraid of the Tick function as many things will have to tick. Now to help answer your question, I think you should look into the attribute system built into Unreal. Sounds like you want to have a prop in the game affect something. Your prop ranges from consumables to weapons and perhaps range weapons? We can (and probably should) abstract their functions into “On use, affect something”. We can also abstract other actors with attributes such that your props apply GameplayEffects to them. Weapon is a little bit special because it also cares about collision and on hit, do damage (which is itself an effect that takes away the health attribute).
In short, your item actor should be a regular actor with a list of effects that will change one or more attributes on another actor. In this model, your item actor should not need Tick as their effects should only happen when an event has happened (on overlap or on use). However, if you need something dynamic like say the item changes color depending on the owner’s position, then you will have to Tick.
yes. It has been helpful. Since it is SinglePlayer, 2D JRPGs (Chrono Trigger, possibly old Final Fantasy), Weapons won’t contain collision check, yet still need to be adjusted into the unit (actor)'s hands and its statistic. Anyway. thank you so much for help. I may need to try to activate Tick in Item Class just like you said rather than with tick in actor component…in case if it has to be dynamic. Btw what is attribute system built into Unreal? I can google it, but do you have links or sample?
Mixed Use item is a Spear by the way, because it can be used as melee weapon, and as ammo by pipe gun. That’s the reason I implemented separate item type class such as Weapon (damage and durability), Ammo (Quantity and damage) and Goods (HP modifier and Quantity). I forgot to mention that in previous comment. But come to think of it… ChaoSXDemon… it would be better as sole actor with many variables.
First check is to verify if the tick component is really running by having some sort of printout.
// actorcomponent.cpp in constructor
PrimaryComponentTick.bCanEverTick = true; // true if you need tick function.
PrimaryComponentTick.bStartWithTickEnabled = false; // self explanatory variable name
// actorcomponent.cpp in any other functions
SetComponentTickEnabled(true); // or false to disable when you are done with tick function...
// actorcomponent.h you should have this by default
virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;
I have tested tick functions to work with character, actor and actor component. The names might be different though.