UsingItemActionAttributes stackoverflow error

SekaiX

New member
Hi,

im getting stackoverflow when using item action set attributes. am i not using this correctly?
Im trying to get item cooldown working
also is there example of using this in the feature demo?
itemactionset2.pngactionitemset.pngitemsetattributes.png
 

Attachments

  • itemview pf.png
    itemview pf.png
    269.3 KB · Views: 5
I think the reason you are getting a stack overlfow is because of the ActionIndex = 0

Most likely instead of calling the relevant action you are calling the Use action again. You need to make sure it calls the itemaction with the proper index or another itemactionset

So you have an infinite loop of the use Action calling itself over and over

Unfortunatly there are no examples in the demo for cooldown.
 
I think the reason you are getting a stack overlfow is because of the ActionIndex = 0

Most likely instead of calling the relevant action you are calling the Use action again. You need to make sure it calls the itemaction with the proper index or another itemactionset

So you have an infinite loop of the use Action calling itself over and over

Unfortunatly there are no examples in the demo for cooldown.
okay but what is action index pointing to? or what does it call? how else is it supposed to use the script stompingtank if i dont assign it on use? im so confused. is there anything related to this usingitemactionattributes. it doesnt have to be cooldown neccesarrily. i just need to see how its being used with whatever its being used for1772713674204.png
 
You need to think about it in two parts

You have one ItemActionSet for your UI. This is where you will have your UseItemActionGetAttribute action. It's purpose is to each item can individually decide what action is processed when the play presses "Use"

On the ItemAttribute (in your case you've set it named as "ItemActionSet") you assign a second, different ItemActionSet. This is where you define what it does. It shouldn't be another "UseItemActionGetAttribute action"


Example:
Apple : Has an ItemActionSet with an action "Heal" that heals x HP, the Apple ItemActionSet is assigned in the ItemActionSet attribute
Bomb: Has a different ItemAction Set with an action "Throw" that spawns the bomb, the Bomb ItemActionSet is assigned in the ItemActionSet attribute


The you UI ItemActionSet for your InventoryGrid or Hotbar can now have a single ItemAction "Use", that will find this "ItemActionSet" attribute, get the relevant ItemAction at the index specified (imagine index 0 is the "Heal" action for apple and "Throw" action for the bomb)
This way use uses those relevant actions.


In your case my assumption is that you've set the StompingCapsuleItemActionSet as the attribute. So it goes in an infinite loop as it keeps calling the Use action of itself

Hopefully that makes sense
 
You need to think about it in two parts

You have one ItemActionSet for your UI. This is where you will have your UseItemActionGetAttribute action. It's purpose is to each item can individually decide what action is processed when the play presses "Use"

On the ItemAttribute (in your case you've set it named as "ItemActionSet") you assign a second, different ItemActionSet. This is where you define what it does. It shouldn't be another "UseItemActionGetAttribute action"


Example:
Apple : Has an ItemActionSet with an action "Heal" that heals x HP, the Apple ItemActionSet is assigned in the ItemActionSet attribute
Bomb: Has a different ItemAction Set with an action "Throw" that spawns the bomb, the Bomb ItemActionSet is assigned in the ItemActionSet attribute


The you UI ItemActionSet for your InventoryGrid or Hotbar can now have a single ItemAction "Use", that will find this "ItemActionSet" attribute, get the relevant ItemAction at the index specified (imagine index 0 is the "Heal" action for apple and "Throw" action for the bomb)
This way use uses those relevant actions.


In your case my assumption is that you've set the StompingCapsuleItemActionSet as the attribute. So it goes in an infinite loop as it keeps calling the Use action of itself

Hopefully that makes sense
okay i finally get it. its just a global way to call other itemactions that you setup for each item in the attributes.
Ofcourse i just found out about item skills in the docs. facepalm
 
Back
Top