[Feature Request] Get int value playmaker

MenSoft

New member
Hi,

It would be awesome if you get the int value from a item so you can update it in a playmaker FSM.

Easy speaking, a "Get inventory int value" from playmaker so you can change the value of a item from "5" to "6" while playing the game.

You posted this yourself in the discord (incase you forget about it ;-))
"I found this blog post which explains how to have a return type in an action. That might help me make actions that get values from the items: https://matthewwaring.wordpress.com...script-method-from-a-playmaker-custom-action/"
 
Please find the new script attached bellow. I didn't have time to test it properly so let me know if you find any issues with it. I inspired myself from the GetSet actions built-in within the PlayMaker system. Essentially you make a playmaker variable and set it as the "Value" within the new "GetSetItemAttributeValue(Int/Bool/Float/etc...)". Then you can toggle the "SetValue" option to define whether the value should be set or get to/from the attribute.

As a reminder only Mutable Item Attributes can be set. Non-Mutable Item or ItemDefinition/ItemCategory Attribute canno be set at runtime, they must be constants.

The new action I made gets/sets an attribute of an Item within an inventory. If you have two unquie/mutable items with the same ItemDefinition the action won't be able to know the difference between the two. But that's simply a limitation of using predefined Actions. That being said now that one exists you should be able to read trhough the code, copy paste and make minor changes to fit your needs if necessary. This doesn't require any code experience, just common sense and trial and error.

I hope that helps :)
 

Attachments

  • GetSetItemAttributeValue.cs
    10.3 KB · Views: 4
Hi. One more suggestion, would it be possible to grab "Get BuyPrice/Get SellPrice" So I can change the price in real time also?
 
Getting the price is more complicated because it is an array of currencie amounts and PlayMaker doesn't have a variable type for that.
So Instead of one variable I added two. Two Arrays, one for the currencies and one for the amounts. They must be of the same size otherwise it doesn't work.

Please find attached the new script
 

Attachments

  • GetSetItemAttributeValue.cs
    12.7 KB · Views: 4
Top