Random choise in buttons

Hi everyone. I need your help. It is necessary to make a trading system between NPC
and players. To begin with, I made a system of reactions to buttons. Each button has a random reaction. It is necessary to make it so that if the reaction matches, it shows plus one to loyalty, and so on up to 4 choices. Therefore, the price becomes either lower, or yours after 4 clicks on the buttons. Screenshot in attachment. I really need your help


hi ,
if you just need to shot this kind of thing you may just run a random value from 1 to 4
and if is 1 you add + to the price XD (the % are the same i think, just 1 on 4)
But here is how make the system you are talking about

you have 4 rounds,
i would start with a value for this. Var_Rounds = 4
now you need a Choice_var lets use a int type ? so you have 0,1,2,3 for the choice.
BluButton must set Choice_var to 0 and then
GreenButton must set Choice_var to 1 and then and so on…
Now all these nodes should call the same event “Buyer_Choise”
and just create a Buyer_Choice value and set it with a random int from 0 to 3

Now we can check if the 2 choice are the same .
and we will store the result in an array.
Create an array of int Array_Result and set the element Number “Var_Rounds” with the result.

Last thing, if VarRounds is == 0 , we have done all the choices
So you can use a foreach loop node to read and sum all the values inside your array for getting the end result

Hello. Thanks for the answer, but could you write how to do it in blueprints, because it’s difficult for me

Someone help me with blueprints. i don’t know how to do this

@Chub7
Here a video

Thank you. I watched the video and you are almost right. Probably I didn’t explain correctly. No need to create button events, because it’s from a button in a widget. You need to make a trading system. The character is the buyer, and the NPC is the seller. It is necessary after 4 elections to make the price go down for example by 10 or go up. Depends on if the emotions match. Blue with blue, green with green and so on. In the last printscreen, I combined your idea and mine. I hope you can help me, because this is a difficult task for me. As a result, I need to make it so that after 4 clicks on the button, the price of the product becomes lower or higher. I attach printscreens



its almost exactly wha i posted you, just make a widget blueprint with 4 buttons and connect the On click event to my button_1 Button_2…

I will try to do this. But I have another question. How to make the price lower after 4 positive answers or higher after 4 negative answers?

I need you help

you check the result ,
if is = +4 you got 4 good choice and you can increase price
if is = -4 you got 4 bad answers and you can decrease price

Should I do this after the 4th round set? And do it with brunch?

yes

when you completed your blueprint, upload an image as answer !

@Est_engine
I tried to do so, but it doesn’t work. Can you help me?

You need to add your nodes out of the Loop, where the Completed Wire is !
So that only after 4 rounds you will do your check and + price or - prices

@Est_engine
Thank you. I’ll try to do it and give you feedback

@Est_engine
Thank you. It works!!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.